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/bed.js
2015-01-01 12:47:36 +00:00

32 lines
798 B
JavaScript

'use strict';
/*global require, Packages*/
var Drone = require('./drone').Drone,
blocks = require('blocks');
var bedDirections = {
0:3, // east
1:0, // south
2:1, // west
3:2 // north
};
function bed(){
this.then(function(){
var foot = this.setBlock(blocks.bed, bedDirections[this.dir], 0,0,0, false);
var head = this.setBlock(blocks.bed, bedDirections[this.dir] + 8, 0,0,1, false);
if (Drone.bountiful){
var prop = require('blockhelper').property;
var BedHalf = Packages.net.canarymod.api.world.blocks.properties.BlockPropertyEnums.BedHalf;
prop(foot)
.set('facing',this.dir)
.set('part', BedHalf.FOOT);
prop(head)
.set('facing',this.dir)
.set('part', BedHalf.HEAD);
}
foot.update();
head.update();
});
}
Drone.extend( bed );