This repository has been archived on 2021-07-14. You can view files and clone it, but cannot push or open issues or pull requests.
scriptcraft/src/main/js/plugins/drone/ladder.js
2015-01-01 12:47:36 +00:00

41 lines
859 B
JavaScript

'use strict';
var Drone = require('./drone').Drone;
/************************************************************************
### Drone.ladder() method
Creates a ladder extending skyward.
#### Parameters
* height (optional - default 1)
#### Example
To create a ladder extending 10 blocks high:
var drone = new Drone(self);
drone.ladder(10)
At the in-game prompt, look at a block and then type:
/js ladder(10)
A ladder 10 blocks high will be created at the point you were looking at.
#### Since
##### 3.0.3
***/
var blocks = require('blocks');
function ladder( height ){
var block = this.getBlock();
if (block.typeId == blocks.air || block.typeId == blocks.ladder){
this.box(blocks.ladder, 1, height, 1);
} else {
this
.back()
.box(blocks.ladder, 1, height, 1)
.fwd();
}
}
Drone.extend( ladder );