From db4f52027612cf7a6a11e79055247077303968f3 Mon Sep 17 00:00:00 2001 From: Cube14yt Date: Mon, 4 Aug 2025 19:04:54 +0800 Subject: [PATCH] Add files via upload --- mods/fission.js | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 mods/fission.js diff --git a/mods/fission.js b/mods/fission.js new file mode 100644 index 00000000..7479e257 --- /dev/null +++ b/mods/fission.js @@ -0,0 +1,68 @@ +elements.neutron.onCollide = function(pixel1, pixel2) { + if (pixel2.element === "uranium" && Math.random() <= 0.25) { + pixel2.react = true; + } +} + +elements.uranium.tick = function(pixel) { + pixel.cd ??= 0; + pixel.hp ??= 8; + pixel.energy ??= 0; + + // Cooldown + if (pixel.cd > 0) { + pixel.cd--; + return; + } + + if (pixel.react) { + let released = 0; + + // spawn neutrons + for (let j = 0; j < squareCoordsShuffle.length && released < 3; j++) { + let c = squareCoordsShuffle[j]; + let nx = pixel.x + c[0]; + let ny = pixel.y + c[1]; + + if (isEmpty(nx, ny)) { + createPixel("neutron", nx, ny); + released++; + let neutron = getPixel(nx, ny); + if (neutron && neutron.element === "neutron") { + neutron.by = -1; + } + } + } + + // accumulate energy + consume HP + pixel.energy += released; + pixel.hp--; + + // depletion condition + if (pixel.hp <= 0 || pixel.energy >= 20) { + changePixel(pixel, "lead_powder"); + } + + // reset flags + pixel.cd = 5; + pixel.react = false; + } +} + + + + +elements.lead_powder = { + color: ["#6c6c6a","#838381"], + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "M2|M1 AND SW:uranium%25|M2" + ], + tempHigh: 327.5, + stateHigh: "molten_lead", + category: "solids", + density: 11343, + conduct: 0.41, + superconductAt: -265.95 +} \ No newline at end of file