From 6ceafe5aa8f2501f5d81f14e357f0218c616d693 Mon Sep 17 00:00:00 2001 From: Nekonico <163950752+DBNekonico@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:59:43 -0700 Subject: [PATCH 1/8] Added colors and fixed more bugs. --- mods/sandboxels.js | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/mods/sandboxels.js b/mods/sandboxels.js index efdc014f..df31907b 100644 --- a/mods/sandboxels.js +++ b/mods/sandboxels.js @@ -270,7 +270,7 @@ elements.rock_screen = { elements.saw_screen = { name:"screen", hidden:true, - color: "#e6d577", + color: ["#dec150","#c7b15a"], behavior: [ "XX|XX|XX", "XX|XX|XX", @@ -396,7 +396,7 @@ elements.saw_screen = { elements.cellulose_screen = { name:"screen", hidden:true, - color: "#2167ff", + color: "#c7d4c9", behavior: [ "XX|XX|XX", "SW:sandboxels_screen|XX|SW:sandboxels_screen", @@ -893,7 +893,7 @@ elements.ice_screen = { elements.wood_screen = { name:"screen", hidden:true, - color: "#808080", + color: "#a0522d", behavior: behaviors.WALL, properties: { dtemp: 20, @@ -964,24 +964,6 @@ elements.digital_rock = { desc: "Use on screen to place digital sand." }, -elements.digital_sawdust = { - color: "#e6d577", - behavior: [ - "CH:sandboxels_screen>saw_screen|CH:sandboxels_screen>saw_screen|CH:sandboxels_screen>saw_screen", - "CH:sandboxels_screen>saw_screen|CH:sandboxels_screen>saw_screen|CH:sandboxels_screen>saw_screen", - "CH:sandboxels_screen>saw_screen|CH:sandboxels_screen>saw_screen|CH:sandboxels_screen>saw_screen", - ], - tool: function(pixel) { - if (elements[pixel.element].id === elements.sandboxels_screen.id) { - changePixel(pixel,"saw_screen"); - } - }, - insulate:true, - canPlace: false, - category: "digital", - desc: "Use on screen to place digital sawdust." -}, - elements.digital_water = { color: "#2167ff", behavior: [ @@ -1033,11 +1015,11 @@ elements.digital_steam = { insulate:true, canPlace: false, category: "digital", - desc: "Use on a screen to place digital ice." + desc: "Use on a screen to place digital steam." }, elements.digital_wood = { - color: "#abd6ff", + color: "#a0522d", behavior: [ "CH:sandboxels_screen>wood_screen|CH:sandboxels_screen>wood_screen|CH:sandboxels_screen>wood_screen", "CH:sandboxels_screen>wood_screen|CH:sandboxels_screen>wood_screen|CH:sandboxels_screen>wood_screen", @@ -1051,7 +1033,7 @@ elements.digital_wood = { insulate:true, canPlace: false, category: "digital", - desc: "Use on a screen to place digital ice." + desc: "Use on a screen to place digital wood." }, elements.digital_wall = { @@ -1069,7 +1051,7 @@ elements.digital_wall = { insulate:true, canPlace: false, category: "digital", - desc: "Use on a screen to place digital walls." + desc: "Use on a screen to place digital wall." }, elements.digital_heat = { From e3f2347778dfb9afd572a2c9fa72b330bc64ba86 Mon Sep 17 00:00:00 2001 From: Nekonico <163950752+DBNekonico@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:28:45 -0700 Subject: [PATCH 2/8] Update sandboxels.js --- mods/sandboxels.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/mods/sandboxels.js b/mods/sandboxels.js index df31907b..88c1e5bc 100644 --- a/mods/sandboxels.js +++ b/mods/sandboxels.js @@ -1,3 +1,45 @@ +/* mod by nekonico */ + +window.addEventListener("load", () => { + document.getElementById("elementButton-sandboxels_screen")?.remove() +}) + +window.addEventListener("load", () => { + document.getElementById("elementButton-sand_screen")?.remove() +}) + +window.addEventListener("load", () => { + document.getElementById("elementButton-rock_screen")?.remove() +}) + +window.addEventListener("load", () => { + document.getElementById("elementButton-wall_screen")?.remove() +}) + +window.addEventListener("load", () => { + document.getElementById("elementButton-water_screen")?.remove() +}) + +window.addEventListener("load", () => { + document.getElementById("elementButton-steam_screen")?.remove() +}) + +window.addEventListener("load", () => { + document.getElementById("elementButton-ice_screen")?.remove() +}) + +window.addEventListener("load", () => { + document.getElementById("elementButton-wood_screen")?.remove() +}) + +window.addEventListener("load", () => { + document.getElementById("elementButton-saw_screen")?.remove() +}) + +window.addEventListener("load", () => { + document.getElementById("elementButton-cellulose_screen")?.remove() +}) + elements.sandboxels_screen_off = { name:"screen", color: "#454545", From fd46411411bbff4c235a8a2c8bc5b52c43cc7a83 Mon Sep 17 00:00:00 2001 From: Nekonico <163950752+DBNekonico@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:54:34 -0700 Subject: [PATCH 3/8] bugfixes, and paper, and digitalizer --- mods/sandboxels.js | 481 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 443 insertions(+), 38 deletions(-) diff --git a/mods/sandboxels.js b/mods/sandboxels.js index 88c1e5bc..9d1dca26 100644 --- a/mods/sandboxels.js +++ b/mods/sandboxels.js @@ -40,6 +40,80 @@ window.addEventListener("load", () => { document.getElementById("elementButton-cellulose_screen")?.remove() }) +window.addEventListener("load", () => { + document.getElementById("elementButton-paper_screen")?.remove() +}) + +elements.digitalizer = { + color: ["#d1c6be","#b5c0ad","#b9b8bc"], + behavior: behaviors.WALL, + onSelect: function() { + logMessage("Do not digitalize unregistered elements!"); + }, + tempHigh: 1500, + stateHigh: ["molten_glass","molten_glass","molten_glass","molten_gallium"], + conduct: 1, + breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","sand"], + tempLow: -80, + stateLow: "glass_shard", + category: "digital", + tick: function(pixel) { + if (!isEmpty(pixel.x,pixel.y-1,true) && !isEmpty(pixel.x,pixel.y+1,true)) { + var newPixel = pixelMap[pixel.x][pixel.y-1]; + var screen = pixelMap[pixel.x][pixel.y+1]; + if (screen.element === "sandboxels_screen") { + if (newPixel.element === "sand" && screen.element === "sandboxels_screen") { + changePixel(screen,"sand_screen"); + deletePixel(newPixel.x,newPixel.y) + } + else if (newPixel.element === "ice" && screen.element === "sandboxels_screen") { + changePixel(screen,"ice_screen"); + deletePixel(newPixel.x,newPixel.y) + } + else if (newPixel.element === "steam" && screen.element === "sandboxels_screen") { + changePixel(screen,"steam_screen"); + deletePixel(newPixel.x,newPixel.y) + } + else if (newPixel.element === "water" && screen.element === "sandboxels_screen") { + changePixel(screen,"water_screen"); + deletePixel(newPixel.x,newPixel.y) + } + else if (newPixel.element === "wood" && screen.element === "sandboxels_screen") { + changePixel(screen,"wood_screen"); + deletePixel(newPixel.x,newPixel.y) + } + else if (newPixel.element === "paper" && screen.element === "sandboxels_screen") { + changePixel(screen,"paper_screen"); + deletePixel(newPixel.x,newPixel.y) + } + else if (newPixel.element === "sawdust" && screen.element === "sandboxels_screen") { + changePixel(screen,"saw_screen"); + deletePixel(newPixel.x,newPixel.y) + } + else if (newPixel.element === "cellulose" && screen.element === "sandboxels_screen") { + changePixel(screen,"cellulose_screen"); + deletePixel(newPixel.x,newPixel.y) + } + else if (newPixel.element === "rock" && screen.element === "sandboxels_screen") { + changePixel(screen,"rock_screen"); + deletePixel(newPixel.x,newPixel.y) + } + else if (newPixel.element === "wall" && screen.element === "sandboxels_screen") { + changePixel(screen,"wall_screen"); + deletePixel(newPixel.x,newPixel.y) + } + else { + changePixel(screen,"malware"); + deletePixel(newPixel.x,newPixel.y) + } + } + } + }, + state: "solid", + density: 1200, + desc: "Digitalizes elements." +}, + elements.sandboxels_screen_off = { name:"screen", color: "#454545", @@ -52,7 +126,7 @@ elements.sandboxels_screen_off = { tempHigh: 1500, stateHigh: ["molten_glass","molten_glass","molten_glass","molten_gallium"], conduct: 1, - breakInto: "glass_shard", + breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","sand"], tempLow: -80, stateLow: "glass_shard", category: "digital", @@ -73,7 +147,7 @@ elements.sandboxels_screen = { tempHigh: 1500, stateHigh: ["molten_glass","molten_glass","molten_glass","molten_gallium"], conduct: 1, - breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","sand"], + breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","sand"], tempLow: -45, stateLow: "sandboxels_screen_off", category: "digital", @@ -123,6 +197,24 @@ elements.sand_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + changePixel(newPixel,"sand_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"cellulose_screen"); + } else if (newPixel.element === "rock_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -149,6 +241,24 @@ elements.sand_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + changePixel(newPixel,"sand_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"cellulose_screen"); + } else if (newPixel.element === "sand_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -180,6 +290,24 @@ elements.sand_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + changePixel(newPixel,"sand_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"cellulose_screen"); + } else if (newPixel.element === "sand_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -229,17 +357,15 @@ elements.rock_screen = { newPixel.dtemp = pixel.dtemp; changePixel(pixel,"water_screen"); } - else if (newPixel.element === "ice_screen") { - newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); - pixel.dtemp = newPixel.dtemp; - } else if (newPixel.element === "steam_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } - else if (newPixel.element === "sand_screen") { - newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + else if (newPixel.element === "cellulose_screen") { + changePixel(newPixel,"rock_screen"); pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"cellulose_screen"); } else if (Math.random() > 0.5 && !isEmpty(pixel.x+1,pixel.y+1,true)) { var newPixel = pixelMap[pixel.x+1][pixel.y+1]; @@ -263,6 +389,24 @@ elements.rock_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + changePixel(newPixel,"rock_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"cellulose_screen"); + } else if (newPixel.element === "sand_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -294,6 +438,24 @@ elements.rock_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + changePixel(newPixel,"rock_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"cellulose_screen"); + } else if (newPixel.element === "sand_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -324,7 +486,7 @@ elements.saw_screen = { tempHigh: 1500, stateHigh: ["molten_glass","molten_glass","molten_glass","molten_gallium"], conduct: 1, - breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","sand"], + breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","sawdust"], tempLow: -45, stateLow: "sandboxels_screen_off", category: "digital", @@ -343,19 +505,11 @@ elements.saw_screen = { newPixel.dtemp = pixel.dtemp; changePixel(pixel,"water_screen"); } - else if (newPixel.element === "ice_screen") { - newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); - pixel.dtemp = newPixel.dtemp; - } else if (newPixel.element === "steam_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } - else if (newPixel.element === "sand_screen") { - newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); - pixel.dtemp = newPixel.dtemp; - } - else if (newPixel.element === "rock_screen") { + else if (newPixel.element === "cellulose_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } @@ -381,10 +535,22 @@ elements.saw_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "sand_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -416,10 +582,22 @@ elements.saw_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "sand_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -450,7 +628,7 @@ elements.cellulose_screen = { tempHigh: 1500, stateHigh: ["molten_glass","molten_glass","molten_glass","molten_gallium"], conduct: 1, - breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","water"], + breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","cellulose"], tempLow: -45, stateLow: "sandboxels_screen_off", category: "digital", @@ -463,6 +641,12 @@ elements.cellulose_screen = { changePixel(pixel,"sandboxels_screen"); pixel.dtemp = 0; } + else if (newPixel.element === "water_screen") { + changePixel(newPixel,"cellulose_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"water_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -471,6 +655,14 @@ elements.cellulose_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -491,6 +683,12 @@ elements.cellulose_screen = { changePixel(pixel,"sandboxels_screen"); pixel.dtemp = 0; } + else if (newPixel.element === "water_screen") { + changePixel(newPixel,"cellulose_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"water_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -499,6 +697,14 @@ elements.cellulose_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -520,6 +726,12 @@ elements.cellulose_screen = { changePixel(pixel,"sandboxels_screen"); pixel.dtemp = 0; } + else if (newPixel.element === "water_screen") { + changePixel(newPixel,"cellulose_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"water_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -528,6 +740,14 @@ elements.cellulose_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -550,6 +770,12 @@ elements.cellulose_screen = { changePixel(pixel,"sandboxels_screen"); pixel.dtemp = 0; } + else if (newPixel.element === "water_screen") { + changePixel(newPixel,"cellulose_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"water_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -558,6 +784,14 @@ elements.cellulose_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -579,6 +813,12 @@ elements.cellulose_screen = { changePixel(pixel,"sandboxels_screen"); pixel.dtemp = 0; } + else if (newPixel.element === "water_screen") { + changePixel(newPixel,"cellulose_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"water_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -587,6 +827,14 @@ elements.cellulose_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -600,7 +848,7 @@ elements.cellulose_screen = { pixel.dtemp = newPixel.dtemp; } } - if (pixel.dtemp > 199) { changePixel(pixel,"steam_screen") } + if (pixel.dtemp > 99) { changePixel(pixel,"paper_screen") } }, state: "solid", density: 1200, @@ -642,6 +890,10 @@ elements.water_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { changePixel(newPixel,"cellulose_screen"); newPixel.dtemp = pixel.dtemp; @@ -672,12 +924,22 @@ elements.water_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { changePixel(newPixel,"cellulose_screen"); newPixel.dtemp = pixel.dtemp; changePixel(pixel,"sandboxels_screen"); pixel.dtemp = 0; } + else if (newPixel.element === "paper_screen") { + changePixel(newPixel,"cellulose_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } else if (newPixel.element === "sand_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -703,12 +965,22 @@ elements.water_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { changePixel(newPixel,"cellulose_screen"); newPixel.dtemp = pixel.dtemp; changePixel(pixel,"sandboxels_screen"); pixel.dtemp = 0; } + else if (newPixel.element === "paper_screen") { + changePixel(newPixel,"cellulose_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } else if (newPixel.element === "sand_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -735,12 +1007,22 @@ elements.water_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { changePixel(newPixel,"cellulose_screen"); newPixel.dtemp = pixel.dtemp; changePixel(pixel,"sandboxels_screen"); pixel.dtemp = 0; } + else if (newPixel.element === "paper_screen") { + changePixel(newPixel,"cellulose_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } else if (newPixel.element === "sand_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -766,12 +1048,22 @@ elements.water_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { changePixel(newPixel,"cellulose_screen"); newPixel.dtemp = pixel.dtemp; changePixel(pixel,"sandboxels_screen"); pixel.dtemp = 0; } + else if (newPixel.element === "paper_screen") { + changePixel(newPixel,"cellulose_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } else if (newPixel.element === "sand_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -819,6 +1111,22 @@ elements.steam_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "water_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -843,6 +1151,22 @@ elements.steam_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "water_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -867,6 +1191,22 @@ elements.steam_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "water_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -891,6 +1231,22 @@ elements.steam_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "water_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -943,7 +1299,26 @@ elements.wood_screen = { tempHigh: 1500, stateHigh: ["molten_glass","molten_glass","molten_glass","molten_gallium"], conduct: 1, - breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","concrete"], + breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","wood"], + tempLow: -45, + stateLow: "sandboxels_screen_off", + category: "digital", + state: "solid", + density: 1200, +}, + +elements.paper_screen = { + name:"screen", + hidden:true, + color: "#f0f0f0", + behavior: behaviors.WALL, + properties: { + dtemp: 20, + }, + tempHigh: 1500, + stateHigh: ["molten_glass","molten_glass","molten_glass","molten_gallium"], + conduct: 1, + breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","paper"], tempLow: -45, stateLow: "sandboxels_screen_off", category: "digital", @@ -1078,6 +1453,24 @@ elements.digital_wood = { desc: "Use on a screen to place digital wood." }, +elements.digital_paper = { + color: "#f0f0f0", + behavior: [ + "CH:sandboxels_screen>paper_screen|CH:sandboxels_screen>paper_screen|CH:sandboxels_screen>paper_screen", + "CH:sandboxels_screen>paper_screen|CH:sandboxels_screen>paper_screen|CH:sandboxels_screen>paper_screen", + "CH:sandboxels_screen>paper_screen|CH:sandboxels_screen>paper_screen|CH:sandboxels_screen>paper_screen", + ], + tool: function(pixel) { + if (elements[pixel.element].id === elements.sandboxels_screen.id) { + changePixel(pixel,"paper_screen"); + } + }, + insulate:true, + canPlace: false, + category: "digital", + desc: "Use on a screen to place digital paper." +}, + elements.digital_wall = { color: "#808080", behavior: [ @@ -1128,6 +1521,9 @@ elements.digital_heat = { else if (elements[pixel.element].id === elements.wood_screen.id) { pixel.dtemp += 1 } + else if (elements[pixel.element].id === elements.paper_screen.id) { + pixel.dtemp += 1 + } }, insulate:true, canPlace: false, @@ -1167,6 +1563,9 @@ elements.digital_cool = { else if (elements[pixel.element].id === elements.wood_screen.id) { pixel.dtemp -= 1 } + else if (elements[pixel.element].id === elements.paper_screen.id) { + pixel.dtemp -= 1 + } }, insulate:true, canPlace: false, @@ -1189,22 +1588,25 @@ elements.digital_roomtemp = { pixel.dtemp = 20 } else if (elements[pixel.element].id === elements.saw_screen.id) { - pixel.dtemp = 1 + pixel.dtemp = 20 } else if (elements[pixel.element].id === elements.water_screen.id) { - pixel.dtemp = 1 + pixel.dtemp = 20 } else if (elements[pixel.element].id === elements.cellulose_screen.id) { - pixel.dtemp = 1 + pixel.dtemp = 20 } else if (elements[pixel.element].id === elements.steam_screen.id) { - pixel.dtemp = 1 + pixel.dtemp = 20 } else if (elements[pixel.element].id === elements.ice_screen.id) { - pixel.dtemp = 1 + pixel.dtemp = 20 } else if (elements[pixel.element].id === elements.wood_screen.id) { - pixel.dtemp = 1 + pixel.dtemp = 20 + } + else if (elements[pixel.element].id === elements.paper_screen.id) { + pixel.dtemp = 20 } }, insulate:true, @@ -1266,6 +1668,9 @@ elements.digital_erase = { else if (elements[pixel.element].id === elements.wood_screen.id) { changePixel(pixel,"sandboxels_screen"); } + else if (elements[pixel.element].id === elements.paper_screen.id) { + changePixel(pixel,"sandboxels_screen"); + } else if (elements[pixel.element].id === elements.wall_screen.id) { changePixel(pixel,"sandboxels_screen"); } @@ -1277,14 +1682,14 @@ elements.digital_erase = { }; if (!elements.malware.reactions) { elements.malware.reactions = {} } - elements.malware.reactions.sandboxels_screen = { "elem2": ["sand_screen","sandboxels_screen_off",null], chance:0.1 }; - elements.malware.reactions.saw_screen = { "elem2": ["wall_screen","sandboxels_screen_off",null], chance:0.1 }; - elements.malware.reactions.sand_screen = { "elem2": ["wood_screen","sandboxels_screen_off",null], chance:0.1 }; - elements.malware.reactions.rock_screen = { "elem2": ["ice_screen","sandboxels_screen_off",null], chance:0.1 }; - elements.malware.reactions.cellulose_screen = { "elem2": ["steam_screen","sandboxels_screen_off",null], chance:0.1 }; - elements.malware.reactions.water_screen = { "elem2": ["water_screen","sandboxels_screen_off",null], chance:0.1 }; - elements.malware.reactions.steam_screen = { "elem2": ["cellulose_screen","sandboxels_screen_off",null], chance:0.1 }; - elements.malware.reactions.ice_screen = { "elem2": ["rock_screen","sandboxels_screen_off",null], chance:0.1 }; - elements.malware.reactions.wood_screen = { "elem2": ["sand_screen","sandboxels_screen_off",null], chance:0.1 }; - elements.malware.reactions.wall_screen = { "elem2": ["saw_screen","sandboxels_screen_off",null], chance:0.1 }; - + elements.malware.reactions.sandboxels_screen = { "elem2": ["sand_screen","sandboxels_screen_off","sandboxels_screen_off","malware"] }; + elements.malware.reactions.saw_screen = { "elem2": ["wall_screen","wall_screen","sandboxels_screen_off","malware"] }; + elements.malware.reactions.sand_screen = { "elem2": ["paper_screen","paper_screen","sandboxels_screen_off","malware"] }; + elements.malware.reactions.rock_screen = { "elem2": ["wood_screen","wood_screen","sandboxels_screen_off","malware"] }; + elements.malware.reactions.cellulose_screen = { "elem2": ["ice_screen","ice_screen","sandboxels_screen_off","malware"] }; + elements.malware.reactions.water_screen = { "elem2": ["steam_screen","steam_screen","sandboxels_screen_off","malware"] }; + elements.malware.reactions.steam_screen = { "elem2": ["water_screen","water_screen","sandboxels_screen_off","malware"] }; + elements.malware.reactions.ice_screen = { "elem2": ["cellulose_screen","cellulose_screen","sandboxels_screen_off","malware"] }; + elements.malware.reactions.wood_screen = { "elem2": ["rock_screen","rock_screen","sandboxels_screen_off","malware"] }; + elements.malware.reactions.paper_screen = { "elem2": ["sand_screen","sand_screen","sandboxels_screen_off","malware"] }; + elements.malware.reactions.wall_screen = { "elem2": ["saw_screen","saw_screen","sandboxels_screen_off","malware"] }; From d4a132b0759f6e000d39b2a81c2f56312efe44ae Mon Sep 17 00:00:00 2001 From: Nekonico <163950752+DBNekonico@users.noreply.github.com> Date: Fri, 27 Sep 2024 13:15:00 -0700 Subject: [PATCH 4/8] Create cannibal_cooking.js --- mods/cannibal_cooking.js | 240 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 240 insertions(+) create mode 100644 mods/cannibal_cooking.js diff --git a/mods/cannibal_cooking.js b/mods/cannibal_cooking.js new file mode 100644 index 00000000..3302e216 --- /dev/null +++ b/mods/cannibal_cooking.js @@ -0,0 +1,240 @@ +elements.sweet_blood = { + color: "#ff4040", + behavior: behaviors.LIQUID, + reactions: { + "yeast": { elem1:["infection","infection","alcohol","yeast",null] }, + "plague": { elem1:"infection", elem2:null }, + "rotten_meat": { elem1:"infection" }, + "rotten_cheese": { elem1:"infection" }, + "virus": { elem1:"infection", elem2:null }, + "cancer": { elem1:"infection" }, + "cyanide": { elem1:"infection", elem2:null }, + "cyanide_gas": { elem1:"infection", elem2:null }, + "mushroom_spore": { elem1:"infection", elem2:null }, + "mushroom_gill": { elem1:"infection" }, + "dirty_water": { elem1:"infection", elem2:null }, + "rad_steam": { elem1:"infection" }, + "rad_glass": { elem1:"infection" }, + "rad_shard": { elem1:"infection" }, + "rad_cloud": { elem1:"infection" }, + "fallout": { elem1:"infection" }, + "rust": { elem1:"infection", chance:0.05 }, + "oxidized_copper": { elem1:"infection", chance:0.05 }, + "rat": { elem1:"infection", chance:0.075 }, + "flea": { elem1:"infection", chance:0.03 }, + "worm": { elem1:"infection", chance:0.03 }, + "mercury": { elem1:"infection", elem2:null, chance:0.05 }, + "lead": { elem1:"infection", elem2:null, chance:0.01 }, + "oxygen": { elem2:null, chance:0.05 }, + "carbon_dioxide": { elem2:null, chance:0.05 }, + "alcohol": { elem1:[null,"sugar","dna"], chance:0.02 } + }, + viscosity: 12, + tempHigh: 120, + stateHigh: ["steam","sugar","oxygen","steam","sugar","oxygen","steam","salt","oxygen"], + tempLow: -5, + stateLow: "candy", + category:"food", + state: "liquid", + density: 1080, + stain: 0.05 +} + +elements.mellified_man = { + color: ["#be5c4b","#c8846f","#dda592","#bc6157"], + behavior: [ + "XX|CR:honey%0.00001|XX", + "CR:honey%0.00001|XX|CR:honey%0.00001", + "XX|M1 AND CR:honey%0.00001|XX", + ], + reactions: { + "water": { elem2:"sugar_water", tempMin:70, color2:"#d7db69" }, + "salt_water": { elem2:"sugar_water", tempMin:70, color2:"#d7db69"}, + "sugar_water": { elem2:"sugar_water", tempMin:70, color2:"#d7db69" }, + "seltzer": { elem2:"sugar_water", tempMin:70, color2:"#d7db69" }, + }, + tempHigh: 200, + stateHigh: ["cooked_meat","cooked_meat","caramel",], + category:"food", + burn:15, + burnTime:200, + burnInto:["cooked_meat","cooked_meat","caramel",], + state: "solid", + density: 1020, + conduct: 0.1, + isFood: true, + hidden: true +} + +elements.human_flesh = { + behavior: [ + "XX|XX|XX", + "SP|XX|SP", + "XX|M1|XX", + ], + reactions: { + "honey": { elem1:"mellified_man", elem2:["honey","honey",null], chance:0.0001 }, + "dirty_water": { elem1:"rotten_human_flesh", chance:0.1 }, + "fly": { elem1:"rotten_human_flesh", chance:0.2 }, + "dioxin": { elem1:"rotten_human_flesh", elem2:null, chance:0.1 }, + "uranium": { elem1:"rotten_human_flesh", chance:0.1 }, + "cancer": { elem1:"rotten_human_flesh", chance:0.1 }, + "plague": { elem1:"rotten_human_flesh", elem2:null, chance:0.3 }, + "ant": { elem1:"rotten_human_flesh", chance:0.1 }, + "worm": { elem1:"rotten_human_flesh", chance:0.1 }, + "rat": { elem1:"rotten_human_flesh", chance:0.3 }, + "mushroom_spore": { elem1:"rotten_human_flesh", chance:0.1 }, + "mushroom_stalk": { elem1:"rotten_human_flesh", chance:0.1 }, + "mycelium": { elem1:"rotten_human_flesh", chance:0.1 }, + "hyphae": { elem1:"rotten_human_flesh", chance:0.1 }, + "mercury": { elem1:"rotten_human_flesh", elem2:null, chance:0.2 }, + "mercury_gas": { elem1:"rotten_human_flesh", elem2:null, chance:0.1 }, + "virus": { elem1:"rotten_human_flesh", chance:0.1 }, + "poison": { elem1:"rotten_human_flesh", elem2:null, chance:0.5 }, + "infection": { elem1:"rotten_human_flesh", elem2:null, chance:0.1 }, + "ink": { elem1:"rotten_human_flesh", elem2:null, chance:0.1 }, + "acid": { elem1:"rotten_human_flesh", elem2:null, chance:0.5 }, + "acid_gas": { elem1:"rotten_human_flesh", chance:0.4 }, + "cyanide": { elem1:"rotten_human_flesh", elem2:null, chance:0.5 }, + "cyanide_gas": { elem1:"rotten_human_flesh", elem2:null, chance:0.5 }, + "rotten_cheese": { elem1:"rotten_human_flesh", chance:0.02 }, + "fallout": { elem1:"rotten_human_flesh", chance:0.2 }, + "water": { elem2:"broth", tempMin:70 }, + "salt_water": { elem2:"broth", tempMin:70 }, + "sugar_water": { elem2:"broth", tempMin:70 }, + "seltzer": { elem2:"broth", tempMin:70 }, + "salt": { elem1:"cured_human_flesh" }, + "vinegar": { elem1:"cured_human_flesh", chance:0.1 }, + }, + tempHigh: 100, + stateHigh: "cooked_meat", + tempLow: -18, + stateLow: "frozen_meat", + category:"food", + burn:15, + burnTime:200, + burnInto:"cooked_meat", + state: "solid", + density: 1050, + conduct: 0.2, + isFood: true, + hidden: true +} + +elements.rotten_human_flesh = { + name: "rotten_meat", + color: ["#b8b165","#b89765"], + behavior: [ + "XX|CR:plague,stench,stench,stench,fly%0.25 AND CH:meat>rotten_meat%1 AND CH:human_flesh>rotten_human_flesh%1|XX", + "SP%99 AND CH:meat>rotten_meat%1 AND CH:human_flesh>rotten_human_flesh%1|XX|SP%99 AND CH:meat>rotten_meat%1 AND CH:human_flesh>rotten_human_flesh%1", + "XX|M1 AND CH:meat>rotten_meat%1 AND CH:human_flesh>rotten_human_flesh%1|XX", + ], + reactions: { + "water": { elem2:"broth", tempMin:70, color2:"#d7db69" }, + "salt_water": { elem2:"broth", tempMin:70, color2:"#d7db69" }, + "sugar_water": { elem2:"broth", tempMin:70, color2:"#d7db69" }, + "dirty_water": { elem2:"broth", tempMin:70, color2:"#d7db69" }, + "seltzer": { elem2:"broth", tempMin:70, color2:"#d7db69" } + }, + tempHigh: 300, + stateHigh: ["plague","ash","ammonia"], + category:"food", + hidden: true, + burn:12, + burnTime:200, + burnInto:["plague","ash","ammonia"], + state: "solid", + density: 1005, + conduct: 0.1, + isFood: true +} + +elements.cured_human_flesh = { + name: "cured_meat", + color: ["#be5c4b","#c8846f","#dda592","#bc6157"], + behavior: [ + "XX|XX|XX", + "SP|XX|SP", + "XX|M1|XX", + ], + reactions: { + "honey": { elem1:"mellified_man", elem2:["honey","honey",null], chance:0.0001 }, + "water": { elem2:"broth", tempMin:70 }, + "salt_water": { elem2:"broth", tempMin:70 }, + "sugar_water": { elem2:"broth", tempMin:70 }, + "seltzer": { elem2:"broth", tempMin:70 }, + }, + tempHigh: 100, + stateHigh: "cooked_meat", + category:"food", + burn:15, + burnTime:200, + burnInto:"cooked_meat", + state: "solid", + density: 1019.5, + conduct: 0.3, + isFood: true, + hidden: true +} + +elements.human_corpse = { + color: ["#069469","#047e99","#7f5fb0"], + category: "life", + hidden: true, + density: 1500, + state: "solid", + conduct: .05, + temp: 37, + tempHigh: 200, + stateHigh: "cooked_meat", + tempLow: -30, + stateLow: "frozen_meat", + burn: 10, + burnTime: 250, + burnInto: "cooked_meat", + breakInto: ["blood","human_flesh","bone"], + forceSaveColor: true, + reactions: { + "honey": { elem1:"mellified_man", elem2:["honey","honey",null], chance:0.0005 }, + "cancer": { elem1:"cancer", chance:0.005 }, + "radiation": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_meat"], chance:0.4 }, + "neutron": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_meat"], chance:0.01 }, + "fallout": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_meat"], chance:0.01 }, + "plague": { elem1:["plague","plague","rotten_human_flesh"], chance:0.05 }, + "stink_bug": { elem2:"stench", oneway:true }, + "sun": { elem1:"cooked_meat" }, + }, +} + +elements.decapitated_head = { + color: ["#f3e7db","#f7ead0","#eadaba","#d7bd96","#a07e56","#825c43","#604134","#3a312a"], + category: "life", + hidden: true, + density: 1080, + state: "solid", + conduct: .05, + temp: 37, + tempHigh: 200, + stateHigh: "cooked_meat", + tempLow: -30, + stateLow: "frozen_meat", + burn: 10, + burnTime: 250, + burnInto: "cooked_meat", + breakInto: ["blood","human_flesh","bone"], + forceSaveColor: true, + reactions: { + "honey": { elem1:"mellified_man", elem2:["honey","honey",null], chance:0.0005 }, + "cancer": { elem1:"cancer", chance:0.005 }, + "radiation": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.4 }, + "neutron": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.03 }, + "fallout": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.03 }, + "plague": { elem1:"plague", chance:0.05 }, + "sun": { elem1:"cooked_meat" }, + "light": { stain1:"#825043" }, + }, +} + +if (!elements.blood.reactions) { elements.blood.reactions = {} } + elements.blood.reactions.caramel = { "elem1": "sweet_blood", "elem2": null, chance:0.001 }; + elements.blood.reactions.sugar = { "elem2": "sweet_blood", "elem2": null, chance:0.0005 }; From b1acb4b73c4366d3c2c475e83a840a189d4b94fd Mon Sep 17 00:00:00 2001 From: Nekonico <163950752+DBNekonico@users.noreply.github.com> Date: Sat, 28 Sep 2024 10:37:30 -0700 Subject: [PATCH 5/8] Update cannibal_cooking.js --- mods/cannibal_cooking.js | 192 ++++++++++++++++++++++++++++++++++----- 1 file changed, 168 insertions(+), 24 deletions(-) diff --git a/mods/cannibal_cooking.js b/mods/cannibal_cooking.js index 3302e216..b5cdb260 100644 --- a/mods/cannibal_cooking.js +++ b/mods/cannibal_cooking.js @@ -1,8 +1,83 @@ +elements.knife = { + color: ["#cbcdcd","#bdbdbd"], + behavior: behaviors.STURDYPOWDER, + reactions: { + "head": { elem2:"brain", chance:0.5 }, + "water": { elem1:"rust", chance:0.0025 }, + "salt_water": { elem1:"rust", chance:0.005 }, + "dirty_water": { elem1:"rust", chance:0.04 }, + "pool_water": { elem1:"rust", chance:0.04 }, + "sugar_water": { elem1:"rust", chance:0.0035 }, + "seltzer": { elem1:"rust", chance:0.006 }, + "salt": { elem1:"rust", chance:0.004 }, + "blood": { elem1:"rust", chance:0.003 }, + "infection": { elem1:"rust", chance:0.003 }, + "antibody": { elem1:"rust", chance:0.003 }, + "fire": { elem1:"rust", chance:0.0025 }, + "coffee": { elem1:"rust", chance:0.0003 }, + "tea": { elem1:"rust", chance:0.0003 }, + "broth": { elem1:"rust", chance:0.0003 }, + "juice": { elem1:"rust", chance:0.0003 }, + "nut_milk": { elem1:"rust", chance:0.0003 }, + }, + tempHigh: 1200, + stateHigh: ["molten_steel","molten_steel","ash","charcoal"], + category: "weapons", + density: 2500, + conduct: 0.15, + hardness: 0.2, + darkText: true +} + +elements.brain = { + color: ["#fce3e3","#deb6c5","#f5ced5","#e87b8f"], + behavior: [ + "XX|XX|XX", + "XX|CH:rotten_human_flesh%0.0005|XX", + "M2|M1|M2", + ], + reactions: { + "dirty_water": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "fly": { "elem1":"rotten_human_flesh", "chance":0.2 }, + "dioxin": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 }, + "uranium": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "cancer": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "plague": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.3 }, + "ant": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "worm": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "rat": { "elem1":"rotten_human_flesh", "chance":0.3 }, + "mushroom_spore": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "mushroom_stalk": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "mercury": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.2 }, + "mercury_gas": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 }, + "virus": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "poison": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.5 }, + "infection": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 }, + "ink": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 }, + "acid": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.5 }, + "acid_gas": { "elem1":"rotten_human_flesh", "chance":0.4 }, + "cyanide": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.5 }, + }, + tempHigh: 100, + stateHigh: "cooked_brain", + tempLow: -18, + stateLow: "frozen_human_flesh", + category:"life", + hidden: true, + breakInto: ["human_flesh", "blood"], + burn:10, + burnTime:200, + burnInto:["cooked_brain","cooked_brain","cooked_brain","steam","salt"], + state: "solid", + density: 1081, + conduct: 1, +}; + elements.sweet_blood = { color: "#ff4040", behavior: behaviors.LIQUID, reactions: { - "yeast": { elem1:["infection","infection","alcohol","yeast",null] }, + "yeast": { elem1:"alcohol", chance:0.005 }, "plague": { elem1:"infection", elem2:null }, "rotten_meat": { elem1:"infection" }, "rotten_cheese": { elem1:"infection" }, @@ -37,11 +112,13 @@ elements.sweet_blood = { category:"food", state: "liquid", density: 1080, - stain: 0.05 + stain: 0.05, + isFood: true, + hidden: true } elements.mellified_man = { - color: ["#be5c4b","#c8846f","#dda592","#bc6157"], + color: ["#f4f8db","#f8fbd0","#fbebba","#e8ce96","#b18f56","#936d43","#715234","#4b422a"], behavior: [ "XX|CR:honey%0.00001|XX", "CR:honey%0.00001|XX|CR:honey%0.00001", @@ -54,11 +131,11 @@ elements.mellified_man = { "seltzer": { elem2:"sugar_water", tempMin:70, color2:"#d7db69" }, }, tempHigh: 200, - stateHigh: ["cooked_meat","cooked_meat","caramel",], + stateHigh: ["cooked_human","cooked_human","honey",], category:"food", burn:15, burnTime:200, - burnInto:["cooked_meat","cooked_meat","caramel",], + burnInto:["cooked_human","cooked_human","honey",], state: "solid", density: 1020, conduct: 0.1, @@ -107,13 +184,13 @@ elements.human_flesh = { "vinegar": { elem1:"cured_human_flesh", chance:0.1 }, }, tempHigh: 100, - stateHigh: "cooked_meat", + stateHigh: "cooked_human", tempLow: -18, - stateLow: "frozen_meat", + stateLow: "frozen_human_flesh", category:"food", burn:15, burnTime:200, - burnInto:"cooked_meat", + burnInto:"cooked_human", state: "solid", density: 1050, conduct: 0.2, @@ -121,6 +198,73 @@ elements.human_flesh = { hidden: true } +elements.cooked_brain = { + color: ["#ae7d5b","#9b6d54","#7e4d31"], + behavior: behaviors.STURDYPOWDER, + tick: function(pixel) { + if (pixel.temp > 100 && Math.random() < 0.003 && isEmpty(pixel.x,pixel.y-1)) { + changePixel(pixel,"grease") + } + }, + reactions: { + "water": { elem2:"broth", tempMin:70 }, + "salt_water": { elem2:"broth", tempMin:70 }, + "sugar_water": { elem2:"broth", tempMin:70 }, + "dirty_water": { elem2:"broth", tempMin:70, color2:"#d7db69" }, + "seltzer": { elem2:"broth", tempMin:70 } + }, + tempHigh: 300, + stateHigh: "ash", + category:"food", + hidden:true, + burn:10, + burnTime:200, + burnInto: "ash", + state: "solid", + density: 1005, + isFood: true +} + +elements.cooked_human = { + color: ["#ae7d5b","#9b6d54","#7e4d31"], + behavior: behaviors.STURDYPOWDER, + tick: function(pixel) { + if (pixel.temp > 100 && Math.random() < 0.0025 && isEmpty(pixel.x,pixel.y-1)) { + changePixel(pixel,"grease") + } + }, + reactions: { + "water": { elem2:"broth", tempMin:70 }, + "salt_water": { elem2:"broth", tempMin:70 }, + "sugar_water": { elem2:"broth", tempMin:70 }, + "dirty_water": { elem2:"broth", tempMin:70, color2:"#d7db69" }, + "seltzer": { elem2:"broth", tempMin:70 } + }, + tempHigh: 300, + stateHigh: "ash", + category:"food", + hidden:true, + burn:10, + burnTime:200, + burnInto: "ash", + state: "solid", + density: 1005, + isFood: true +} + +elements.frozen_human_flesh = { + color: ["#399e8f","#49baa9","#6cd2c6","#40a197"], + behavior: behaviors.STURDYPOWDER, + temp: -18, + tempHigh: 0, + stateHigh: "human_flesh", + category:"food", + hidden:true, + state: "solid", + density: 1070, + isFood: true +} + elements.rotten_human_flesh = { name: "rotten_meat", color: ["#b8b165","#b89765"], @@ -165,11 +309,11 @@ elements.cured_human_flesh = { "seltzer": { elem2:"broth", tempMin:70 }, }, tempHigh: 100, - stateHigh: "cooked_meat", + stateHigh: "cooked_human", category:"food", burn:15, burnTime:200, - burnInto:"cooked_meat", + burnInto:"cooked_human", state: "solid", density: 1019.5, conduct: 0.3, @@ -186,23 +330,23 @@ elements.human_corpse = { conduct: .05, temp: 37, tempHigh: 200, - stateHigh: "cooked_meat", + stateHigh: "cooked_human", tempLow: -30, - stateLow: "frozen_meat", + stateLow: "frozen_human_flesh", burn: 10, burnTime: 250, - burnInto: "cooked_meat", + burnInto: "cooked_human", breakInto: ["blood","human_flesh","bone"], forceSaveColor: true, reactions: { "honey": { elem1:"mellified_man", elem2:["honey","honey",null], chance:0.0005 }, "cancer": { elem1:"cancer", chance:0.005 }, - "radiation": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_meat"], chance:0.4 }, - "neutron": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_meat"], chance:0.01 }, - "fallout": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_meat"], chance:0.01 }, + "radiation": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_human"], chance:0.4 }, + "neutron": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_human"], chance:0.01 }, + "fallout": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_human"], chance:0.01 }, "plague": { elem1:["plague","plague","rotten_human_flesh"], chance:0.05 }, "stink_bug": { elem2:"stench", oneway:true }, - "sun": { elem1:"cooked_meat" }, + "sun": { elem1:"cooked_human" }, }, } @@ -215,22 +359,22 @@ elements.decapitated_head = { conduct: .05, temp: 37, tempHigh: 200, - stateHigh: "cooked_meat", + stateHigh: "cooked_human", tempLow: -30, - stateLow: "frozen_meat", + stateLow: "frozen_human_flesh", burn: 10, burnTime: 250, - burnInto: "cooked_meat", + burnInto: "cooked_human", breakInto: ["blood","human_flesh","bone"], forceSaveColor: true, reactions: { "honey": { elem1:"mellified_man", elem2:["honey","honey",null], chance:0.0005 }, "cancer": { elem1:"cancer", chance:0.005 }, - "radiation": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.4 }, - "neutron": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.03 }, - "fallout": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.03 }, + "radiation": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_human"], chance:0.4 }, + "neutron": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_human"], chance:0.03 }, + "fallout": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_human"], chance:0.03 }, "plague": { elem1:"plague", chance:0.05 }, - "sun": { elem1:"cooked_meat" }, + "sun": { elem1:"cooked_human" }, "light": { stain1:"#825043" }, }, } From 577f67c56ef30bb5e0a32cf3d91efeaa1f74aeec Mon Sep 17 00:00:00 2001 From: Nekonico <163950752+DBNekonico@users.noreply.github.com> Date: Sun, 29 Sep 2024 11:04:00 -0700 Subject: [PATCH 6/8] SIMULATED HUMANS --- mods/sandboxels.js | 1267 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 1210 insertions(+), 57 deletions(-) diff --git a/mods/sandboxels.js b/mods/sandboxels.js index 9d1dca26..06b07c23 100644 --- a/mods/sandboxels.js +++ b/mods/sandboxels.js @@ -40,10 +40,257 @@ window.addEventListener("load", () => { document.getElementById("elementButton-cellulose_screen")?.remove() }) +window.addEventListener("load", () => { + document.getElementById("elementButton-blood_screen")?.remove() +}) + window.addEventListener("load", () => { document.getElementById("elementButton-paper_screen")?.remove() }) +elements.danger_suit = { + color: ["#A8A7AB","#878689"], + behavior: behaviors.STURDYPOWDER, + reactions: { + "radiation": { elem2:"electric", temp1:200 }, + "body":{ elem1:null, elem2:"suited_body" }, + }, + tempHigh: 500, + stateHigh: ["molten_aluminum","smoke","ash"], + burn: 10, + burnTime: 300, + burnInto: ["molten_aluminum","smoke","smoke","smoke","ash"], + category: "simulation", + state: "solid", + density: 2710, + conduct: 0.73, + hardness: 0.05, + breakInto: "metal_scrap", + fireColor: "#A7B3BF", + superconductAt: -271.95 +}, + +elements.danger_helmet = { + color: ["#323233","#434344"], + behavior: behaviors.STURDYPOWDER, + reactions: { + "head":{ elem1:null, elem2:"suited_head" }, + }, + tempHigh: 1500, + stateHigh: ["molten_glass","molten_glass","molten_plastic"], + burn: 10, + burnTime: 200, + burnInto: ["glass_shard","glass_shard","glass_shard","glass_shard","dioxin","smoke","dioxin","smoke","stench"], + category: "simulation", + state: "solid", + density: 2500, + breakInto: "glass_shard", +}, + +elements.suited_body = { + color: ["#A8A7AB","#878689"], + category: "life", + hidden: true, + density: 2710, + state: "solid", + conduct: .05, + temp: 37, + tempHigh: 300, + stateHigh: ["cooked_meat","cooked_meat","cooked_meat","cooked_meat","ash"], + tempLow: -75, + stateLow: "frozen_meat", + burn: 10, + burnTime: 250, + burnInto: ["cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","molten_aluminum","smoke","smoke","smoke","ash"], + breakInto: ["blood","meat","bone"], + forceSaveColor: true, + reactions: { + "egg": { elem2:"yolk", chance:0.5, oneway:true }, + "grape": { elem2:"juice", chance:0.5, color2:"#291824", oneway:true }, + "ant": { elem2:"dead_bug", chance:0.05, oneway:true }, + "fly": { elem2:"dead_bug", oneway:true }, + "firefly": { elem2:"dead_bug", oneway:true }, + "bee": { elem2:"dead_bug", oneway:true }, + "flea": { elem2:"dead_bug", oneway:true }, + "termite": { elem2:"dead_bug", oneway:true }, + "worm": { elem2:"slime", chance:0.05, oneway:true }, + "stink_bug": { elem2:"stench", oneway:true }, + "gold_coin": { elem2:null, chance:0.05 }, + "diamond": { elem2:null, chance:0.05 }, + "sun": { elem1:"cooked_meat" }, + }, + properties: { + dead: false, + dir: 1, + panic: 0 + }, + tick: function(pixel) { + if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall + if (!isEmpty(pixel.x, pixel.y-2, true)) { // Drag head down + var headpixel = pixelMap[pixel.x][pixel.y-2]; + if (headpixel.element == "head") { + if (isEmpty(pixel.x, pixel.y-1)) { + movePixel(pixelMap[pixel.x][pixel.y-2], pixel.x, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x][pixel.y-2], pixelMap[pixel.x][pixel.y-1]); + } + } + if (headpixel.element == "suited_head") { + if (isEmpty(pixel.x, pixel.y-1)) { + movePixel(pixelMap[pixel.x][pixel.y-2], pixel.x, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x][pixel.y-2], pixelMap[pixel.x][pixel.y-1]); + } + } + } + } + doHeat(pixel); + doBurning(pixel); + doElectricity(pixel); + if (pixel.dead) { + // Turn into rotten_meat if pixelTicks-dead > 500 + if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) { + changePixel(pixel,"rotten_meat"); + } + return + } + + // Find the head + if (!isEmpty(pixel.x, pixel.y-1, true) && pixelMap[pixel.x][pixel.y-1].element == "head") { + var head = pixelMap[pixel.x][pixel.y-1]; + if (head.dead) { // If head is dead, kill body + pixel.dead = head.dead; + } + } + else if (!isEmpty(pixel.x, pixel.y-1, true) && pixelMap[pixel.x][pixel.y-1].element == "suited_head") { + var head = pixelMap[pixel.x][pixel.y-1]; + if (head.dead) { // If head is dead, kill body + pixel.dead = head.dead; + } + } + else { var head = null } + if (pixel.burning) { + pixel.panic += 0.1; + if (head && pixelTicks-pixel.burnStart > 240) { + pixel.color = head.color; + } + } + else if (pixel.panic > 0) { + pixel.panic -= 0.1; + } + + if (isEmpty(pixel.x, pixel.y-1)) { + // create blood if decapitated 10% chance + if (Math.random() < 0.1 && !pixel.charge) { + createPixel("blood", pixel.x, pixel.y-1); + // set dead to true 15% chance + if (Math.random() < 0.15) { + pixel.dead = pixelTicks; + } + } + } + else if (head == null) { return } + else if (Math.random() < 0.1*(isEmpty(pixel.x, pixel.y+1) ? 1 : pixel.panic+1)) { // Move 10% chance + var movesToTry = [ + [1*pixel.dir,0], + [1*pixel.dir,-1], + ]; + // While movesToTry is not empty, tryMove(pixel, x, y) with a random move, then remove it. if tryMove returns true, break. + while (movesToTry.length > 0) { + var move = movesToTry.splice(Math.floor(Math.random() * movesToTry.length), 1)[0]; + if (isEmpty(pixel.x+move[0], pixel.y+move[1]-1)) { + var origx = pixel.x+move[0]; + var origy = pixel.y+move[1]; + if (tryMove(pixel, pixel.x+move[0], pixel.y+move[1]) && pixel.x===origx && pixel.y===origy) { + movePixel(head, head.x+move[0], head.y+move[1]); + break; + } + } + } + // 15% chance to change direction + if (Math.random() < 0.15) { + pixel.dir *= -1; + } + // homeostasis + if (pixel.temp > 37) { pixel.temp -= 1; } + else if (pixel.temp < 37) { pixel.temp += 1; } + } + + } +}, + +elements.suited_head = { + color: ["#46433F","#47443C","#4D483D"], + category: "life", + hidden: true, + density: 1080, + state: "solid", + conduct: .05, + temp: 37, + tempHigh: 300, + stateHigh: ["cooked_meat","cooked_meat","cooked_meat","cooked_meat","glass_shard"], + tempLow: -75, + stateLow: "frozen_meat", + burn: 10, + burnTime: 250, + burnInto: ["cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","melted_plastic","glass_shard"], + breakInto: ["blood","meat","bone","blood","meat","bone","glass_shard"], + forceSaveColor: true, + reactions: { + "oxygen": { elem2:"carbon_dioxide", chance:0.5 }, + "sun": { elem1:"cooked_meat" }, + "water": { elem2:"bubble", attr2:{"clone":"water"}, chance:0.001 }, + "salt_water": { elem2:"bubble", attr2:{"clone":"salt_water"}, chance:0.001 }, + "pool_water": { elem2:"bubble", attr2:{"clone":"pool_water"}, chance:0.001 }, + }, + properties: { + dead: false + }, + tick: function(pixel) { + doHeat(pixel); + doBurning(pixel); + doElectricity(pixel); + if (pixel.dead) { + // Turn into rotten_meat if pixelTicks-dead > 500 + if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) { + changePixel(pixel,"rotten_meat"); + return + } + } + + // Find the body + if (!isEmpty(pixel.x, pixel.y+1, true) && pixelMap[pixel.x][pixel.y+1].element == "body") { + var body = pixelMap[pixel.x][pixel.y+1]; + if (body.dead) { // If body is dead, kill head + pixel.dead = body.dead; + } + } + else if (!isEmpty(pixel.x, pixel.y+1, true) && pixelMap[pixel.x][pixel.y+1].element == "suited_body") { + var body = pixelMap[pixel.x][pixel.y+1]; + if (body.dead) { // If body is dead, kill head + pixel.dead = body.dead; + } + } + else { var body = null } + + if (tryMove(pixel, pixel.x, pixel.y+1)) { + // create blood if severed 10% chance + if (isEmpty(pixel.x, pixel.y+1) && !pixel.dead && Math.random() < 0.1 && !pixel.charge) { + createPixel("blood", pixel.x, pixel.y+1); + // set dead to true 15% chance + if (Math.random() < 0.15) { + pixel.dead = pixelTicks; + } + } + } + // homeostasis + if (pixel.temp > 37) { pixel.temp -= 1; } + else if (pixel.temp < 37) { pixel.temp += 1; } + } +}, + elements.digitalizer = { color: ["#d1c6be","#b5c0ad","#b9b8bc"], behavior: behaviors.WALL, @@ -56,7 +303,7 @@ elements.digitalizer = { breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","sand"], tempLow: -80, stateLow: "glass_shard", - category: "digital", + category: "simulation", tick: function(pixel) { if (!isEmpty(pixel.x,pixel.y-1,true) && !isEmpty(pixel.x,pixel.y+1,true)) { var newPixel = pixelMap[pixel.x][pixel.y-1]; @@ -94,6 +341,18 @@ elements.digitalizer = { changePixel(screen,"cellulose_screen"); deletePixel(newPixel.x,newPixel.y) } + else if (newPixel.element === "blood" && screen.element === "sandboxels_screen") { + changePixel(screen,"blood_screen"); + deletePixel(newPixel.x,newPixel.y) + } + else if (newPixel.element === "body" && screen.element === "sandboxels_screen") { + changePixel(screen,"blood_screen"); + deletePixel(newPixel.x,newPixel.y) + } + else if (newPixel.element === "head" && screen.element === "sandboxels_screen") { + changePixel(screen,"blood_screen"); + deletePixel(newPixel.x,newPixel.y) + } else if (newPixel.element === "rock" && screen.element === "sandboxels_screen") { changePixel(screen,"rock_screen"); deletePixel(newPixel.x,newPixel.y) @@ -102,6 +361,14 @@ elements.digitalizer = { changePixel(screen,"wall_screen"); deletePixel(newPixel.x,newPixel.y) } + else if (!isEmpty(pixel.x,pixel.y-2,true) && newPixel.element === "suited_body" && screen.element === "sandboxels_screen") { + var headPixel = pixelMap[pixel.x][pixel.y-2]; + if (headPixel.element === "suited_head" && newPixel.element === "suited_body" && screen.element === "sandboxels_screen") { + changePixel(screen,"simulated_human"); + deletePixel(newPixel.x,newPixel.y-1) + deletePixel(newPixel.x,newPixel.y) + } + } else { changePixel(screen,"malware"); deletePixel(newPixel.x,newPixel.y) @@ -111,7 +378,7 @@ elements.digitalizer = { }, state: "solid", density: 1200, - desc: "Digitalizes elements." + desc: "simulatedizes elements." }, elements.sandboxels_screen_off = { @@ -129,7 +396,7 @@ elements.sandboxels_screen_off = { breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","sand"], tempLow: -80, stateLow: "glass_shard", - category: "digital", + category: "simulation", state: "solid", density: 1200, desc: "Shock to turn on." @@ -150,11 +417,45 @@ elements.sandboxels_screen = { breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","sand"], tempLow: -45, stateLow: "sandboxels_screen_off", - category: "digital", + category: "simulation", state: "solid", density: 1200, }, - + +elements.simulated_human = { + hidden:true, + color: ["#46433F","#47443C","#4D483D"], + category: "simulation", + properties: { + dead: false, + dir: 1, + panic: 0 + }, + tick: function(pixel) { + if (!isEmpty(pixel.x, pixel.y+1),true) { + var oldPixel = pixelMap[pixel.x][pixel.y]; + var newPixel = pixelMap[pixel.x][pixel.y+1]; + if (newPixel.element === "sandboxels_screen") { + changePixel(newPixel, "body_screen"); + pixel.element = "head_screen"; + } + } + else if (!isEmpty(pixel.x, pixel.y-1),true) { + var newPixel = pixelMap[pixel.x][pixel.y-1]; + if (newPixel.element === "sandboxels_screen") { + changePixel(newPixel, "head_screen"); + pixel.element = "body_screen"; + } + } + else { + changePixel(oldPixel, "sandboxels_screen"); + } + }, + related: ["suited_body","suited_head"], + cooldown: defaultCooldown, + forceSaveColor: true, +}, + elements.sand_screen = { name:"screen", hidden:true, @@ -173,7 +474,7 @@ elements.sand_screen = { breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","sand"], tempLow: -45, stateLow: "sandboxels_screen_off", - category: "digital", + category: "simulation", tick: function(pixel) { if (!isEmpty(pixel.x,pixel.y+1,true)) { var newPixel = pixelMap[pixel.x][pixel.y+1]; @@ -189,6 +490,12 @@ elements.sand_screen = { newPixel.dtemp = pixel.dtemp; changePixel(pixel,"water_screen"); } + else if (newPixel.element === "blood_screen") { + changePixel(newPixel,"sand_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"blood_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -233,6 +540,12 @@ elements.sand_screen = { newPixel.dtemp = pixel.dtemp; changePixel(pixel,"water_screen"); } + else if (newPixel.element === "blood_screen") { + changePixel(newPixel,"sand_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"blood_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -282,6 +595,12 @@ elements.sand_screen = { newPixel.dtemp = pixel.dtemp; changePixel(pixel,"water_screen"); } + else if (newPixel.element === "blood_screen") { + changePixel(newPixel,"sand_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"blood_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -341,7 +660,7 @@ elements.rock_screen = { breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","rock"], tempLow: -45, stateLow: "sandboxels_screen_off", - category: "digital", + category: "simulation", tick: function(pixel) { if (!isEmpty(pixel.x,pixel.y+1,true)) { var newPixel = pixelMap[pixel.x][pixel.y+1]; @@ -357,6 +676,12 @@ elements.rock_screen = { newPixel.dtemp = pixel.dtemp; changePixel(pixel,"water_screen"); } + else if (newPixel.element === "blood_screen") { + changePixel(newPixel,"rock_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"blood_screen"); + } else if (newPixel.element === "steam_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -381,6 +706,12 @@ elements.rock_screen = { newPixel.dtemp = pixel.dtemp; changePixel(pixel,"water_screen"); } + else if (newPixel.element === "blood_screen") { + changePixel(newPixel,"rock_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"blood_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -430,6 +761,12 @@ elements.rock_screen = { newPixel.dtemp = pixel.dtemp; changePixel(pixel,"water_screen"); } + else if (newPixel.element === "blood_screen") { + changePixel(newPixel,"rock_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"blood_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -489,7 +826,7 @@ elements.saw_screen = { breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","sawdust"], tempLow: -45, stateLow: "sandboxels_screen_off", - category: "digital", + category: "simulation", tick: function(pixel) { if (!isEmpty(pixel.x,pixel.y+1,true)) { var newPixel = pixelMap[pixel.x][pixel.y+1]; @@ -631,7 +968,7 @@ elements.cellulose_screen = { breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","cellulose"], tempLow: -45, stateLow: "sandboxels_screen_off", - category: "digital", + category: "simulation", tick: function(pixel) { if (Math.random() > 0.2 && !isEmpty(pixel.x,pixel.y+1,true)) { var newPixel = pixelMap[pixel.x][pixel.y+1]; @@ -647,6 +984,12 @@ elements.cellulose_screen = { newPixel.dtemp = pixel.dtemp; changePixel(pixel,"water_screen"); } + else if (newPixel.element === "blood_screen") { + changePixel(newPixel,"cellulose_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"blood_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -689,6 +1032,12 @@ elements.cellulose_screen = { newPixel.dtemp = pixel.dtemp; changePixel(pixel,"water_screen"); } + else if (newPixel.element === "blood_screen") { + changePixel(newPixel,"cellulose_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"blood_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -706,8 +1055,8 @@ elements.cellulose_screen = { pixel.dtemp = newPixel.dtemp; } else if (newPixel.element === "saw_screen") { - newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); - pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; } else if (newPixel.element === "sand_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); @@ -732,6 +1081,12 @@ elements.cellulose_screen = { newPixel.dtemp = pixel.dtemp; changePixel(pixel,"water_screen"); } + else if (newPixel.element === "blood_screen") { + changePixel(newPixel,"cellulose_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"blood_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -776,6 +1131,12 @@ elements.cellulose_screen = { newPixel.dtemp = pixel.dtemp; changePixel(pixel,"water_screen"); } + else if (newPixel.element === "blood_screen") { + changePixel(newPixel,"cellulose_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"blood_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -819,6 +1180,12 @@ elements.cellulose_screen = { newPixel.dtemp = pixel.dtemp; changePixel(pixel,"water_screen"); } + else if (newPixel.element === "blood_screen") { + changePixel(newPixel,"cellulose_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"blood_screen"); + } else if (newPixel.element === "ice_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -853,6 +1220,297 @@ elements.cellulose_screen = { state: "solid", density: 1200, }, + +elements.blood_screen = { + name:"screen", + hidden:true, + color: ["#ff0000","#ee0000"], + behavior: [ + "XX|XX|XX", + "SW:sandboxels_screen|XX|SW:sandboxels_screen", + "SW:sandboxels_screen|XX|SW:sandboxels_screen", + ], + properties: { + dtemp: 20, + }, + tempHigh: 1500, + stateHigh: ["molten_glass","molten_glass","molten_glass","molten_gallium"], + conduct: 1, + breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","blood"], + tempLow: -45, + stateLow: "sandboxels_screen_off", + category: "simulation", + tick: function(pixel) { + if (Math.random() > 0.2 && !isEmpty(pixel.x,pixel.y+1,true)) { + var newPixel = pixelMap[pixel.x][pixel.y+1]; + if (newPixel.element === "sandboxels_screen") { + changePixel(newPixel,"blood_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } + else if (newPixel.element === "water_screen") { + changePixel(newPixel,"blood_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"water_screen"); + } + else if (newPixel.element === "ice_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "steam_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + changePixel(newPixel,"cellulose_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "sand_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "rock_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (Math.random() > 0.5 && !isEmpty(pixel.x+1,pixel.y+1,true)) { + var newPixel = pixelMap[pixel.x+1][pixel.y+1]; + if (newPixel.element === "sandboxels_screen") { + changePixel(newPixel,"blood_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } + else if (newPixel.element === "water_screen") { + changePixel(newPixel,"blood_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"water_screen"); + } + else if (newPixel.element === "ice_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "steam_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + changePixel(newPixel,"cellulose_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "sand_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "rock_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + } + else if (!isEmpty(pixel.x-1,pixel.y+1,true)) { + var newPixel = pixelMap[pixel.x-1][pixel.y+1]; + if (newPixel.element === "sandboxels_screen") { + changePixel(newPixel,"blood_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } + else if (newPixel.element === "water_screen") { + changePixel(newPixel,"blood_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"water_screen"); + } + else if (newPixel.element === "ice_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "steam_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + changePixel(newPixel,"cellulose_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "sand_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "rock_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + } + } + else if (Math.random() > 0.5 && !isEmpty(pixel.x+1,pixel.y,true)) { + var newPixel = pixelMap[pixel.x+1][pixel.y]; + if (newPixel.element === "sandboxels_screen") { + changePixel(newPixel,"blood_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } + else if (newPixel.element === "water_screen") { + changePixel(newPixel,"blood_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"water_screen"); + } + else if (newPixel.element === "ice_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "steam_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + changePixel(newPixel,"cellulose_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "sand_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "rock_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + } + else if (!isEmpty(pixel.x-1,pixel.y,true)) { + var newPixel = pixelMap[pixel.x-1][pixel.y]; + if (newPixel.element === "sandboxels_screen") { + changePixel(newPixel,"blood_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } + else if (newPixel.element === "water_screen") { + changePixel(newPixel,"blood_screen"); + pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"water_screen"); + } + else if (newPixel.element === "ice_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "steam_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + changePixel(newPixel,"cellulose_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "sand_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "rock_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + } + if (pixel.dtemp > 124) { changePixel(pixel,"steam_screen") } + }, + state: "solid", + density: 1200, +}, elements.water_screen = { name:"screen", @@ -872,7 +1530,7 @@ elements.water_screen = { breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","water"], tempLow: -45, stateLow: "sandboxels_screen_off", - category: "digital", + category: "simulation", tick: function(pixel) { if (Math.random() > 0.2 && !isEmpty(pixel.x,pixel.y+1,true)) { var newPixel = pixelMap[pixel.x][pixel.y+1]; @@ -894,12 +1552,26 @@ elements.water_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { changePixel(newPixel,"cellulose_screen"); newPixel.dtemp = pixel.dtemp; changePixel(pixel,"sandboxels_screen"); pixel.dtemp = 0; } + else if (newPixel.element === "paper_screen") { + changePixel(newPixel,"cellulose_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } else if (newPixel.element === "sand_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -928,6 +1600,14 @@ elements.water_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { changePixel(newPixel,"cellulose_screen"); newPixel.dtemp = pixel.dtemp; @@ -969,6 +1649,14 @@ elements.water_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { changePixel(newPixel,"cellulose_screen"); newPixel.dtemp = pixel.dtemp; @@ -1011,6 +1699,14 @@ elements.water_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { changePixel(newPixel,"cellulose_screen"); newPixel.dtemp = pixel.dtemp; @@ -1052,6 +1748,14 @@ elements.water_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "saw_screen") { changePixel(newPixel,"cellulose_screen"); newPixel.dtemp = pixel.dtemp; @@ -1098,7 +1802,7 @@ elements.steam_screen = { breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","steam"], tempLow: -45, stateLow: "sandboxels_screen_off", - category: "digital", + category: "simulation", tick: function(pixel) { if (Math.random() > 0.75 && !isEmpty(pixel.x+1,pixel.y-1,true)) { var newPixel = pixelMap[pixel.x+1][pixel.y-1]; @@ -1127,6 +1831,10 @@ elements.steam_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "water_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -1167,6 +1875,10 @@ elements.steam_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "water_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -1207,6 +1919,10 @@ elements.steam_screen = { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } else if (newPixel.element === "water_screen") { newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); pixel.dtemp = newPixel.dtemp; @@ -1266,6 +1982,227 @@ elements.steam_screen = { density: 1200, }, +elements.body_screen = { + color: ["#A8A7AB","#878689"], + name:"screen", + hidden:true, + behavior: [ + "XX|CH:sandboxels_screen>blood_screen%0.1|XX", + "XX|XX|XX", + "XX|XX|XX", + ], + properties: { + dtemp: 20, + }, + tempHigh: 1500, + stateHigh: ["molten_glass","molten_glass","molten_glass","molten_gallium"], + conduct: 1, + breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","body"], + tempLow: -45, + stateLow: "sandboxels_screen_off", + category: "simulation", + tick: function(pixel) { + if (!isEmpty(pixel.x,pixel.y-1,true) && pixelMap[pixel.x][pixel.y-1].element === "head_screen") { + var headPixel = pixelMap[pixel.x][pixel.y-1]; + if (!isEmpty(pixel.x,pixel.y+1,true)) { + var newPixel = pixelMap[pixel.x][pixel.y+1]; + if (newPixel.element === "sandboxels_screen") { + changePixel(newPixel,"body_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"head_screen"); + pixel.dtemp = headPixel.dtemp; + } + else if (newPixel.element === "water_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "ice_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "steam_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "rock_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + } + else if (Math.random() < 0.01 && !isEmpty(pixel.x+1,pixel.y,true) && !isEmpty(pixel.x+1,pixel.y-1,true)) { + var newPixel = pixelMap[pixel.x+1][pixel.y]; + var newHeadPixel = pixelMap[pixel.x+1][pixel.y-1]; + if (newPixel.element === "sandboxels_screen" && newHeadPixel.element === "sandboxels_screen") { + changePixel(pixel,"sandboxels_screen"); + changePixel(headPixel,"sandboxels_screen"); + changePixel(newPixel,"body_screen"); + changePixel(newHeadPixel,"head_screen"); + newPixel.dtemp = pixel.dtemp; + newHeadPixel.dtemp = headPixel.dtemp; + pixel.dtemp = 0; + headPixel.dtemp = 0; + } + } + else if (Math.random() < 0.01 && !isEmpty(pixel.x-1,pixel.y,true) && !isEmpty(pixel.x-1,pixel.y-1,true)) { + var newPixel = pixelMap[pixel.x-1][pixel.y]; + var newHeadPixel = pixelMap[pixel.x-1][pixel.y-1]; + if (newPixel.element === "sandboxels_screen" && newHeadPixel.element === "sandboxels_screen") { + changePixel(pixel,"sandboxels_screen"); + changePixel(headPixel,"sandboxels_screen"); + changePixel(newPixel,"body_screen"); + changePixel(newHeadPixel,"head_screen"); + newPixel.dtemp = pixel.dtemp; + newHeadPixel.dtemp = headPixel.dtemp; + pixel.dtemp = 0; + headPixel.dtemp = 0; + } + } + if (!isEmpty(pixel.x,pixel.y-2,true) && pixelMap[pixel.x][pixel.y-2].element === "head_screen") { + changePixel(pixelMap[pixel.x][pixel.y-2],"sandboxels_screen"); + } + } + else if (!isEmpty(pixel.x,pixel.y+1,true)) { + var newPixel = pixelMap[pixel.x][pixel.y+1]; + if (newPixel.element === "sandboxels_screen") { + changePixel(newPixel,"body_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } + else if (newPixel.element === "water_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "ice_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "steam_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "rock_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + } + }, +}, + +elements.head_screen = { + color: ["#46433F","#47443C","#4D483D"], + name:"screen", + hidden:true, + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "XX|XX|XX", + ], + properties: { + dtemp: 20, + }, + tempHigh: 1500, + stateHigh: ["molten_glass","molten_glass","molten_glass","molten_gallium"], + conduct: 1, + breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","head"], + tempLow: -45, + stateLow: "sandboxels_screen_off", + category: "simulation", + tick: function(pixel) { + if (!isEmpty(pixel.x,pixel.y+1,true)) { + var newPixel = pixelMap[pixel.x][pixel.y+1]; + if (newPixel.element === "sandboxels_screen") { + if (Math.random() < 0.1) { + changePixel(newPixel,"blood_screen"); + newPixel.dtemp = pixel.dtemp; + } + else { + changePixel(newPixel,"head_screen"); + newPixel.dtemp = pixel.dtemp; + changePixel(pixel,"sandboxels_screen"); + pixel.dtemp = 0; + } + } + else if (newPixel.element === "water_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "blood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "ice_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "steam_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "wood_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "paper_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "saw_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "cellulose_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + else if (newPixel.element === "rock_screen") { + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); + pixel.dtemp = newPixel.dtemp; + } + } + }, +}, + elements.ice_screen = { name:"screen", hidden:true, @@ -1280,7 +2217,7 @@ elements.ice_screen = { breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","ice"], tempLow: -45, stateLow: "sandboxels_screen_off", - category: "digital", + category: "simulation", tick: function(pixel) { if (pixel.dtemp > 5) { changePixel(pixel,"water_screen") } }, @@ -1302,7 +2239,7 @@ elements.wood_screen = { breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","wood"], tempLow: -45, stateLow: "sandboxels_screen_off", - category: "digital", + category: "simulation", state: "solid", density: 1200, }, @@ -1321,7 +2258,7 @@ elements.paper_screen = { breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","paper"], tempLow: -45, stateLow: "sandboxels_screen_off", - category: "digital", + category: "simulation", state: "solid", density: 1200, }, @@ -1340,12 +2277,12 @@ elements.wall_screen = { breakInto: ["glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","glass_shard","concrete"], tempLow: -45, stateLow: "sandboxels_screen_off", - category: "digital", + category: "simulation", state: "solid", density: 1200, }, -elements.digital_sand = { +elements.simulated_sand = { color: "#e6d577", behavior: [ "CH:sandboxels_screen>sand_screen|CH:sandboxels_screen>sand_screen|CH:sandboxels_screen>sand_screen", @@ -1359,11 +2296,11 @@ elements.digital_sand = { }, insulate:true, canPlace: false, - category: "digital", - desc: "Use on screen to place digital sand." + category: "simulation", + desc: "Use on screen to place simulated sand." }, -elements.digital_rock = { +elements.simulated_rock = { color: ["#808080","#4f4f4f","#949494"], behavior: [ "CH:sandboxels_screen>rock_screen|CH:sandboxels_screen>rock_screen|CH:sandboxels_screen>rock_screen", @@ -1377,11 +2314,11 @@ elements.digital_rock = { }, insulate:true, canPlace: false, - category: "digital", - desc: "Use on screen to place digital sand." + category: "simulation", + desc: "Use on screen to place simulated sand." }, -elements.digital_water = { +elements.simulated_water = { color: "#2167ff", behavior: [ "CH:sandboxels_screen>water_screen|CH:sandboxels_screen>water_screen|CH:sandboxels_screen>water_screen", @@ -1395,11 +2332,11 @@ elements.digital_water = { }, insulate:true, canPlace: false, - category: "digital", - desc: "Use on a screen to place digital water." + category: "simulation", + desc: "Use on a screen to place simulated water." }, -elements.digital_ice = { +elements.simulated_ice = { color: "#b2daeb", behavior: [ "CH:sandboxels_screen>ice_screen|CH:sandboxels_screen>ice_screen|CH:sandboxels_screen>ice_screen", @@ -1413,11 +2350,11 @@ elements.digital_ice = { }, insulate:true, canPlace: false, - category: "digital", - desc: "Use on a screen to place digital ice." + category: "simulation", + desc: "Use on a screen to place simulated ice." }, -elements.digital_steam = { +elements.simulated_steam = { color: "#abd6ff", behavior: [ "CH:sandboxels_screen>steam_screen|CH:sandboxels_screen>steam_screen|CH:sandboxels_screen>steam_screen", @@ -1431,11 +2368,47 @@ elements.digital_steam = { }, insulate:true, canPlace: false, - category: "digital", - desc: "Use on a screen to place digital steam." + category: "simulation", + desc: "Use on a screen to place simulated steam." }, -elements.digital_wood = { +elements.simulated_blood = { + color: ["#ff0000","#ee0000"], + behavior: [ + "CH:sandboxels_screen>blood_screen|CH:sandboxels_screen>blood_screen|CH:sandboxels_screen>blood_screen", + "CH:sandboxels_screen>blood_screen|CH:sandboxels_screen>blood_screen|CH:sandboxels_screen>blood_screen", + "CH:sandboxels_screen>blood_screen|CH:sandboxels_screen>blood_screen|CH:sandboxels_screen>blood_screen", + ], + tool: function(pixel) { + if (elements[pixel.element].id === elements.sandboxels_screen.id) { + changePixel(pixel,"blood_screen"); + } + }, + insulate:true, + canPlace: false, + category: "simulation", + desc: "Use on a screen to place simulated blood." +}, + +elements.simulated_sawdust = { + color: ["#dec150","#c7b15a"], + behavior: [ + "CH:sandboxels_screen>saw_screen|CH:sandboxels_screen>saw_screen|CH:sandboxels_screen>saw_screen", + "CH:sandboxels_screen>saw_screen|CH:sandboxels_screen>saw_screen|CH:sandboxels_screen>saw_screen", + "CH:sandboxels_screen>saw_screen|CH:sandboxels_screen>saw_screen|CH:sandboxels_screen>saw_screen", + ], + tool: function(pixel) { + if (elements[pixel.element].id === elements.sandboxels_screen.id) { + changePixel(pixel,"saw_screen"); + } + }, + insulate:true, + canPlace: false, + category: "simulation", + desc: "Use on screen to place simulated sawdust." +}, + +elements.simulated_wood = { color: "#a0522d", behavior: [ "CH:sandboxels_screen>wood_screen|CH:sandboxels_screen>wood_screen|CH:sandboxels_screen>wood_screen", @@ -1449,11 +2422,11 @@ elements.digital_wood = { }, insulate:true, canPlace: false, - category: "digital", - desc: "Use on a screen to place digital wood." + category: "simulation", + desc: "Use on a screen to place simulated wood." }, -elements.digital_paper = { +elements.simulated_paper = { color: "#f0f0f0", behavior: [ "CH:sandboxels_screen>paper_screen|CH:sandboxels_screen>paper_screen|CH:sandboxels_screen>paper_screen", @@ -1467,11 +2440,11 @@ elements.digital_paper = { }, insulate:true, canPlace: false, - category: "digital", - desc: "Use on a screen to place digital paper." + category: "simulation", + desc: "Use on a screen to place simulated paper." }, -elements.digital_wall = { +elements.simulated_wall = { color: "#808080", behavior: [ "CH:sandboxels_screen>ice_screen|CH:sandboxels_screen>ice_screen|CH:sandboxels_screen>ice_screen", @@ -1485,11 +2458,11 @@ elements.digital_wall = { }, insulate:true, canPlace: false, - category: "digital", - desc: "Use on a screen to place digital wall." + category: "simulation", + desc: "Use on a screen to place simulated wall." }, -elements.digital_heat = { +elements.simulated_heat = { color: "#ff0000", behavior: [ "XX|XX|XX", @@ -1512,6 +2485,9 @@ elements.digital_heat = { else if (elements[pixel.element].id === elements.cellulose_screen.id) { pixel.dtemp += 1 } + else if (elements[pixel.element].id === elements.blood_screen.id) { + pixel.dtemp += 1 + } else if (elements[pixel.element].id === elements.steam_screen.id) { pixel.dtemp += 1 } @@ -1524,14 +2500,20 @@ elements.digital_heat = { else if (elements[pixel.element].id === elements.paper_screen.id) { pixel.dtemp += 1 } + else if (elements[pixel.element].id === elements.head_screen.id) { + pixel.dtemp += 1 + } + else if (elements[pixel.element].id === elements.body_screen.id) { + pixel.dtemp += 1 + } }, insulate:true, canPlace: false, - category: "digital", - desc: "Use on a screen to heat digital elements." + category: "simulation", + desc: "Use on a screen to heat simulated elements." }, -elements.digital_cool = { +elements.simulated_cool = { color: "#0000ff", behavior: [ "XX|XX|XX", @@ -1554,6 +2536,9 @@ elements.digital_cool = { else if (elements[pixel.element].id === elements.cellulose_screen.id) { pixel.dtemp -= 1 } + else if (elements[pixel.element].id === elements.blood_screen.id) { + pixel.dtemp -= 1 + } else if (elements[pixel.element].id === elements.steam_screen.id) { pixel.dtemp -= 1 } @@ -1566,14 +2551,20 @@ elements.digital_cool = { else if (elements[pixel.element].id === elements.paper_screen.id) { pixel.dtemp -= 1 } + else if (elements[pixel.element].id === elements.head_screen.id) { + pixel.dtemp -= 1 + } + else if (elements[pixel.element].id === elements.body_screen.id) { + pixel.dtemp -= 1 + } }, insulate:true, canPlace: false, - category: "digital", - desc: "Use on a screen to cool digital elements." + category: "simulation", + desc: "Use on a screen to cool simulated elements." }, -elements.digital_roomtemp = { +elements.simulated_roomtemp = { color: "#b1c96d", behavior: [ "XX|XX|XX", @@ -1596,6 +2587,9 @@ elements.digital_roomtemp = { else if (elements[pixel.element].id === elements.cellulose_screen.id) { pixel.dtemp = 20 } + else if (elements[pixel.element].id === elements.blood_screen.id) { + pixel.dtemp = 20 + } else if (elements[pixel.element].id === elements.steam_screen.id) { pixel.dtemp = 20 } @@ -1608,14 +2602,20 @@ elements.digital_roomtemp = { else if (elements[pixel.element].id === elements.paper_screen.id) { pixel.dtemp = 20 } + else if (elements[pixel.element].id === elements.head_screen.id) { + pixel.dtemp = 20 + } + else if (elements[pixel.element].id === elements.body_screen.id) { + pixel.dtemp = 20 + } }, insulate:true, canPlace: false, - category: "digital", - desc: "Use on a screen to make digital elements room temperature." + category: "simulation", + desc: "Use on a screen to make simulated elements room temperature." }, -elements.digital_smash = { +elements.simulated_smash = { color: ["#666666","#888888","#666666"], behavior: [ "XX|XX|XX", @@ -1629,14 +2629,20 @@ elements.digital_smash = { else if (elements[pixel.element].id === elements.wood_screen.id) { changePixel(pixel,"saw_screen"); } + else if (elements[pixel.element].id === elements.head_screen.id) { + changePixel(pixel,"blood_screen"); + } + else if (elements[pixel.element].id === elements.body_screen.id) { + changePixel(pixel,"blood_screen"); + } }, insulate:true, canPlace: false, - category: "digital", - desc: "Use on a screen to smash digital elements." + category: "simulation", + desc: "Use on a screen to smash simulated elements." }, -elements.digital_erase = { +elements.simulated_erase = { color: "#fdb5ff", behavior: [ "XX|XX|XX", @@ -1659,6 +2665,9 @@ elements.digital_erase = { else if (elements[pixel.element].id === elements.cellulose_screen.id) { changePixel(pixel,"sandboxels_screen"); } + else if (elements[pixel.element].id === elements.blood_screen.id) { + changePixel(pixel,"sandboxels_screen"); + } else if (elements[pixel.element].id === elements.steam_screen.id) { changePixel(pixel,"sandboxels_screen"); } @@ -1674,11 +2683,17 @@ elements.digital_erase = { else if (elements[pixel.element].id === elements.wall_screen.id) { changePixel(pixel,"sandboxels_screen"); } + else if (elements[pixel.element].id === elements.head_screen.id) { + changePixel(pixel,"sandboxels_screen"); + } + else if (elements[pixel.element].id === elements.body_screen.id) { + changePixel(pixel,"sandboxels_screen"); + } }, insulate:true, canPlace: false, - category: "digital", - desc: "Use on a screen to erase digital elements." + category: "simulation", + desc: "Use on a screen to erase simulated elements." }; if (!elements.malware.reactions) { elements.malware.reactions = {} } @@ -1686,10 +2701,148 @@ if (!elements.malware.reactions) { elements.malware.reactions = {} } elements.malware.reactions.saw_screen = { "elem2": ["wall_screen","wall_screen","sandboxels_screen_off","malware"] }; elements.malware.reactions.sand_screen = { "elem2": ["paper_screen","paper_screen","sandboxels_screen_off","malware"] }; elements.malware.reactions.rock_screen = { "elem2": ["wood_screen","wood_screen","sandboxels_screen_off","malware"] }; - elements.malware.reactions.cellulose_screen = { "elem2": ["ice_screen","ice_screen","sandboxels_screen_off","malware"] }; + elements.malware.reactions.cellulose_screen = { "elem2": ["blood_screen","blood_screen","sandboxels_screen_off","malware"] }; + elements.malware.reactions.blood_screen = { "elem2": ["ice_screen","ice_screen","sandboxels_screen_off","malware"] }; elements.malware.reactions.water_screen = { "elem2": ["steam_screen","steam_screen","sandboxels_screen_off","malware"] }; elements.malware.reactions.steam_screen = { "elem2": ["water_screen","water_screen","sandboxels_screen_off","malware"] }; elements.malware.reactions.ice_screen = { "elem2": ["cellulose_screen","cellulose_screen","sandboxels_screen_off","malware"] }; elements.malware.reactions.wood_screen = { "elem2": ["rock_screen","rock_screen","sandboxels_screen_off","malware"] }; elements.malware.reactions.paper_screen = { "elem2": ["sand_screen","sand_screen","sandboxels_screen_off","malware"] }; elements.malware.reactions.wall_screen = { "elem2": ["saw_screen","saw_screen","sandboxels_screen_off","malware"] }; + +elements.head.tick = function(pixel) { + doHeat(pixel); + doBurning(pixel); + doElectricity(pixel); + if (pixel.dead) { + // Turn into rotten_meat if pixelTicks-dead > 500 + if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) { + changePixel(pixel,"rotten_meat"); + return + } + } + + // Find the body + if (!isEmpty(pixel.x, pixel.y+1, true) && pixelMap[pixel.x][pixel.y+1].element == "body") { + var body = pixelMap[pixel.x][pixel.y+1]; + if (body.dead) { // If body is dead, kill head + pixel.dead = body.dead; + } + } + else if (!isEmpty(pixel.x, pixel.y+1, true) && pixelMap[pixel.x][pixel.y+1].element == "suited_body") { + var body = pixelMap[pixel.x][pixel.y+1]; + if (body.dead) { // If body is dead, kill head + pixel.dead = body.dead; + } + } + else { var body = null } + + if (tryMove(pixel, pixel.x, pixel.y+1)) { + // create blood if severed 10% chance + if (isEmpty(pixel.x, pixel.y+1) && !pixel.dead && Math.random() < 0.1 && !pixel.charge) { + createPixel("blood", pixel.x, pixel.y+1); + // set dead to true 15% chance + if (Math.random() < 0.15) { + pixel.dead = pixelTicks; + } + } + } + // homeostasis + if (pixel.temp > 37) { pixel.temp -= 1; } + else if (pixel.temp < 37) { pixel.temp += 1; } +} + +elements.body.tick = function(pixel) { + if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall + if (!isEmpty(pixel.x, pixel.y-2, true)) { // Drag head down + var headpixel = pixelMap[pixel.x][pixel.y-2]; + if (headpixel.element == "head") { + if (isEmpty(pixel.x, pixel.y-1)) { + movePixel(pixelMap[pixel.x][pixel.y-2], pixel.x, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x][pixel.y-2], pixelMap[pixel.x][pixel.y-1]); + } + } + else if (headpixel.element == "suited_head") { + if (isEmpty(pixel.x, pixel.y-1)) { + movePixel(pixelMap[pixel.x][pixel.y-2], pixel.x, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x][pixel.y-2], pixelMap[pixel.x][pixel.y-1]); + } + } + } + } + doHeat(pixel); + doBurning(pixel); + doElectricity(pixel); + if (pixel.dead) { + // Turn into rotten_meat if pixelTicks-dead > 500 + if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) { + changePixel(pixel,"rotten_meat"); + } + return + } + + // Find the head + if (!isEmpty(pixel.x, pixel.y-1, true) && pixelMap[pixel.x][pixel.y-1].element == "head") { + var head = pixelMap[pixel.x][pixel.y-1]; + if (head.dead) { // If head is dead, kill body + pixel.dead = head.dead; + } + } + else if (!isEmpty(pixel.x, pixel.y-1, true) && pixelMap[pixel.x][pixel.y-1].element == "suited_head") { + var head = pixelMap[pixel.x][pixel.y-1]; + if (head.dead) { // If head is dead, kill body + pixel.dead = head.dead; + } + } + else { var head = null } + if (pixel.burning) { + pixel.panic += 0.1; + if (head && pixelTicks-pixel.burnStart > 240) { + pixel.color = head.color; + } + } + else if (pixel.panic > 0) { + pixel.panic -= 0.1; + } + + if (isEmpty(pixel.x, pixel.y-1)) { + // create blood if decapitated 10% chance + if (Math.random() < 0.1 && !pixel.charge) { + createPixel("blood", pixel.x, pixel.y-1); + // set dead to true 15% chance + if (Math.random() < 0.15) { + pixel.dead = pixelTicks; + } + } + } + else if (head == null) { return } + else if (Math.random() < 0.1*(isEmpty(pixel.x, pixel.y+1) ? 1 : pixel.panic+1)) { // Move 10% chance + var movesToTry = [ + [1*pixel.dir,0], + [1*pixel.dir,-1], + ]; + // While movesToTry is not empty, tryMove(pixel, x, y) with a random move, then remove it. if tryMove returns true, break. + while (movesToTry.length > 0) { + var move = movesToTry.splice(Math.floor(Math.random() * movesToTry.length), 1)[0]; + if (isEmpty(pixel.x+move[0], pixel.y+move[1]-1)) { + var origx = pixel.x+move[0]; + var origy = pixel.y+move[1]; + if (tryMove(pixel, pixel.x+move[0], pixel.y+move[1]) && pixel.x===origx && pixel.y===origy) { + movePixel(head, head.x+move[0], head.y+move[1]); + break; + } + } + } + // 15% chance to change direction + if (Math.random() < 0.15) { + pixel.dir *= -1; + } + // homeostasis + if (pixel.temp > 37) { pixel.temp -= 1; } + else if (pixel.temp < 37) { pixel.temp += 1; } + } +} From 83cc6fb292f6400bb7ad7921f0b205c2240b0069 Mon Sep 17 00:00:00 2001 From: Nekonico <163950752+DBNekonico@users.noreply.github.com> Date: Sun, 29 Sep 2024 17:09:51 -0700 Subject: [PATCH 7/8] more bugfixes --- mods/cannibal_cooking.js | 260 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 248 insertions(+), 12 deletions(-) diff --git a/mods/cannibal_cooking.js b/mods/cannibal_cooking.js index b5cdb260..273bbdcf 100644 --- a/mods/cannibal_cooking.js +++ b/mods/cannibal_cooking.js @@ -1,8 +1,15 @@ elements.knife = { color: ["#cbcdcd","#bdbdbd"], - behavior: behaviors.STURDYPOWDER, + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "XX|M1 AND SM%0.005|XX", + ], reactions: { - "head": { elem2:"brain", chance:0.5 }, + "head": { elem2:["brain","bone"], chance:0.5 }, + "body": { elem2:["heart","bone"], chance:0.5 }, + "decapitated_head": { elem2:["brain","bone"], chance:0.8 }, + "human_corpse": { elem2:["heart","bone"], chance:0.8 }, "water": { elem1:"rust", chance:0.0025 }, "salt_water": { elem1:"rust", chance:0.005 }, "dirty_water": { elem1:"rust", chance:0.04 }, @@ -30,11 +37,11 @@ elements.knife = { } elements.brain = { - color: ["#fce3e3","#deb6c5","#f5ced5","#e87b8f"], + color: ["#deb6c5","#F5CED5","#e87b8f"], behavior: [ "XX|XX|XX", - "XX|CH:rotten_human_flesh%0.0005|XX", - "M2|M1|M2", + "XX|CH:rotten_human_flesh%0.00005|XX", + "M2%75|M1|M2%75", ], reactions: { "dirty_water": { "elem1":"rotten_human_flesh", "chance":0.1 }, @@ -73,6 +80,50 @@ elements.brain = { conduct: 1, }; +elements.heart = { + color: ["#e31b23","#98002e","#6f1200","#551900","#e31b23","#98002e","#6f1200","#551900","#e31b23","#98002e","#6f1200","#551900","#532e63"], + behavior: [ + "CR:blood%0.01|CR:blood%0.02|CR:blood%0.01", + "CR:blood%0.01|CH:rotten_human_flesh%0.00005|CR:blood%0.01", + "M2%75 AND CR:blood%0.02|M1 AND CR:blood%0.05|M2%75AND CR:blood%0.02", + ], + reactions: { + "dirty_water": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "fly": { "elem1":"rotten_human_flesh", "chance":0.2 }, + "dioxin": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 }, + "uranium": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "cancer": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "plague": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.3 }, + "ant": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "worm": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "rat": { "elem1":"rotten_human_flesh", "chance":0.3 }, + "mushroom_spore": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "mushroom_stalk": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "mercury": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.2 }, + "mercury_gas": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 }, + "virus": { "elem1":"rotten_human_flesh", "chance":0.1 }, + "poison": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.5 }, + "infection": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 }, + "ink": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 }, + "acid": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.5 }, + "acid_gas": { "elem1":"rotten_human_flesh", "chance":0.4 }, + "cyanide": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.5 }, +}, +tempHigh: 110, +stateHigh: "cooked_heart", +tempLow: -18, +stateLow: "frozen_human_flesh", +category:"life", +hidden: true, +breakInto: ["human_flesh","blood","blood"], +burn:10, +burnTime:200, +burnInto:["cooked_heart","cooked_heart","cooked_heart","blood"], +state: "solid", +density: 1075, +conduct: 1, +}; + elements.sweet_blood = { color: "#ff4040", behavior: behaviors.LIQUID, @@ -120,9 +171,9 @@ elements.sweet_blood = { elements.mellified_man = { color: ["#f4f8db","#f8fbd0","#fbebba","#e8ce96","#b18f56","#936d43","#715234","#4b422a"], behavior: [ - "XX|CR:honey%0.00001|XX", - "CR:honey%0.00001|XX|CR:honey%0.00001", - "XX|M1 AND CR:honey%0.00001|XX", + "XX|CR:honey%0.0001|XX", + "CR:honey%0.0001|XX|CR:honey%0.0001", + "XX|M1 AND CR:honey%0.0001|XX", ], reactions: { "water": { elem2:"sugar_water", tempMin:70, color2:"#d7db69" }, @@ -136,6 +187,7 @@ elements.mellified_man = { burn:15, burnTime:200, burnInto:["cooked_human","cooked_human","honey",], + breakInto: ["blood","human_flesh","bone","honey","human_flesh","bone"], state: "solid", density: 1020, conduct: 0.1, @@ -144,6 +196,7 @@ elements.mellified_man = { } elements.human_flesh = { + color: ["#9e4839","#ba6449","#d2856c","#a14940"], behavior: [ "XX|XX|XX", "SP|XX|SP", @@ -199,10 +252,37 @@ elements.human_flesh = { } elements.cooked_brain = { - color: ["#ae7d5b","#9b6d54","#7e4d31"], + color: ["#C37C6E","#B77269","#AE625C"], behavior: behaviors.STURDYPOWDER, tick: function(pixel) { - if (pixel.temp > 100 && Math.random() < 0.003 && isEmpty(pixel.x,pixel.y-1)) { + if (pixel.temp > 100 && Math.random() < 0.0025 && isEmpty(pixel.x,pixel.y-1)) { + changePixel(pixel,"grease") + } + }, + reactions: { + "water": { elem2:"broth", tempMin:70 }, + "salt_water": { elem2:"broth", tempMin:70 }, + "sugar_water": { elem2:"broth", tempMin:70 }, + "dirty_water": { elem2:"broth", tempMin:70, color2:"#d7db69" }, + "seltzer": { elem2:"broth", tempMin:70 } + }, + tempHigh: 300, + stateHigh: "ash", + category:"food", + hidden:true, + burn:10, + burnTime:200, + burnInto: "ash", + state: "solid", + density: 1005, + isFood: true +} + +elements.cooked_heart = { + color: ["#A44447","#9A4546","#8A2A30"], + behavior: behaviors.STURDYPOWDER, + tick: function(pixel) { + if (pixel.temp > 100 && Math.random() < 0.0025 && isEmpty(pixel.x,pixel.y-1)) { changePixel(pixel,"grease") } }, @@ -266,7 +346,6 @@ elements.frozen_human_flesh = { } elements.rotten_human_flesh = { - name: "rotten_meat", color: ["#b8b165","#b89765"], behavior: [ "XX|CR:plague,stench,stench,stench,fly%0.25 AND CH:meat>rotten_meat%1 AND CH:human_flesh>rotten_human_flesh%1|XX", @@ -323,6 +402,18 @@ elements.cured_human_flesh = { elements.human_corpse = { color: ["#069469","#047e99","#7f5fb0"], + behavior: [ + "XX|XX|XX", + "XX|CH:rotten_human_flesh%0.0001|XX", + "XX|M1|XX", + ], + tick: function(pixel) { + if (isEmpty(pixel.x, pixel.y-1)) { + if (Math.random() < 0.01 && !pixel.charge) { + createPixel("blood", pixel.x, pixel.y-1); + } + } + }, category: "life", hidden: true, density: 1500, @@ -352,6 +443,18 @@ elements.human_corpse = { elements.decapitated_head = { color: ["#f3e7db","#f7ead0","#eadaba","#d7bd96","#a07e56","#825c43","#604134","#3a312a"], + behavior: [ + "XX|XX|XX", + "XX|CH:rotten_human_flesh%0.0001|XX", + "M2%90|M1|M2%90", + ], + tick: function(pixel) { + if (tryMove(pixel, pixel.x, pixel.y+1)) { + if (isEmpty(pixel.x, pixel.y+1) && Math.random() < 0.01) { + createPixel("blood", pixel.x, pixel.y+1); + } + } + }, category: "life", hidden: true, density: 1080, @@ -379,6 +482,139 @@ elements.decapitated_head = { }, } +elements.head.tick = function(pixel) { + doHeat(pixel); + doBurning(pixel); + doElectricity(pixel); + if (pixel.dead) { + // Turn into rotten_meat if pixelTicks-dead > 500 + if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) { + pixel.element = "decapitated_head"; + return + } + } + + // Find the body + if (!isEmpty(pixel.x, pixel.y+1, true) && pixelMap[pixel.x][pixel.y+1].element == "body") { + var body = pixelMap[pixel.x][pixel.y+1]; + if (body.dead) { // If body is dead, kill head + pixel.dead = body.dead; + } + } + else { var body = null } + + if (tryMove(pixel, pixel.x, pixel.y+1)) { + // create blood if severed 10% chance + if (isEmpty(pixel.x, pixel.y+1) && !pixel.dead && Math.random() < 0.1 && !pixel.charge) { + createPixel("blood", pixel.x, pixel.y+1); + // set dead to true 15% chance + if (Math.random() < 0.15) { + pixel.dead = pixelTicks; + } + } + } + // homeostasis + if (pixel.temp > 37) { pixel.temp -= 1; } + else if (pixel.temp < 37) { pixel.temp += 1; } +} + +elements.body.tick = function(pixel) { + if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall + if (!isEmpty(pixel.x, pixel.y-2, true)) { // Drag head down + var headpixel = pixelMap[pixel.x][pixel.y-2]; + if (headpixel.element == "head") { + if (isEmpty(pixel.x, pixel.y-1)) { + movePixel(pixelMap[pixel.x][pixel.y-2], pixel.x, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x][pixel.y-2], pixelMap[pixel.x][pixel.y-1]); + } + } + } + } + doHeat(pixel); + doBurning(pixel); + doElectricity(pixel); + if (pixel.dead) { + // Turn into rotten_meat if pixelTicks-dead > 500 + if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) { + pixel.element = "human_corpse"; + } + return + } + + // Find the head + if (!isEmpty(pixel.x, pixel.y-1, true) && pixelMap[pixel.x][pixel.y-1].element == "head") { + var head = pixelMap[pixel.x][pixel.y-1]; + if (head.dead) { // If head is dead, kill body + pixel.dead = head.dead; + } + } + else { var head = null } + if (pixel.burning) { + pixel.panic += 0.1; + if (head && pixelTicks-pixel.burnStart > 240) { + pixel.color = head.color; + } + } + else if (pixel.panic > 0) { + pixel.panic -= 0.1; + } + + if (isEmpty(pixel.x, pixel.y-1)) { + // create blood if decapitated 10% chance + if (Math.random() < 0.1 && !pixel.charge) { + createPixel("blood", pixel.x, pixel.y-1); + // set dead to true 15% chance + if (Math.random() < 0.15) { + pixel.dead = pixelTicks; + } + } + } + else if (head == null) { return } + else if (Math.random() < 0.1*(isEmpty(pixel.x, pixel.y+1) ? 1 : pixel.panic+1)) { // Move 10% chance + var movesToTry = [ + [1*pixel.dir,0], + [1*pixel.dir,-1], + ]; + // While movesToTry is not empty, tryMove(pixel, x, y) with a random move, then remove it. if tryMove returns true, break. + while (movesToTry.length > 0) { + var move = movesToTry.splice(Math.floor(Math.random() * movesToTry.length), 1)[0]; + if (isEmpty(pixel.x+move[0], pixel.y+move[1]-1)) { + var origx = pixel.x+move[0]; + var origy = pixel.y+move[1]; + if (tryMove(pixel, pixel.x+move[0], pixel.y+move[1]) && pixel.x===origx && pixel.y===origy) { + movePixel(head, head.x+move[0], head.y+move[1]); + break; + } + } + } + // 15% chance to change direction + if (Math.random() < 0.15) { + pixel.dir *= -1; + } + // homeostasis + if (pixel.temp > 37) { pixel.temp -= 1; } + else if (pixel.temp < 37) { pixel.temp += 1; } + } +} + +elements.body.stateHigh = "cooked_human" +elements.head.stateHigh = "cooked_human" + +elements.body.breakInto = ["blood","human_flesh","bone","blood","human_flesh","bone","blood","heart","bone",] +elements.head.breakInto = ["blood","brain","bone"] + +elements.body.stateLow = "frozen_human_flesh" +elements.head.stateLow = "frozen_human_flesh" + if (!elements.blood.reactions) { elements.blood.reactions = {} } elements.blood.reactions.caramel = { "elem1": "sweet_blood", "elem2": null, chance:0.001 }; - elements.blood.reactions.sugar = { "elem2": "sweet_blood", "elem2": null, chance:0.0005 }; + elements.blood.reactions.sugar = { "elem1": "sweet_blood", "elem2": null, chance:0.0005}; + +if (!elements.head.reactions) { elements.head.reactions = {} } + elements.head.reactions.human_flesh = { "elem2": null, chance:0.01 }; + elements.head.reactions.cooked_human = { "elem2": null, chance:0.05 }; + elements.head.reactions.cooked_brain = { "elem2": null, chance:0.03 }; + elements.head.reactions.cooked_heart = { "elem2": null, chance:0.04 }; + From 899738d0d16e04c1cbf9815b66430f635d1a3cb5 Mon Sep 17 00:00:00 2001 From: Nekonico <163950752+DBNekonico@users.noreply.github.com> Date: Sun, 29 Sep 2024 17:59:27 -0700 Subject: [PATCH 8/8] human bugfixes --- mods/sandboxels.js | 75 ++++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/mods/sandboxels.js b/mods/sandboxels.js index 06b07c23..3d1a6daf 100644 --- a/mods/sandboxels.js +++ b/mods/sandboxels.js @@ -46,6 +46,14 @@ window.addEventListener("load", () => { window.addEventListener("load", () => { document.getElementById("elementButton-paper_screen")?.remove() +}) + +window.addEventListener("load", () => { + document.getElementById("elementButton-body_screen")?.remove() +}) + +window.addEventListener("load", () => { + document.getElementById("elementButton-head_screen")?.remove() }) elements.danger_suit = { @@ -432,23 +440,18 @@ elements.simulated_human = { panic: 0 }, tick: function(pixel) { - if (!isEmpty(pixel.x, pixel.y+1),true) { - var oldPixel = pixelMap[pixel.x][pixel.y]; + if (!isEmpty(pixel.x, pixel.y+1),true && pixelMap[pixel.x][pixel.y+1].element === "sandboxels_screen") { var newPixel = pixelMap[pixel.x][pixel.y+1]; - if (newPixel.element === "sandboxels_screen") { - changePixel(newPixel, "body_screen"); - pixel.element = "head_screen"; - } + newPixel.element = "body_screen"; + pixel.element = "head_screen"; } - else if (!isEmpty(pixel.x, pixel.y-1),true) { + else if (!isEmpty(pixel.x, pixel.y-1),true && pixelMap[pixel.x][pixel.y-1].element === "sandboxels_screen") { var newPixel = pixelMap[pixel.x][pixel.y-1]; - if (newPixel.element === "sandboxels_screen") { - changePixel(newPixel, "head_screen"); - pixel.element = "body_screen"; - } + newPixel.element = "head_screen"; + pixel.element = "body_screen"; } else { - changePixel(oldPixel, "sandboxels_screen"); + changePixel(pixel, "sandboxels_screen"); } }, related: ["suited_body","suited_head"], @@ -2003,50 +2006,50 @@ elements.body_screen = { category: "simulation", tick: function(pixel) { if (!isEmpty(pixel.x,pixel.y-1,true) && pixelMap[pixel.x][pixel.y-1].element === "head_screen") { - var headPixel = pixelMap[pixel.x][pixel.y-1]; + var headPixel = pixelMap[pixel.x][pixel.y-1] if (!isEmpty(pixel.x,pixel.y+1,true)) { - var newPixel = pixelMap[pixel.x][pixel.y+1]; + var newPixel = pixelMap[pixel.x][pixel.y+1] if (newPixel.element === "sandboxels_screen") { - changePixel(newPixel,"body_screen"); - newPixel.dtemp = pixel.dtemp; - changePixel(pixel,"head_screen"); - pixel.dtemp = headPixel.dtemp; + changePixel(newPixel,"body_screen") + newPixel.dtemp = pixel.dtemp + changePixel(pixel,"head_screen") + pixel.dtemp = headPixel.dtemp } else if (newPixel.element === "water_screen") { - newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); - pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2) + pixel.dtemp = newPixel.dtemp } else if (newPixel.element === "blood_screen") { - newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); - pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2) + pixel.dtemp = newPixel.dtemp } else if (newPixel.element === "ice_screen") { - newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); - pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2) + pixel.dtemp = newPixel.dtemp } else if (newPixel.element === "steam_screen") { - newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); - pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2) + pixel.dtemp = newPixel.dtemp } else if (newPixel.element === "wood_screen") { - newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); - pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2) + pixel.dtemp = newPixel.dtemp } else if (newPixel.element === "paper_screen") { - newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); - pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2) + pixel.dtemp = newPixel.dtemp } else if (newPixel.element === "saw_screen") { - newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); - pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2) + pixel.dtemp = newPixel.dtemp } else if (newPixel.element === "cellulose_screen") { - newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); - pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2) + pixel.dtemp = newPixel.dtemp } else if (newPixel.element === "rock_screen") { - newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2); - pixel.dtemp = newPixel.dtemp; + newPixel.dtemp = ((pixel.dtemp + newPixel.dtemp) / 2) + pixel.dtemp = newPixel.dtemp } } else if (Math.random() < 0.01 && !isEmpty(pixel.x+1,pixel.y,true) && !isEmpty(pixel.x+1,pixel.y-1,true)) {