From 84a51c12d95e1665b42f20a302a6eb1b055e22e6 Mon Sep 17 00:00:00 2001 From: WoodStuff Date: Fri, 19 Apr 2024 19:26:06 +0200 Subject: [PATCH] add freeze tool to nirmod & add copy_canvas.js --- mods/copy_canvas.js | 9 +++++++++ mods/nirmod.js | 46 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 mods/copy_canvas.js diff --git a/mods/copy_canvas.js b/mods/copy_canvas.js new file mode 100644 index 00000000..d7e8be64 --- /dev/null +++ b/mods/copy_canvas.js @@ -0,0 +1,9 @@ +document.addEventListener("keydown", function(e) { + if (e.keyCode == 83) { + document.getElementById("game").toBlob(function(blob) { + const item = new ClipboardItem({ "image/png": blob }); + navigator.clipboard.write([item]); + }); + alert("Canvas copied!"); + } +}) \ No newline at end of file diff --git a/mods/nirmod.js b/mods/nirmod.js index 013971eb..99e69ade 100644 --- a/mods/nirmod.js +++ b/mods/nirmod.js @@ -82,6 +82,7 @@ class Type { this.breakInto = undefined; this.properties = undefined; this.maxSize = undefined; + this.tool = undefined; } setColor(color) { @@ -238,16 +239,16 @@ function createOther() { Fw.stateHigh = "plasma"; Fw.breakInto = "fire"; Fw.reactions = { - "water": { elem1: "wall", chance: 0.2 }, - "steam": { elem1: "wall", chance: 0.2 }, - "carbon_dioxide": { elem1: "wall", chance: 0.2 }, - "foam": { elem1: "wall", chance: 0.2 }, - "dirty_water": { elem1: "wall", chance: 0.2 }, - "salt_water": { elem1: "wall", chance: 0.2 }, - "sugar_water": { elem1: "wall", chance: 0.2 }, - "seltzer": { elem1: "wall", chance: 0.2 }, - "pool_water": { elem1: "wall", chance: 0.2 }, - }, + "water": { elem1: "wall", chance: 0.2 }, + "steam": { elem1: "wall", chance: 0.2 }, + "carbon_dioxide": { elem1: "wall", chance: 0.2 }, + "foam": { elem1: "wall", chance: 0.2 }, + "dirty_water": { elem1: "wall", chance: 0.2 }, + "salt_water": { elem1: "wall", chance: 0.2 }, + "sugar_water": { elem1: "wall", chance: 0.2 }, + "seltzer": { elem1: "wall", chance: 0.2 }, + "pool_water": { elem1: "wall", chance: 0.2 }, + }, Fw.Add(); const Nz = new Type("nirmizer"); @@ -267,6 +268,29 @@ function createOther() { Nz.Add(); } +function createTools() { + const Fr = new Type("freeze"); + Fr.setColor(["#7fcef0", "#b2daeb"]); + Fr.behavior = [ + "CO:100|CO:100|CO:100", + "CO:100|CO:100|CO:100", + "CO:100|CO:100|CO:100", + ], + Fr.tool = function(pixel) { + let value = Math.max(30, pixel.temp / 5); + if (shiftDown) value *= 2; + pixel.temp -= value; + pixelTempCheck(pixel); + } + Fr.temp = -273; + Fr.category = cat.ENERGY; + Fr.insulate = true; + Fr.canPlace = false; + Fr.desc = "Use on pixels to heavily decrease temperature." + Fr.Add(); +} + createNirmics(); createMinerals(); -createOther(); \ No newline at end of file +createOther(); +createTools(); \ No newline at end of file