2013-01-08 01:48:09 +01:00
|
|
|
load(__folder + "drone.js");
|
2013-01-01 21:33:59 +01:00
|
|
|
//
|
|
|
|
// constructs a medieval fort
|
2013-01-01 23:38:16 +01:00
|
|
|
//
|
|
|
|
Drone.extend('fort', function(side, height)
|
2013-01-01 21:33:59 +01:00
|
|
|
{
|
|
|
|
if (typeof side == "undefined")
|
|
|
|
side = 18;
|
|
|
|
if (typeof height == "undefined")
|
|
|
|
height = 6;
|
|
|
|
// make sure side is even
|
|
|
|
if (side%2)
|
|
|
|
side++;
|
2013-01-03 09:36:49 +01:00
|
|
|
if (height < 4 || side < 10)
|
|
|
|
throw new java.lang.RuntimeException("Forts must be at least 10 wide X 4 tall");
|
2013-01-01 21:33:59 +01:00
|
|
|
var brick = 98;
|
|
|
|
//
|
|
|
|
// build walls.
|
|
|
|
//
|
2013-01-01 23:38:16 +01:00
|
|
|
this.chkpt('fort').box0(brick,side,height-1,side);
|
2013-01-01 21:33:59 +01:00
|
|
|
//
|
2013-01-03 10:30:34 +01:00
|
|
|
// build battlements
|
2013-01-01 21:33:59 +01:00
|
|
|
//
|
2013-01-01 23:38:16 +01:00
|
|
|
this.up(height-1);
|
2013-01-01 21:33:59 +01:00
|
|
|
for (i = 0;i <= 3;i++){
|
|
|
|
var turret = [];
|
2013-01-01 23:38:16 +01:00
|
|
|
this.box(brick) // solid brick corners
|
2013-01-01 21:33:59 +01:00
|
|
|
.up().box('50:5').down() // light a torch on each corner
|
|
|
|
.fwd();
|
2013-01-01 23:38:16 +01:00
|
|
|
turret.push('109:'+ Drone.PLAYER_STAIRS_FACING[this.dir]);
|
|
|
|
turret.push('109:'+ Drone.PLAYER_STAIRS_FACING[(this.dir+2)%4]);
|
|
|
|
this.box(turret,1,1,side-2).fwd(side-2).turn();
|
2013-01-01 21:33:59 +01:00
|
|
|
}
|
|
|
|
//
|
2013-01-03 10:30:34 +01:00
|
|
|
// build battlement's floor
|
2013-01-01 21:33:59 +01:00
|
|
|
//
|
2013-01-01 23:38:16 +01:00
|
|
|
this.move('fort');
|
2013-01-03 10:30:34 +01:00
|
|
|
this.up(height-2).fwd().right().box('126:0',side-2,1,side-2);
|
2013-01-01 21:33:59 +01:00
|
|
|
var battlementWidth = 3;
|
|
|
|
if (side <= 12)
|
|
|
|
battlementWidth = 2;
|
|
|
|
|
2013-01-01 23:38:16 +01:00
|
|
|
this.fwd(battlementWidth).right(battlementWidth)
|
2013-01-01 21:33:59 +01:00
|
|
|
.box(0,side-((1+battlementWidth)*2),1,side-((1+battlementWidth)*2));
|
|
|
|
//
|
|
|
|
// add door
|
|
|
|
//
|
2013-01-01 23:38:16 +01:00
|
|
|
var torch = '50:' + Drone.PLAYER_TORCH_FACING[this.dir];
|
|
|
|
this.move('fort').right((side/2)-1).door2() // double doors
|
2013-01-01 21:33:59 +01:00
|
|
|
.back().left().up().box(torch) // left torch
|
|
|
|
.right(3).box(torch); // right torch
|
|
|
|
//
|
|
|
|
// add ladder up to battlements
|
|
|
|
//
|
2013-01-01 23:38:16 +01:00
|
|
|
var ladder = '65:' + Drone.PLAYER_SIGN_FACING[(this.dir+2)%4];
|
|
|
|
this.move('fort').right((side/2)-3).fwd(1) // move inside fort
|
2013-01-01 21:33:59 +01:00
|
|
|
.box(ladder, 1,height-1,1);
|
2013-01-01 23:38:16 +01:00
|
|
|
return this.move('fort');
|
|
|
|
|
|
|
|
});
|
|
|
|
|