// Like drone.box , but takes properties for setblock as second param
function boxprop(block, prop, x, y, z) {
if (typeof x == 'undefined') {
x = 1;
}
if (typeof y == 'undefined') {
y = 1;
}
if (typeof z == 'undefined') {
z = 1;
}
for ( var i = 0; i < x; i++ ) {
this.right(i);
for ( var j = 0; j < y ; j++ ) {
this.up(j);
for ( var k = 0; k < z ; k++ ) {
this.fwd(k);
this.setBlock(block,prop,0,0,0,false);
this.back(k);
}
this.down(j);
}
this.left(i);
}
}
Drone.extend(boxprop);
// have the pistons face the drone if prop is pistonDirections[this.dir], like in regular minecraft
var pistonDirections = {
0:4, // east
1:2, // south
2:5, // west
3:3 // north
};
function hiddendoor ( wall, floor ) {
if (typeof wall == 'undefined' ) {
wall = blocks.stone;
}
if (typeof floor == 'undefined' ) {
wall = blocks.grass;
}
this
.up(1).fwd(3)
.boxprop(blocks.sticky_piston,pistonDirections[this.dir],2,2,1);
this
.turn(1).fwd(3)
.boxprop(blocks.sticky_piston,pistonDirections[this.dir],2,2,1)
.turn(2).left(1).fwd(5)
.boxprop(blocks.sticky_piston,pistonDirections[this.dir],2,2,1);
}
Drone.extend(hiddendoor);