-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcityBuilder.js
134 lines (124 loc) · 3.69 KB
/
cityBuilder.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
var here = "here"
var params = 50
var startPosition = "INGENTING"
var tidSidenSidst = [];
function bygArena(params, sender){
materiale = 7 // Bedrock er nummer 7 bloacks.bedrock
bredde = 20
laengde = 20
hoejde = 3
var Drone = require('drone');
arenaDrone = new Drone(sender.location);
if (sender.location.yaw > 225 && sender.location.yaw < 315) {
echo (sender, "Yaw 225-315")
arenaDrone.back(10);
arenaDrone.left(4); //venstre
}else if (sender.location.yaw > 135 && sender.location.yaw < 225) {
echo (sender, "Yaw 135-225")
arenaDrone.back(10)
arenaDrone.right(4)
}else if (sender.location.yaw > 45 && sender.location.yaw < 135) {
echo (sender, "Yaw 45-135")
arenaDrone.back(10) //ok
} else {
echo (sender, "Yaw 315-360 eller 0-45")
arenaDrone.back(10) //ok
}
arenaDrone.down(1)
arenaDrone.box(materiale,bredde,1,laengde)
arenaDrone.up(1)
arenaDrone.box0(materiale, bredde, hoejde, laengde)
arenaDrone.up(hoejde)
arenaDrone.box(20,bredde,1,laengde)
arenaDrone.down(1)
arenaDrone.fwd(12)
arenaDrone.right(5)
arenaDrone.box(10,2,1,2)
}
function buildCity(params, sender){
echo (sender, params)
if (startPosition == "INGENTING") {
echo(sender, "start med at bruge /jsp setStart bummelum");
} else {
var Drone = require('drone');
playerDrone = new Drone(startPosition);
clearArea(startPosition);
bygHus(startPosition, 20);
playerDrone.fwd(15);
bygAndet(playerDrone, 7, 6, 3);
playerDrone.fwd(15);
bygAndet(playerDrone, 7, 10, 8);
//echo(sender, startPosition);
}
};
function setStart(params, sender) {
if ( sender.onGround ){
echo (sender, "Settings locattion to " + sender.location);
startPosition = sender.location;
} else {
echo (sender, "Heeey du er vist ude at flyve")
}
};
function canI(sender){
var d = new Date();
if (tidSidenSidst[sender] === undefined) {
tidSidenSidst[sender] = ""
}
if (tidSidenSidst[sender] !== ""){
if (d.getTime() > (tidSidenSidst[sender] + 10000)) {
tidSidenSidst[sender] = d.getTime();
return true;
} else {
echo (sender, "false")
return false;
}
}
tidSidenSidst[sender] = d.getTime();
echo (sender, "tid sat")
return true;
}
function givMig(params, sender) {
if ( canI(sender) === false ){
echo (sender, "Veeeent lige lidt")
} else {
echo (sender, "afleverer")
var inventory = require('inventory');
var items = require('items');
inventory(sender)
.add( items.diamondPickaxe(1))
}
}
function clearArea(location) {
var Drone = require('drone');
playerDrone = new Drone(location);
playerDrone.chkpt( 'cityStart' );
playerDrone.left(10);
playerDrone.box('blocks.air', 20, 20, 20);
playerDrone.move('cityStart');
}
function bygHus(location, materiale) {
var Drone = require('drone');
husDrone = new Drone(location);
husDrone.box0(materiale, 4, 3, 8);
husDrone.up(3);
husDrone.prism0(134,4,8);
}
function bygAndet(sender, materiale, hoejde, bredde, dybde) {
var Drone = require('drone');
husDrone = new Drone(sender.location);
husDrone.box0(materiale, bredde, hoejde, dybde);
husDrone.up(hoejde);
husDrone.prism0(134,bredde,dybde);
}
function bygnoget(params, sender) {
materiale = params[0];
hoejde = parseInt(params[1]);
bredde = parseInt(params[2]);
dybde = parseInt(params[3]);
bygAndet(sender, materiale, hoejde, bredde, dybde)
}
command(bygArena, here);
command(givMig, here);
command(buildCity, here);
command(setStart, here);
command(bygnoget, params);