2 fire.playingBurnSounds = 0;
3 fire.playBurnSound = function(){
4 if(fire.playingBurnSounds > 2)
6 fire.playingBurnSounds++;
7 let audio = new Audio(dragonblocks.getSound("fire_burn.ogg"));
9 fire.playingBurnSounds--;
13 fire.catchfire = function(map, x, y){
14 let mapNode = map.getNode(x, y);
15 if(mapNode && mapNode.toNode().flammable){
16 if(mapNode.toNode().onfire && mapNode.toNode().onfire(x, y) == false)
18 dragonblocks.player.place(map, x, y - 1, "fire:fire");
21 dragonblocks.registerGroup({
24 dragonblocks.registerNode({
27 texture: "fire_fire.png",
36 onset: (map, x, y) => {
37 let meta = map.getNode(x, y).meta;
38 meta.fireInterval = setInterval(_ => {
39 if(dblib.random(0, 6) == 0);
41 for(let ix = x - 1; ix <= x + 1; ix++){
42 for(let iy = y - 1; iy <= y + 2; iy++){
43 if(dblib.random(0, 3) == 0)
44 fire.catchfire(map, ix, iy);
47 if (! map.getNode(x, y + 1) || ! map.getNode(x, y + 1).toNode().inGroup("flammable")) {
48 if (dblib.random(0, 20) == 0)
49 map.setNode(x, y, "air");
50 } else if (dblib.random(0, map.getNode(x, y + 1).toNode().hardness * 2) == 0) {
51 dragonblocks.player.dig(map, x, y + 1);
55 onremove: (map, x, y) => {
56 clearInterval(map.getNode(x, y).meta.fireInterval);