2 torch.directions = ["floor", "left", "right", "ceiling"];
3 torch.check = function(direction, x, y){
6 return ! dragonblocks.getNode(x, y + 1) || dragonblocks.getNode(x, y + 1).stable;
8 return ! dragonblocks.getNode(x - 1, y) || dragonblocks.getNode(x - 1, y).stable;
10 return ! dragonblocks.getNode(x + 1, y) || dragonblocks.getNode(x + 1, y).stable;
12 return ! dragonblocks.getNode(x, y - 1) || dragonblocks.getNode(x, y - 1).stable;
15 dragonblocks.registerItem({
18 texture: "torch_torch_floor.png",
20 for(let direction of torch.directions)
21 if(dragonblocks.player.place(x, y, dragonblocks.nodes["torch:torch_" + direction]))
25 for(let direction of torch.directions){
26 dragonblocks.registerNode({
27 name: "torch:torch_" + direction,
33 texture: "torch_torch_" + direction + ".png",
36 onactivate: (x, y) => {
37 if(! torch.check(direction, x, y))
38 dragonblocks.setNode(x, y, "air");
41 if(! torch.check(direction, x, y))
46 dragonblocks.registerRecipe({
47 result: "torch:torch 4",