diff --git a/mods/weapons.js b/mods/weapons.js new file mode 100644 index 00000000..dfb8ed94 --- /dev/null +++ b/mods/weapons.js @@ -0,0 +1,88 @@ +elements.tsar_bomba = { + color: "#524C41", + behavior: [ + "XX|EX:150>plasma|XX", + "XX|XX|XX", + "M2|M1 AND EX:150>plasma|M2", + ], + category: "weapons", + state: "solid", + density: 1300, + excludeRandom: true, + cooldown: defaultCooldown +}, +elements.little_boy = { + color: "#F5F5DC", + behavior: [ + "XX|EX:20>plasma|XX", + "XX|XX|XX", + "M2|M1 AND EX:70>plasma,plasma,plasma,plasma,radiation,fallout|M2", + ], + category: "weapons", + state: "solid", + density: 500, + excludeRandom: true, + cooldown: defaultCooldown +}, +elements.fat_man = { + color: ["#ffff00","#000000"], + behavior: [ + "XX|EX:28>plasma|XX", + "XX|XX|XX", + "M2|M1 AND EX:98>plasma,plasma,plasma,plasma,radiation,fallout|M2", + ], + category: "weapons", + state: "solid", + density: 1000, + excludeRandom: true, + cooldown: defaultCooldown +}, + elements.self_propelled_bomb = { + color: "#71797E", + tick: function(pixel) { + if ((pixel.temp > 1000 || pixel.charge) && !pixel.burning) { + pixel.burning = true; + pixel.burnStart = pixelTicks; + } + if (pixel.burning) { + if (!tryMove(pixel, pixel.x, pixel.y-1)) { + // tryMove again to the top left or top right + tryMove(pixel, pixel.x+(Math.random() < 0.5 ? -1 : 1), pixel.y-1); + } + if (pixelTicks-pixel.burnStart > 50 && Math.random() < 0.1) { + explodeAt(pixel.x, pixel.y, 10, "bomb"); + } + } + else { + if (!tryMove(pixel, pixel.x, pixel.y+1)) { + // tryMove again to the bottom left or bottom right + tryMove(pixel, pixel.x+(Math.random() < 0.5 ? -1 : 1), pixel.y+1); + } + } + doDefaults(pixel); + }, + burn: 90, + burnTime: 100, + density: 2000, + conduct: 1, + state: "solid", + category: "weapons" +}, +elements.left_missile = { + color: "#4c4e42", + behavior: [ + "XX|EX:10|XX", + "CR:left_missile AND EX:10|CH:fire|EX:10", + "M2|M1 AND EX:10|M2", + ], + category:"weapons", +}, +elements.right_missile = { + color: "#4c4e42", + behavior: [ + "XX|EX:10|XX", + "EX:10|CH:fire|EX:10 AND CR:right_missile", + "M2|M1 AND EX:10|M2", + ], + category:"weapons", +}; \ No newline at end of file