From ac9f3703f9a7ca6310ff9982363202a8d7e342ae Mon Sep 17 00:00:00 2001 From: kaeud <97579413+kaeudomt@users.noreply.github.com> Date: Thu, 21 Mar 2024 04:36:54 +0700 Subject: [PATCH 1/9] Add files via upload --- mods/WhisperingTheory.js | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 mods/WhisperingTheory.js diff --git a/mods/WhisperingTheory.js b/mods/WhisperingTheory.js new file mode 100644 index 00000000..7e4b0205 --- /dev/null +++ b/mods/WhisperingTheory.js @@ -0,0 +1,55 @@ +/* TODO +- [x] powder heater & coller +- [ ] block roomtemp +- [ ] no smoke from cold fire +*/ + +elements.powder_heater = { + category: "machines", + behavior: [ + "XX|HT:2|XX", + "HT:2|XX|HT:2", + "M2|HT:2 AND M1|M2", + ], + color: "#881111", + insulate: true, +} + +elements.powder_cooler = { + category: "machines", + behavior: [ + "XX|CO:2|XX", + "CO:2|XX|CO:2", + "M2|CO:2 AND M1|M2", + ], + color: "#111188", + insulate: true, +} + +elements.powder_superheater = { + category: "machines", + behavior: [ + "XX|HT:10|XX", + "HT:10|XX|HT:10", + "M2|HT:10 AND M1|M2", + ], + color: "#dd1111", + insulate: true, +} + +elements.powder_freeze = { + category: "machines", + behavior: [ + "XX|CO:10|XX", + "CO:10|XX|CO:10", + "M2|CO:10 AND M1|M2", + ], + color: "#1111dd", + insulate: true, +} + +elements.cold_fire.behavior = [ + "M1|M1|M1", + "M2|DL%8|M2", + "XX|M2|XX", +] \ No newline at end of file From ebeed6314161cef442da2d5397a36724d3ed2b12 Mon Sep 17 00:00:00 2001 From: kaeud <97579413+kaeudomt@users.noreply.github.com> Date: Thu, 21 Mar 2024 04:43:55 +0700 Subject: [PATCH 2/9] Delete mods/WhisperingTheory.js --- mods/WhisperingTheory.js | 55 ---------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 mods/WhisperingTheory.js diff --git a/mods/WhisperingTheory.js b/mods/WhisperingTheory.js deleted file mode 100644 index 7e4b0205..00000000 --- a/mods/WhisperingTheory.js +++ /dev/null @@ -1,55 +0,0 @@ -/* TODO -- [x] powder heater & coller -- [ ] block roomtemp -- [ ] no smoke from cold fire -*/ - -elements.powder_heater = { - category: "machines", - behavior: [ - "XX|HT:2|XX", - "HT:2|XX|HT:2", - "M2|HT:2 AND M1|M2", - ], - color: "#881111", - insulate: true, -} - -elements.powder_cooler = { - category: "machines", - behavior: [ - "XX|CO:2|XX", - "CO:2|XX|CO:2", - "M2|CO:2 AND M1|M2", - ], - color: "#111188", - insulate: true, -} - -elements.powder_superheater = { - category: "machines", - behavior: [ - "XX|HT:10|XX", - "HT:10|XX|HT:10", - "M2|HT:10 AND M1|M2", - ], - color: "#dd1111", - insulate: true, -} - -elements.powder_freeze = { - category: "machines", - behavior: [ - "XX|CO:10|XX", - "CO:10|XX|CO:10", - "M2|CO:10 AND M1|M2", - ], - color: "#1111dd", - insulate: true, -} - -elements.cold_fire.behavior = [ - "M1|M1|M1", - "M2|DL%8|M2", - "XX|M2|XX", -] \ No newline at end of file From d3ebf7dc9ce96ff7db2f3667ff8f69c5f6e5b05d Mon Sep 17 00:00:00 2001 From: kaeud <97579413+kaeudomt@users.noreply.github.com> Date: Thu, 21 Mar 2024 04:44:48 +0700 Subject: [PATCH 3/9] WhisperingTheory beta 1 uncompleted idk how to use custom js --- mods/WhisperingTheory.js | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 mods/WhisperingTheory.js diff --git a/mods/WhisperingTheory.js b/mods/WhisperingTheory.js new file mode 100644 index 00000000..7e4b0205 --- /dev/null +++ b/mods/WhisperingTheory.js @@ -0,0 +1,55 @@ +/* TODO +- [x] powder heater & coller +- [ ] block roomtemp +- [ ] no smoke from cold fire +*/ + +elements.powder_heater = { + category: "machines", + behavior: [ + "XX|HT:2|XX", + "HT:2|XX|HT:2", + "M2|HT:2 AND M1|M2", + ], + color: "#881111", + insulate: true, +} + +elements.powder_cooler = { + category: "machines", + behavior: [ + "XX|CO:2|XX", + "CO:2|XX|CO:2", + "M2|CO:2 AND M1|M2", + ], + color: "#111188", + insulate: true, +} + +elements.powder_superheater = { + category: "machines", + behavior: [ + "XX|HT:10|XX", + "HT:10|XX|HT:10", + "M2|HT:10 AND M1|M2", + ], + color: "#dd1111", + insulate: true, +} + +elements.powder_freeze = { + category: "machines", + behavior: [ + "XX|CO:10|XX", + "CO:10|XX|CO:10", + "M2|CO:10 AND M1|M2", + ], + color: "#1111dd", + insulate: true, +} + +elements.cold_fire.behavior = [ + "M1|M1|M1", + "M2|DL%8|M2", + "XX|M2|XX", +] \ No newline at end of file From d2e2900007a971a3b337793cf4112a4f493f766e Mon Sep 17 00:00:00 2001 From: kaeud <97579413+kaeudomt@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:20:51 +0700 Subject: [PATCH 4/9] WhisperingTheory.js v1 everything done --- mods/WhisperingTheory.js | 42 +++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/mods/WhisperingTheory.js b/mods/WhisperingTheory.js index 7e4b0205..ad41280b 100644 --- a/mods/WhisperingTheory.js +++ b/mods/WhisperingTheory.js @@ -1,7 +1,7 @@ /* TODO - [x] powder heater & coller -- [ ] block roomtemp -- [ ] no smoke from cold fire +- [x] block roomtemp +- [x] no smoke from cold fire */ elements.powder_heater = { @@ -13,7 +13,7 @@ elements.powder_heater = { ], color: "#881111", insulate: true, -} +}; elements.powder_cooler = { category: "machines", @@ -24,7 +24,7 @@ elements.powder_cooler = { ], color: "#111188", insulate: true, -} +}; elements.powder_superheater = { category: "machines", @@ -35,7 +35,7 @@ elements.powder_superheater = { ], color: "#dd1111", insulate: true, -} +}; elements.powder_freeze = { category: "machines", @@ -46,10 +46,38 @@ elements.powder_freeze = { ], color: "#1111dd", insulate: true, -} +}; + +elements.roomtemper = { + color: "#29632f", + behavior: behaviors.WALL, + tick: function(pixel) { + for (var i = 0; i < squareCoords.length; i++) { + var coord = squareCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if (!isEmpty(x,y, true)) { + if(pixelMap[x][y].temp < -230) { + pixelMap[x][y].temp = (pixelMap[x][y].temp + 7) + } else if(pixelMap[x][y].temp > 270) { + pixelMap[x][y].temp = (pixelMap[x][y].temp - 7) + } else if (pixelMap[x][y].temp < 20) { + pixelMap[x][y].temp = (pixelMap[x][y].temp + 2) + } else if (pixelMap[x][y].temp > 20) { + pixelMap[x][y].temp = (pixelMap[x][y].temp - 2) + } + } + } + }, + category:"machines", + state:"solid", + insulate: true, + noMix: true, + movable: false, +}, elements.cold_fire.behavior = [ "M1|M1|M1", "M2|DL%8|M2", "XX|M2|XX", -] \ No newline at end of file +] From 9c6132dcb64f2c91f890b52265502bcef231057f Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Thu, 21 Mar 2024 19:03:04 -0400 Subject: [PATCH 5/9] Create electricityTest.js --- mods/electricityTest.js | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 mods/electricityTest.js diff --git a/mods/electricityTest.js b/mods/electricityTest.js new file mode 100644 index 00000000..73be4942 --- /dev/null +++ b/mods/electricityTest.js @@ -0,0 +1,42 @@ +doElectricity = function (pixel) { + if (pixel.charge) { + // Check each adjacent pixel, if that pixel's charge is false, set it to the same charge + for (var i = 0; i < adjacentCoords.length; i++) { + var x = pixel.x+adjacentCoords[i][0]; + var y = pixel.y+adjacentCoords[i][1]; + if (!isEmpty(x,y,true)) { + var newPixel = pixelMap[x][y]; + var con = elements[newPixel.element].conduct; + if (con == undefined) {continue} + if (Math.random() < con) { // If random number is less than conductivity + if (!newPixel.charge && !newPixel.chargeCD) { + newPixel.charge = 1; + if (elements[newPixel.element].colorOn) { + newPixel.color = pixelColorPick(newPixel); + } + } + } + else if (elements[newPixel.element].insulate != true) { // Otherwise heat the pixel (Resistance simulation) + newPixel.temp += pixel.charge/4; + newPixel.chargeCD = 8; + pixelTempCheck(newPixel); + } + } + } + pixel.charge -= 0.25; + if (pixel.charge <= 0) { + delete pixel.charge; + pixel.chargeCD = 4; + } + } + // Lower charge cooldown + else if (pixel.chargeCD) { + pixel.chargeCD -= 1; + if (pixel.chargeCD <= 0) { + delete pixel.chargeCD; + if (elements[pixel.element].colorOn) { + pixel.color = pixelColorPick(pixel); + } + } + } +} \ No newline at end of file From ef8a1f788ec7eac1eb49ea96f23caf3cf41f3d1b Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Thu, 21 Mar 2024 19:22:37 -0400 Subject: [PATCH 6/9] Update electricityTest.js --- mods/electricityTest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/electricityTest.js b/mods/electricityTest.js index 73be4942..de4b87fb 100644 --- a/mods/electricityTest.js +++ b/mods/electricityTest.js @@ -18,7 +18,7 @@ doElectricity = function (pixel) { } else if (elements[newPixel.element].insulate != true) { // Otherwise heat the pixel (Resistance simulation) newPixel.temp += pixel.charge/4; - newPixel.chargeCD = 8; + if (con < 0.8) { newPixel.chargeCD = 8; } pixelTempCheck(newPixel); } } From aa0068c88c9fab75d858e2664d3b2970f8b76d98 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Thu, 21 Mar 2024 19:44:16 -0400 Subject: [PATCH 7/9] hotfix --- index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 67c13993..1f33f15b 100644 --- a/index.html +++ b/index.html @@ -9960,6 +9960,7 @@ else { changePixel(pixel, elem2); } } if (r.func) { r.func(pixel,pixel) } + if (r.color2) { pixel.color = pixelColorPick(pixel,r.color2) } } }, ignore: ["sun"], @@ -15520,7 +15521,7 @@ window.onload = function() { return elements[e].excludeRandom != true && elements[e].category != "tools" && !elements[e].tool; }); gameCanvas.addEventListener("mousedown", mouseClick); - gameCanvas.addEventListener("mousedown", function(){ + gameCanvas.addEventListener("mousedown", function(e){ if (elements[currentElement] && elements[currentElement].onMouseDown) { elements[currentElement].onMouseDown(e); } From 2c4a0e38617665b705978cae99000dc820c9aa6d Mon Sep 17 00:00:00 2001 From: GGod <46885632+GGodPL@users.noreply.github.com> Date: Fri, 22 Mar 2024 00:45:41 +0100 Subject: [PATCH 8/9] fix a bunch of random stuff ig --- mods/betterMenuScreens.js | 2 +- mods/betterSettings.js | 9 +++++++-- mods/elementsManager.js | 2 +- mods/moreViews.js | 19 ++++++++++--------- mods/video.js | 1 + 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/mods/betterMenuScreens.js b/mods/betterMenuScreens.js index dc18861c..d150d814 100644 --- a/mods/betterMenuScreens.js +++ b/mods/betterMenuScreens.js @@ -153,7 +153,7 @@ class MenuScreen { /** * Sets close button visibility. When false the close button will not be added to the menu screen - * @param {boolean} show Visibility of the close button + * @param {boolean} show Visibility of the close g button */ setShowCloseButton(show) { this.showCloseButton = show; diff --git a/mods/betterSettings.js b/mods/betterSettings.js index 811946a7..bb213cc0 100644 --- a/mods/betterSettings.js +++ b/mods/betterSettings.js @@ -6,16 +6,19 @@ const settingType = { SELECT: [4, null] } class Setting { - constructor (name, storageName, type, disabled = false, defaultValue = null) { + constructor (name, storageName, type, disabled = false, defaultValue = null, description = "", customValidator = () => true) { this.tabName = null; this.name = name; this.storageName = storageName; this.type = type[0]; this.disabled = disabled; this.defaultValue = defaultValue ?? type[1]; + this.description = description; + this.validate = customValidator; } set(value) { + if (!this.validate(value)) return false; this.value = value; const settings = JSON.parse(localStorage.getItem(`${this.tabName}/settings`)) ?? {}; settings[this.name] = value; @@ -61,7 +64,7 @@ class Setting { const id = "betterSettings/" + this.modName + "/" + this.storageName; const span = document.createElement("span"); span.className = "setting-span"; - span.title = 'Default: "' + this.defaultValue + '"' + (this.disabled ? ". This setting is disabled." : ""); + span.title = 'Default: "' + this.defaultValue + '"' + (this.disabled ? ". This setting is disabled" : "") + (this.description ? `. ${this.description}` : ""); span.innerText = this.name + " "; const element = document.createElement("input"); switch (this.type) { @@ -162,12 +165,14 @@ class SettingsTab { if (this.categories.has(category)) this.categories.get(category).push(setting); else this.categories.set(category, [setting]); this.registry.set(setting.storageName, setting); + return this; } registerSettings(category = "General", ...settings) { for (const setting of settings) { this.registerSetting(setting, category); } + return this; } set(name, value) { diff --git a/mods/elementsManager.js b/mods/elementsManager.js index 74cdbee9..23ac1dd0 100644 --- a/mods/elementsManager.js +++ b/mods/elementsManager.js @@ -257,7 +257,7 @@ if (enabledMods.includes("mods/betterMenuScreens.js")) { // ugly way of doing it but probably works const checkType = (key, value) => { - if (key == "behavior" && (typeof value == "function" || (value instanceof Array && value.filter(e => e instanceof Array && e.filter(s => typeof s == "string").length == e.length).length == value.length))) return true; + if (key == "behavior" && (typeof value == "function" || (value instanceof Array && value.filter(e => typeof e == "string").length == value.length))) return true; else if (key == "behavior") return false; if (["darkText", "hidden", "insulate", "noMix", "isFood", "forceAutoGen", "customColor", "ignoreAir", "excludeRandom", "burning", "flipX", "flipY", "flippableX", "flippableY"].includes(key) && typeof value != "boolean") return false; if (["name", "category", "desc", "alias", "seed", "baby", "state", "stateHigh", "stateHighName", "stateHighColor", "stateLow", "stateLowNmae", "stateLowColor"].includes(key) && typeof value != "string") return false; diff --git a/mods/moreViews.js b/mods/moreViews.js index 1d874d60..c2c18f67 100644 --- a/mods/moreViews.js +++ b/mods/moreViews.js @@ -34,18 +34,19 @@ setView = (n) => { document.querySelector('span[setting="view"]').children[0].value = view ?? 0; } -for (const i in views) { - if (i < 4) continue; - const option = document.createElement("option"); - option.setAttribute("value", i); - option.innerText = views[i]; - document.querySelector('.setting-span[setting="view"]').querySelector("select").appendChild(option); - viewKey[i] = views[i]; -} +runAfterLoadList.push(() => { + for (const i in views) { + if (i < 4) continue; + const option = document.createElement("option"); + option.setAttribute("value", i); + option.innerText = views[i]; + document.querySelector('.setting-span[setting="view"]').querySelector("select").appendChild(option); + viewKey[i] = views[i]; + } +}) const vcrFont = new FontFace("VCR", "url(mods/VCR_OSD_MONO.ttf)"); vcrFont.load().then(font => { - console.log(font); document.fonts.add(font); }) diff --git a/mods/video.js b/mods/video.js index ce21ee24..2a75e490 100644 --- a/mods/video.js +++ b/mods/video.js @@ -89,6 +89,7 @@ elements.video = { } }; + currentVideoFrames = []; video.currentTime = 0; video.onseeked = () => { From 72e1d61b7596811aac8d998c4ed973673d7e710e Mon Sep 17 00:00:00 2001 From: JustAGenericUsername Date: Thu, 21 Mar 2024 20:02:51 -0400 Subject: [PATCH 9/9] funny spacedust drink --- mods/nousersthings.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/mods/nousersthings.js b/mods/nousersthings.js index 7164924c..006af6b3 100644 --- a/mods/nousersthings.js +++ b/mods/nousersthings.js @@ -2343,4 +2343,28 @@ elements.scuffed_circle_brush = { deletePixel(thisx, thisy) createPixel(circleElem, thisx, thisy) } -} \ No newline at end of file +} +elements.spacedust_cola = { + color: ["#090033", "#0a0027", "#0a001b", "#0b000f"], + behavior: elements.soda.behavior, + tempHigh: 104, + stateHigh: ["steam", "carbon_dioxide", "spacedust", "spacedust"], + category: "liquids", + state: "liquid", + reactions: {head: {elem1: null, chance: 0.02}}, + density: elements.tungsten.density, +} +elements.spacedust = { + color: ["#090033", "#0a0027", "#0a001b", "#0b000f", "#090033", "#0a0027", "#0a001b", "#0b000f", "#090033", "#0a0027", "#0a001b", "#0b000f", "#090033", "#0a0027", "#0a001b", "#0b000f", "#090033", "#0a0027", "#0a001b", "#0b000f", "#090033", "#0a0027", "#0a001b", "#0b000f", "#ffffff"], + behavior: behaviors.POWDER, + category: "special", + state: "solid", + reactions: { + "acid": {elem1: null, elem2: ["hydrogen", "helium", "hydrogen", "helium", "hydrogen", "helium", "hydrogen", "hydrogen", "hydrogen", "hydrogen", "metal_scrap"], chance: 0.02}, + "seltzer": {elem1: null, elem2: "spacedust_cola"}, + "soda": {elem1: null, elem2: "spacedust_cola"}, + }, + density: elements.tungsten.density, +} +elements.acid.ignore.push("spacedust") +elements.acid.ignore.push("spacedust_cola") \ No newline at end of file