From 1886d25e6a87dd8877e619c7686f330b979b7269 Mon Sep 17 00:00:00 2001
From: BatteRaquette581 <84451047+BatteRaquette581@users.noreply.github.com>
Date: Fri, 8 Mar 2024 21:00:27 +0100
Subject: [PATCH 01/56] Create lye.js
---
mods/lye.js | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100644 mods/lye.js
diff --git a/mods/lye.js b/mods/lye.js
new file mode 100644
index 00000000..44735414
--- /dev/null
+++ b/mods/lye.js
@@ -0,0 +1,34 @@
+/*
+MIT License
+
+Copyright (c) 2024 BatteRaquette58 (a.k.a BatteRaquette581)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+elements.lye = {
+ color: "#e5cccc",
+ behavior: behaviors.POWDER,
+ category: "powders",
+ state: "solid",
+ tempHigh: 1388,
+ stateHigh: "caustic_potash",
+}
+
+elements.water.reactions.ash.elem2 = "lye"
From a2bbad7a8fca61b42db7d83b8a1a9a8b764a8342 Mon Sep 17 00:00:00 2001
From: BatteRaquette581 <84451047+BatteRaquette581@users.noreply.github.com>
Date: Fri, 8 Mar 2024 21:04:46 +0100
Subject: [PATCH 02/56] Update mod-list.html
---
mod-list.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/mod-list.html b/mod-list.html
index daa35cfe..1d2c4462 100644
--- a/mod-list.html
+++ b/mod-list.html
@@ -165,6 +165,7 @@
iocalfaeus_clones.js Adds Iorefrius, Iolucius, and Ioradius gas Alice
laetium.js Adds several fictional elements Alice
liquid_energy.js Adds liquid versions of the elements in the Energy category Alice
+lye.js Adds lye BatteRaquette58
metals.js Adds several metals Alice
mixture.js Allows many chemicals to be mixed lllllllllwith10ls
more_gold.js Adds Green Gold pixelegend4
From b63e46a441b66e79021c55cdfb5a095aa5b4e2b7 Mon Sep 17 00:00:00 2001
From: BatteRaquette581 <84451047+BatteRaquette581@users.noreply.github.com>
Date: Fri, 8 Mar 2024 22:22:56 +0100
Subject: [PATCH 03/56] Create tps_counter.js
---
mods/tps_counter.js | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 mods/tps_counter.js
diff --git a/mods/tps_counter.js b/mods/tps_counter.js
new file mode 100644
index 00000000..06764915
--- /dev/null
+++ b/mods/tps_counter.js
@@ -0,0 +1,44 @@
+/*
+MIT License
+
+Copyright (c) 2024 BatteRaquette58 (a.k.a BatteRaquette581)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+const old_tick = tick
+
+let tps_counter = document.createElement("span")
+tps_counter.id = "stat-tps-counter"
+tps_counter.classList = ["stat",]
+const total_wrapper = document.getElementById("totalWrapper")
+const first_child = total_wrapper.childNodes[0]
+total_wrapper.insertBefore(tps_counter, first_child)
+total_wrapper.insertBefore(document.createElement("br"), first_child)
+
+tick = () => {
+ const t1 = Date.now()
+ old_tick()
+ const t2 = Date.now()
+ let time_elapsed = t2 - t1
+ tps_counter.innerText = Math.min(tps, 1 / (time_elapsed / 1000))
+}
+
+window.clearInterval(tickInterval)
+tickInterval = window.setInterval(tick, 1000 / tps)
From 46afcaf72248abfeb525350439061d39ec1279bf Mon Sep 17 00:00:00 2001
From: BatteRaquette581 <84451047+BatteRaquette581@users.noreply.github.com>
Date: Fri, 8 Mar 2024 22:24:20 +0100
Subject: [PATCH 04/56] Update mod-list.html
---
mod-list.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/mod-list.html b/mod-list.html
index 1d2c4462..75aa620a 100644
--- a/mod-list.html
+++ b/mod-list.html
@@ -146,6 +146,7 @@
save_loading.js Adds the ability to save and load scenes from files (See the info page of the element) Alice
stripe_paint.js Adds a tool to paint with stripes Alice
the_ground.js Adds several rock types, worldgen settings, and gemstones Alice
+tps_counter.js Adds an ingame TPS counter that counts the actual TPS and not the target TPS (counter in upper left corner) BatteRaquette58/td>
Science & Chemistry
alcohol.js Adds methanol, (iso-)propanol, and butanol Alice
From 377ca71487122cd172efd564555fd22092d28b66 Mon Sep 17 00:00:00 2001
From: BatteRaquette581 <84451047+BatteRaquette581@users.noreply.github.com>
Date: Fri, 8 Mar 2024 21:32:47 +0000
Subject: [PATCH 05/56] Revert "Create tps_counter.js"
This reverts commit b63e46a441b66e79021c55cdfb5a095aa5b4e2b7.
---
mods/tps_counter.js | 44 --------------------------------------------
1 file changed, 44 deletions(-)
delete mode 100644 mods/tps_counter.js
diff --git a/mods/tps_counter.js b/mods/tps_counter.js
deleted file mode 100644
index 06764915..00000000
--- a/mods/tps_counter.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-MIT License
-
-Copyright (c) 2024 BatteRaquette58 (a.k.a BatteRaquette581)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-const old_tick = tick
-
-let tps_counter = document.createElement("span")
-tps_counter.id = "stat-tps-counter"
-tps_counter.classList = ["stat",]
-const total_wrapper = document.getElementById("totalWrapper")
-const first_child = total_wrapper.childNodes[0]
-total_wrapper.insertBefore(tps_counter, first_child)
-total_wrapper.insertBefore(document.createElement("br"), first_child)
-
-tick = () => {
- const t1 = Date.now()
- old_tick()
- const t2 = Date.now()
- let time_elapsed = t2 - t1
- tps_counter.innerText = Math.min(tps, 1 / (time_elapsed / 1000))
-}
-
-window.clearInterval(tickInterval)
-tickInterval = window.setInterval(tick, 1000 / tps)
From c95f90473e4f655f61c1aacd9a92905ec08d70ef Mon Sep 17 00:00:00 2001
From: BatteRaquette581 <84451047+BatteRaquette581@users.noreply.github.com>
Date: Fri, 8 Mar 2024 21:32:56 +0000
Subject: [PATCH 06/56] Revert "Update mod-list.html"
This reverts commit 46afcaf72248abfeb525350439061d39ec1279bf.
---
mod-list.html | 1 -
1 file changed, 1 deletion(-)
diff --git a/mod-list.html b/mod-list.html
index 75aa620a..1d2c4462 100644
--- a/mod-list.html
+++ b/mod-list.html
@@ -146,7 +146,6 @@
save_loading.js Adds the ability to save and load scenes from files (See the info page of the element) Alice
stripe_paint.js Adds a tool to paint with stripes Alice
the_ground.js Adds several rock types, worldgen settings, and gemstones Alice
-tps_counter.js Adds an ingame TPS counter that counts the actual TPS and not the target TPS (counter in upper left corner) BatteRaquette58/td>
Science & Chemistry
alcohol.js Adds methanol, (iso-)propanol, and butanol Alice
From 84a4b34f6080968005adfa5230ce54bc22e74693 Mon Sep 17 00:00:00 2001
From: DoobieRalsei <163950752+DoobieRalsei@users.noreply.github.com>
Date: Fri, 24 May 2024 13:13:31 -0700
Subject: [PATCH 07/56] Improved 096s face sight range
---
mods/scp.js | 40 ++++++++++++++++++++++++++++++++--------
1 file changed, 32 insertions(+), 8 deletions(-)
diff --git a/mods/scp.js b/mods/scp.js
index 55e23bd3..9703ac3d 100644
--- a/mods/scp.js
+++ b/mods/scp.js
@@ -1116,16 +1116,16 @@ elements.shy_body = {
}
if (pixel.dir == 1) {
if (!isEmpty(pixel.x+2, pixel.y-1, true) && pixelMap[pixel.x+2][pixel.y-1].element == "head") {
- pixel.panic += 0.1;
+ pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x+3, pixel.y-1, true) && pixelMap[pixel.x+2][pixel.y-1].element == "head") {
- pixel.panic += 0.1;
+ pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x+4, pixel.y-1, true) && pixelMap[pixel.x+4][pixel.y-1].element == "head") {
- pixel.panic += 0.1;
+ pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x+5, pixel.y-1, true) && pixelMap[pixel.x+5][pixel.y-1].element == "head") {
- pixel.panic += 0.1;
+ pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x+5, pixel.y-1, true) && pixelMap[pixel.x+5][pixel.y-1].element == "head") {
pixel.panic += 0.1;
@@ -1139,19 +1139,31 @@ elements.shy_body = {
else if (!isEmpty(pixel.x+8, pixel.y-1, true) && pixelMap[pixel.x+8][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
+ else if (!isEmpty(pixel.x+9, pixel.y-1, true) && pixelMap[pixel.x+9][pixel.y-1].element == "head") {
+ pixel.panic += 0.1;
+ }
+ else if (!isEmpty(pixel.x+10, pixel.y-1, true) && pixelMap[pixel.x+10][pixel.y-1].element == "head") {
+ pixel.panic += 0.1;
+ }
+ else if (!isEmpty(pixel.x+11, pixel.y-1, true) && pixelMap[pixel.x+11][pixel.y-1].element == "head") {
+ pixel.panic += 0.1;
+ }
+ else if (!isEmpty(pixel.x+12, pixel.y-1, true) && pixelMap[pixel.x+12][pixel.y-1].element == "head") {
+ pixel.panic += 0.1;
+ }
}
else if (pixel.dir == -1) {
if (!isEmpty(pixel.x-2, pixel.y-1, true) && pixelMap[pixel.x-2][pixel.y-1].element == "head") {
- pixel.panic += 0.1;
+ pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x-3, pixel.y-1, true) && pixelMap[pixel.x-3][pixel.y-1].element == "head") {
- pixel.panic += 0.1;
+ pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x-4, pixel.y-1, true) && pixelMap[pixel.x-4][pixel.y-1].element == "head") {
- pixel.panic += 0.1;
+ pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x-5, pixel.y-1, true) && pixelMap[pixel.x-5][pixel.y-1].element == "head") {
- pixel.panic += 0.1;
+ pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x-5, pixel.y-1, true) && pixelMap[pixel.x-5][pixel.y-1].element == "head") {
pixel.panic += 0.1;
@@ -1165,6 +1177,18 @@ elements.shy_body = {
else if (!isEmpty(pixel.x-8, pixel.y-1, true) && pixelMap[pixel.x-8][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
+ else if (!isEmpty(pixel.x-9, pixel.y-1, true) && pixelMap[pixel.x-9][pixel.y-1].element == "head") {
+ pixel.panic += 0.1;
+ }
+ else if (!isEmpty(pixel.x-10, pixel.y-1, true) && pixelMap[pixel.x-10][pixel.y-1].element == "head") {
+ pixel.panic += 0.1;
+ }
+ else if (!isEmpty(pixel.x-11, pixel.y-1, true) && pixelMap[pixel.x-11][pixel.y-1].element == "head") {
+ pixel.panic += 0.1;
+ }
+ else if (!isEmpty(pixel.x-12, pixel.y-1, true) && pixelMap[pixel.x-12][pixel.y-1].element == "head") {
+ pixel.panic += 0.1;
+ }
}
},
density: 1080,
From 0ba885959c5ce9f0452d8bb83bd846d57f43c2eb Mon Sep 17 00:00:00 2001
From: te-agma-at <72958435+te-agma-at@users.noreply.github.com>
Date: Tue, 28 May 2024 01:41:58 -0400
Subject: [PATCH 08/56] Update moreliquids.js
doing some more stuff
---
mods/moreliquids.js | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/mods/moreliquids.js b/mods/moreliquids.js
index 61a51996..a6c6b0b7 100644
--- a/mods/moreliquids.js
+++ b/mods/moreliquids.js
@@ -79,7 +79,6 @@ elements.paste = {
color: "#C4AA98",
behavior: behaviors.WALL,
category: "solids",
- stateHigh: ["liquid_paste"],
state: "solid",
density: 230
};
@@ -90,6 +89,15 @@ elements.husk = {
reactions: {},
state: "solid"
};
+elements.restored_husk = {
+ color: ["#E0CABB", "#CAB3A0", "#CAB3A0"],
+ behavior: [
+ "XX|CR:bless%0.03|XX",
+ ],
+ category: "solids",
+ reactions: {},
+ state: "solid"
+};
elements.remnant = {
color: "#3C382B",
behavior: behaviors.POWDER,
@@ -104,7 +112,7 @@ elements.rot = {
"XX|XX|XX",
"XX|CR:rot%0.054|XX",
],
- category: "liquids",
+ category: "life",
viscosity: 1,
state: "liquid",
reactions: {},
@@ -124,5 +132,7 @@ elements.poop.reactions.water = { "elem1":"dried_poop", "elem2":"fly" };
elements.tar.reactions.husk = { "elem1":"rot", "elem2":"fly" };
elements.husk.reactions.molasses = { "elem1":"smoke", "elem2":"remnant" };
elements.rot.reactions.fire = { "elem1":"smoke", "elem2":"cinder" };
+elements.bless.reactions.husk = { "elem1":"restored_husk", "elem2":"restored_husk" };
+elements.bless.reactions.rot = { "elem1":"restored_husk", "elem2":"restored_husk" };
elements.water.reactions.rot = { "elem1":"blood", "elem2":"slag" };
From 7a655784918e858faa21223b38b2176ae2ee84bf Mon Sep 17 00:00:00 2001
From: DoobieRalsei <163950752+DoobieRalsei@users.noreply.github.com>
Date: Mon, 5 Aug 2024 18:40:17 -0700
Subject: [PATCH 09/56] coal no longer breaks into ash as much
---
mods/fossils.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mods/fossils.js b/mods/fossils.js
index d8e97c67..8d6aee1b 100644
--- a/mods/fossils.js
+++ b/mods/fossils.js
@@ -242,13 +242,13 @@ elements.coal = {
},
burn: 28,
burnTime: 1000,
- burnInto: ["fire","fire","fire","fire","ash","carbon_dioxide"],
+ burnInto: ["fire","fire","fire","fire","dust","carbon_dioxide"],
tempHigh: 6000,
stateHigh: "fire",
category: "powders",
state: "solid",
density: 250,
- breakInto: ["ash","ash","carbon_dioxide"],
+ breakInto: ["dust","ash","carbon_dioxide"],
hardness: 0.5,
},
From f23544ea9ce7a0b84093103dc0a886fc766c8411 Mon Sep 17 00:00:00 2001
From: Jayd-Rubies <155784127+Jayd-Rubies@users.noreply.github.com>
Date: Wed, 7 Aug 2024 01:16:47 -0400
Subject: [PATCH 10/56] Add files via upload
---
mods/texture_pack_by_jayd.js | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 mods/texture_pack_by_jayd.js
diff --git a/mods/texture_pack_by_jayd.js b/mods/texture_pack_by_jayd.js
new file mode 100644
index 00000000..7c3ced5f
--- /dev/null
+++ b/mods/texture_pack_by_jayd.js
@@ -0,0 +1,29 @@
+//texture_pack_by_jayd
+document.body.style.backgroundImage = 'url("https://jayd-rubies.github.io/1236951076024877107.png")';
+gameDiv.style.border = "0px solid #ffffff";
+function drawCursor() {
+ canvas.style.backgroundColor = "#00000000";
+ var layerCtx = canvasLayers.gui.getContext('2d');
+ var mouseOffset = Math.trunc(mouseSize/2);
+ var topLeft = [mousePos.x-mouseOffset,mousePos.y-mouseOffset];
+ var bottomRight = [mousePos.x+mouseOffset,mousePos.y+mouseOffset];
+ // Draw a square around the mouse
+ layerCtx.strokeStyle = "#FFFFFF80";
+ layerCtx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize);
+ // draw one transparent pixel in the center
+ if (settings.precision) {
+ layerCtx.fillStyle = "#ffffffc8";
+ layerCtx.fillRect(mousePos.x*pixelSize,mousePos.y*pixelSize,pixelSize,pixelSize);
+ }
+ if (shaping) {
+ if (shaping === 1) { // Draw a white line from shapeStart.x to shapeStart.y
+ layerCtx.beginPath();
+ layerCtx.strokeStyle = "#FFFFFF80";
+ layerCtx.lineWidth = 2;
+ layerCtx.moveTo(shapeStart.x*pixelSize+pixelSizeHalf, shapeStart.y*pixelSize+pixelSizeHalf);
+ layerCtx.lineTo(mousePos.x*pixelSize+pixelSizeHalf, mousePos.y*pixelSize+pixelSizeHalf);
+ layerCtx.stroke();
+ layerCtx.lineWidth = 1;
+ }
+ }
+}
\ No newline at end of file
From ee20718c8ab545180782ff8555a2728e19e6bb1a Mon Sep 17 00:00:00 2001
From: redbirdly <155550833+redbirdly@users.noreply.github.com>
Date: Wed, 7 Aug 2024 22:30:30 +0800
Subject: [PATCH 11/56] Update circuitcore.js, fix error and add destructable
circuits
---
mods/circuitcore.js | 282 +++++++++++++++++++++++++++++++-------------
1 file changed, 198 insertions(+), 84 deletions(-)
diff --git a/mods/circuitcore.js b/mods/circuitcore.js
index 41903bd4..d5edbfdc 100644
--- a/mods/circuitcore.js
+++ b/mods/circuitcore.js
@@ -98,15 +98,23 @@ function createCircuitFrame(pixel, width_, height_, center=true, rotation=0) {
var [rx, ry] = rotateCoordinate(x, y, rotation);
var px = pixel.x + rx;
var py = pixel.y + ry;
+
if (!(0 <= px && px < width && 0 <= py && py < height)) {continue;}
+ // Create the pixel
if (!pixelMap[px] || pixelMap[px][py] === undefined) {
createPixel("circuit_material", px, py);
}
+
+ // Set the core position property
+ if (pixelMap[px] && pixelMap[px][py] && pixelMap[px][py].element === "circuit_material") {
+ pixelMap[px][py].corePosition = { x: pixel.x, y: pixel.y };
+ }
}
}
}
+
function createPins(pixel, pins, rotation=0) {
for (var i = 0; i < pins.length; i++) {
var [rx, ry] = rotateCoordinate(pins[i][0], pins[i][1], rotation);
@@ -691,75 +699,75 @@ elements.four_bit_SIPO_shift_register_circuit = {
};
elements.four_bit_program_counter_circuit = {
- tick: function(pixel) {
- var pins = [
- // Data inputs (D0-D3)
- [-3, -3, true], // D0
- [-1, -3, true], // D1
- [1, -3, true], // D2
- [3, -3, true], // D3
+ tick: function(pixel) {
+ var pins = [
+ // Data inputs (D0-D3)
+ [-3, -3, true], // D0
+ [-1, -3, true], // D1
+ [1, -3, true], // D2
+ [3, -3, true], // D3
- // Control inputs (Increment, Write Enable)
- [5, -1, true], // Increment
- [5, 1, true], // Write Enable
+ // Control inputs (Increment, Write Enable)
+ [5, -1, true], // Increment
+ [5, 1, true], // Write Enable
- // Outputs (Q0-Q3)
- [-3, 3, false], // Q0
- [-1, 3, false], // Q1
- [1, 3, false], // Q2
- [3, 3, false], // Q3
- ];
+ // Outputs (Q0-Q3)
+ [-3, 3, false], // Q0
+ [-1, 3, false], // Q1
+ [1, 3, false], // Q2
+ [3, 3, false], // Q3
+ ];
- initializeCircuit(pixel, pins, 9, 5);
+ initializeCircuit(pixel, pins, 9, 5);
- // Read data inputs
- var D = [
- checkPin(pixel, pins, 0),
- checkPin(pixel, pins, 1),
- checkPin(pixel, pins, 2),
- checkPin(pixel, pins, 3)
- ];
+ // Read data inputs
+ var D = [
+ checkPin(pixel, pins, 0),
+ checkPin(pixel, pins, 1),
+ checkPin(pixel, pins, 2),
+ checkPin(pixel, pins, 3)
+ ];
- // Read control inputs
- var Increment = checkPin(pixel, pins, 4);
- var WriteEnable = checkPin(pixel, pins, 5);
+ // Read control inputs
+ var Increment = checkPin(pixel, pins, 4);
+ var WriteEnable = checkPin(pixel, pins, 5);
- // Initialize the state if not already done
- if (pixel._state === undefined) {
- pixel._state = [false, false, false, false];
- pixel.prevIncrement = false; // Previous state of Increment pin
- }
+ // Initialize the state if not already done
+ if (pixel._state === undefined) {
+ pixel._state = [false, false, false, false];
+ pixel.prevIncrement = false; // Previous state of Increment pin
+ }
- // Convert the state to a 4-bit binary number
- var stateValue = binaryArrayToNumber(pixel._state);
+ // Convert the state to a 4-bit binary number
+ var stateValue = binaryArrayToNumber(pixel._state);
- // Detect the positive edge on the Increment pin
- if (Increment && !pixel.prevIncrement) {
- stateValue = (stateValue + 1) % 16; // Ensure the value wraps around at 4 bits
- }
+ // Detect the positive edge on the Increment pin
+ if (Increment && !pixel.prevIncrement) {
+ stateValue = (stateValue + 1) % 16; // Ensure the value wraps around at 4 bits
+ }
- // Update the register state if WriteEnable is active
- if (WriteEnable) {
- stateValue = binaryArrayToNumber(D); // Load data inputs into state
- }
+ // Update the register state if WriteEnable is active
+ if (WriteEnable) {
+ stateValue = binaryArrayToNumber(D); // Load data inputs into state
+ }
- // Update the state
- pixel._state = [
- (stateValue & 8) !== 0,
- (stateValue & 4) !== 0,
- (stateValue & 2) !== 0,
- (stateValue & 1) !== 0
- ];
+ // Update the state
+ pixel._state = [
+ (stateValue & 8) !== 0,
+ (stateValue & 4) !== 0,
+ (stateValue & 2) !== 0,
+ (stateValue & 1) !== 0
+ ];
- // Output the register state
- setPin(pixel, pins, 6, pixel._state[0]); // Q0
- setPin(pixel, pins, 7, pixel._state[1]); // Q1
- setPin(pixel, pins, 8, pixel._state[2]); // Q2
- setPin(pixel, pins, 9, pixel._state[3]); // Q3
+ // Output the register state
+ setPin(pixel, pins, 6, pixel._state[0]); // Q0
+ setPin(pixel, pins, 7, pixel._state[1]); // Q1
+ setPin(pixel, pins, 8, pixel._state[2]); // Q2
+ setPin(pixel, pins, 9, pixel._state[3]); // Q3
- // Update previous state of Increment pin
- pixel.prevIncrement = Increment;
- }
+ // Update previous state of Increment pin
+ pixel.prevIncrement = Increment;
+ }
};
elements.four_bit_register_circuit = {
@@ -1200,6 +1208,11 @@ elements.very_fast_clock = {
tick: general_clock(8, 4),
}
+elements.fast_clock = {
+ color: "#FFAAFF",
+ tick: general_clock(16, 8),
+}
+
var addDisplayCallback = function(pixel, pins, w, h) {
for (var y = 1; y < h - 1; y++) {
for (var x = 1; x < w - 1; x++) {
@@ -1324,15 +1337,84 @@ elements.simple_double_seven_segment_display = {
}
};
+function malfunction_chip(pixel) {
+ var emptySpaces = [];
+
+ // Search in a 5x5 neighborhood for empty spaces
+ for (var dy = -2; dy <= 2; dy++) {
+ for (var dx = -2; dx <= 2; dx++) {
+ var neighborX = pixel.x + dx;
+ var neighborY = pixel.y + dy;
+ if (pixelMap[neighborX] && pixelMap[neighborX][neighborY] === undefined) {
+ emptySpaces.push({ x: neighborX, y: neighborY });
+ }
+ }
+ }
+
+ if (emptySpaces.length > 0) {
+ // Randomly select one of the empty spaces
+ var randomSpace = emptySpaces[Math.floor(Math.random() * emptySpaces.length)];
+
+ // Determine what to spawn based on probability
+ var rand = Math.random();
+ if (rand < 0.7) {
+ createPixel("electric", randomSpace.x, randomSpace.y);
+ } else if (rand < 0.99) {
+ createPixel("fire", randomSpace.x, randomSpace.y);
+ } else {
+ createPixel("explosion", randomSpace.x, randomSpace.y);
+ }
+ }
+}
+
elements.circuit_material = {
color: "#444444",
- category: "logic"
+ category: "logic",
+ state: "solid",
+ behavior: behaviors.WALL,
+ hoverStat: function(pixel) {
+ return `Circuit: ${pixel.corePosition}`;
+ },
+ tick: function(pixel) {
+ // Make it that extreme temperatures can stop the chip from working (for realism)
+ if (Math.random() < 0.003) { // Chance to check for temperature or nearby particles
+ // Check temperature
+ if (pixel.temp > 120) {
+ // Replace the circuit core with lead if overheating
+ if (pixel.corePosition && Math.random() < (0.00015) * (pixel.temp - 120)) {
+ var corePos = pixel.corePosition;
+ if (pixelMap[corePos.x] && pixelMap[corePos.x][corePos.y]) {
+ deletePixel(corePos.x, corePos.y);
+ createPixel("lead", corePos.x, corePos.y);
+ }
+ }
+
+ // Randomly trigger malfunction if overheating
+ if (Math.random() < 0.001 * (pixel.temp - 120)) {
+ malfunction_chip(pixel);
+ }
+
+ // Break the circuit material itself if overheating
+ if (Math.random() < 0.001 * (pixel.temp - 120)) {
+ var px = pixel.x;
+ var py = pixel.y;
+ deletePixel(px, py);
+ if (Math.random() < 0.5) {createPixel("lead", px, py);}
+ }
+ }
+ }
+ }
};
+
elements.input_pin = {
color: "#DDAA33",
category: "logic",
+ state: "solid",
active: false,
+ stateHigh: "lead",
+ tempHigh: 570,
+ behavior: behaviors.WALL,
tick: function(pixel) {
pixel.active = false;
var neighbors = getNeighbors(pixel);
@@ -1349,7 +1431,11 @@ elements.input_pin = {
elements.output_pin = {
color: "#AAAAAA",
category: "logic",
+ state: "solid",
active: false,
+ stateHigh: "lead",
+ tempHigh: 570,
+ behavior: behaviors.WALL,
tick: function(pixel) {
var neighbors = getNeighbors(pixel);
for (var i = 0;i < neighbors.length;i++) {
@@ -1486,6 +1572,7 @@ var circuits = [
{ circuit: elements.medium_clock },
{ circuit: elements.fast_clock },
{ circuit: elements.very_fast_clock },
+ { circuit: elements.very_fast_clock },
// Displays/visual circuits: white
{ circuit: elements.simple_seven_segment_display, color: cc_WHITE, size: [5, 9, false] },
{ circuit: elements.simple_double_seven_segment_display, color: cc_WHITE, size: [9, 9, false] },
@@ -1497,6 +1584,32 @@ circuits.forEach(circuitInfo => {
circuitInfo.circuit.maxSize = 1;
circuitInfo.circuit.isCircuitCore = true;
circuitInfo.circuit.previewSize = circuitInfo.size;
+
+ // Exclude circuits without a frame
+ if (circuitInfo.size) {
+ var previousCircuitTick = circuitInfo.circuit.tick;
+ circuitInfo.circuit.tick = function(pixel) {
+ previousCircuitTick(pixel);
+
+ // Don't constantly check
+ if (Math.random() < 0.1) {
+ // If there aren't 4 neighboring circuit_material elements then remove the circuit's core
+ var neighbors = getNeighbors(pixel);
+ var circuitMaterialCount = 0;
+ for (var i = 0;i < neighbors.length;i++) {
+ if (neighbors[i].element == "circuit_material") {
+ circuitMaterialCount++;
+ }
+ }
+
+ if (circuitMaterialCount < 2) {
+ deletePixel(pixel.x, pixel.y);
+ }
+
+ pixel.temp += Math.random(0, 5);
+ }
+ }
+ }
});
var circuitRotation = 0;
@@ -1508,41 +1621,41 @@ document.addEventListener('keydown', function(event) {
});
function drawCircuitExtras() {
- if (elements[currentElement].isCircuitCore && elements[currentElement].previewSize) {
- var circuitWidth = elements[currentElement].previewSize[0];
- var circuitHeight = elements[currentElement].previewSize[1];
- var centered = elements[currentElement].previewSize[2];
- var rotation = circuitRotation;
+ if (elements[currentElement].isCircuitCore && elements[currentElement].previewSize) {
+ var circuitWidth = elements[currentElement].previewSize[0];
+ var circuitHeight = elements[currentElement].previewSize[1];
+ var centered = elements[currentElement].previewSize[2];
+ var rotation = circuitRotation;
- var startX = 0;
- var startY = 0;
- var endX = circuitWidth - 1;
- var endY = circuitHeight - 1;
+ var startX = 0;
+ var startY = 0;
+ var endX = circuitWidth - 1;
+ var endY = circuitHeight - 1;
- if (centered) {
- startX = -Math.floor(circuitWidth / 2);
- startY = -Math.floor(circuitHeight / 2);
- endX = Math.floor(circuitWidth / 2);
- endY = Math.floor(circuitHeight / 2);
- }
+ if (centered) {
+ startX = -Math.floor(circuitWidth / 2);
+ startY = -Math.floor(circuitHeight / 2);
+ endX = Math.floor(circuitWidth / 2);
+ endY = Math.floor(circuitHeight / 2);
+ }
- for (var y = startY; y <= endY; y++) {
- for (var x = startX; x <= endX; x++) {
-// if (!(0 <= x && x < width && 0 <= y && y < height)) {continue;}
+ for (var y = startY; y <= endY; y++) {
+ for (var x = startX; x <= endX; x++) {
+// if (!(0 <= x && x < width && 0 <= y && y < height)) {continue;}
- var [rx, ry] = rotateCoordinate(x, y, rotation);
- var px = mousePos.x + rx;
- var py = mousePos.y + ry;
+ var [rx, ry] = rotateCoordinate(x, y, rotation);
+ var px = mousePos.x + rx;
+ var py = mousePos.y + ry;
- ctx.fillStyle = "rgba(255, 255, 255, 0.1)";
+ ctx.fillStyle = "rgba(255, 255, 255, 0.1)";
if ((rotation != 0 && !centered) || (0 <= px && px < width && 0 <= py && py < height) && pixelMap[px][py]) {
ctx.fillStyle = "rgba(255, 0, 0, 0.3)";
}
- ctx.fillRect(px * pixelSize, py * pixelSize, pixelSize, pixelSize);
- }
- }
- }
+ ctx.fillRect(px * pixelSize, py * pixelSize, pixelSize, pixelSize);
+ }
+ }
+ }
}
runAfterLoad(() => {
@@ -1550,6 +1663,7 @@ runAfterLoad(() => {
drawPixels = function(forceTick=false) {
originalDrawPixels3(forceTick);
drawCircuitExtras();
+ return true;
};
});
resetInterval(tps);
From ea288c8996cb81f6066fd5deec9cb3ffabd9b367 Mon Sep 17 00:00:00 2001
From: redbirdly <155550833+redbirdly@users.noreply.github.com>
Date: Wed, 7 Aug 2024 22:32:29 +0800
Subject: [PATCH 12/56] Update text.js
From 28279953d6cc7e4c1173e0c103c10723f14147e5 Mon Sep 17 00:00:00 2001
From: GuineaOfPig <164094925+GuineaOfPig@users.noreply.github.com>
Date: Wed, 7 Aug 2024 16:40:45 -0400
Subject: [PATCH 13/56] Update zh_hant.json 1.10
---
lang/zh_hant.json | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lang/zh_hant.json b/lang/zh_hant.json
index 0d402dfe..ff5873c2 100644
--- a/lang/zh_hant.json
+++ b/lang/zh_hant.json
@@ -545,5 +545,9 @@
"freeze_ray":"冷雷",
"kelp":"海帶",
"mixer":"混合機",
-"grinder":"混合機"
+"grinder":"混合機",
+"rice":"米",
+"galvinized_steel":"鍍鋅鋼",
+"midas_touch":"點石成金",
+"liquid_ozone":"液臭氧"
}
From 2fbe9f684fed645d42d0ebf9dd5705e9040c6ed7 Mon Sep 17 00:00:00 2001
From: DoobieRalsei <163950752+DoobieRalsei@users.noreply.github.com>
Date: Wed, 7 Aug 2024 15:31:57 -0700
Subject: [PATCH 14/56] DNA EXTRACTION UPDATE
---
mods/fossils.js | 256 +++++++++++++++++++++++++++++++++++++++---------
1 file changed, 212 insertions(+), 44 deletions(-)
diff --git a/mods/fossils.js b/mods/fossils.js
index 8d6aee1b..324c0993 100644
--- a/mods/fossils.js
+++ b/mods/fossils.js
@@ -1,3 +1,5 @@
+/* code by nekonico aka doobienecoarc */
+
elements.fossil = {
color: ["#bbb3ae","#b4b4b4","#c0c0c0"],
behavior: [
@@ -6,12 +8,12 @@ elements.fossil = {
"M2%75|M1|M2%75",
],
reactions: {
- "water": {elem1: "wet_sand", chance: 0.00035},
- "salt_water": {elem1: "wet_sand", chance: 0.0005},
- "sugar_water": {elem1: "wet_sand", chance: 0.0004},
- "seltzer": {elem1: "wet_sand", chance: 0.0004},
- "dirty_water": {elem1: "wet_sand", chance: 0.0004},
- "soda": {elem1: "wet_sand", chance: 0.0004},
+ "water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
+ "salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
+ "sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@@ -20,7 +22,7 @@ elements.fossil = {
"tree_branch": {elem2: "petrified_wood", chance: 0.000015},
"grape": {elem2: "juice", chance: 0.1, color2: "#291824"},
"wheat": {elem2: "flour"},
- "primordial_soup": {elem1: "wet_sand", chance: 0.001}
+ "primordial_soup": {elem1: ["wet_sand","fossil_sand"], chance: 0.001}
},
tempHigh: 950,
stateHigh: "magma",
@@ -31,10 +33,9 @@ elements.fossil = {
breakInto: ["rock","gravel","gravel","gravel","sand"],
};
-elements.marrow_fossil = {
- color: ["#cbb2b3","#c1a8a8","#d0b0b0"],
- hidden:true,
- behavior: behaviors.SUPPORTPOWDER,
+elements.fossil_sand = {
+ color: ["#bbb3ae","#b4b4b4","#c0c0c0"],
+ behavior: behaviors.POWDER,
reactions: {
"water": {elem1: "wet_sand", chance: 0.00035},
"salt_water": {elem1: "wet_sand", chance: 0.0005},
@@ -42,6 +43,32 @@ elements.marrow_fossil = {
"seltzer": {elem1: "wet_sand", chance: 0.0004},
"dirty_water": {elem1: "wet_sand", chance: 0.0004},
"soda": {elem1: "wet_sand", chance: 0.0004},
+ "bone": {elem2: "fossil", chance: 0.0000025},
+ "bone_marrow": {elem2: "marrow_fossil", chance: 0.000002},
+ "skull": {elem2: ["human_fossil","human_fossil","fossil"], chance: 0.0000025},
+ "wood": {elem2: "petrified_wood", chance: 0.0000015},
+ "tree_branch": {elem2: "petrified_wood", chance: 0.0000015},
+ "primordial_soup": {elem1: "wet_sand", chance: 0.001}
+ },
+ tempHigh: 1700,
+ stateHigh: "molten_glass",
+ category: "land",
+ state: "solid",
+ density: 2000,
+ breakInto: ["gravel","gravel","sand"],
+};
+
+elements.marrow_fossil = {
+ color: ["#cbb2b3","#c1a8a8","#d0b0b0"],
+ hidden:true,
+ behavior: behaviors.SUPPORTPOWDER,
+ reactions: {
+ "water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
+ "salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
+ "sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@@ -70,12 +97,12 @@ elements.human_fossil = {
"M2%50|M1|M2%50",
],
reactions: {
- "water": {elem1: "wet_sand", chance: 0.00035},
- "salt_water": {elem1: "wet_sand", chance: 0.0005},
- "sugar_water": {elem1: "wet_sand", chance: 0.0004},
- "seltzer": {elem1: "wet_sand", chance: 0.0004},
- "dirty_water": {elem1: "wet_sand", chance: 0.0004},
- "soda": {elem1: "wet_sand", chance: 0.0004},
+ "water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
+ "salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
+ "sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@@ -103,12 +130,12 @@ elements.dino_fossil = {
"M2%75|M1|M2%75",
],
reactions: {
- "water": {elem1: "wet_sand", chance: 0.00035},
- "salt_water": {elem1: "wet_sand", chance: 0.0005},
- "sugar_water": {elem1: "wet_sand", chance: 0.0004},
- "seltzer": {elem1: "wet_sand", chance: 0.0004},
- "dirty_water": {elem1: "wet_sand", chance: 0.0004},
- "soda": {elem1: "wet_sand", chance: 0.0004},
+ "water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
+ "salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
+ "sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@@ -133,12 +160,12 @@ elements.petrified_wood = {
hidden:true,
behavior: behaviors.STURDYPOWDER,
reactions: {
- "water": {elem1: "wet_sand", chance: 0.00035},
- "salt_water": {elem1: "wet_sand", chance: 0.0005},
- "sugar_water": {elem1: "wet_sand", chance: 0.0004},
- "seltzer": {elem1: "wet_sand", chance: 0.0004},
- "dirty_water": {elem1: "wet_sand", chance: 0.0004},
- "soda": {elem1: "wet_sand", chance: 0.0004},
+ "water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
+ "salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
+ "sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
+ "soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@@ -189,10 +216,47 @@ elements.skull = {
state: "solid",
density: 1000,
hardness: 0.5,
+ breakInto: ["quicklime","bone","human_bones","bone_marrow"]
+},
+
+elements.human_bones = {
+ name: "bone",
+ color: "#d9d9d9",
+ hidden:true,
+ behavior: behaviors.SUPPORT,
+ reactions: {
+ "water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
+ "salt_water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
+ "sugar_water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
+ "seltzer": { elem2:"broth", tempMin:70, color2:"#d7db69" },
+ "rock": { "elem1": "human_fossil", chance:0.00005 },
+ "sand": { "elem1": "human_fossil", chance:0.000035 },
+ "dirt": { "elem1": "human_fossil", chance:0.00003 },
+ "tuff": { "elem1": "human_fossil", chance:0.00005 },
+ "basalt": { "elem1": "human_fossil", chance:0.00004 },
+ "mudstone": { "elem1": "human_fossil", chance:0.00004 },
+ "packed_sand": { "elem1": "human_fossil", chance:0.00004 },
+ "gravel": { "elem1": "human_fossil", chance:0.000035 },
+ "clay": { "elem1": "human_fossil", chance:0.00003 },
+ "clay_soil": { "elem1": "human_fossil", chance:0.00003 },
+ "permafrost": { "elem1": "human_fossil", chance:0.000035 },
+ "mulch": { "elem1": "human_fossil", chance:0.00003 },
+ "ant_wall": { "elem1": "human_fossil", chance:0.00002 },
+ "limestone": { "elem1": "human_fossil", chance:0.00005 },
+ "quicklime": { "elem1": "human_fossil", chance:0.000045 },
+ "slaked_lime": { "elem1": "human_fossil", chance:0.000035 },
+ },
+ category:"life",
+ tempHigh: 760,
+ stateHigh: "quicklime",
+ state: "solid",
+ density: 1000,
+ hardness: 0.5,
breakInto: ["quicklime","bone","bone","bone_marrow"]
},
elements.dino_bones = {
+ name: "bone",
color: "#d9d9d9",
hidden:true,
behavior: behaviors.SUPPORT,
@@ -253,6 +317,8 @@ elements.coal = {
},
elements.bug_amber = {
+ hidden:true,
+ name: "amber",
color: ["#ffc000","#b67f18","#c86305","#cf7a19","#e4ae3a"],
temp: 20,
tempHigh: 345,
@@ -262,6 +328,8 @@ elements.bug_amber = {
},
elements.hive_amber = {
+ hidden:true,
+ name: "amber",
color: "#ffc000",
temp: 20,
tempHigh: 345,
@@ -271,6 +339,7 @@ elements.hive_amber = {
},
elements.dinosaur = {
+ hidden:true,
color: ["#7F2B0A","#808080","#006400"],
behavior: [
"XX|M2%5|XX",
@@ -308,31 +377,130 @@ elements.dinosaur = {
"glass": { elem2: "glass_shard", chance: 0.05 },
"concrete": { elem2: "dust", chance: 0.03 },
}
+},
+
+elements.trilobite = {
+ hidden:true,
+ color: "#808080",
+ behavior: [
+ "XX|M2%5|SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water,primordial_soup%05",
+ "XX|FX%0.5|M2%50 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water,primordial_soup%10 AND BO",
+ "M2%50|M1|M2%50 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water,primordial_soup%10",
+ ],
+ reactions: {
+ "algae": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "kelp": { elem2:"water", chance:0.25 },
+ "plant": { elem2:null, chance:0.125, func:behaviors.FEEDPIXEL },
+ "fly": { elem2:null, chance:0.4, func:behaviors.FEEDPIXEL },
+ "firefly": { elem2:null, chance:0.6, func:behaviors.FEEDPIXEL },
+ "worm": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "tadpole": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "oxygen": { elem2:"carbon_dioxide", chance:0.5 },
+ "broth": { elem2:"water", chance:0.2, func:behaviors.FEEDPIXEL },
+ "slug": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
+ "herb": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
+ "lettuce": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
+ "dead_plant": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
+ "lichen": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
+ "yeast": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
+ "yogurt": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
+ "tea": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
+ "yolk": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
+ "cell": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
+ "crumb": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
+ "alcohol": { elem1:"dead_bug", chance:0.001 },
+ "water": { elem2:"bubble", attr2:{"clone":"water"}, chance:0.002, oneway:true },
+ "salt_water": { elem2:"bubble", attr2:{"clone":"salt_water"}, chance:0.002, oneway:true },
+ "pool_water": { elem1:"dead_bug", chance:0.001 },
+ "chlorine": { elem1:"dead_bug", chance:0.1 },
+ "vinegar": { elem1:"dead_bug", chance:0.001 },
+ },
+ foodNeed: 10,
+ temp: 20,
+ tempHigh: 150,
+ stateHigh: "meat",
+ tempLow: -20,
+ stateLow: ["dead_bug","frozen_meat"],
+ category:"life",
+ breakInto: ["dead_bug","blood"],
+ burn:25,
+ burnTime:250,
+ state: "solid",
+ density: 1080,
+ conduct: 0.2,
+ eggColor: ["#211316","#2C1A1D","#503734"]
+},
+
+elements.extracted_dna = {
+ hidden:true,
+ name: "artificial_egg",
+ color: ["#211316","#2C1A1D","#503734","#e0d3ab","#d1c6be","#b5c0ad","#b9b8bc"],
+ behavior: behaviors.POWDER,
+ tick: function(pixel) {
+ if (Math.random() < 0.00025 || (pixel.dna && pixel.temp > 40 && pixel.temp < 150)) {
+ if (pixel.dna) {
+ changePixel(pixel,pixel.dna);
+ }
+ else changePixel(pixel,"cell")
+ }
+ },
+ innerColor: "#ffffff",
+ tempHigh: 1200,
+ stateHigh: ["steam","dna","calcium","carbon_dioxide","sulfur_gas"],
+ breakInto: ["yolk","yolk","dna","cell"],
+ category:"life",
+ conduct: 1,
};
-elements.head.breakInto = ["blood","meat","skull"]
+elements.extractor = {
+ name: "dna-extractor",
+ color: ["#d1c6be","#b5c0ad","#b9b8bc"],
+ behavior: behaviors.STURDYPOWDER,
+ reactions: {
+ "hive_amber": { elem2:"extracted_dna", chance:0.2 },
+ "bug_amber": { elem2:"extracted_dna", chance:0.2 },
+ "dino_bones": { elem2:"extracted_dna", attr1:{"dna":"dinosaur"}, chance:0.2 },
+ "skull": { elem2:"extracted_dna", attr1:{"dna":"human"}, chance:0.2 },
+ "dino_fossil": { elem2:"extracted_dna", attr1:{"dna":"dinosaur"}, chance:0.02 },
+ "human_fossil": { elem2:"extracted_dna", attr1:{"dna":"human"}, chance:0.02 },
+ },
+ category:"machines",
+ conduct: 1,
+ hardness: 1,
+};
-elements.head.burnInto = ["ash","cooked_meat","skull"]
+elements.head.breakInto = ["blood","meat","human_bones","skull"]
-elements.head.stateHigh = ["cooked_meat","cooked_meat","skull"]
+elements.head.burnInto = ["ash","cooked_meat","human_bones","skull","skull"]
-elements.head.stateLow = ["frozen_meat","frozen_meat","skull"]
+elements.head.stateHigh = ["cooked_meat","human_bones","skull","skull"]
+
+elements.head.stateLow = ["frozen_meat","human_bones","skull","skull","skull"]
+
+elements.body.breakInto = ["blood","meat","human_bones","bone"]
+
+elements.body.burnInto = ["ash","cooked_meat","human_bones"]
+
+elements.body.stateHigh = ["cooked_meat","human_bones"]
+
+elements.body.stateLow = ["frozen_meat","human_bones","human_bones"]
elements.dead_bug.breakInto = ["calcium","calcium","calcium","quicklime"]
if (!elements.sap.reactions) { elements.sap.reactions = {} }
elements.sap.reactions.dead_bug = { elem1:"bug_amber", elem2:null, chance:0.1 };
- elements.sap.reactions.hive = { elem1:null, elem2:"hive_amber", chance:0.01 };
- elements.sap.reactions.ant = { elem1:"bug_amber", elem2:null, chance:0.1 };
- elements.sap.reactions.fly = { elem1:"bug_amber", elem2:null, chance:0.1 };
- elements.sap.reactions.flea = { elem1:"bug_amber", elem2:null, chance:0.1 };
- elements.sap.reactions.termite = { elem1:"bug_amber", elem2:null, chance:0.1 };
- elements.sap.reactions.worm = { elem1:"bug_amber", elem2:null, chance:0.1 };
- elements.sap.reactions.bee = { elem1:"bug_amber", elem2:null, chance:0.1 };
- elements.sap.reactions.firefly = { elem1:"bug_amber", elem2:null, chance:0.1 };
- elements.sap.reactions.stinkbug = { elem1:"bug_amber", elem2:null, chance:0.1 };
- elements.sap.reactions.slug = { elem1:"bug_amber", elem2:null, chance:0.08 };
- elements.sap.reactions.snail = { elem1:"bug_amber", elem2:null, chance:0.05 };
+ elements.sap.reactions.hive = { elem1:null, elem2:"hive_amber", attr2:{"dna":"bee"}, chance:0.01 };
+ elements.sap.reactions.ant = { elem1:"bug_amber", attr1:{"dna":"ant"}, elem2:null, chance:0.1 };
+ elements.sap.reactions.fly = { elem1:"bug_amber", attr1:{"dna":"fly"}, elem2:null, chance:0.1 };
+ elements.sap.reactions.flea = { elem1:"bug_amber", attr1:{"dna":"flea"}, elem2:null, chance:0.1 };
+ elements.sap.reactions.termite = { elem1:"bug_amber", attr1:{"dna":"termite"}, elem2:null, chance:0.1 };
+ elements.sap.reactions.worm = { elem1:"bug_amber", attr1:{"dna":"worm"}, elem2:null, chance:0.1 };
+ elements.sap.reactions.bee = { elem1:"bug_amber", attr1:{"dna":"bee"}, elem2:null, chance:0.1 };
+ elements.sap.reactions.firefly = { elem1:"bug_amber", attr1:{"dna":"firefly"}, elem2:null, chance:0.1 };
+ elements.sap.reactions.stinkbug = { elem1:"bug_amber", attr1:{"dna":"stinkbug"}, elem2:null, chance:0.1 };
+ elements.sap.reactions.slug = { elem1:"bug_amber", attr1:{"dna":"slug"}, elem2:null, chance:0.08 };
+ elements.sap.reactions.snail = { elem1:"bug_amber", attr1:{"dna":"snail"}, elem2:null, chance:0.05 };
+ elements.sap.reactions.trilobite = { elem1:"bug_amber", attr1:{"dna":"trilobite"}, elem2:null, chance:0.1 };
if (!elements.bone.reactions) { elements.bone.reactions = {} }
From 6d5db165b96997679b454674c82d41f0d1c6cbeb Mon Sep 17 00:00:00 2001
From: slweeb <91897291+slweeb@users.noreply.github.com>
Date: Wed, 7 Aug 2024 20:41:03 -0400
Subject: [PATCH 15/56] Update zh_hant.json
---
lang/zh_hant.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lang/zh_hant.json b/lang/zh_hant.json
index ff5873c2..4cfe2415 100644
--- a/lang/zh_hant.json
+++ b/lang/zh_hant.json
@@ -547,7 +547,7 @@
"mixer":"混合機",
"grinder":"混合機",
"rice":"米",
-"galvinized_steel":"鍍鋅鋼",
+"galvanized_steel":"鍍鋅鋼",
"midas_touch":"點石成金",
"liquid_ozone":"液臭氧"
}
From 797967b3461407b30746ef098015dc513ee9bf94 Mon Sep 17 00:00:00 2001
From: GGod <46885632+GGodPL@users.noreply.github.com>
Date: Thu, 8 Aug 2024 18:07:57 +0200
Subject: [PATCH 16/56] Update betterMenuScreens.js
---
mods/betterMenuScreens.js | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/mods/betterMenuScreens.js b/mods/betterMenuScreens.js
index d150d814..61300345 100644
--- a/mods/betterMenuScreens.js
+++ b/mods/betterMenuScreens.js
@@ -214,6 +214,11 @@ class MenuScreen {
return this;
}
+ setMenuTextId(id) {
+ this.menuTextId = id;
+ return this;
+ }
+
/**
* Adds a node to the menu screen content
* @param {Node|Node[]} node Any HTML node/element or array of HTML nodes/elements
@@ -262,12 +267,13 @@ class MenuScreen {
parent.style.display = "none";
const inner = document.createElement("div");
inner.className = this.innerDivClass ?? "menuScreen";
+ inner.id = this.innerDivId;
inner.innerHTML = `${this.showCloseButton ? `${this.closeButtonText}` : ""}
- ";
+ ";
this.nodes.forEach(n => inner.querySelector(".menuText").appendChild(n));
parent.appendChild(inner);
document.getElementById(id).appendChild(parent);
}
}
-runAfterLoadList.push(inject);
+runAfterLoadList.push(inject);
\ No newline at end of file
From 51b3066a241c82e38b467ae02d6c16c913ae1ace Mon Sep 17 00:00:00 2001
From: JustAGenericUsername
<92590792+JustAGenericUsername@users.noreply.github.com>
Date: Thu, 8 Aug 2024 15:49:45 -0400
Subject: [PATCH 17/56] ore mod
---
mods/ores.js | 196 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 196 insertions(+)
create mode 100644 mods/ores.js
diff --git a/mods/ores.js b/mods/ores.js
new file mode 100644
index 00000000..38cd5ce7
--- /dev/null
+++ b/mods/ores.js
@@ -0,0 +1,196 @@
+function makePerlinMap(){
+ return Array.from({ length: Math.pow(12, 2) }, () => Math.random() * 2 * Math.PI);
+}
+function perlinNoise(C, x, y) {
+ // Helper function to calculate dot product
+ function dotProduct(a, b) {
+ return a[0] * b[0] + a[1] * b[1];
+ }
+
+ // Function d
+ function d(index) {
+ return [Math.cos(C[index]), Math.sin(C[index])];
+ }
+
+ // Function f
+ function f(x, y, t) {
+ return x + (y - x) * (6 * t ** 5 - 15 * t ** 4 + 10 * t ** 3);
+ }
+
+ // Function g
+ function g(x, y, z, w) {
+ const dx = x - z;
+ const dy = y - w;
+ return dotProduct([dx, dy], d(z + w * 6 + 1));
+ }
+
+ // Main function h
+ const x0 = Math.floor(x);
+ const x1 = Math.ceil(x);
+ const y0 = Math.floor(y);
+ const y1 = Math.ceil(y);
+
+ const g00 = g(x, y, x0, y0);
+ const g10 = g(x, y, x1, y0);
+ const g01 = g(x, y, x0, y1);
+ const g11 = g(x, y, x1, y1);
+
+ const fx = f(g00, g10, x - x0);
+ const fy = f(g01, g11, x - x0);
+
+ return Math.sqrt(2) * f(fx, fy, y - y0);
+}
+function getScalingFactor(d1, d2){
+ return Math.min(d1, d2)/6
+}
+function scaledPerlinNoise(C, x, y){
+ let scale = getScalingFactor(width, height)
+ return perlinNoise(C, x/scale, y/scale)
+}
+if (!eLists.oreSpawnConditions){eLists.oreSpawnConditions = {}}
+eLists.oreSpawnConditions = {...eLists.oreSpawnConditions, ...{
+ uranium: 0.65,
+ diamond: 0.65,
+ gold: 0.55,
+ silver: 0.52,
+ iron: 0.45,
+ copper: 0.4,
+ charcoal: 0.4
+}}
+if (!eLists.oreRgb){eLists.oreRgb = {}}
+eLists.oreRgb = {...eLists.oreRgb, ...{
+ charcoal: "rgba(54, 54, 54, ",
+ iron: "rgba(247, 218, 157, ",
+ silver: "rgba(206, 206, 206, ",
+ copper: "rgba(151, 80, 10, ",
+ gold: "rgba(255, 215, 0, ",
+ diamond: "rgba(125, 214, 255, ",
+ uranium: "rgba(0, 100, 8, "
+}}
+let oldclearall = clearAll
+let oreMap = []
+clearAll = function(skipworldgen){
+ oldclearall(skipworldgen)
+ oreMaps = {}
+ for (let ore of Object.keys(eLists.oreSpawnConditions)){
+ oreMaps[ore] = makePerlinMap()
+ }
+ //console.log(oreMaps)
+ for (let x in pixelMap){
+ oreMap.push([]);
+ for (let y in pixelMap){
+ oreMap[x].push(false);
+ for (let ore in eLists.oreSpawnConditions){
+ if (scaledPerlinNoise(oreMaps[ore], x, y) > eLists.oreSpawnConditions[ore]){
+ oreMap[x][y] = ore
+ //console.log(ore + " at " + x + ", " + y)
+ break;
+ }
+ }
+ }
+ }
+}
+
+adjacentToCanvas = function(x, y, px, py){
+ if (x == 0 && y == -1){
+ return [[canvasCoord(px), canvasCoord(py)], [canvasCoord(px)+pixelSize, canvasCoord(py)]]
+ }
+ if (x == 0 && y == 1){
+ return [[canvasCoord(px), canvasCoord(py)+pixelSize], [canvasCoord(px)+pixelSize, canvasCoord(py)+pixelSize]]
+ }
+ if (x == -1 && y == 0){
+ return [[canvasCoord(px), canvasCoord(py)], [canvasCoord(px), canvasCoord(py)+pixelSize]]
+ }
+ if (x == 1 && y == 0){
+ return [[canvasCoord(px)+pixelSize, canvasCoord(py)], [canvasCoord(px)+pixelSize, canvasCoord(py)+pixelSize]]
+ }
+}
+renderEachPixel(function(pixel, ctx) {
+ if (currentElement == "ore_xray") {
+ if (Math.abs(pixel.x - mousePos.x) <= mouseSize/2 && Math.abs(pixel.y - mousePos.y) <= mouseSize/2) {
+ if (!oreMap[pixel.x][pixel.y]) {
+ drawSquare(ctx, "rgba(0, 0, 0, 0.7)", pixel.x, pixel.y, 1, 1);
+ } else {
+ drawSquare(ctx, eLists.oreRgb[oreMap[pixel.x][pixel.y]] + "0.2)", pixel.x, pixel.y, 1, 1);
+ let differentAdjacent = [];
+ for (let i = 0; i < adjacentCoords.length; i++) {
+ let x = adjacentCoords[i][0] + pixel.x;
+ let y = adjacentCoords[i][1] + pixel.y;
+ if (isEmpty(x, y, true)) {
+ differentAdjacent.push(adjacentCoords[i]);
+ } else {
+ let otherPixel = pixelMap[x][y];
+ if (oreMap[x][y] != oreMap[pixel.x][pixel.y] && (oreMap[x][y] == false || eLists.oreSpawnConditions[oreMap[pixel.x][pixel.y]] >= eLists.oreSpawnConditions[oreMap[x][y]])) {
+ differentAdjacent.push(adjacentCoords[i]);
+ }
+ }
+ }
+ differentAdjacent.forEach(adj => {
+ let canvasadjacentCoords = adjacentToCanvas(adj[0], adj[1], pixel.x, pixel.y);
+ if (!canvasadjacentCoords){
+ console.log(adj)
+ return;
+ }
+ //console.log(canvasadjacentCoords);
+ ctx.beginPath();
+ ctx.moveTo(canvasadjacentCoords[0][0], canvasadjacentCoords[0][1]);
+ ctx.lineTo(canvasadjacentCoords[1][0], canvasadjacentCoords[1][1]);
+ ctx.strokeStyle = eLists.oreRgb[oreMap[pixel.x][pixel.y]]+"1)";
+ ctx.lineWidth = 4;
+ ctx.stroke();
+ //console.log("line")
+ });
+ }
+ }
+ }
+});
+
+let validGroundElements = []
+for (let elementi in elements){
+ if (elements[elementi].category == "land"){
+ validGroundElements.push(elementi)
+ }
+}
+elements.pickaxe = {
+ category: "tools",
+ color: "#b0b0b0",
+ canPlace: false,
+ maxSize: 5,
+ tool: function(pixel){
+ if (oreMap[pixel.x][pixel.y].length > 0 && validGroundElements.includes(pixel.element)){
+ if (Math.random()>0.95){
+ changePixel(pixel, oreMap[pixel.x][pixel.y], false)
+ oreMap[pixel.x][pixel.y] = false
+ }
+ else if (Math.random() > 0.9){
+ deletePixel(pixel.x, pixel.y)
+ oreMap[pixel.x][pixel.y] = false
+ }
+ }
+ }
+}
+elements.chisel = {
+ category: "tools",
+ color: "#8d8574",
+ canPlace: false,
+ maxSize: 3,
+ tool: function(pixel){
+ if (oreMap[pixel.x][pixel.y].length > 0 && validGroundElements.includes(pixel.element)){
+ if (Math.random()>0.95){
+ changePixel(pixel, oreMap[pixel.x][pixel.y], false)
+ oreMap[pixel.x][pixel.y] = false
+ }
+ else if (Math.random() > 0.98){
+ deletePixel(pixel.x, pixel.y)
+ oreMap[pixel.x][pixel.y] = false
+ }
+ }
+ }
+}
+elements.ore_xray = {
+ category: "tools",
+ color: "#220f27",
+ canPlace: false,
+ maxSize: 15,
+ tool: function(pixel){}
+}
\ No newline at end of file
From 1523c31dda727ab0097094c8608d7ed4d9d34d1b Mon Sep 17 00:00:00 2001
From: JustAGenericUsername
<92590792+JustAGenericUsername@users.noreply.github.com>
Date: Thu, 8 Aug 2024 15:52:34 -0400
Subject: [PATCH 18/56] ad
---
mod-list.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/mod-list.html b/mod-list.html
index 74cdac83..23a32119 100644
--- a/mod-list.html
+++ b/mod-list.html
@@ -288,6 +288,7 @@
nocancer2.js Removes cancer from the game altogether. May be incompatible with other mods that spawn cancer mollthecoder
nograssgrow.js Prevents Grass from growing mollthecoder
ocean.js Adds many Marine life SquareScreamYT
+ores.js Adds ore generation along with tools to mine them nousernamefound
pizzasstuff.js New animals, foods, and plants _ilikepizza_
plants.js Adds a wide variety of new plants and fruits Adora
primordial_birthpool.js A cross between Primordial Soup and Birthpool. Requires F&M Alice
From a4c8686c6684335e8e66a49b814a6c625aa1e003 Mon Sep 17 00:00:00 2001
From: JustAGenericUsername
<92590792+JustAGenericUsername@users.noreply.github.com>
Date: Thu, 8 Aug 2024 16:52:05 -0400
Subject: [PATCH 19/56] huh
---
mods/ores.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mods/ores.js b/mods/ores.js
index 38cd5ce7..3d208ef4 100644
--- a/mods/ores.js
+++ b/mods/ores.js
@@ -143,6 +143,9 @@ renderEachPixel(function(pixel, ctx) {
}
}
}
+ if (oreMap.length < 2){
+ clearAll();
+ }
});
let validGroundElements = []
From 926239f572b1a22ed39f4928a5589591caba196b Mon Sep 17 00:00:00 2001
From: JustAGenericUsername
<92590792+JustAGenericUsername@users.noreply.github.com>
Date: Thu, 8 Aug 2024 19:57:43 -0400
Subject: [PATCH 20/56] height
---
mods/ores.js | 53 ++++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 43 insertions(+), 10 deletions(-)
diff --git a/mods/ores.js b/mods/ores.js
index 3d208ef4..4461c9ea 100644
--- a/mods/ores.js
+++ b/mods/ores.js
@@ -49,13 +49,14 @@ function scaledPerlinNoise(C, x, y){
}
if (!eLists.oreSpawnConditions){eLists.oreSpawnConditions = {}}
eLists.oreSpawnConditions = {...eLists.oreSpawnConditions, ...{
- uranium: 0.65,
- diamond: 0.65,
- gold: 0.55,
- silver: 0.52,
- iron: 0.45,
- copper: 0.4,
- charcoal: 0.4
+ uranium: 0.67,
+ diamond: 0.67,
+ gold: 0.57,
+ pyrite: 0.56,
+ silver: 0.54,
+ iron: 0.47,
+ copper: 0.42,
+ charcoal: 0.42
}}
if (!eLists.oreRgb){eLists.oreRgb = {}}
eLists.oreRgb = {...eLists.oreRgb, ...{
@@ -64,12 +65,25 @@ eLists.oreRgb = {...eLists.oreRgb, ...{
silver: "rgba(206, 206, 206, ",
copper: "rgba(151, 80, 10, ",
gold: "rgba(255, 215, 0, ",
+ pyrite: "rgba(134, 119, 31, ",
diamond: "rgba(125, 214, 255, ",
uranium: "rgba(0, 100, 8, "
}}
+if (!eLists.idealOreHeight){eLists.idealOreHeight = {}}
+eLists.idealOreHeight = {...eLists.idealOreHeight, ...{
+ uranium: 0.2,
+ diamond: 0.06,
+ gold: 0.3,
+ pyrite: 0.34,
+ silver: 0.4,
+ iron: 0.7,
+ copper: 0.6,
+ charcoal: 0.4
+ }}
let oldclearall = clearAll
let oreMap = []
clearAll = function(skipworldgen){
+ oreMap = []
oldclearall(skipworldgen)
oreMaps = {}
for (let ore of Object.keys(eLists.oreSpawnConditions)){
@@ -81,7 +95,7 @@ clearAll = function(skipworldgen){
for (let y in pixelMap){
oreMap[x].push(false);
for (let ore in eLists.oreSpawnConditions){
- if (scaledPerlinNoise(oreMaps[ore], x, y) > eLists.oreSpawnConditions[ore]){
+ if ((scaledPerlinNoise(oreMaps[ore], x, y)-((Math.abs(y-((1-eLists.idealOreHeight[ore])*height)))/(1.33*height))+0.07) > eLists.oreSpawnConditions[ore]){
oreMap[x][y] = ore
//console.log(ore + " at " + x + ", " + y)
break;
@@ -111,7 +125,7 @@ renderEachPixel(function(pixel, ctx) {
if (!oreMap[pixel.x][pixel.y]) {
drawSquare(ctx, "rgba(0, 0, 0, 0.7)", pixel.x, pixel.y, 1, 1);
} else {
- drawSquare(ctx, eLists.oreRgb[oreMap[pixel.x][pixel.y]] + "0.2)", pixel.x, pixel.y, 1, 1);
+ drawSquare(ctx, eLists.oreRgb[oreMap[pixel.x][pixel.y]] + "0.7)", pixel.x, pixel.y, 1, 1);
let differentAdjacent = [];
for (let i = 0; i < adjacentCoords.length; i++) {
let x = adjacentCoords[i][0] + pixel.x;
@@ -170,6 +184,7 @@ elements.pickaxe = {
oreMap[pixel.x][pixel.y] = false
}
}
+ if (settings.limitless){elements.pickaxe.maxSize = 10000} else {elements.pickaxe.maxSize = 5}
}
}
elements.chisel = {
@@ -188,6 +203,22 @@ elements.chisel = {
oreMap[pixel.x][pixel.y] = false
}
}
+ if (settings.limitless){elements.chisel.maxSize = 10000} else {elements.chisel.maxSize = 3}
+ }
+}
+elements.brush = {
+ category: "tools",
+ color: "#805c2e",
+ canPlace: false,
+ maxSize: 1,
+ tool: function(pixel){
+ if (oreMap[pixel.x][pixel.y].length > 0 && validGroundElements.includes(pixel.element)){
+ if (Math.random()>0.985){
+ changePixel(pixel, oreMap[pixel.x][pixel.y], false)
+ oreMap[pixel.x][pixel.y] = false
+ }
+ }
+ if (settings.limitless){elements.brush.maxSize = 10000} else {elements.brush.maxSize = 1}
}
}
elements.ore_xray = {
@@ -195,5 +226,7 @@ elements.ore_xray = {
color: "#220f27",
canPlace: false,
maxSize: 15,
- tool: function(pixel){}
+ tool: function(pixel){
+ if (settings.limitless){elements.ore_xray.maxSize = 10000} else {elements.ore_xray.maxSize = 15}
+ }
}
\ No newline at end of file
From 53bfea80210ff408e1443fb0d41f3d1e5c3ff7a6 Mon Sep 17 00:00:00 2001
From: SuperASAX
Date: Thu, 8 Aug 2024 18:20:58 -0700
Subject: [PATCH 21/56] Add files via upload
---
cold_opposites.js | 64 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
create mode 100644 cold_opposites.js
diff --git a/cold_opposites.js b/cold_opposites.js
new file mode 100644
index 00000000..c48c0a35
--- /dev/null
+++ b/cold_opposites.js
@@ -0,0 +1,64 @@
+elements.torch = {
+ color: "#d68542",
+ behavior: [
+ "CR:fire%50|CR:fire|CR:fire%50",
+ "XX|XX|XX",
+ "XX|XX|XX",
+ ],
+ reactions: {
+ "water": { elem1:"wood" },
+ "sugar_water": { elem1:"wood" },
+ "salt_water": { elem1:"wood" },
+ "seltzer": { elem1:"wood" },
+ "dirty_water": { elem1:"wood" },
+ "pool_water": { elem1:"wood" },
+ "steam": { elem1:"wood" },
+ "smog": { elem1:"wood" },
+ "rain_cloud": { elem1:"wood" },
+ "cloud": { elem1:"wood" },
+ "snow_cloud": { elem1:"wood" },
+ "hail_cloud": { elem1:"wood" },
+ "thunder_cloud": { elem1:"wood" },
+ "ice_nine": { elem1:"wood" }
+ },
+ temp:600,
+ category:"special",
+ breakInto: "sawdust",
+ tempLow: -273,
+ stateLow: "wood"
+},
+elements.cold_torch = {
+ color: "#d68542",
+ behavior: [
+ "CR:cold_fire%50|CR:cold_fire|CR:cold_fire%50",
+ "XX|CO|XX",
+ "XX|XX|XX",
+ ],
+ temp:-273,
+ category:"special",
+ breakInto: "sawdust",
+ tempHigh: 0,
+ stateHigh: "wood"
+},
+elements.extinguisher= {
+ color: "#d6baa9",
+ behavior: [
+ "CR:eanprop|CR:eanprop|CR:eanprop",
+ "XX|XX|XX",
+ "XX|XX|XX",
+ ],
+ temp:-30,
+ category: "machines",
+ conduct: 0.73
+},
+elements.eanprop = {
+ color: "#cfcfcf",
+ behavior: behaviors.GAS,
+ temp:-25,
+ category: "gases",
+ tempLow: -43,
+ stateLow: "cold_fire",
+ state: "gas",
+ density: 2.0098,
+ alias: "gas"
+};
\ No newline at end of file
From 1816b45c639c8ad3345c4577e86c2a86d25ff719 Mon Sep 17 00:00:00 2001
From: SuperASAX
Date: Thu, 8 Aug 2024 18:53:22 -0700
Subject: [PATCH 22/56] Add files via upload
---
cold_liquid_explosion.js | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
create mode 100644 cold_liquid_explosion.js
diff --git a/cold_liquid_explosion.js b/cold_liquid_explosion.js
new file mode 100644
index 00000000..fc222142
--- /dev/null
+++ b/cold_liquid_explosion.js
@@ -0,0 +1,18 @@
+elements.liquid_tnt = {
+ color: "#c92a2a",
+ behavior: behaviors.LIQUID,
+ behaviorOn: [
+ "XX|XX|XX",
+ "XX|EX:10|XX",
+ "XX|XX|XX",
+ ],
+ conduct: 1,
+ category: "weapons",
+ tempLow: -50,
+ state: "solid",
+ stateLow: "explosion",
+ density: 1630,
+ excludeRandom: true,
+ alias: "trinitrotoluene"
+};
+//Made by SuperASAX or SuperAAX
\ No newline at end of file
From 4acdd428151e1e9dc17d6965b1133a673c4d4590 Mon Sep 17 00:00:00 2001
From: SuperASAX
Date: Thu, 8 Aug 2024 18:55:34 -0700
Subject: [PATCH 23/56] Update and rename cold_liquid_explosion.js to
mods/cold_liquid_explosion.js
---
cold_liquid_explosion.js => mods/cold_liquid_explosion.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
rename cold_liquid_explosion.js => mods/cold_liquid_explosion.js (87%)
diff --git a/cold_liquid_explosion.js b/mods/cold_liquid_explosion.js
similarity index 87%
rename from cold_liquid_explosion.js
rename to mods/cold_liquid_explosion.js
index fc222142..367b6e0c 100644
--- a/cold_liquid_explosion.js
+++ b/mods/cold_liquid_explosion.js
@@ -15,4 +15,4 @@ elements.liquid_tnt = {
excludeRandom: true,
alias: "trinitrotoluene"
};
-//Made by SuperASAX or SuperAAX
\ No newline at end of file
+//Made by SuperASAX or SuperAAX
From 4692f2c5268a9de2583683cf80faebc70a67c551 Mon Sep 17 00:00:00 2001
From: SuperASAX
Date: Thu, 8 Aug 2024 18:56:13 -0700
Subject: [PATCH 24/56] Update and rename cold_opposites.js to
mods/cold_opposites.js
---
cold_opposites.js => mods/cold_opposites.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
rename cold_opposites.js => mods/cold_opposites.js (95%)
diff --git a/cold_opposites.js b/mods/cold_opposites.js
similarity index 95%
rename from cold_opposites.js
rename to mods/cold_opposites.js
index c48c0a35..8b26b391 100644
--- a/cold_opposites.js
+++ b/mods/cold_opposites.js
@@ -61,4 +61,4 @@ elements.eanprop = {
state: "gas",
density: 2.0098,
alias: "gas"
-};
\ No newline at end of file
+};
From b966a2aba50a0d4d0720f21f5d777bcfd5f72c4f Mon Sep 17 00:00:00 2001
From: SuperASAX
Date: Thu, 8 Aug 2024 19:00:02 -0700
Subject: [PATCH 25/56] Update cold_liquid_explosion.js
---
mods/cold_liquid_explosion.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mods/cold_liquid_explosion.js b/mods/cold_liquid_explosion.js
index 367b6e0c..cd2cf7f1 100644
--- a/mods/cold_liquid_explosion.js
+++ b/mods/cold_liquid_explosion.js
@@ -9,7 +9,7 @@ elements.liquid_tnt = {
conduct: 1,
category: "weapons",
tempLow: -50,
- state: "solid",
+ state: "liquid",
stateLow: "explosion",
density: 1630,
excludeRandom: true,
From 3abf5b70f0ab5b4250c483403f18db4177881276 Mon Sep 17 00:00:00 2001
From: redbirdly <155550833+redbirdly@users.noreply.github.com>
Date: Fri, 9 Aug 2024 21:47:10 +0800
Subject: [PATCH 26/56] Update wifi_draw.js
---
mods/wifi_draw.js | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
diff --git a/mods/wifi_draw.js b/mods/wifi_draw.js
index bd20c247..41bf5ad1 100644
--- a/mods/wifi_draw.js
+++ b/mods/wifi_draw.js
@@ -1,14 +1,14 @@
// RedBirdly's mod to draw lines between transmitters/receivers
-// logicgates.js required
+// logicgates.js or wifi.js required
let logicReceivers = [];
let logicTransmitters = [];
-// let receivers = [];
-// let transmitters = [];
+let receivers = [];
+let transmitters = [];
function updateLogicLists() {
- // receivers = [];
- // transmitters = [];
+ receivers = [];
+ transmitters = [];
logicReceivers = [];
logicTransmitters = [];
@@ -18,11 +18,11 @@ function updateLogicLists() {
logicReceivers.push(pixel);
} else if (pixel.element === "logic_transmitter") {
logicTransmitters.push(pixel);
- } /*else if (pixel.element === "receiver") {
+ } else if (pixel.element === "receiver") {
receivers.push(pixel);
} else if (pixel.element === "transmitter") {
transmitters.push(pixel);
- }*/
+ }
}
}
@@ -67,12 +67,21 @@ function drawLinks() {
}
}
}
+
+ // Iterate through transmitters and receivers to draw lines for linked channels
+ for (const transmitter of transmitters) {
+ for (const receiver of receivers) {
+ if (transmitter._channel === receiver._channel) {
+ ctx.beginPath();
+ ctx.moveTo(transmitter.x * pixelSize + pixelSizeHalf, transmitter.y * pixelSize + pixelSizeHalf);
+ ctx.lineTo(receiver.x * pixelSize + pixelSizeHalf, receiver.y * pixelSize + pixelSizeHalf);
+ ctx.strokeStyle = "RGBA(0,0,255,0.2)";
+ ctx.lineWidth = 2;
+ ctx.stroke();
+ }
+ }
+ }
}
-var originalDrawPixels2 = drawPixels;
-drawPixels = function(forceTick=false) {
- originalDrawPixels2(forceTick);
- updateLogicLists();
- drawLinks();
-};
-resetInterval(tps);
+renderPostPixel(updateLogicLists);
+renderPostPixel(drawLinks);
From b76d73e4aaaa7ecf237383cf08949973474b96ec Mon Sep 17 00:00:00 2001
From: redbirdly <155550833+redbirdly@users.noreply.github.com>
Date: Fri, 9 Aug 2024 21:55:59 +0800
Subject: [PATCH 27/56] forgot to actualy upload the other mod
---
mods/mod_for_mnem.js | 1 +
1 file changed, 1 insertion(+)
create mode 100644 mods/mod_for_mnem.js
diff --git a/mods/mod_for_mnem.js b/mods/mod_for_mnem.js
new file mode 100644
index 00000000..2766d904
--- /dev/null
+++ b/mods/mod_for_mnem.js
@@ -0,0 +1 @@
+Object.keys(elements).forEach((element)=>{if (elements[element].category == "life") {delete elements[element]}})
\ No newline at end of file
From 734c22ad14310d83b3d5ae1b4588f3c5b090f586 Mon Sep 17 00:00:00 2001
From: SuperASAX
Date: Fri, 9 Aug 2024 13:26:43 -0700
Subject: [PATCH 28/56] Add files via upload
---
mods/SuperASAX_Funny_Mod.js | 103 ++++++++++++++++++++++++++++++++++++
1 file changed, 103 insertions(+)
create mode 100644 mods/SuperASAX_Funny_Mod.js
diff --git a/mods/SuperASAX_Funny_Mod.js b/mods/SuperASAX_Funny_Mod.js
new file mode 100644
index 00000000..3bbb0ce8
--- /dev/null
+++ b/mods/SuperASAX_Funny_Mod.js
@@ -0,0 +1,103 @@
+//Made by SuperASAX or SuperAAX
+elements.spread_bomb = {
+ color: "#524c41",
+ behavior: [
+ "XX|EX:10|XX",
+ "XX|DL|XX",
+ "M2 AND CL|M1 AND EX:10|M2 AND CL",
+ ],
+ category: "Super's Funny Mod",
+ state: "solid",
+ density: 1300,
+ excludeRandom: true,
+ cooldown: defaultCooldown
+},
+
+elements.random_bomb = {
+ color: "#524c41",
+ behavior: [
+ "XX|EX:10|XX",
+ "CL%10|DL%5|CL%10",
+ "M2 AND CL%10|M1%25 AND EX:10|M2 AND CL%10",
+ ],
+ category: "Super's Funny Mod",
+ state: "solid",
+ density: 1300,
+ excludeRandom: true,
+ cooldown: defaultCooldown
+},
+
+elements.strange_spread = {
+ color: "#ABCDEF",
+ category: "Super's Funny Mod",
+ behavior: [
+ "CL%90|XX|CL%90",
+ "XX|EX:5%0.1|XX",
+ "M2 AND CL%10|M1%25|M2 AND CL%10",
+ ],
+},
+
+elements.cheese_matter = {
+ color: "#fcba03",
+ tick: function(pixel) {
+ for (var i = 0; i < adjacentCoords.length; i++) {
+ var coords = adjacentCoords[i];
+ var x = pixel.x + coords[0];
+ var y = pixel.y + coords[1];
+ if ((Math.random() < 0.05 || coords[0]) && !isEmpty(x,y,true)) {
+ var elem = pixelMap[x][y].element;
+ if (elements.cheese_matter.ignore.indexOf(elem) === -1 && elements[elem].hardness !== 1) {
+ if (coords[1]) {
+ swapPixels(pixel,pixelMap[x][y]);
+ }
+ else {
+ changePixel(pixelMap[x][y],"cheese_matter");
+ }
+ }
+ }
+ }
+ var move1Spots = [
+ [pixel.x, pixel.y+1],
+ [pixel.x+1, pixel.y+1],
+ [pixel.x-1, pixel.y+1],
+ ]
+ if (Math.random() < 0.1) { move1Spots.push([pixel.x-1,pixel.y]) }
+ if (Math.random() < 0.1) { move1Spots.push([pixel.x+1,pixel.y]) }
+ if (Math.random() < 0.1) { move1Spots.push([pixel.x,pixel.y-1]) }
+ if (Math.random() < 0.1) { move1Spots.push([pixel.x-1,pixel.y-1]) }
+ if (Math.random() < 0.1) { move1Spots.push([pixel.x+1,pixel.y-1]) }
+ for (var i = 0; i < move1Spots.length; i++) {
+ var j = Math.floor(Math.random()*move1Spots.length);
+ var coords = move1Spots[j];
+ if (tryMove(pixel, coords[0], coords[1])) { break; }
+ else { move1Spots.splice(j, 1); }
+ }
+ doDefaults(pixel);
+ },
+ reactions: {
+ "void": { elem1:"explosion" }
+ },
+ category: "Super's Funny Mod",
+ state: "solid",
+ density: 2000,
+ excludeRandom: true,
+ ignore: ["fire","smoke","antimatter","strange_matter","wall","ewall","plasma","void","border","cheese"],
+ behavior: [
+ "XX|XX|XX",
+ "XX|CH:cheese%5|XX",
+ "XX|XX|XX",
+ ],
+},
+
+
+
+elements.antiball = {
+ color: "#EEA537",
+ behavior: [
+ "ST|ST AND M1|ST",
+ "ST|XX|ST",
+ "ST|ST|ST",
+ ],
+ state: "solid",
+ category: "Super's Funny Mod"
+};
\ No newline at end of file
From 5afb85014b1a9bf9c026e3f3b97508ac39784383 Mon Sep 17 00:00:00 2001
From: SuperASAX
Date: Sat, 10 Aug 2024 11:45:35 -0700
Subject: [PATCH 29/56] Add files via upload
---
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.html b/index.html
index 750b14ce..3795a656 100644
--- a/index.html
+++ b/index.html
@@ -17374,7 +17374,7 @@ window.onload = function() {
-
+
5 && Math.random() < 0.05)) { pixel.phase = 2; pixel.rising = 0; } // Start gliding
+ else { pixel.rising ++; }
+ }
+ doHeat(pixel);
+ doElectricity(pixel);
+ doBurning(pixel);
+ },
+ flippableX: true,
+ reactions: {
+ "head": {elem1:"explosion"},
+ "body": {elem1:"explosion"},
+ "fly": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "firefly": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL },
+ "bee": { elem2:null, chance:0.05, func:behaviors.FEEDPIXEL },
+ "worm": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "ant": { elem2:null, chance:0.025, func:behaviors.FEEDPIXEL },
+ "stink_bug": { elem2:"stench", chance:0.025, func:behaviors.FEEDPIXEL },
+ "dead_bug": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL },
+ "lichen": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL },
+ "termite": { elem2:null, chance:0.025, func:behaviors.FEEDPIXEL },
+ "flea": { elem2:null, chance:0.025, func:behaviors.FEEDPIXEL },
+ "mushroom_cap": { elem2:null, chance:0.025, func:behaviors.FEEDPIXEL },
+ "mushroom_gill": { elem2:null, chance:0.025, func:behaviors.FEEDPIXEL },
+ "seeds": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "flower_seed": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "wheat_seed": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "corn_seed": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "corn": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "potato_seed": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "grass_seed": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "crumb": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "pumpkin": { elem2:null, chance:0.025, func:behaviors.FEEDPIXEL },
+ "pumpkin_seed": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "rice": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "coffee_bean": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "coffee_ground": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "nut": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "nut_meat": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "nut_butter": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "jelly": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
+ "plague": { elem1:"plague", chance:0.05 },
+ "oxygen": { elem2:"carbon_dioxide", chance:0.5 }
+ },
+ foodNeed: 20,
+ temp: 41,
+ tempHigh: 120,
+ stateHigh: "cooked_meat",
+ stateHighColor: "#E4CFB9",
+ tempLow: -18,
+ stateLow: "frozen_meat",
+ category:"Super's Funny Mod",
+ burn:50,
+ burnTime:100,
+ breakInto: ["feather","blood"],
+ state: "solid",
+ density: 400,
+ conduct: 0.5
+},
+
+elements.fillerX = {
+ color: "#ae4cd9",
+ behavior: [
+ "DL|CL|DL",
+ "CL|XX|CL",
+ "DL|CL|DL",
+ ],
+ category:"special",
+ excludeRandom: true,
+ reactions: {
+ "neutron": { elem1:"lattice" },
+ "proton": { elem1:"vertical" },
+ "electric": { elem1:"horizontal" },
+ "positron": { elem1:"vertical" },
+ "plasma": { elem1:"armageddon", tempMin:500, charged:true },
+ },
+ density: 1834
+},
+elements.latticeX = {
+ color: "#cb4cd9",
+ behavior: [
+ "CL|DL|CL",
+ "DL|XX|DL",
+ "CL|DL|CL",
+ ],
+ tick: function(pixel) {
+ for (var i = 0; i < adjacentCoords.length; i++) {
+ var coords = adjacentCoords[i];
+ var x = pixel.x + coords[0];
+ var y = pixel.y + coords[1];
+ if (!isEmpty(x,y,true) && pixelMap[x][y].element === "lattice") {
+ deletePixel(x,y)
+ }
+ }
+ },
+ reactions: {
+ "cold_fire": { elem1:"ice_nine", chance:0.1 },
+ "proton": { elem1:"filler", elem2:null, chance:0.1 },
+ "electric": { elem1:null, elem2:"filler", chance:0.1 },
+ },
+ category:"special",
+ excludeRandom: true,
+ movable: false,
+ density: 917
+},
+
+
+
+elements.mystery_thing_1 = {
+ color: "#EEA537",
+ behavior: [
+ "ST AND CL%10|ST AND CL%10 AND M2|ST AND CL%10",
+ "ST AND CL%10|DL%25 AND EX:5%1|ST AND CL%10",
+ "ST AND CL%10|ST AND M1|ST AND CL%10",
+ ],
+ state: "solid",
+ category: "Super's Funny Mod",
+ reactions: {
+ "water": { elem1:"null" }
+ },
+},
+elements.mystery_thing_2 = {
+ color: "#abcfed",
+ behavior: [
+ "CL%10 AND CH:galvanized_steel%10|CL%10 AND CH:galvanized_steel%10|CL%10 AND CH:galvanized_steel%10",
+ "M2|CH:galvanized_steel%10 AND CH:spread_bomb%0.1|M2",
+ "CH:null%10|M1|CH:null%10",
+ ],
+ category: "Super's Funny Mod",
+ name:"0.1 by 0.1 meter apartment"
+},
+elements.sandboxelizer = {
+ color: "#e6d577",
+ category: "Super's Funny Mod",
+ behavior: [
+ "CL%3 AND CH:sand%10|M2|CL%3 AND CH:sand%10",
+ "M2|M1|M2",
+ "CL%3 AND CH:sand%10|M2|CL%3 AND CH:sand%10",
+ ],
+ reactions: {
+ "sand": { elem1:"void", chance:0.1}
+ }
+};
+//just doing some modding
\ No newline at end of file
diff --git a/mods/cold_liquid_explosion.js b/mods/cold_liquid_explosion.js
index cd2cf7f1..90581214 100644
--- a/mods/cold_liquid_explosion.js
+++ b/mods/cold_liquid_explosion.js
@@ -1,3 +1,5 @@
+//Made by SuperASAX or SuperAAX
+
elements.liquid_tnt = {
color: "#c92a2a",
behavior: behaviors.LIQUID,
@@ -15,4 +17,4 @@ elements.liquid_tnt = {
excludeRandom: true,
alias: "trinitrotoluene"
};
-//Made by SuperASAX or SuperAAX
+//Made by SuperASAX or SuperAAX
\ No newline at end of file
diff --git a/mods/cold_opposites.js b/mods/cold_opposites.js
index 8b26b391..ad52fa92 100644
--- a/mods/cold_opposites.js
+++ b/mods/cold_opposites.js
@@ -1,3 +1,5 @@
+//Made by SuperASAX or SuperAAX
+
elements.torch = {
color: "#d68542",
behavior: [
@@ -61,4 +63,4 @@ elements.eanprop = {
state: "gas",
density: 2.0098,
alias: "gas"
-};
+};
\ No newline at end of file
diff --git a/mods/random_fixes.js b/mods/random_fixes.js
new file mode 100644
index 00000000..8bdee76f
--- /dev/null
+++ b/mods/random_fixes.js
@@ -0,0 +1,42 @@
+//Made by SuperASAX or SuperAAX
+
+elements.metal_scrap = {
+ color: ["#b0afb4","#8c8f98","#cbcdcd","#6c6c6a","#fef9ff"],
+ behavior: behaviors.POWDER,
+ reactions: {
+ "rust": { elem1:null, elem2:"thermite", chance:0.1 },
+ },
+ tempHigh: 1538,
+ category: "powders",
+ density: 2720,
+ state: "solid",
+ conduct: 0.43,
+ hardness: 0.266,
+ stateHigh:"molten_metal_scrap"
+},
+
+elements.molten_metal_scrap = {
+ color: ["#b0afb4","#8c8f98","#cbcdcd","#6c6c6a","#fef9ff"],
+ behavior: behaviors.MOLTEN,
+ category: "liquids",
+ density: 2720,
+ state: "liquid",
+ temp: 1600,
+ conduct: 0.43,
+ hidden: true,
+ hardness: 0.266,
+ tempLow: 1538,
+ stateLow: "metal_scrap",
+ tick: function(pixel) {
+ var randomNumGot=Math.random()
+ if (randomNumGot < 0.15) {
+ changePixel(pixelMap[pixel.x][pixel.y],"molten_tin");
+ }
+ if (randomNumGot < 0.30 && randomNumGot > 0.15) {
+ changePixel(pixelMap[pixel.x][pixel.y],"molten_aluminum");
+ }
+ if (randomNumGot < 0.45 && randomNumGot > 0.30) {
+ changePixel(pixelMap[pixel.x][pixel.y],"molten_brass");
+ }
+ }
+};
\ No newline at end of file
From 23b11e2130f6f3e63e8959c21bb27d76836f12fa Mon Sep 17 00:00:00 2001
From: SuperASAX
Date: Sat, 10 Aug 2024 11:53:49 -0700
Subject: [PATCH 31/56] Add files via upload
---
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.html b/index.html
index 3795a656..b17269b3 100644
--- a/index.html
+++ b/index.html
@@ -17374,7 +17374,7 @@ window.onload = function() {
-
+ ?
- ?
+
parseInt(val.trim()));
+ } else if (colorString.startsWith('#')) {
+ let hex = colorString.slice(1);
+
+ // Handle shorthand hex (e.g., #03F)
+ if (hex.length === 3) {
+ hex = hex.split('').map(char => char + char).join('');
+ }
+
+ if (hex.length !== 6) {
+ console.error('Invalid hex color:', colorString);
+ return null;
+ }
+
+ const r = parseInt(hex.slice(0, 2), 16);
+ const g = parseInt(hex.slice(2, 4), 16);
+ const b = parseInt(hex.slice(4, 6), 16);
+
+ return [r, g, b];
+ } else {
+ console.error('Invalid color format:', colorString);
+ return null;
+ }
+}
+
+function cc_arrayToRgbString(rgbArray) {
+ return `rgb(${rgbArray.join(', ')})`;
+}
+
+function cc_scaleList(numbers, scale) {
+ return numbers.map(number => number * scale);
+}
+
function binaryArrayToNumber(binaryArray) {
return binaryArray.reduce((acc, bit, index) => acc + bit * Math.pow(2, (binaryArray.length - 1) - index), 0);
}
@@ -358,16 +399,17 @@ function general_encoder(inputBits) {
// Define input pins
for (var i = 0; i < inputBits; i++) {
- pins.push([-Math.floor(circuitWidth / 2) + 1 + 2 * i, outputBits + 1, true]);
+ pins.push([Math.floor(circuitWidth / 2) - 1 - (2 * i), outputBits + 1, true]);
}
// Define output pins
for (var i = 0; i < outputBits; i++) {
- pins.push([Math.floor(circuitWidth / 2) + 1, -outputBits + 1 + 2 * i, false]); // Right outputs
+ pins.push([Math.floor(circuitWidth / 2) + 1, outputBits - 1 - (2 * i), false]); // Right outputs
}
+ // Mirrored outputs
for (var i = 0; i < outputBits; i++) {
- pins.push([-Math.floor(circuitWidth / 2) - 1, -outputBits + 1 + 2 * i, false]); // Left outputs
+ pins.push([-Math.floor(circuitWidth / 2) - 1, outputBits - 1 - (2 * i), false]); // Left outputs
}
initializeCircuit(pixel, pins, circuitWidth, circuitHeight);
@@ -427,7 +469,7 @@ function general_demultiplexer(selectorBits) {
// Define output pins
for (var i = 0; i < outputCount; i++) {
- pins.push([Math.floor(circuitWidth / 2) + 1, -Math.floor(circuitHeight / 2) + 1 + 2 * i, false]);
+ pins.push([Math.floor(circuitWidth / 2) + 1, Math.floor(circuitHeight / 2) - 1 - (2 * i), false]);
}
initializeCircuit(pixel, pins, circuitWidth, circuitHeight);
@@ -477,16 +519,16 @@ function general_decoder(inputBits) {
// Define input pins
for (var i = 0; i < inputBits; i++) {
- pins.push([-Math.floor(circuitWidth / 2) + 1 + 2 * i, outputCount + 1, true]);
+ pins.push([Math.floor(circuitWidth / 2) - 1 - (2 * i), outputCount + 1, true]);
}
// Define output pins
for (var i = 0; i < outputCount; i++) {
- pins.push([Math.floor(circuitWidth / 2) + 1, -outputCount + 1 + 2 * i, false]); // Right outputs
+ pins.push([Math.floor(circuitWidth / 2) + 1, outputCount - 1 - (2 * i), false]); // Right outputs
}
for (var i = 0; i < outputCount; i++) {
- pins.push([-Math.floor(circuitWidth / 2) - 1, -outputCount + 1 + 2 * i, false]); // Left outputs
+ pins.push([-Math.floor(circuitWidth / 2) - 1, outputCount - 1 - (2 * i), false]); // Left outputs
}
initializeCircuit(pixel, pins, circuitWidth, circuitHeight);
@@ -533,12 +575,12 @@ function general_multiplexer(inputLines) {
// Define selector pins
for (var i = 0; i < selectorBits; i++) {
- pins.push([-Math.floor(circuitWidth / 2) + 1 + 2 * i, inputLines + 1, true]);
+ pins.push([Math.floor(circuitWidth / 2) - 1 - (2 * i), inputLines + 1, true]);
}
// Define input data pins
for (var i = 0; i < inputLines; i++) {
- pins.push([-Math.floor(circuitWidth / 2) - 1, -inputLines + 1 + 2 * i, true]);
+ pins.push([-Math.floor(circuitWidth / 2) - 1, inputLines - 1 - (2 * i), true]);
}
// Define output pin
@@ -582,10 +624,10 @@ elements.four_bit_PISO_shift_register_circuit = {
tick: function(pixel) {
var pins = [
// Data inputs (D0-D3)
- [-3, -3, true], // D0
- [-1, -3, true], // D1
- [1, -3, true], // D2
[3, -3, true], // D3
+ [1, -3, true], // D2
+ [-1, -3, true], // D1
+ [-3, -3, true], // D0
// Control input (Load/Shift Enable)
[-5, -1, true], // Load/Shift Enable
@@ -665,10 +707,10 @@ elements.four_bit_SIPO_shift_register_circuit = {
[-2, -1, true], // Clock
// Parallel outputs (Q0-Q3)
- [2, -3, false], // Q0
- [2, -1, false], // Q1
+ [2, 3, false], // Q3
[2, 1, false], // Q2
- [2, 3, false] // Q3
+ [2, -1, false], // Q1
+ [2, -3, false] // Q0
];
initializeCircuit(pixel, pins, 3, 9);
@@ -1050,19 +1092,19 @@ elements.four_bit_incrementer_circuit = {
tick: function(pixel) {
var pins = [
// 4-bit number inputs (N0-N3)
- [-3, -2, true], // N0
- [-1, -2, true], // N1
- [1, -2, true], // N2
[3, -2, true], // N3
+ [1, -2, true], // N2
+ [-1, -2, true], // N1
+ [-3, -2, true], // N0
// Increment control input (INC)
[-5, 0, true], // Increment (INC)
// Outputs (Q0-Q3)
- [-3, 2, false], // Q0
- [-1, 2, false], // Q1
- [1, 2, false], // Q2
[3, 2, false], // Q3
+ [1, 2, false], // Q2
+ [-1, 2, false], // Q1
+ [-3, 2, false], // Q0
// Carry out
[5, 0, false] // Carry out (COUT)
@@ -1107,25 +1149,25 @@ elements.four_bit_adder_circuit = {
tick: function(pixel) {
var pins = [
// First 4-bit number (A)
- [-7, -2, true], // A0
- [-5, -2, true], // A1
- [-3, -2, true], // A2
[-1, -2, true], // A3
+ [-3, -2, true], // A2
+ [-5, -2, true], // A1
+ [-7, -2, true], // A0
// Second 4-bit number (B)
- [1, -2, true], // B0
- [3, -2, true], // B1
- [5, -2, true], // B2
[7, -2, true], // B3
+ [5, -2, true], // B2
+ [3, -2, true], // B1
+ [1, -2, true], // B0
// Carry-in (C_in)
[9, 0, true], // Carry-in (C_in)
// Output sum (S)
- [-7, 2, false], // S0
- [-5, 2, false], // S1
- [-3, 2, false], // S2
[-1, 2, false], // S3
+ [-3, 2, false], // S2
+ [-5, 2, false], // S1
+ [-7, 2, false], // S0
[1, 2, false], // Carry Out (C4)
];
@@ -1208,9 +1250,51 @@ elements.very_fast_clock = {
tick: general_clock(8, 4),
}
-elements.fast_clock = {
- color: "#FFAAFF",
- tick: general_clock(16, 8),
+
+elements.custom_RGB_led = {
+ tick: function(pixel) {
+ var pins = [
+ // RGB values
+ [-2, -1, true], // R0
+ [-2, 1, true], // R1
+ [1, -2, true], // G0
+ [-1, -2, true], // G1
+ [2, -1, true], // B0
+ [2, 1, true], // B1
+ ];
+
+ initializeCircuit(pixel, pins, 3, 3);
+
+ // Read inputs
+ var l = [
+ checkPin(pixel, pins, 0),
+ checkPin(pixel, pins, 1),
+ checkPin(pixel, pins, 2),
+ checkPin(pixel, pins, 3),
+ checkPin(pixel, pins, 4),
+ checkPin(pixel, pins, 5)
+ ];
+
+ var color = { color: cc_scaleList([(l[0] * 2) + l[1], (l[2] * 2) + l[3], (l[4] * 2) + l[5]], (255 / 3) * 10) };
+
+ if (lightmapEnabled) {
+ lightmap[Math.floor(pixel.y / lightmapScale)][Math.floor(pixel.x / lightmapScale)] = color;
+ }
+ var scaledColor = cc_scaleList(color.color, 0.1);
+
+// pixelMap[pixel.x][pixel.y].color = scaledColor;
+ for (let dx = -1; dx <= 1; dx++) {
+ for (let dy = -1; dy <= 1; dy++) {
+ var nx = pixel.x + dx;
+ var ny = pixel.y + dy;
+
+ if (pixelMap[nx] && pixelMap[nx][ny]) {
+ var n = ((2 - (Math.abs(dx) + Math.abs(dy))) + 4) / 6;
+ pixelMap[nx][ny].color = cc_arrayToRgbString(cc_scaleList(scaledColor, n));
+ }
+ }
+ }
+ }
}
var addDisplayCallback = function(pixel, pins, w, h) {
@@ -1231,10 +1315,10 @@ elements.simple_seven_segment_display = {
tick: function(pixel) {
var pins = [
// Data inputs (D0-D3)
- [-1, 1, true], // D0
- [-1, 3, true], // D1
- [-1, 5, true], // D2
- [-1, 7, true], // D3
+ [-1, 7, true],
+ [-1, 5, true],
+ [-1, 3, true],
+ [-1, 1, true],
];
initializeCircuit(pixel, pins, 5, 9, false, pixel.circuitRotation, addDisplayCallback);
@@ -1273,15 +1357,15 @@ elements.simple_double_seven_segment_display = {
tick: function(pixel) {
var pins = [
// Data inputs (D0-D3)
- [-1, 1, true], // D0
- [-1, 3, true], // D1
- [-1, 5, true], // D2
- [-1, 7, true], // D3
+ [-1, 7, true],
+ [-1, 5, true],
+ [-1, 3, true],
+ [-1, 1, true],
- [1, -1, true], // D2-0
- [3, -1, true], // D2-1
- [5, -1, true], // D2-2
- [7, -1, true], // D2-3
+ [7, -1, true],
+ [5, -1, true],
+ [3, -1, true],
+ [1, -1, true],
];
initializeCircuit(pixel, pins, 9, 9, false, pixel.circuitRotation, addDisplayCallback);
@@ -1377,7 +1461,7 @@ elements.circuit_material = {
},
tick: function(pixel) {
// Make it that extreme temperatures can stop the chip from working (for realism)
- if (Math.random() < 0.003) { // Chance to check for temperature or nearby particles
+ if (Math.random() < 0.003 && cc_setting1.value) { // Chance to check for temperature or nearby particles
// Check temperature
if (pixel.temp > 120) {
// Replace the circuit core with lead if overheating
@@ -1576,12 +1660,15 @@ var circuits = [
// Displays/visual circuits: white
{ circuit: elements.simple_seven_segment_display, color: cc_WHITE, size: [5, 9, false] },
{ circuit: elements.simple_double_seven_segment_display, color: cc_WHITE, size: [9, 9, false] },
+ { circuit: elements.custom_RGB_led, color: cc_WHITE, size: [3, 3, true] },
];
circuits.forEach(circuitInfo => {
if (circuitInfo.color) {circuitInfo.circuit.color = circuitInfo.color;}
circuitInfo.circuit.category = "logic";
circuitInfo.circuit.maxSize = 1;
+ circuitInfo.circuit.behavior = behaviors.WALL;
+ circuitInfo.circuit.state = "solid";
circuitInfo.circuit.isCircuitCore = true;
circuitInfo.circuit.previewSize = circuitInfo.size;
@@ -1606,7 +1693,10 @@ circuits.forEach(circuitInfo => {
deletePixel(pixel.x, pixel.y);
}
- pixel.temp += Math.random(0, 5);
+ // Check if circuit overheating is enabled
+ if (cc_setting1.value) {
+ pixel.temp += Math.random(0.5);
+ }
}
}
}
@@ -1658,12 +1748,4 @@ function drawCircuitExtras() {
}
}
-runAfterLoad(() => {
- var originalDrawPixels3 = drawPixels;
- drawPixels = function(forceTick=false) {
- originalDrawPixels3(forceTick);
- drawCircuitExtras();
- return true;
- };
-});
-resetInterval(tps);
+renderPostPixel(drawCircuitExtras);
From 6394aa918a3aa85ffdbc3767e7c610e1d3c5954a Mon Sep 17 00:00:00 2001
From: Nekonico <163950752+DBNekonico@users.noreply.github.com>
Date: Tue, 13 Aug 2024 16:13:44 -0700
Subject: [PATCH 34/56] Update fossils.js
---
mods/fossils.js | 82 +++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 69 insertions(+), 13 deletions(-)
diff --git a/mods/fossils.js b/mods/fossils.js
index 324c0993..94d334bc 100644
--- a/mods/fossils.js
+++ b/mods/fossils.js
@@ -1,5 +1,20 @@
/* code by nekonico aka doobienecoarc */
+worldgentypes.prehistory = {
+ layers: [
+ [1.00, "grass"],
+ [0.10, "dirt"],
+ [0.02, "rock"],
+ [0, "basalt"],
+ ],
+ decor: [
+ ["dinosaur", 0.1, 10],
+ ["pinecone", 0.075],
+ ["bird", 0.025, 5],
+ ],
+ baseHeight: 0.5
+},
+
elements.fossil = {
color: ["#bbb3ae","#b4b4b4","#c0c0c0"],
behavior: [
@@ -89,6 +104,10 @@ elements.marrow_fossil = {
};
elements.human_fossil = {
+ properties: {
+ dna: "human",
+ },
+ name: "fossil",
color: ["#bbb3ae","#b4b4b4","#c0c0c0"],
hidden:true,
behavior: [
@@ -123,6 +142,10 @@ elements.human_fossil = {
};
elements.dino_fossil = {
+ properties: {
+ dna: "dinosaur",
+ },
+ name: "fossil",
color: ["#bbb3ae","#b4b4b4","#c0c0c0"],
behavior: [
"XX|XX|XX",
@@ -156,6 +179,9 @@ elements.dino_fossil = {
};
elements.petrified_wood = {
+ properties: {
+ dna: "sapling",
+ },
color: ["#4e4e3e","#464646","#52533a"],
hidden:true,
behavior: behaviors.STURDYPOWDER,
@@ -185,6 +211,9 @@ elements.petrified_wood = {
};
elements.skull = {
+ properties: {
+ dna: "human",
+ },
color: "#d9d9d9",
hidden:true,
behavior: behaviors.POWDER,
@@ -220,6 +249,9 @@ elements.skull = {
},
elements.human_bones = {
+ properties: {
+ dna: "human",
+ },
name: "bone",
color: "#d9d9d9",
hidden:true,
@@ -256,6 +288,9 @@ elements.human_bones = {
},
elements.dino_bones = {
+ properties: {
+ dna: "dinosaur",
+ },
name: "bone",
color: "#d9d9d9",
hidden:true,
@@ -329,6 +364,9 @@ elements.bug_amber = {
elements.hive_amber = {
hidden:true,
+ properties: {
+ dna: "bee",
+ },
name: "amber",
color: "#ffc000",
temp: 20,
@@ -340,6 +378,9 @@ elements.hive_amber = {
elements.dinosaur = {
hidden:true,
+ properties: {
+ dna: "dinosaur",
+ },
color: ["#7F2B0A","#808080","#006400"],
behavior: [
"XX|M2%5|XX",
@@ -365,22 +406,24 @@ elements.dinosaur = {
"plant": { elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL },
"bone": { elem2: ["bone_marrow","blood","quicklime",null,null,null], chance: 0.3, },
"skull": { elem2: ["bone_marrow","blood","quicklime",null,null,null], chance: 0.1, },
- "bone_marrow": { elem2: ["blood","blood",null], chance: 0.3, func: behaviors.FEEDPIXEL },
- "blood": { elem2: null, chance: 0.1, func: behaviors.FEEDPIXEL },
+ "bone_marrow": { elem2: ["blood","blood",null], chance: 0.3, func: behaviors.FEEDPIXEL },attr1:{"dna":"snail"},
+ "blood": { elem2: null, chance: 0.01, func: behaviors.FEEDPIXEL },
"meat": { elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL },
"cooked_meat": { elem2: null, chance: 0.4, func: behaviors.FEEDPIXEL },
- "cured_meat": { elem2: null, chance: 0.4, func: behaviors.FEEDPIXEL },
+ "cured_meat": { elem2: null, chance: 0.1, func: behaviors.FEEDPIXEL },
"fly": { elem2: null, chance: 0.05, func: behaviors.FEEDPIXEL },
- "ant": { elem2: null, chance: 0.05, func: behaviors.FEEDPIXEL },
- "worm": { elem2: null, chance: 0.05, func: behaviors.FEEDPIXEL },
- "wood": { elem2: "sawdust", chance: 0.04 },
+ "ant": { elem2: [null,null,null,null,null,null,"dead_bug"], chance: 0.05, func: behaviors.FEEDPIXEL },
+ "worm": { elem2: [null,null,null,null,null,null,"slime"], chance: 0.05, func: behaviors.FEEDPIXEL },
"glass": { elem2: "glass_shard", chance: 0.05 },
"concrete": { elem2: "dust", chance: 0.03 },
- }
+ },
},
elements.trilobite = {
hidden:true,
+ properties: {
+ dna: "trilobite",
+ },
color: "#808080",
behavior: [
"XX|M2%5|SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water,primordial_soup%05",
@@ -408,7 +451,7 @@ elements.trilobite = {
"yolk": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"cell": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"crumb": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
- "alcohol": { elem1:"dead_bug", chance:0.001 },
+ "alcohol": { elem1:"dead_bug", attr1:{"dna":"trilobite"}, chance:0.001 },
"water": { elem2:"bubble", attr2:{"clone":"water"}, chance:0.002, oneway:true },
"salt_water": { elem2:"bubble", attr2:{"clone":"salt_water"}, chance:0.002, oneway:true },
"pool_water": { elem1:"dead_bug", chance:0.001 },
@@ -434,7 +477,7 @@ elements.trilobite = {
elements.extracted_dna = {
hidden:true,
name: "artificial_egg",
- color: ["#211316","#2C1A1D","#503734","#e0d3ab","#d1c6be","#b5c0ad","#b9b8bc"],
+ color: ["#211316","#2C1A1D","#503734","#e0d3ab"],
behavior: behaviors.POWDER,
tick: function(pixel) {
if (Math.random() < 0.00025 || (pixel.dna && pixel.temp > 40 && pixel.temp < 150)) {
@@ -457,12 +500,25 @@ elements.extractor = {
color: ["#d1c6be","#b5c0ad","#b9b8bc"],
behavior: behaviors.STURDYPOWDER,
reactions: {
+ "fossil": { elem2:"extracted_dna", chance:0.05 },
+ "marrow_fossil": { elem2:"extracted_dna", chance:0.06 },
+ "petrified_wood": { elem2:"extracted_dna", attr2:{"dna":"sapling"}, chance:0.01 },
+ "wood": { elem2:"extracted_dna", attr2:{"dna":"sapling"}, chance:0.05 },
+ "bone_marrow": { elem2:"extracted_dna", chance:0.1 },
+ "bone": { elem2:"extracted_dna", chance:0.1 },
+ "meat": { elem2:"extracted_dna", chance:0.1 },
+ "frozen_meat": { elem2:"extracted_dna", chance:0.1 },
+ "cooked_meat": { elem2:"extracted_dna", chance:0.1 },
+ "rotten_meat": { elem2:"extracted_dna", chance:0.05 },
+ "blood": { elem2:"extracted_dna", chance:0.1 },
+ "slime": { elem2:"extracted_dna", chance:0.05 },
+ "dead_bug": { elem2:"extracted_dna", chance:0.2 },
"hive_amber": { elem2:"extracted_dna", chance:0.2 },
"bug_amber": { elem2:"extracted_dna", chance:0.2 },
- "dino_bones": { elem2:"extracted_dna", attr1:{"dna":"dinosaur"}, chance:0.2 },
- "skull": { elem2:"extracted_dna", attr1:{"dna":"human"}, chance:0.2 },
- "dino_fossil": { elem2:"extracted_dna", attr1:{"dna":"dinosaur"}, chance:0.02 },
- "human_fossil": { elem2:"extracted_dna", attr1:{"dna":"human"}, chance:0.02 },
+ "dino_bones": { elem2:"extracted_dna", attr2:{"dna":"dinosaur"}, chance:0.2 },
+ "skull": { elem2:"extracted_dna", attr2:{"dna":"human"}, chance:0.2 },
+ "dino_fossil": { elem2:"extracted_dna", attr2:{"dna":"dinosaur"}, chance:0.02 },
+ "human_fossil": { elem2:"extracted_dna", attr2:{"dna":"human"}, chance:0.02 },
},
category:"machines",
conduct: 1,
From 2ae2d9359d2e5390438a22939ef6ef378445666d Mon Sep 17 00:00:00 2001
From: Nekonico <163950752+DBNekonico@users.noreply.github.com>
Date: Tue, 13 Aug 2024 16:14:41 -0700
Subject: [PATCH 35/56] Update scp.js
---
mods/scp.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mods/scp.js b/mods/scp.js
index 9703ac3d..c71f61ce 100644
--- a/mods/scp.js
+++ b/mods/scp.js
@@ -1,3 +1,5 @@
+/* mod by nekonico aka doobienecoarc */
+
window.addEventListener("load", () => {
document.getElementById("elementButton-mask_head")?.remove()
})
@@ -37,8 +39,6 @@ window.addEventListener("load", () => {
// Coding junk above this point
-// also hi jonny ray
-
elements.SCP_008 = {
color: "#11111f",
behavior: [
From aa8dadb964a85d9a45b7d80566262ee0fbd69340 Mon Sep 17 00:00:00 2001
From: Nekonico <163950752+DBNekonico@users.noreply.github.com>
Date: Tue, 13 Aug 2024 23:00:05 -0700
Subject: [PATCH 36/56] Humanitize Added!
My new mod, currently planning a lot more but currently in the stage with basic economy and drowning
---
mods/Humanitize.js | 590 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 590 insertions(+)
create mode 100644 mods/Humanitize.js
diff --git a/mods/Humanitize.js b/mods/Humanitize.js
new file mode 100644
index 00000000..ccc01218
--- /dev/null
+++ b/mods/Humanitize.js
@@ -0,0 +1,590 @@
+/* mod by nekonico aka doobienecoarc */
+
+window.addEventListener("load", () => {
+ document.getElementById("elementButton-easy_way_out")?.remove()
+})
+
+elements.easy_way_out = {
+ hidden: true,
+ color: "#00000f",
+ excludeRandom: true,
+ onPlace: function(pixel) {
+ deletePixel(pixel.x, pixel.y);
+ },
+ category: "special",
+ state: "solid",
+ movable: false,
+},
+
+elements.cultured_human = {
+ name: "human",
+ // color: ["#f5eac6","#d4c594","#a89160","#7a5733","#523018","#361e0e"],
+ color: ["#f3e7db","#f7ead0","#eadaba","#d7bd96","#a07e56","#825c43","#604134","#3a312a"],
+ category: "human",
+ properties: {
+ dead: false,
+ dir: 1,
+ panic: 0
+ },
+ onPlace: function(pixel) {
+ if (isEmpty(pixel.x, pixel.y+1)) {
+ createPixel("c_body", pixel.x, pixel.y+1);
+ createPixel("c_head", pixel.x, pixel.y);
+ }
+ else if (isEmpty(pixel.x, pixel.y-1)) {
+ createPixel("c_head", pixel.x, pixel.y-1);
+ pixelMap[pixel.x][pixel.y-1].color = pixel.color;
+ createPixel("c_body", pixel.x, pixel.y);
+ }
+ else {
+ deletePixel(pixel.x, pixel.y);
+ }
+ },
+ related: ["c_body","c_head"],
+ cooldown: defaultCooldown,
+ forceSaveColor: true,
+},
+
+elements.c_body = {
+ name: "body",
+ color: ["#069469","#047e99","#7f5fb0"],
+ forceSaveColor: true,
+ category: "human",
+ 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","meat","bone"],
+ reactions: {
+ "basket": { func:function(pixel,basket){ if (pixel.basket == false) {changePixel(basket,"easy_way_out"), (pixel.basket = true);} }, chance:0.5 },
+ "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.01 },
+ "fallout": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.01 },
+ "plague": { elem1:"plague", chance:0.05 },
+ "egg": { func:function(pixel,egg){
+ if (pixel.basket == true) {(pixel.eggcount += 1), changePixel(egg,"easy_way_out");}
+ else {changePixel(egg,"yolk");}
+ }, chance:0.5},
+ "flour": { func:function(pixel,flour){
+ if (pixel.basket == true) {(pixel.flourcount += 1), changePixel(flour,"easy_way_out");}
+ }, chance:0.5},
+ "dough": { func:function(pixel,dough){
+ if (pixel.basket == true) {(pixel.doughcount += 1), changePixel(dough,"easy_way_out");}
+ }, chance:0.5},
+ "meat": { func:function(pixel,meat){
+ if (pixel.basket == true) {(pixel.meatcount += 1), changePixel(meat,"easy_way_out");}
+ }, chance:0.4},
+ "cured_meat": { func:function(pixel,meat){
+ if (pixel.basket == true) {(pixel.meatcount += 1), changePixel(meat,"easy_way_out");}
+ }, chance:0.5},
+ "bread": { func:function(pixel,bread){
+ if (pixel.basket == true) {(pixel.breadcount += 1), changePixel(bread,"easy_way_out");}
+ else if (pixel.basket == false && pixel.breadcount < 1) {(pixel.breadcount = 1), changePixel(bread,"easy_way_out");}
+ }, chance:0.5},
+ "toast": { func:function(pixel,bread){
+ if (pixel.basket == true) {(pixel.breadcount += 1), changePixel(bread,"easy_way_out");}
+ else if (pixel.basket == false && pixel.breadcount < 1) {(pixel.breadcount = 1), changePixel(bread,"easy_way_out");}
+ }, chance:0.4},
+ "crumb": { func:function(pixel,bread){
+ if (pixel.basket == true) {(pixel.breadcount += 0.1), changePixel(bread,"easy_way_out");}
+ }, chance:0.1},
+ "cooked_meat": { func:function(pixel,cooked_meat){
+ if (pixel.basket == true) {(pixel.cookedmeatcount += 1), changePixel(cooked_meat,"easy_way_out");}
+ else if (pixel.basket == true && pixel.cookedmeatcount < 1) {(pixel.cookedmeatcount = 1), changePixel(cooked_meat,"easy_way_out");}
+ }, chance:0.5},
+ "bead": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.1},
+ "glitter": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.1},
+ "copper_sulfate": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.05},
+ "confetti": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.05},
+ "color_sand": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.05},
+ "incense": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.05},
+ "pinecone": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.03},
+ "feather": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.01},
+ "glass_shard": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.01},
+ "porcelain_shard": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.01},
+ "flower_seed": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.01},
+ "wheat_seed": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.05},
+ "corn_seed": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.05},
+ "potato_seed": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.05},
+ "pumpkin_seed": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.05},
+ "petal": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.01},
+ "metal_scrap": { func:function(pixel,trinket){
+ if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
+ }, chance:0.01},
+ "furnace": { func:function(pixel,oven){
+ if (pixel.meatcount > 0) {(pixel.cookedmeatcount += 1),(pixel.meatcount -= 1),(oven.temp = 100);}
+ else if (pixel.doughcount > 0) {(pixel.breadcount += 1),(pixel.doughcount -= 1),(oven.temp = 95);}
+ }, chance:0.01},
+ "oven": { func:function(pixel,oven){
+ if (pixel.meatcount > 0) {(pixel.cookedmeatcount += 1),(pixel.meatcount -= 1),(oven.temp = 100);}
+ else if (pixel.doughcount > 0) {(pixel.breadcount += 1),(pixel.doughcount -= 1),(oven.temp = 95);}
+ }, chance:0.02},
+ "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 },
+ "grass_seed": { elem2:null, chance:0.05 },
+ "tax_bill": { elem2:null, func:(pixel,tax) => { (pixel.moneycount *= 0.75) }, chance:0.01 },
+ "money": { elem2:null, func:(pixel,money) => { (pixel.moneycount += 1) }, chance:0.03 },
+ "gold_coin": { elem2:null, func:(pixel,money) => { (pixel.moneycount += 100) }, chance:0.04 },
+ "diamond": { elem2:null, func:(pixel,money) => { (pixel.moneycount += 5000) }, chance:0.05 },
+ "sun": { elem1:"cooked_meat" },
+ },
+ properties: {
+ dead: false,
+ dir: 1,
+ panic: 0,
+ hungry: false,
+ greedy: false,
+ basket: false,
+ moneycount: 0,
+ eggcount: 0,
+ flourcount: 0,
+ doughcount: 0,
+ meatcount: 0,
+ cookedmeatcount: 0,
+ breadcount: 0,
+ trinketscount: 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 == "c_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 == "c_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; }
+ }
+ if (pixel.moneycount > 17999) {
+ pixel.color = pixelColorPick(pixel,"#ffd700");
+ }
+ if (pixel.breadcount < 1 && pixel.cookedmeatcount < 1 && Math.random() < 0.005) { //eating mechanic
+ pixel.hungry = true
+ }
+ else if (pixel.breadcount > 0.5 && pixel.hungry == true) {
+ pixel.hungry = false, pixel.breadcount -= 1
+ }
+ else if (pixel.cookedmeatcount > 0 && pixel.hungry == true) {
+ pixel.hungry = false, pixel.cookedmeatcount -= 1
+ }
+ else if (pixel.breadcount > 0.5 && Math.random() < 0.005) {
+ pixel.hungry = false, pixel.breadcount -= 1
+ }
+ else if (pixel.cookedmeatcount > 0 && Math.random() < 0.005) {
+ pixel.hungry = false, pixel.cookedmeatcount -= 1
+ }
+ if (pixel.trinketscount < 1 && Math.random() < 0.001) { //trinket desire mechanic
+ pixel.greedy = true
+ }
+ else if (pixel.trinketscount > 1 && Math.random() < 0.01) {
+ pixel.greedy = false
+ }
+ if (!isEmpty(pixel.x-1, pixel.y, true) && pixelMap[pixel.x-1][pixel.y].element == "c_body") {
+ var seller = pixelMap[pixel.x-1][pixel.y];
+ if (seller.dead) { // If seller is dead, stop trade
+ var seller = null;
+ }
+ else { (seller.panic = -10), (pixel.panic = -10);
+ if (seller.trinketscount > 0 && pixel.greedy == true) {
+ seller.trinketscount -= 1, seller.moneycount += 1, pixel.moneycount -= 1, pixel.trinketscount += 1;
+ }
+ if (seller.cookedmeatcount > 0 && pixel.cookedmeatcount < 5) {
+ seller.cookedmeatcount -= 1, seller.moneycount += 3, pixel.moneycount -= 3, pixel.cookedmeatcount += 1;
+ }
+ if (seller.breadcount > 0 && pixel.breadcount < 5) {
+ seller.breadcount -= 1, seller.moneycount += 2, pixel.moneycount -= 2, pixel.breadcount += 1;
+ };
+ (seller.panic = 0), (pixel.panic = 0)
+ }
+ }
+ else { var seller = null }
+
+ }
+},
+
+elements.c_head = {
+ name: "head",
+ color: ["#f3e7db","#f7ead0","#eadaba","#d7bd96","#a07e56","#825c43","#604134","#3a312a"],
+ forceSaveColor: true,
+ category: "human",
+ 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","meat","bone"],
+ forceSaveColor: true,
+ reactions: {
+ "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 },
+ "oxygen": { func:function(pixel,oxygen){pixel.drowning -= 1}, elem2:"carbon_dioxide", chance:0.5 },
+ "carbon_dioxide": { func:function(pixel,oxygen){pixel.drowning += 1}, elem2:"carbon_dioxide", chance:0.1 },
+ "meat": { elem2:null, chance:0.1 },
+ "cooked_meat": { elem2:null, chance:0.1 },
+ "cured_meat": { elem2:null, chance:0.1 },
+ "sugar": { elem2:null, chance:0.1 },
+ "broth": { elem2:null, chance:0.2 },
+ "yolk": { elem2:null, chance:0.1 },
+ "hard_yolk": { elem2:null, chance:0.1 },
+ "dough": { elem2:null, chance:0.1 },
+ "batter": { elem2:null, chance:0.2 },
+ "butter": { elem2:null, chance:0.1 },
+ "melted_butter": { elem2:null, chance:0.2 },
+ "chocolate": { elem2:null, chance:0.2 },
+ "melted_chocolate": { elem2:null, chance:0.3 },
+ "grape": { elem2:null, chance:0.1 },
+ "tomato": { elem2:null, chance:0.1 },
+ "herb": { elem2:null, chance:0.1 },
+ "lettuce": { elem2:null, chance:0.1 },
+ "corn": { elem2:null, chance:0.1 },
+ "popcorn": { elem2:null, chance:0.15 },
+ "potato": { elem2:null, chance:0.1 },
+ "baked_potato": { elem2:null, chance:0.15 },
+ "bread": { elem2:null, chance:0.1 },
+ "toast": { elem2:null, chance:0.1 },
+ "gingerbread": { elem2:null, chance:0.1 },
+ "baked_batter": { elem2:null, chance:0.2 },
+ "wheat": { elem2:null, chance:0.1 },
+ "candy": { elem2:null, chance:0.1 },
+ "yogurt": { elem2:null, chance:0.2 },
+ "frozen_yogurt": { elem2:null, chance:0.1 },
+ "ice_cream": { elem2:null, chance:0.2 },
+ "beans": { elem2:[null,null,null,null,null,null,null,null,"stench"], chance:0.2 },
+ "tea": { elem2:null, chance:0.2 },
+ "coffee": { elem2:null, chance:0.2 },
+ "milk": { elem2:null, chance:0.2 },
+ "cream": { elem2:null, chance:0.2 },
+ "soda": { elem2:null, chance:0.2 },
+ "chocolate_milk": { elem2:null, chance:0.2 },
+ "fruit_milk": { elem2:null, chance:0.2 },
+ "pilk": { elem2:null, chance:0.2 },
+ "eggnog": { elem2:null, chance:0.2 },
+ "juice": { elem2:null, chance:0.2 },
+ "cheese": { elem2:null, chance:0.1 },
+ "melted_cheese": { elem2:null, chance:0.2 },
+ "alcohol": { elem2:null, chance:0.2 },
+ "antidote": { elem2:null, chance:0.2 },
+ "honey": { elem2:null, chance:0.2 },
+ "caramel": { elem2:null, chance:0.2 },
+ "molasses": { elem2:null, chance:0.05 },
+ "ketchup": { elem2:null, chance:0.1 },
+ "pumpkin_seed": { elem2:null, chance:0.1 },
+ "nut": { elem2:null, chance:0.1 },
+ "nut_meat": { elem2:null, chance:0.1 },
+ "nut_butter": { elem2:null, chance:0.1 },
+ "nut_milk": { elem2:null, chance:0.2 },
+ "jelly": { elem2:null, chance:0.2 },
+ "mayo": { elem2:null, chance:0.2 },
+ "mashed_potato": { elem2:null, chance:0.2 },
+ "sauce": { elem2:null, chance:0.2 },
+ "pickle": { elem2:null, chance:0.1 },
+ "sun": { elem1:"cooked_meat" },
+ "light": { stain1:"#825043" },
+ "bee": { stain1:"#cc564b", chance:0.2 },
+ "water": { func:function(pixel,water){pixel.drowning += 1}, elem2:"bubble", attr2:{"clone":"water"}, chance:0.002 },
+ "salt_water": { func:function(pixel,water){pixel.drowning += 2}, elem2:"bubble", attr2:{"clone":"salt_water"}, chance:0.002 },
+ "sugar_water": { func:function(pixel,water){pixel.drowning += 2}, elem2:"bubble", attr2:{"clone":"sugar_water"}, chance:0.002 },
+ "seltzer": { func:function(pixel,water){pixel.drowning += 4}, elem2:"bubble", attr2:{"clone":["seltzer","seltzer","carbon_dioxide"]}, chance:0.002 },
+ "pool_water": { func:function(pixel,water){pixel.drowning += 1}, elem2:"bubble", attr2:{"clone":"pool_water"}, chance:0.002 },
+ "dirty_water": { func:function(pixel,water){pixel.drowning += 4}, elem2:"bubble", color2:["#0e824e","#07755a","#0c6934"], attr2:{"clone":"dirty_water"}, chance:0.003 },
+ "blood": { func:function(pixel,water){pixel.drowning += 5}, elem2:"bubble", color2:["#ff0000","#ee0000","#ff4040"], attr2:{"clone":"blood"}, chance:0.003 },
+ },
+ properties: {
+ dead: false,
+ drowning: 0
+ },
+ 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 == "c_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; }
+
+ // drowning
+ if (pixel.drowning > 99.9) { pixel.dead = true }
+ }
+},
+
+elements.money = {
+ color: ["#85bb65","#5e8347","#65bb7d","#b2bb65","#dbffc4"],
+ behavior: behaviors.POWDER,
+ reactions: {
+ "water": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "dirty_water": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "salt_water": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "sugar_water": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "seltzer": { elem1:"cellulose", elem2:null },
+ "soda": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "blood": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "foam": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "bubble": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "oil": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "alcohol": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "vinegar": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "light": { stain1:"#ebdfa7" },
+ "oxygen": { stain1:"#ebdfa7" }
+ },
+ tempHigh: 248,
+ stateHigh: ["fire","fire","fire","fire","fire","ash"],
+ burn: 70,
+ burnTime: 300,
+ burnInto: ["fire","fire","fire","fire","fire","ash"],
+ category: "human",
+ state: "solid",
+ density: 1000,
+ breakInto: "confetti",
+ breakIntoColor: ["#85bb65","#65bb7d","#b2bb65","#85bb65"]
+},
+
+elements.tax_bill = {
+ color: ["#f0f0f0","#f0f0f0","#f0f0f0","#f0f0f0","#f0f0f0","#ff0000","#171717",],
+ behavior: behaviors.POWDER,
+ reactions: {
+ "water": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "dirty_water": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "salt_water": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "sugar_water": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "seltzer": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "soda": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "blood": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "foam": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "bubble": { elem1:"cellulose", elem2:null, chance:0.1 },
+ "oil": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "alcohol": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "vinegar": { elem1:"cellulose", elem2:null, chance:0.01 },
+ "light": { stain1:"#ebdfa7" },
+ "oxygen": { stain1:"#ebdfa7" },
+ "money": { elem1:null, elem2:null, chance:0.5},
+ "gold_coin": { elem1:null, elem2:null, chance:0.4 }
+ },
+ tempHigh: 248,
+ stateHigh: ["fire","fire","fire","fire","fire","ash"],
+ burn: 70,
+ burnTime: 300,
+ burnInto: ["fire","fire","fire","fire","fire","ash"],
+ category: "human",
+ state: "solid",
+ density: 1100,
+ breakInto: "confetti",
+ breakIntoColor: ["#ffffff","#e6e6e6","#dbdbdb","#ffffff","#e6e6e6","#dbdbdb","#ff0000","#171717",]
+},
+
+elements.basket = {
+ color: ["#88665d","#bcaa99","#c2b97f"],
+ behavior: behaviors.POWDER,
+ tempHigh: 400,
+ stateHigh: "fire",
+ burn: 35,
+ burnTime: 210,
+ burnInto: ["smoke","smoke","smoke","smoke","ash"],
+ breakInto: "straw",
+ category: "human",
+ state: "solid",
+ density: 70
+},
+
+elements.furnace = {
+ color: ["#808080","#4f4f4f","#949494"],
+ behavior: behaviors.STURDYPOWDER,
+ reactions: {
+ "bird": { elem2:["cooked_meat","cooked_meat","feather"], chance:0.025 },
+ "meat": { elem2:"cooked_meat", chance:0.1 },
+ "yolk": { elem2:"hard_yolk", chance:0.1 },
+ "egg": { elem2:"hard_yolk", chance:0.1 },
+ "batter": { elem2:"baked_batter", chance:0.1 },
+ "dough": { elem2:"bread", chance:0.1 },
+ "bread": { elem2:"toast", chance:0.05 },
+ "wood": { elem2:"charcoal", chance:0.005 },
+ "metal_scrap": { elem1:"oven", elem2:null, chance:0.05 },
+ },
+ temp:40,
+ tempHigh: 1000,
+ stateHigh: "magma",
+ category: "human",
+ state: "solid",
+ density: 2550,
+ hardness: 0.2,
+ breakInto: ["sand","gravel","charcoal","ash"]
+},
+
+elements.oven = {
+ color: ["#4f4f4f","#71797e"],
+ behavior: behaviors.WALL,
+ reactions: {
+ "bird": { elem2:["cooked_meat","cooked_meat","feather"], chance:0.025 },
+ "meat": { elem2:"cooked_meat", chance:0.1 },
+ "yolk": { elem2:"hard_yolk", chance:0.1 },
+ "egg": { elem2:"hard_yolk", chance:0.1 },
+ "batter": { elem2:"baked_batter", chance:0.1 },
+ "dough": { elem2:"bread", chance:0.1 },
+ "bread": { elem2:"toast", chance:0.05 },
+ },
+ temp:50,
+ tempHigh: 1550,
+ stateHigh: "molten_metal_scrap",
+ category: "human",
+ state: "solid",
+ density: 2550,
+ hardness: 0.5,
+ breakInto: ["metal_scrap","metal_scrap","charcoal","ash"]
+};
+
+elements.human.name = "dummy"
+
+elements.head.name = "brainless_head"
+
+elements.body.name = "dumb_body"
From 7c8aca6493a8cf49531d8245223230aef6a2ce53 Mon Sep 17 00:00:00 2001
From: redbirdly <155550833+redbirdly@users.noreply.github.com>
Date: Fri, 16 Aug 2024 19:16:05 +0800
Subject: [PATCH 37/56] circuitcore.js: make circuits consistant and add mono
displays
---
mods/circuitcore.js | 306 +++++++++++++++++++++++++++++++++++++-------
1 file changed, 258 insertions(+), 48 deletions(-)
diff --git a/mods/circuitcore.js b/mods/circuitcore.js
index d63e39a6..c214cc5c 100644
--- a/mods/circuitcore.js
+++ b/mods/circuitcore.js
@@ -1,6 +1,7 @@
// CircuitCore: adds circuits to sandboxels, logicgates.js is required
if (!enabledMods.includes("mods/betterSettings.js")) { enabledMods.unshift("mods/betterSettings.js"); localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); window.location.reload() };
+if (!enabledMods.includes("mods/logicgates.js")) { enabledMods.unshift("mods/logicgates.js"); localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); window.location.reload() };
var lightmapEnabled = enabledMods.includes("mods/lightmap.js") || enabledMods.includes("mods/fast_lightmap.js");
var cc_settingsTab = new SettingsTab("CircuitCore");
@@ -15,6 +16,31 @@ var dataVisualizationPalette16 = [
"#777777", "#770000", "#773300", "#777700", "#007700", "#007777", "#000077", "#770077",
];
+function hueLerp(value) {
+ // Clamp the value between -50 and 400
+ if (value < -50) value = -50;
+ if (value > 400) value = 400;
+
+ let r, g, b;
+
+ if (value <= 300) {
+ // Interpolate between blue and red
+ let t = (value + 50) / 350; // Normalize value from -50 to 300 to a 0-1 range
+ r = Math.round(255 * t);
+ g = 0;
+ b = Math.round(255 * (1 - t));
+ } else {
+ // Interpolate between red and white
+ let t = (value - 300) / 100; // Normalize value from 300 to 400 to a 0-1 range
+ r = 255;
+ g = Math.round(255 * t);
+ b = Math.round(255 * t);
+ }
+
+ // Convert RGB values to a hex string
+ return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase();
+}
+
function cc_rgbToArray(colorString) {
if (typeof colorString !== 'string') {
console.error('Invalid colorString:', colorString);
@@ -193,7 +219,7 @@ function setPin(pixel, pins, index, value, rotation=pixel.circuitRotation) {
// Circuits
elements.four_bit_enabler_circuit = {
centered: true,
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
// Data inputs (D0-D3)
[-3, -2, true], // D0
@@ -250,7 +276,7 @@ elements.four_bit_enabler_circuit = {
elements.randomizer = {
color: "#FFCCFF",
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x + coord[0];
@@ -271,7 +297,7 @@ elements.randomizer = {
}
elements.four_bit_randomizer_circuit = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
// Clock input
[0, -2, true], // Clock
@@ -319,9 +345,51 @@ elements.four_bit_randomizer_circuit = {
}
};
+var tempVar = 0;
+elements.temperature_sensor = {
+ behavior: behaviors.WALL,
+ onSelect: function() {
+ var answertemp = Number(prompt("Set your target temperature:",(tempVar||undefined)));
+ if (!answertemp) { return }
+ tempVar = answertemp;
+ },
+ hoverStat: function(pixel) {
+ return `TargetTmp: {pixel.targetTemp}`;
+ },
+ cc_stableTick: function(pixel) {
+ if (pixel.start === pixelTicks){
+ pixel.targetTemp = tempVar;
+ }
+
+ pixel.color = hueLerp(pixel.targetTemp);
+
+ pixel.active = pixel.temp >= pixel.targetTemp;
+ var neighbors = getNeighbors(pixel);
+ for (var i = 0;i < neighbors.length;i++) {
+ var neighbor = neighbors[i];
+
+ // Check if it's a wire
+ if (elements[neighbor.element].conduct > 0 && pixel.active) {
+ neighbor.charge = 1;
+ }
+
+ // Check if it's a logic wire (logicgates.js)
+ if (neighbor.lstate != undefined) {
+ if (pixel.active) {
+ neighbor.lstate = 2;
+ neighbor.color = pixelColorPick(neighbor, "#ffe49c");
+ } else {
+ neighbor.lstate = -2;
+ neighbor.color = pixelColorPick(neighbor, "#3d4d2c");
+ }
+ }
+ }
+ }
+}
+
/*elements.ROM_circuit = {
previewSize: false,
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var romWidth = 16;
var romHeight = 16;
@@ -434,22 +502,22 @@ function general_encoder(inputBits) {
// Define a 2-to-1 encoder using the general_encoder function
elements.two_to_one_encoder_circuit = {
- tick: general_encoder(2)
+ cc_stableTick: general_encoder(2)
};
// Define a 4-to-2 encoder using the general_encoder function
elements.four_to_two_encoder_circuit = {
- tick: general_encoder(4)
+ cc_stableTick: general_encoder(4)
};
// Define an 8-to-3 encoder using the general_encoder function
elements.eight_to_three_encoder_circuit = {
- tick: general_encoder(8)
+ cc_stableTick: general_encoder(8)
};
// Define a 16-to-4 encoder using the general_encoder function
elements.sixteen_to_four_encoder_circuit = {
- tick: general_encoder(16)
+ cc_stableTick: general_encoder(16)
};
function general_demultiplexer(selectorBits) {
@@ -492,22 +560,22 @@ function general_demultiplexer(selectorBits) {
// Define a 1-to-2 demultiplexer using the general_demultiplexer function
elements.one_to_two_demultiplexer_circuit = {
- tick: general_demultiplexer(1)
+ cc_stableTick: general_demultiplexer(1)
};
// Define a 1-to-4 demultiplexer using the general_demultiplexer function
elements.one_to_four_demultiplexer_circuit = {
- tick: general_demultiplexer(2)
+ cc_stableTick: general_demultiplexer(2)
};
// Define a 1-to-8 demultiplexer using the general_demultiplexer function
elements.one_to_eight_demultiplexer_circuit = {
- tick: general_demultiplexer(3)
+ cc_stableTick: general_demultiplexer(3)
};
// Define a 1-to-16 demultiplexer using the general_demultiplexer function
elements.one_to_sixteen_demultiplexer_circuit = {
- tick: general_demultiplexer(4)
+ cc_stableTick: general_demultiplexer(4)
};
function general_decoder(inputBits) {
@@ -551,19 +619,19 @@ function general_decoder(inputBits) {
}
elements.one_to_two_decoder_circuit = {
- tick: general_decoder(1)
+ cc_stableTick: general_decoder(1)
};
elements.two_to_four_decoder_circuit = {
- tick: general_decoder(2)
+ cc_stableTick: general_decoder(2)
};
elements.three_to_eight_decoder_circuit = {
- tick: general_decoder(3)
+ cc_stableTick: general_decoder(3)
};
elements.four_to_sixteen_decoder_circuit = {
- tick: general_decoder(4)
+ cc_stableTick: general_decoder(4)
};
function general_multiplexer(inputLines) {
@@ -602,26 +670,26 @@ function general_multiplexer(inputLines) {
// Define a 2-input multiplexer using the general_multiplexer function
elements.two_to_one_multiplexer_circuit = {
- tick: general_multiplexer(2)
+ cc_stableTick: general_multiplexer(2)
};
// Define a 4-input multiplexer using the general_multiplexer function
elements.four_to_one_multiplexer_circuit = {
- tick: general_multiplexer(4)
+ cc_stableTick: general_multiplexer(4)
};
// Define an 8-input multiplexer using the general_multiplexer function
elements.eight_to_one_multiplexer_circuit = {
- tick: general_multiplexer(8)
+ cc_stableTick: general_multiplexer(8)
};
// Define an 8-input multiplexer using the general_multiplexer function
elements.sixteen_to_one_multiplexer_circuit = {
- tick: general_multiplexer(16)
+ cc_stableTick: general_multiplexer(16)
};
elements.four_bit_PISO_shift_register_circuit = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
// Data inputs (D0-D3)
[3, -3, true], // D3
@@ -698,7 +766,7 @@ elements.four_bit_PISO_shift_register_circuit = {
};
elements.four_bit_SIPO_shift_register_circuit = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
// Serial input (Data In)
[-2, -3, true], // Data In
@@ -741,7 +809,7 @@ elements.four_bit_SIPO_shift_register_circuit = {
};
elements.four_bit_program_counter_circuit = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
// Data inputs (D0-D3)
[-3, -3, true], // D0
@@ -813,7 +881,7 @@ elements.four_bit_program_counter_circuit = {
};
elements.four_bit_register_circuit = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
// Data inputs (D0-D3)
[-3, -3, true], // D0
@@ -873,7 +941,7 @@ elements.four_bit_register_circuit = {
};
elements.SR_latch_circuit = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
[0, -2, true], // Input: Set
[0, 2, true], // Input: Reset
@@ -891,7 +959,7 @@ elements.SR_latch_circuit = {
};
elements.T_flip_flop_circuit = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
[0, -2, true], // Input: Toggle (T)
[2, 0, false], // Output (Q)
@@ -922,7 +990,7 @@ elements.T_flip_flop_circuit = {
};
elements.D_latch_circuit = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
[0, -2, true], // Input: Data
[2, 0, true], // Input: Enable
@@ -944,7 +1012,7 @@ elements.D_latch_circuit = {
};
elements.D_flip_flop_circuit = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
[0, -2, true], // Input: Data
[2, 0, true], // Input: Enable
@@ -983,7 +1051,7 @@ elements.D_flip_flop_circuit = {
};
elements.four_bit_D_latch_circuit = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
// Data inputs (D0-D3)
[-3, -2, true], // D0
@@ -1032,7 +1100,7 @@ elements.four_bit_D_latch_circuit = {
};
elements.four_bit_D_flip_flop_circuit = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
// Data inputs (D0-D3)
[-3, -2, true], // D0
@@ -1089,7 +1157,7 @@ elements.four_bit_D_flip_flop_circuit = {
};
elements.four_bit_incrementer_circuit = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
// 4-bit number inputs (N0-N3)
[3, -2, true], // N3
@@ -1146,7 +1214,7 @@ elements.four_bit_incrementer_circuit = {
};
elements.four_bit_adder_circuit = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
// First 4-bit number (A)
[-1, -2, true], // A3
@@ -1232,27 +1300,26 @@ function general_clock(speed, s2) {
elements.slow_clock = {
color: "#BB66BB",
- tick: general_clock(64, 32),
+ cc_stableTick: general_clock(64, 32),
}
elements.medium_clock = {
color: "#DD88DD",
- tick: general_clock(32, 16),
+ cc_stableTick: general_clock(32, 16),
}
elements.fast_clock = {
color: "#FFAAFF",
- tick: general_clock(16, 8),
+ cc_stableTick: general_clock(16, 8),
}
elements.very_fast_clock = {
color: "#FFCCFF",
- tick: general_clock(8, 4),
+ cc_stableTick: general_clock(8, 4),
}
-
elements.custom_RGB_led = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
// RGB values
[-2, -1, true], // R0
@@ -1277,7 +1344,7 @@ elements.custom_RGB_led = {
var color = { color: cc_scaleList([(l[0] * 2) + l[1], (l[2] * 2) + l[3], (l[4] * 2) + l[5]], (255 / 3) * 10) };
- if (lightmapEnabled) {
+ if (lightmapEnabled && color.color[0] && color.color[1], color.color[2]) {
lightmap[Math.floor(pixel.y / lightmapScale)][Math.floor(pixel.x / lightmapScale)] = color;
}
var scaledColor = cc_scaleList(color.color, 0.1);
@@ -1312,7 +1379,7 @@ var addDisplayCallback = function(pixel, pins, w, h) {
}
elements.simple_seven_segment_display = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
// Data inputs (D0-D3)
[-1, 7, true],
@@ -1354,7 +1421,7 @@ elements.simple_seven_segment_display = {
};
elements.simple_double_seven_segment_display = {
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var pins = [
// Data inputs (D0-D3)
[-1, 7, true],
@@ -1421,6 +1488,117 @@ elements.simple_double_seven_segment_display = {
}
};
+function general_display(w, h) {
+ return function(pixel) {
+ var pins = [];
+
+ // X input (X0-Xn)
+ for (var i = 0; i < Math.ceil(Math.log2(w)); i++) {
+ pins.push([-1, (Math.ceil(Math.log2(w)) - i) * 2 - 1, true]);
+ }
+
+ // Y input (Y0-Yn)
+ for (var i = 0; i < Math.ceil(Math.log2(h)); i++) {
+ pins.push([(Math.ceil(Math.log2(h)) - i) * 2 - 1, -1, true]);
+ }
+
+ // Color input
+ pins.push([11, -1, true]);
+
+ // Reset pin
+ pins.push([13, -1, true]);
+
+ // Clock input
+ pins.push([15, -1, true]);
+
+ // Initialize the circuit with the necessary pins
+ initializeCircuit(pixel, pins, w + 2, h + 2, false, pixel.circuitRotation, addDisplayCallback);
+
+ // Read inputs
+ var X = [];
+ for (var i = 0; i < Math.ceil(Math.log2(w)); i++) {
+ X.push(checkPin(pixel, pins, i));
+ }
+
+ var Y = [];
+ for (var i = 0; i < Math.ceil(Math.log2(h)); i++) {
+ Y.push(checkPin(pixel, pins, Math.ceil(Math.log2(w)) + i));
+ }
+
+ var color = checkPin(pixel, pins, pins.length - 3);
+ var reset = checkPin(pixel, pins, pins.length - 2);
+ var clock = checkPin(pixel, pins, pins.length - 1);
+
+ // Decode X and Y inputs to determine the pixel position
+ var x_pos = 0;
+ for (var i = 0; i < X.length; i++) {
+ x_pos += (X[i] ? 1 : 0) << i;
+ }
+
+ var y_pos = 0;
+ for (var i = 0; i < Y.length; i++) {
+ y_pos += (Y[i] ? 1 : 0) << i;
+ }
+
+ // Display dimension check
+ if (x_pos >= w || y_pos >= h) return;
+
+ var px = pixel.x + 1 + x_pos; // Adjust for the display position
+ var py = pixel.y + 1 + y_pos;
+
+ // Handle reset functionality
+ if (reset) {
+ for (var y = 1; y <= h; y++) {
+ for (var x = 1; x <= w; x++) {
+ var reset_px = pixel.x + x;
+ var reset_py = pixel.y + y;
+ if (pixelMap[reset_px] && pixelMap[reset_px][reset_py] && pixelMap[reset_px][reset_py].element == "art") {
+ pixelMap[reset_px][reset_py].color = "rgb(16, 230, 120)";
+ }
+ }
+ }
+ return;
+ }
+
+ // Update display on clock pulse
+ if (clock) {
+ if (pixelMap[px] && pixelMap[px][py] && pixelMap[px][py].element == "art") {
+ // Set the pixel color
+ pixelMap[px][py].color = color ? "rgb(16, 230, 120)" : "rgb(16, 230, 120)";
+ }
+ }
+ };
+}
+
+elements.basic_mono_display_8x8 = {
+ cc_stableTick: general_display(8, 8),
+};
+
+elements.basic_mono_display_16x8 = {
+ cc_stableTick: general_display(16, 8),
+};
+
+elements.basic_mono_display_16x16 = {
+ cc_stableTick: general_display(16, 16),
+};
+
+elements.basic_mono_display_32x16 = {
+ cc_stableTick: general_display(32, 16),
+};
+
+elements.basic_mono_display_32x32 = {
+ cc_stableTick: general_display(32, 32),
+};
+
+elements.basic_mono_display_64x32 = {
+ cc_stableTick: general_display(64, 32),
+};
+
+elements.basic_mono_display_64x64 = {
+ cc_stableTick: general_display(64, 64),
+};
+
+
function malfunction_chip(pixel) {
var emptySpaces = [];
@@ -1451,6 +1629,19 @@ function malfunction_chip(pixel) {
}
}
+//elements.display = {
+// color: "#444444",
+// category: "logic",
+// state: "solid",
+// behavior: behaviors.WALL,
+// hoverStat: function(pixel) {
+// return `Circuit: ${pixel.corePosition}`;
+// },
+// cc_stableTick: function(pixel) {
+//
+// }
+//};
+
elements.circuit_material = {
color: "#444444",
category: "logic",
@@ -1459,7 +1650,7 @@ elements.circuit_material = {
hoverStat: function(pixel) {
return `Circuit: ${pixel.corePosition}`;
},
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
// Make it that extreme temperatures can stop the chip from working (for realism)
if (Math.random() < 0.003 && cc_setting1.value) { // Chance to check for temperature or nearby particles
// Check temperature
@@ -1499,7 +1690,7 @@ elements.input_pin = {
stateHigh: "lead",
tempHigh: 570,
behavior: behaviors.WALL,
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
pixel.active = false;
var neighbors = getNeighbors(pixel);
for (var i = 0;i < neighbors.length;i++) {
@@ -1520,7 +1711,7 @@ elements.output_pin = {
stateHigh: "lead",
tempHigh: 570,
behavior: behaviors.WALL,
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var neighbors = getNeighbors(pixel);
for (var i = 0;i < neighbors.length;i++) {
var neighbor = neighbors[i];
@@ -1566,7 +1757,7 @@ elements.logic_corrupt = {
elements.logic_corrupter_machine = {
color: "#DD33DD",
category: "logic",
- tick: function(pixel) {
+ cc_stableTick: function(pixel) {
var radius = 10
for (var y = pixel.y - radius; y < pixel.y + radius; y++) {
for (var x = pixel.x - radius; x < pixel.x + radius; x++) {
@@ -1612,6 +1803,7 @@ var circuits = [
{ circuit: elements.four_bit_enabler_circuit, color: cc_BROWN, size: [9, 3, true] },
{ circuit: elements.randomizer, color: cc_BROWN },
{ circuit: elements.four_bit_randomizer_circuit, color: cc_BROWN, size: [9, 3, true] },
+ { circuit: elements.temperature_sensor, color: cc_BROWN },
// ROM/RAM: red
// { circuit: elements.ROM_circuit, color: cc_RED, size: [18, 18, false] },
// Encoders and de-multiplexers: orange
@@ -1656,11 +1848,17 @@ var circuits = [
{ circuit: elements.medium_clock },
{ circuit: elements.fast_clock },
{ circuit: elements.very_fast_clock },
- { circuit: elements.very_fast_clock },
// Displays/visual circuits: white
{ circuit: elements.simple_seven_segment_display, color: cc_WHITE, size: [5, 9, false] },
{ circuit: elements.simple_double_seven_segment_display, color: cc_WHITE, size: [9, 9, false] },
{ circuit: elements.custom_RGB_led, color: cc_WHITE, size: [3, 3, true] },
+ { circuit: elements.basic_mono_display_8x8, color: cc_WHITE, size: [10, 10, false] },
+ { circuit: elements.basic_mono_display_16x8, color: cc_WHITE, size: [18, 10, false] },
+ { circuit: elements.basic_mono_display_16x16, color: cc_WHITE, size: [18, 18, false] },
+ { circuit: elements.basic_mono_display_32x16, color: cc_WHITE, size: [34, 18, false] },
+ { circuit: elements.basic_mono_display_32x32, color: cc_WHITE, size: [34, 34, false] },
+ { circuit: elements.basic_mono_display_64x32, color: cc_WHITE, size: [66, 34, false] },
+ { circuit: elements.basic_mono_display_64x64, color: cc_WHITE, size: [66, 66, false] },
];
circuits.forEach(circuitInfo => {
@@ -1674,8 +1872,8 @@ circuits.forEach(circuitInfo => {
// Exclude circuits without a frame
if (circuitInfo.size) {
- var previousCircuitTick = circuitInfo.circuit.tick;
- circuitInfo.circuit.tick = function(pixel) {
+ var previousCircuitTick = circuitInfo.circuit.cc_stableTick;
+ circuitInfo.circuit.cc_stableTick = function(pixel) {
previousCircuitTick(pixel);
// Don't constantly check
@@ -1748,4 +1946,16 @@ function drawCircuitExtras() {
}
}
+function runLogicTick() {
+ for (var i = 0;i < currentPixels.length;i++) {
+ var pixel = currentPixels[i];
+ if (elements[pixel.element].category == "logic") {
+ if (elements[pixel.element].cc_stableTick) {
+ elements[pixel.element].cc_stableTick(pixel);
+ }
+ }
+ }
+}
+
renderPostPixel(drawCircuitExtras);
+runEveryTick(runLogicTick);
From ff1b6aac541288aed925366a2bb7bddd0fc9a28b Mon Sep 17 00:00:00 2001
From: Nekonico <163950752+DBNekonico@users.noreply.github.com>
Date: Sun, 18 Aug 2024 18:25:15 -0700
Subject: [PATCH 38/56] Humanitize: HOUSE BUILDING UPDATE!
To all you fellas saying humans should build houses, well now they can! When the leader gets enough wood, they'll eventually build a home. When they gather enough stone and more wood, they'll furnish the house with a furnace and a workbench. With that workbench, they'll use grass, stone and wood to make a pickaxe, which is when they'll be making mining holes if there is a nearby stone patch.
Changelog:
-Humans build wooden houses
-Humans can make pickaxes
-Humans can mine for rock with pickaxes
-Humans can make furnaces and workbenches
-Humans can harvest wood from tree branches
-Humans can harvest fruit from plants
---
mods/Humanitize.js | 443 +++++++++++++++++++++++++++++++++++++++++----
1 file changed, 403 insertions(+), 40 deletions(-)
diff --git a/mods/Humanitize.js b/mods/Humanitize.js
index ccc01218..02540336 100644
--- a/mods/Humanitize.js
+++ b/mods/Humanitize.js
@@ -1,5 +1,11 @@
/* mod by nekonico aka doobienecoarc */
+behaviors.BODY_DELETE = function(pixel) {
+ if (pixel.willbuildhouse == true) {
+ HouseBuilder = false;
+ }
+},
+
window.addEventListener("load", () => {
document.getElementById("elementButton-easy_way_out")?.remove()
})
@@ -16,6 +22,8 @@ elements.easy_way_out = {
movable: false,
},
+HouseBuilder = false
+
elements.cultured_human = {
name: "human",
// color: ["#f5eac6","#d4c594","#a89160","#7a5733","#523018","#361e0e"],
@@ -30,6 +38,7 @@ elements.cultured_human = {
if (isEmpty(pixel.x, pixel.y+1)) {
createPixel("c_body", pixel.x, pixel.y+1);
createPixel("c_head", pixel.x, pixel.y);
+ var bodypixel = pixelMap[pixel.x][pixel.y+1];
}
else if (isEmpty(pixel.x, pixel.y-1)) {
createPixel("c_head", pixel.x, pixel.y-1);
@@ -41,7 +50,8 @@ elements.cultured_human = {
}
},
related: ["c_body","c_head"],
- cooldown: defaultCooldown,
+ maxSize: 1,
+ cooldown: 10,
forceSaveColor: true,
},
@@ -65,7 +75,9 @@ elements.c_body = {
breakInto: ["blood","meat","bone"],
reactions: {
"basket": { func:function(pixel,basket){ if (pixel.basket == false) {changePixel(basket,"easy_way_out"), (pixel.basket = true);} }, chance:0.5 },
- "cancer": { elem1:"cancer", chance:0.005 },
+ "pickaxe": { func:function(pixel,pickaxe){ if (pixel.pickaxe == false) {changePixel(pickaxe,"easy_way_out"), (pixel.pickaxe = true),(pixel.willbuildmine = true);} }, chance:0.5 },
+ "cancer": { elem1:"cancer", chance:0.0005 },
+ "poison": { attr1:{"dead":true}, chance:0.4 },
"radiation": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.4 },
"neutron": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.01 },
"fallout": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.01 },
@@ -84,14 +96,18 @@ elements.c_body = {
if (pixel.basket == true) {(pixel.meatcount += 1), changePixel(meat,"easy_way_out");}
}, chance:0.4},
"cured_meat": { func:function(pixel,meat){
- if (pixel.basket == true) {(pixel.meatcount += 1), changePixel(meat,"easy_way_out");}
+ if (pixel.basket == true) {(pixel.meatcount += 2), changePixel(meat,"easy_way_out");}
}, chance:0.5},
"bread": { func:function(pixel,bread){
if (pixel.basket == true) {(pixel.breadcount += 1), changePixel(bread,"easy_way_out");}
else if (pixel.basket == false && pixel.breadcount < 1) {(pixel.breadcount = 1), changePixel(bread,"easy_way_out");}
}, chance:0.5},
"toast": { func:function(pixel,bread){
- if (pixel.basket == true) {(pixel.breadcount += 1), changePixel(bread,"easy_way_out");}
+ if (pixel.basket == true) {(pixel.breadcount += 2), changePixel(bread,"easy_way_out");}
+ else if (pixel.basket == false && pixel.breadcount < 1) {(pixel.breadcount = 1), changePixel(bread,"easy_way_out");}
+ }, chance:0.4},
+ "baked_batter": { func:function(pixel,bread){
+ if (pixel.basket == true) {(pixel.breadcount += 5), changePixel(bread,"easy_way_out");}
else if (pixel.basket == false && pixel.breadcount < 1) {(pixel.breadcount = 1), changePixel(bread,"easy_way_out");}
}, chance:0.4},
"crumb": { func:function(pixel,bread){
@@ -134,16 +150,7 @@ elements.c_body = {
"flower_seed": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.01},
- "wheat_seed": { func:function(pixel,trinket){
- if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
- }, chance:0.05},
- "corn_seed": { func:function(pixel,trinket){
- if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
- }, chance:0.05},
- "potato_seed": { func:function(pixel,trinket){
- if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
- }, chance:0.05},
- "pumpkin_seed": { func:function(pixel,trinket){
+ "grass_seed": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.05},
"petal": { func:function(pixel,trinket){
@@ -152,15 +159,104 @@ elements.c_body = {
"metal_scrap": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.01},
+ "housefloor1": { func:function(pixel,station){
+ if (pixel.woodcount > 4) {(pixel.woodcount -= 5), changePixel(station,"workbench");}
+ }, chance:0.01},
+ "housefloor2": { func:function(pixel,station){
+ if (pixel.rockcount > 7) {(pixel.rockcount -= 8), changePixel(station,"furnace");}
+ }, chance:0.01},
+ "workbench": { func:function(pixel,station){
+ if (pixel.rockcount > 2 && pixel.woodcount > 1 && pixel.hasstraw == true && pixel.pickaxe == false) {(pixel.pickaxe = true),(pixel.willbuildmine = true),(pixel.rockcount -= 2),(pixel.woodcount -= 1),(pixel.hasstraw = false);}
+ }, chance:0.01},
"furnace": { func:function(pixel,oven){
- if (pixel.meatcount > 0) {(pixel.cookedmeatcount += 1),(pixel.meatcount -= 1),(oven.temp = 100);}
- else if (pixel.doughcount > 0) {(pixel.breadcount += 1),(pixel.doughcount -= 1),(oven.temp = 95);}
+ if (pixel.meatcount > 0) {(pixel.cookedmeatcount += 1),(pixel.meatcount -= 1);}
+ else if (pixel.doughcount > 0) {(pixel.breadcount += 1),(pixel.doughcount -= 1);}
}, chance:0.01},
"oven": { func:function(pixel,oven){
- if (pixel.meatcount > 0) {(pixel.cookedmeatcount += 1),(pixel.meatcount -= 1),(oven.temp = 100);}
- else if (pixel.doughcount > 0) {(pixel.breadcount += 1),(pixel.doughcount -= 1),(oven.temp = 95);}
+ if (pixel.meatcount > 0) {(pixel.cookedmeatcount += 1),(pixel.meatcount -= 1);}
+ else if (pixel.doughcount > 0) {(pixel.breadcount += 1),(pixel.doughcount -= 1);}
}, chance:0.02},
- "grape": { elem2:"juice", chance:0.5, color2:"#291824", oneway:true },
+ "allpurposestation": { func:function(pixel,station){
+ if (pixel.rockcount > 2 && pixel.woodcount > 1 && pixel.hasstraw == true) {(pixel.pickaxe = true),(pixel.rockcount -= 2),(pixel.woodcount -= 1),(pixel.hasstraw = false);}
+ else if (pixel.meatcount > 0) {(pixel.cookedmeatcount += 1),(pixel.meatcount -= 1);}
+ else if (pixel.doughcount > 0) {(pixel.breadcount += 1),(pixel.doughcount -= 1);}
+ else if (pixel.eggcount > 1 && pixel.flourcount > 1) {(pixel.eggcount -= 1),(pixel.flourcount -= 1),(pixel.breadcount += 10);}
+ }, chance:0.1},
+ "loose_straw": { func:function(pixel,straw){
+ if (pixel.hasstraw == false) {(pixel.hasstraw = true), changePixel(straw,"easy_way_out");}
+ }, chance:0.01},
+ "water": { func:function(pixel,water){
+ if (pixel.flourcount > 1) {(pixel.flourcount -= 1), (pixel.doughcount += 1), changePixel(water,["easy_way_out","easy_way_out","water"]);}
+ }, chance:0.5},
+ "straw": { elem2:"loose_straw", oneway:true, chance:0.5 },
+ "grass": { func:function(pixel,grass){
+ if (pixel.hasstraw == false && grass.h == 2) {(pixel.hasstraw = true), changePixel(grass,"easy_way_out");}
+ }, chance:0.01},
+ "rock": { func:function(pixel,rock){
+ if (pixel.basket == true && pixel.rockcount < 3) {(pixel.rockcount += 1), changePixel(rock,"easy_way_out");}
+ else if (pixel.pickaxe == true && pixel.basket == true && pixel.willbuildmine == true) {changePixel(rock,"mine_hole"), (pixel.willbuildmine = false);}
+ }, chance:0.01},
+ "mine_hole": { func:function(pixel,mine){
+ if (pixel.pickaxe == true && pixel.basket == true) {(pixel.rockcount += 1);}
+ }, chance:0.01},
+ "grape": { func:function(pixel,grape){
+ if (pixel.basket == true) {(pixel.foodcount += 0.25), changePixel(grape,"easy_way_out");}
+ else {changePixel(grape,"juice"), grape.color = pixelColorPick(grape,"#291824");}
+ }, oneway:true, chance:0.05},
+ "cheese": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "nut": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.25), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "nut_meat": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.25), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "baked_potato": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.75), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "hard_yolk": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "chocolate": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "mashed_potato": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.75), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "pickle": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.75), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "ice_cream": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "lettuce": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.25), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "tomato": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "potato": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "popcorn": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.25), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "corn": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "candy": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "caramel": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "herb": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.25), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
+ "pumpkin_seed": { func:function(pixel,food){
+ if (pixel.basket == true) {(pixel.foodcount += 0.25), changePixel(food,"easy_way_out");}
+ }, oneway:true, chance:0.05},
"ant": { elem2:"dead_bug", chance:0.05, oneway:true },
"fly": { elem2:"dead_bug", oneway:true },
"firefly": { elem2:"dead_bug", oneway:true },
@@ -169,11 +265,10 @@ elements.c_body = {
"termite": { elem2:"dead_bug", oneway:true },
"worm": { elem2:"slime", chance:0.05, oneway:true },
"stink_bug": { elem2:"stench", oneway:true },
- "grass_seed": { elem2:null, chance:0.05 },
"tax_bill": { elem2:null, func:(pixel,tax) => { (pixel.moneycount *= 0.75) }, chance:0.01 },
"money": { elem2:null, func:(pixel,money) => { (pixel.moneycount += 1) }, chance:0.03 },
- "gold_coin": { elem2:null, func:(pixel,money) => { (pixel.moneycount += 100) }, chance:0.04 },
- "diamond": { elem2:null, func:(pixel,money) => { (pixel.moneycount += 5000) }, chance:0.05 },
+ "gold_coin": { elem2:null, func:(pixel,money) => { (pixel.moneycount += 1000) }, chance:0.04 },
+ "diamond": { elem2:null, func:(pixel,money) => { (pixel.moneycount += 50000) }, chance:0.05 },
"sun": { elem1:"cooked_meat" },
},
properties: {
@@ -183,6 +278,10 @@ elements.c_body = {
hungry: false,
greedy: false,
basket: false,
+ pickaxe: false,
+ hasstraw: false,
+ willbuildhouse: false,
+ willbuildmine: false,
moneycount: 0,
eggcount: 0,
flourcount: 0,
@@ -190,8 +289,12 @@ elements.c_body = {
meatcount: 0,
cookedmeatcount: 0,
breadcount: 0,
- trinketscount: 0
+ foodcount: 0,
+ trinketscount: 0,
+ woodcount: 0,
+ rockcount: 0,
},
+ onDelete: behaviors.BODY_DELETE,
tick: function(pixel) {
if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall
if (!isEmpty(pixel.x, pixel.y-2, true)) { // Drag head down
@@ -213,6 +316,9 @@ elements.c_body = {
// Turn into rotten_meat if pixelTicks-dead > 500
if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) {
changePixel(pixel,"rotten_meat");
+ if (pixel.willbuildhouse == true) {
+ HouseBuilder = false;
+ }
}
return
}
@@ -271,30 +377,102 @@ elements.c_body = {
if (pixel.temp > 37) { pixel.temp -= 1; }
else if (pixel.temp < 37) { pixel.temp += 1; }
}
+
+ if (!isEmpty(pixel.x, pixel.y+1, true) && pixel.woodcount > 15 && pixel.willbuildhouse == true) {
+ deletePixel(pixel.x-3, pixel.y+1); // clear any floor obstructions
+ deletePixel(pixel.x-2, pixel.y+1);
+ deletePixel(pixel.x-1, pixel.y+1);
+ deletePixel(pixel.x, pixel.y+1);
+ deletePixel(pixel.x+1, pixel.y+1);
+ deletePixel(pixel.x+2, pixel.y+1);
+ deletePixel(pixel.x+3, pixel.y+1);
+ createPixel("wood", pixel.x-3, pixel.y-3); // door 1
+ createPixel("wood", pixel.x-3, pixel.y-2);
+ createPixel("wood", pixel.x-3, pixel.y+1);
+ createPixel("wood", pixel.x-2, pixel.y-3); // roof
+ createPixel("wood", pixel.x-1, pixel.y-3);
+ createPixel("wood", pixel.x, pixel.y-3);
+ createPixel("wood", pixel.x+1, pixel.y-3);
+ createPixel("wood", pixel.x+2, pixel.y-3);
+ createPixel("wood", pixel.x+3, pixel.y-3); // door 2
+ createPixel("wood", pixel.x+3, pixel.y-2);
+ createPixel("wood", pixel.x+3, pixel.y+1);
+ createPixel("wood", pixel.x-2, pixel.y+1); // floor
+ createPixel("housefloor1", pixel.x-1, pixel.y+1);
+ createPixel("wood", pixel.x, pixel.y+1);
+ createPixel("housefloor2", pixel.x+1, pixel.y+1);
+ createPixel("wood", pixel.x+2, pixel.y+1);
+ pixel.willbuildhouse = false;
+ pixel.woodcount -= 16
+ }
+
if (pixel.moneycount > 17999) {
pixel.color = pixelColorPick(pixel,"#ffd700");
}
- if (pixel.breadcount < 1 && pixel.cookedmeatcount < 1 && Math.random() < 0.005) { //eating mechanic
+
+ if (pixel.breadcount < 1 && pixel.cookedmeatcount < 1 && pixel.foodcount < 0.25 && Math.random() < 0.005) { //hunger mechanic
pixel.hungry = true
}
- else if (pixel.breadcount > 0.5 && pixel.hungry == true) {
+
+ if (pixel.foodcount > 0 && pixel.hungry == true) {
+ pixel.hungry = false, pixel.foodcount -= 0.25
+ }
+ else if (pixel.breadcount > 0.9 && pixel.hungry == true) {
pixel.hungry = false, pixel.breadcount -= 1
}
else if (pixel.cookedmeatcount > 0 && pixel.hungry == true) {
pixel.hungry = false, pixel.cookedmeatcount -= 1
}
- else if (pixel.breadcount > 0.5 && Math.random() < 0.005) {
+
+ if (pixel.foodcount > 0 && Math.random() < 0.0005) {
+ pixel.hungry = false, pixel.foodcount -= 0.25
+ }
+
+ if (pixel.breadcount > 0.9 && Math.random() < 0.0005) {
pixel.hungry = false, pixel.breadcount -= 1
}
- else if (pixel.cookedmeatcount > 0 && Math.random() < 0.005) {
+
+ if (pixel.cookedmeatcount > 0 && Math.random() < 0.0005) {
pixel.hungry = false, pixel.cookedmeatcount -= 1
}
+
if (pixel.trinketscount < 1 && Math.random() < 0.001) { //trinket desire mechanic
pixel.greedy = true
}
else if (pixel.trinketscount > 1 && Math.random() < 0.01) {
pixel.greedy = false
}
+
+ if (pixel.breadcount > 1.9 && pixel.cookedmeatcount > 0 && Math.random() < 0.005 && pixel.foodcount < 5) { //make a sandwich
+ pixel.foodcount += 1, pixel.breadcount -= 2, pixel.cookedmeatcount -= 1
+ }
+
+ if (pixel.hasstraw == true && Math.random() < 0.005 && pixel.basket == false) { //make a basket
+ pixel.basket = true, pixel.hasstraw = false
+ }
+
+ if (!isEmpty(pixel.x+1, pixel.y-1, true) && pixel.basket == true && pixelMap[pixel.x+1][pixel.y-1].element == "tree_branch") { // harvest branch
+ var wood = pixelMap[pixel.x+1][pixel.y-1];
+ if (wood.element == "tree_branch") {changePixel(wood,"branchless_tree"), pixel.woodcount += 1}
+ }
+ else if (!isEmpty(pixel.x-1, pixel.y-1, true) && pixel.basket == true && pixelMap[pixel.x-1][pixel.y-1].element == "tree_branch") {
+ var wood = pixelMap[pixel.x-1][pixel.y-1];
+ if (wood.element == "tree_branch") {changePixel(wood,"branchless_tree"), pixel.woodcount += 1}
+ }
+
+ if (!isEmpty(pixel.x+1, pixel.y-1, true) && pixel.basket == true && pixelMap[pixel.x+1][pixel.y-1].element == "plant" && Math.random() < 0.05) { // harvest fruit
+ var plant = pixelMap[pixel.x+1][pixel.y-1];
+ if (plant.element == "plant") {pixel.foodcount += 0.25}
+ }
+ else if (!isEmpty(pixel.x-1, pixel.y-1, true) && pixel.basket == true && pixelMap[pixel.x-1][pixel.y-1].element == "plant" && Math.random() < 0.05) {
+ var plant = pixelMap[pixel.x-1][pixel.y-1];
+ if (plant.element == "plant") {pixel.foodcount += 0.25}
+ }
+
+ if (pixel.woodcount > 15 && Math.random() < 0.001 && HouseBuilder == false) {
+ pixel.willbuildhouse = true, HouseBuilder = true
+ }
+
if (!isEmpty(pixel.x-1, pixel.y, true) && pixelMap[pixel.x-1][pixel.y].element == "c_body") {
var seller = pixelMap[pixel.x-1][pixel.y];
if (seller.dead) { // If seller is dead, stop trade
@@ -304,17 +482,25 @@ elements.c_body = {
if (seller.trinketscount > 0 && pixel.greedy == true) {
seller.trinketscount -= 1, seller.moneycount += 1, pixel.moneycount -= 1, pixel.trinketscount += 1;
}
+ if (seller.hasstraw == true && pixel.hasstraw == false && Math.random() < 0.1) {
+ seller.hasstraw = false, seller.moneycount += 1, pixel.moneycount -= 1, pixel.hasstraw = true;
+ }
+ if (seller.foodcount > 0.75 && Math.random() < 0.1) {
+ seller.foodcount -= 1, seller.moneycount += 5, pixel.moneycount -= 5, pixel.foodcount += 1;
+ }
if (seller.cookedmeatcount > 0 && pixel.cookedmeatcount < 5) {
seller.cookedmeatcount -= 1, seller.moneycount += 3, pixel.moneycount -= 3, pixel.cookedmeatcount += 1;
}
- if (seller.breadcount > 0 && pixel.breadcount < 5) {
+ if (seller.meatcount > 0 && pixel.meatcount == 0 && Math.random() > 0.1) {
+ seller.meatcount -= 1, seller.moneycount += 2, pixel.moneycount -= 2, pixel.meatcount += 1;
+ }
+ if (seller.breadcount > 0.9 && pixel.breadcount < 5) {
seller.breadcount -= 1, seller.moneycount += 2, pixel.moneycount -= 2, pixel.breadcount += 1;
};
(seller.panic = 0), (pixel.panic = 0)
}
}
else { var seller = null }
-
}
},
@@ -338,13 +524,14 @@ elements.c_head = {
breakInto: ["blood","meat","bone"],
forceSaveColor: true,
reactions: {
- "cancer": { elem1:"cancer", chance:0.005 },
- "radiation": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.4 },
+ "cancer": { elem1:"cancer", attr1:{"dead":true}, chance:0.005 },
+ "poison": { attr1:{"dead":true}, chance:0.4 },
+ "radiation": { elem1:["ash","meat","rotten_meat","cooked_meat"], color1:["#75816B","#4D6B53"], 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 },
- "oxygen": { func:function(pixel,oxygen){pixel.drowning -= 1}, elem2:"carbon_dioxide", chance:0.5 },
- "carbon_dioxide": { func:function(pixel,oxygen){pixel.drowning += 1}, elem2:"carbon_dioxide", chance:0.1 },
+ "fallout": { elem1:["ash","meat","rotten_meat","cooked_meat"], color1:["#75816B","#4D6B53"], chance:0.03 },
+ "plague": { elem1:["rotten_meat","rotten_meat","rotten_meat","c_head","plague",], color1:["#75816B","#4D6B53"], attr1:{"dead":true}, chance:0.05 },
+ "oxygen": { func:function(pixel,air){pixel.drowning -= 1}, elem2:"carbon_dioxide", chance:0.5 },
+ "carbon_dioxide": { func:function(pixel,air){pixel.drowning += 1}, elem2:"carbon_dioxide", chance:0.1 },
"meat": { elem2:null, chance:0.1 },
"cooked_meat": { elem2:null, chance:0.1 },
"cured_meat": { elem2:null, chance:0.1 },
@@ -523,21 +710,90 @@ elements.tax_bill = {
breakIntoColor: ["#ffffff","#e6e6e6","#dbdbdb","#ffffff","#e6e6e6","#dbdbdb","#ff0000","#171717",]
},
+elements.loose_straw = {
+ hidden: true,
+ color: ["#F9E3A1","#93734E","#C7AA83"],
+ behavior: behaviors.POWDER,
+ tempHigh: 380,
+ stateHigh: "fire",
+ burn: 80,
+ burnTime: 200,
+ category: "powders",
+ state: "solid",
+ density: 45
+},
+
elements.basket = {
- color: ["#88665d","#bcaa99","#c2b97f"],
- behavior: behaviors.POWDER,
+ hidden:true,
+ color: ["#88665d","#bcaa99"],
+ behavior: behaviors.STURDYPOWDER,
tempHigh: 400,
stateHigh: "fire",
- burn: 35,
+ burn: 55,
burnTime: 210,
burnInto: ["smoke","smoke","smoke","smoke","ash"],
- breakInto: "straw",
+ breakInto: "loose_straw",
category: "human",
state: "solid",
density: 70
},
+elements.pickaxe = {
+ hidden:true,
+ color: ["#71797e","#D8B589"],
+ behavior: behaviors.STURDYPOWDER,
+ colorKey: {
+ "A":"#607d8b",
+ "H":"#91754d",
+ "B":"#a0522d"
+ },
+ colorPattern: [
+ "BBBBBB",
+ "BAABHB",
+ "BBBABB",
+ "BBHBAB",
+ "BHBBAB",
+ "HBBBBB"
+ ],
+ reactions: {
+ "mine_hole": { func:function(pixel,mine){
+ if (isEmpty(pixel.x, pixel.y-1)) {(createPixel("rock", pixel.x, pixel.y-1));}
+ else if (isEmpty(pixel.x-1, pixel.y)) {(createPixel("rock", pixel.x-1, pixel.y));}
+ else if (isEmpty(pixel.x+1, pixel.y)) {(createPixel("rock", pixel.x+1, pixel.y));}
+ }, chance:0.05},
+ },
+ tempHigh: 400,
+ stateHigh: ["rock","rock","ash","charcoal",],
+ burn: 55,
+ burnTime: 210,
+ burnInto: ["rock","rock","rock","rock","ash","charcoal","charcoal","smoke"],
+ breakInto: ["rock","rock","wood","sawdust",],
+ category: "human",
+ state: "solid",
+ density: 70
+},
+
+elements.workbench = {
+ hidden:true,
+ color: ["#a0522d"],
+ behavior: behaviors.STURDYPOWDER,
+ reactions: {
+ "loose_straw": { elem2:"basket", chance:0.25 },
+ "rock": { elem2:"pickaxe", chance:0.1 },
+ "oven": { elem1:"allpurposestation", elem2:null, chance:0.5 },
+ },
+ temp:40,
+ tempHigh: 1000,
+ stateHigh: "magma",
+ category: "human",
+ state: "solid",
+ density: 2550,
+ hardness: 0.2,
+ breakInto: ["sand","gravel","charcoal","ash"]
+},
+
elements.furnace = {
+ hidden:true,
color: ["#808080","#4f4f4f","#949494"],
behavior: behaviors.STURDYPOWDER,
reactions: {
@@ -562,9 +818,11 @@ elements.furnace = {
},
elements.oven = {
+ hidden:true,
color: ["#4f4f4f","#71797e"],
- behavior: behaviors.WALL,
+ behavior: behaviors.STURDYPOWDER,
reactions: {
+ "workbench": { elem1:"allpurposestation", elem2:null, chance:0.5 },
"bird": { elem2:["cooked_meat","cooked_meat","feather"], chance:0.025 },
"meat": { elem2:"cooked_meat", chance:0.1 },
"yolk": { elem2:"hard_yolk", chance:0.1 },
@@ -581,10 +839,115 @@ elements.oven = {
density: 2550,
hardness: 0.5,
breakInto: ["metal_scrap","metal_scrap","charcoal","ash"]
+},
+
+elements.allpurposestation = {
+ hidden:true,
+ name: "workshop_station",
+ color: ["#a0522d","#4f4f4f","#71797e"],
+ behavior: behaviors.STURDYPOWDER,
+ reactions: {
+ "rock": { elem2:"pickaxe", chance:0.5 },
+ "loose_straw": { elem2:"basket", chance:0.5 },
+ "meat": { elem2:"cooked_meat", chance:0.1 },
+ "yolk": { elem2:"hard_yolk", chance:0.1 },
+ "egg": { elem2:"hard_yolk", chance:0.1 },
+ "batter": { elem2:"baked_batter", chance:0.1 },
+ "dough": { elem2:"bread", chance:0.1 },
+ "bread": { elem2:"toast", chance:0.05 },
+ },
+ temp:40,
+ tempHigh: 1000,
+ stateHigh: "magma",
+ category: "human",
+ state: "solid",
+ density: 2550,
+ hardness: 0.2,
+ breakInto: ["sand","gravel","charcoal","ash"]
+},
+
+elements.branchless_tree = {
+ name: "wood",
+ color: "#a59965",
+ behavior: behaviors.WALL,
+ renderer: renderPresets.WOODCHAR,
+ tick: function(pixel) {
+ if (Math.random() < 0.02 && pixel.age > 35) {
+ changePixel(pixel,"tree_branch")
+ }
+ else if (pixel.age > 1000 && Math.random() < 0.05) {
+ changePixel(pixel,"wood");
+ pixel.color = pixelColorPick(pixel, pixel.wc);
+ }
+ pixel.age++;
+ },
+ properties: {
+ "age":0
+ },
+ tempHigh: 400,
+ stateHigh: ["ember","charcoal","fire","fire","fire"],
+ category: "solids",
+ burn: 5,
+ burnTime: 300,
+ burnInto: ["ember","charcoal","fire"],
+ state: "solid",
+ hardness: 0.15,
+ breakInto: "sawdust",
};
+elements.mine_hole = {
+ hidden:true,
+ color: "#363636",
+ behavior: behaviors.STURDYPOWDER,
+ tempHigh: 950,
+ stateHigh: "magma",
+ category: "land",
+ state: "solid",
+ density: 2550,
+ hardness: 0.5,
+ breakInto: ["sand","gravel"]
+},
+
+elements.housefloor1 = {
+ name: "wood",
+ color: "#a0522d",
+ behavior: behaviors.WALL,
+ renderer: renderPresets.WOODCHAR,
+ tempHigh: 400,
+ stateHigh: ["ember","charcoal","fire","fire","fire"],
+ category: "solids",
+ burn: 5,
+ burnTime: 300,
+ burnInto: ["ember","charcoal","fire"],
+ state: "solid",
+ hardness: 0.15,
+ breakInto: "sawdust",
+};
+
+elements.housefloor2 = {
+ name: "wood",
+ color: "#a0522d",
+ behavior: behaviors.WALL,
+ renderer: renderPresets.WOODCHAR,
+ tempHigh: 400,
+ stateHigh: ["ember","charcoal","fire","fire","fire"],
+ category: "solids",
+ burn: 5,
+ burnTime: 300,
+ burnInto: ["ember","charcoal","fire"],
+ state: "solid",
+ hardness: 0.15,
+ breakInto: "sawdust",
+};
+
+elements.straw.breakInto = "loose_straw"
+
elements.human.name = "dummy"
elements.head.name = "brainless_head"
elements.body.name = "dumb_body"
+
+elements.grass.properties.h = 1
+
+elements.rotten_meat.density = 1200
From 866c02a04b530cba16ca0f4eee1b8e2ca67bab16 Mon Sep 17 00:00:00 2001
From: jakob3797 <167775393+jakob3797@users.noreply.github.com>
Date: Mon, 19 Aug 2024 13:43:58 -0500
Subject: [PATCH 39/56] Create Random_quicksands.js
Working and tested
---
mods/Random_quicksands.js | 1242 +++++++++++++++++++++++++++++++++++++
1 file changed, 1242 insertions(+)
create mode 100644 mods/Random_quicksands.js
diff --git a/mods/Random_quicksands.js b/mods/Random_quicksands.js
new file mode 100644
index 00000000..55bdf26d
--- /dev/null
+++ b/mods/Random_quicksands.js
@@ -0,0 +1,1242 @@
+elements.thermoplastic = {
+ color: "#A0522D",
+ behavior: elements.slime.behavior,
+ viscosity: 25000,
+ tempHigh: 80,
+ stateHigh: "liquid",
+ tempLow: 20,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.4
+};
+
+elements.oobleck = {
+ color: "#FF8C00",
+ behavior: elements.slime.behavior,
+ viscosity: 40000,
+ tempHigh: 70,
+ stateHigh: "liquid",
+ tempLow: 15,
+ category: "solids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.5
+};
+
+elements.pudding = {
+ color: "#F5DEB3",
+ behavior: elements.slime.behavior,
+ viscosity: 20000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1050,
+ stain: 0.3
+};
+
+elements.magma = {
+ color: "#FF6347",
+ behavior: elements.slime.behavior,
+ viscosity: 800000,
+ tempHigh: 1200,
+ stateHigh: "liquid",
+ tempLow: 800,
+ category: "liquids",
+ state: "liquid",
+ density: 3000,
+ stain: 1.0
+};
+
+elements.agar = {
+ color: "#F0E68C",
+ behavior: elements.slime.behavior,
+ viscosity: 10000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "solids",
+ state: "liquid",
+ density: 1100,
+ stain: 0.2
+};
+
+elements.xanthamGum = {
+ color: "#F4A460",
+ behavior: elements.slime.behavior,
+ viscosity: 60000,
+ tempHigh: 70,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1050,
+ stain: 0.4
+};
+
+elements.caramel = {
+ color: "#FFD700",
+ behavior: elements.slime.behavior,
+ viscosity: 15000,
+ tempHigh: 45,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.5
+};
+
+elements.molasses = {
+ color: "#4B0082",
+ behavior: elements.slime.behavior,
+ viscosity: 30000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "liquids",
+ state: "liquid",
+ density: 1400,
+ stain: 0.7
+};
+
+elements.syrup = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 20000,
+ tempHigh: 40,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "liquids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.5
+};
+
+elements.hydrogels = {
+ color: "#00CED1",
+ behavior: elements.slime.behavior,
+ viscosity: 5000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1000,
+ stain: 0.2
+};
+
+elements.silicone = {
+ color: "#A9A9A9",
+ behavior: elements.slime.behavior,
+ viscosity: 60000,
+ tempHigh: 80,
+ stateHigh: "liquid",
+ tempLow: 10,
+ category: "solids",
+ state: "liquid",
+ density: 1100,
+ stain: 0.3
+};
+
+elements.jelly = {
+ color: "#C71585",
+ behavior: elements.slime.behavior,
+ viscosity: 20000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1050,
+ stain: 0.4
+};
+
+elements.spandex = {
+ color: "#2E8B57",
+ behavior: elements.slime.behavior,
+ viscosity: 30000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 950,
+ stain: 0.3
+};
+
+elements.polyurethane = {
+ color: "#B0C4DE",
+ behavior: elements.slime.behavior,
+ viscosity: 40000,
+ tempHigh: 70,
+ stateHigh: "liquid",
+ tempLow: 10,
+ category: "solids",
+ state: "liquid",
+ density: 1000,
+ stain: 0.4
+};
+elements.oobleck = {
+ color: "#D3D3D3",
+ behavior: elements.slime.behavior,
+ viscosity: 50000,
+ tempHigh: 40,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "liquids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.1
+};
+
+elements.gum = {
+ color: "#FF69B4",
+ behavior: elements.slime.behavior,
+ viscosity: 20000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 950,
+ stain: 0.5
+};
+
+elements.jello = {
+ color: "#FF4500",
+ behavior: elements.slime.behavior,
+ viscosity: 15000,
+ tempHigh: 40,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1100,
+ stain: 0.3
+};
+
+elements.playDough = {
+ color: "#FFD700",
+ behavior: elements.slime.behavior,
+ viscosity: 30000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 950,
+ stain: 0.4
+};
+
+elements.kineticSand = {
+ color: "#C2B280",
+ behavior: elements.slime.behavior,
+ viscosity: 25000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.2
+};
+
+elements.sillyPutty = {
+ color: "#FF1493",
+ behavior: elements.slime.behavior,
+ viscosity: 100000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -20,
+ category: "solids",
+ state: "liquid",
+ density: 920,
+ stain: 0.6
+};
+
+elements.cheese = {
+ color: "#FFFFE0",
+ behavior: elements.slime.behavior,
+ viscosity: 10000,
+ tempHigh: 40,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 950,
+ stain: 0.2
+};
+
+elements.butter = {
+ color: "#FFD700",
+ behavior: elements.slime.behavior,
+ viscosity: 8000,
+ tempHigh: 35,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 910,
+ stain: 0.3
+};
+
+elements.clay = {
+ color: "#D2B48C",
+ behavior: elements.slime.behavior,
+ viscosity: 8000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 2000,
+ stain: 0.3
+};
+
+elements.resin = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 50000,
+ tempHigh: 70,
+ stateHigh: "liquid",
+ tempLow: 20,
+ category: "liquids",
+ state: "liquid",
+ density: 1100,
+ stain: 0.6
+};
+elements.slurry = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 25000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "liquids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.6
+};
+
+elements.earthPaste = {
+ color: "#A0522D",
+ behavior: elements.slime.behavior,
+ viscosity: 30000,
+ tempHigh: 40,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1400,
+ stain: 0.7
+};
+
+elements.pasteMud = {
+ color: "#6A5ACD",
+ behavior: elements.slime.behavior,
+ viscosity: 20000,
+ tempHigh: 45,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "liquids",
+ state: "liquid",
+ density: 1250,
+ stain: 0.5
+};
+
+elements.bog = {
+ color: "#3B3B3B",
+ behavior: elements.slime.behavior,
+ viscosity: 40000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: 5,
+ category: "solids",
+ state: "liquid",
+ density: 1350,
+ stain: 0.8
+};
+
+elements.slimePutty = {
+ color: "#00FF00",
+ behavior: elements.slime.behavior,
+ viscosity: 50000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1150,
+ stain: 0.6
+};
+
+elements.jelliedMud = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 25000,
+ tempHigh: 40,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.5
+};
+
+elements.fluidsand = {
+ color: "#DEB887",
+ behavior: elements.slime.behavior,
+ viscosity: 30000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1100,
+ stain: 0.3
+};
+
+elements.viscousMud = {
+ color: "#6A5ACD",
+ behavior: elements.slime.behavior,
+ viscosity: 45000,
+ tempHigh: 45,
+ stateHigh: "liquid",
+ tempLow: 5,
+ category: "liquids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.7
+};
+
+elements.earthySlime = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 35000,
+ tempHigh: 40,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "solids",
+ state: "liquid",
+ density: 1250,
+ stain: 0.6
+};
+
+elements.liquidClay = {
+ color: "#D2B48C",
+ behavior: elements.slime.behavior,
+ viscosity: 20000,
+ tempHigh: 45,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "liquids",
+ state: "liquid",
+ density: 1400,
+ stain: 0.5
+};
+
+elements.mudGel = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 30000,
+ tempHigh: 40,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.6
+};
+
+elements.earthySlurry = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 40000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: 5,
+ category: "liquids",
+ state: "liquid",
+ density: 1350,
+ stain: 0.7
+};
+
+elements.peat = {
+ color: "#2F4F4F",
+ behavior: elements.slime.behavior,
+ viscosity: 35000,
+ tempHigh: 45,
+ stateHigh: "liquid",
+ tempLow: 5,
+ category: "solids",
+ state: "liquid",
+ density: 1400,
+ stain: 0.8
+};
+
+elements.earthJelly = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 25000,
+ tempHigh: 40,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "solids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.6
+};
+
+elements.gelMud = {
+ color: "#6A5ACD",
+ behavior: elements.slime.behavior,
+ viscosity: 30000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1250,
+ stain: 0.5
+};
+
+elements.muddyGel = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 35000,
+ tempHigh: 45,
+ stateHigh: "liquid",
+ tempLow: 5,
+ category: "solids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.6
+};
+
+elements.thickSlime = {
+ color: "#2E8B57",
+ behavior: elements.slime.behavior,
+ viscosity: 70000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "solids",
+ state: "liquid",
+ density: 1150,
+ stain: 0.7
+};
+
+elements.siliconeSlime = {
+ color: "#A9A9A9",
+ behavior: elements.slime.behavior,
+ viscosity: 60000,
+ tempHigh: 70,
+ stateHigh: "liquid",
+ tempLow: 10,
+ category: "solids",
+ state: "liquid",
+ density: 1100,
+ stain: 0.5
+};
+
+elements.thickMuddyGel = {
+ color: "#6A5ACD",
+ behavior: elements.slime.behavior,
+ viscosity: 50000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.6
+};
+
+elements.viscousClay = {
+ color: "#D2B48C",
+ behavior: elements.slime.behavior,
+ viscosity: 35000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "solids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.5
+};
+
+elements.earthPaste = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 30000,
+ tempHigh: 45,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1400,
+ stain: 0.7
+};
+
+elements.muddySlurry = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 35000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: 5,
+ category: "liquids",
+ state: "liquid",
+ density: 1350,
+ stain: 0.8
+};
+
+elements.thickMud = {
+ color: "#6A5ACD",
+ behavior: elements.slime.behavior,
+ viscosity: 60000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1400,
+ stain: 0.7
+};
+
+elements.clayMud = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 40000,
+ tempHigh: 45,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "solids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.6
+};
+elements.furryGoo = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 25000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1100,
+ stain: 0.5
+};
+
+elements.augmentedSlime = {
+ color: "#00FF00",
+ behavior: elements.slime.behavior,
+ viscosity: 30000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1000,
+ stain: 0.4
+};
+
+elements.activatedGoo = {
+ color: "#ADFF2F",
+ behavior: elements.slime.behavior,
+ viscosity: 35000,
+ tempHigh: 55,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1050,
+ stain: 0.3
+};
+
+elements.moistClay = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 20000,
+ tempHigh: 40,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.4
+};
+
+elements.gooeyCheese = {
+ color: "#F5DEB3",
+ behavior: elements.slime.behavior,
+ viscosity: 25000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.4
+};
+
+elements.gooeyGlucose = {
+ color: "#FF6347",
+ behavior: elements.slime.behavior,
+ viscosity: 40000,
+ tempHigh: 45,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "liquids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.6
+};
+
+elements.softMud = {
+ color: "#6F4F28",
+ behavior: elements.slime.behavior,
+ viscosity: 30000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1400,
+ stain: 0.7
+};
+
+elements.funkyFungus = {
+ color: "#7CFC00",
+ behavior: elements.slime.behavior,
+ viscosity: 20000,
+ tempHigh: 45,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1000,
+ stain: 0.5
+};
+
+elements.smoothGel = {
+ color: "#00FA9A",
+ behavior: elements.slime.behavior,
+ viscosity: 30000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1100,
+ stain: 0.3
+};
+
+elements.custard = {
+ color: "#F5F5DC",
+ behavior: elements.slime.behavior,
+ viscosity: 15000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1050,
+ stain: 0.3
+};
+
+elements.thermoplastic = {
+ color: "#A0522D",
+ behavior: elements.slime.behavior,
+ viscosity: 25000,
+ tempHigh: 80,
+ stateHigh: "liquid",
+ tempLow: 20,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.4
+};
+
+elements.thermoelastic = {
+ color: "#FF8C00",
+ behavior: elements.slime.behavior,
+ viscosity: 40000,
+ tempHigh: 70,
+ stateHigh: "liquid",
+ tempLow: 15,
+ category: "solids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.5
+};
+
+elements.pudding = {
+ color: "#F5DEB3",
+ behavior: elements.slime.behavior,
+ viscosity: 20000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1050,
+ stain: 0.3
+};
+
+elements.magma = {
+ color: "#FF6347",
+ behavior: elements.slime.behavior,
+ viscosity: 800000,
+ tempHigh: 1200,
+ stateHigh: "liquid",
+ tempLow: 800,
+ category: "liquids",
+ state: "liquid",
+ density: 3000,
+ stain: 1.0
+};
+
+elements.agar = {
+ color: "#F0E68C",
+ behavior: elements.slime.behavior,
+ viscosity: 10000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "solids",
+ state: "liquid",
+ density: 1100,
+ stain: 0.2
+};
+
+elements.xanthamGum = {
+ color: "#F4A460",
+ behavior: elements.slime.behavior,
+ viscosity: 60000,
+ tempHigh: 70,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1050,
+ stain: 0.4
+};
+
+elements.caramel = {
+ color: "#FFD700",
+ behavior: elements.slime.behavior,
+ viscosity: 15000,
+ tempHigh: 45,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.5
+};
+
+elements.molasses = {
+ color: "#4B0082",
+ behavior: elements.slime.behavior,
+ viscosity: 30000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: 0,
+ category: "liquids",
+ state: "liquid",
+ density: 1400,
+ stain: 0.7
+};
+
+elements.syrup = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 20000,
+ tempHigh: 40,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "liquids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.5
+};
+
+elements.hydrogels = {
+ color: "#00CED1",
+ behavior: elements.slime.behavior,
+ viscosity: 5000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1000,
+ stain: 0.2
+};
+
+elements.silicone = {
+ color: "#A9A9A9",
+ behavior: elements.slime.behavior,
+ viscosity: 60000,
+ tempHigh: 80,
+ stateHigh: "liquid",
+ tempLow: 10,
+ category: "solids",
+ state: "liquid",
+ density: 1100,
+ stain: 0.3
+};
+
+elements.jelly = {
+ color: "#C71585",
+ behavior: elements.slime.behavior,
+ viscosity: 20000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1050,
+ stain: 0.4
+};
+
+elements.spandex = {
+ color: "#2E8B57",
+ behavior: elements.slime.behavior,
+ viscosity: 30000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 950,
+ stain: 0.3
+};
+
+elements.polyurethane = {
+ color: "#B0C4DE",
+ behavior: elements.slime.behavior,
+ viscosity: 40000,
+ tempHigh: 70,
+ stateHigh: "liquid",
+ tempLow: 10,
+ category: "solids",
+ state: "liquid",
+ density: 1000,
+ stain: 0.4
+};
+elements.furryGoo1 = {
+ color: "#A0522D",
+ behavior: elements.slime.behavior,
+ viscosity: 20000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1100,
+ stain: 0.5
+};
+
+elements.furryGoo2 = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 25000,
+ tempHigh: 55,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.4
+};
+elements.furryGoo1 = {
+ color: "#A0522D",
+ behavior: elements.slime.behavior,
+ viscosity: 20000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1100,
+ stain: 0.5
+};
+
+elements.furryGoo2 = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 25000,
+ tempHigh: 55,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.4
+};
+
+elements.furryGoo3 = {
+ color: "#6F4F28",
+ behavior: elements.slime.behavior,
+ viscosity: 30000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1250,
+ stain: 0.6
+};
+
+elements.furryGoo4 = {
+ color: "#D2691E",
+ behavior: elements.slime.behavior,
+ viscosity: 22000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1150,
+ stain: 0.5
+};
+
+elements.furryGoo5 = {
+ color: "#F4A460",
+ behavior: elements.slime.behavior,
+ viscosity: 27000,
+ tempHigh: 55,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.6
+};
+
+elements.furryGoo6 = {
+ color: "#C2B280",
+ behavior: elements.slime.behavior,
+ viscosity: 28000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1100,
+ stain: 0.4
+};
+
+elements.furryGoo7 = {
+ color: "#B5651D",
+ behavior: elements.slime.behavior,
+ viscosity: 26000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.5
+};
+
+elements.furryGoo8 = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 25000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1250,
+ stain: 0.6
+};
+
+elements.furryGoo9 = {
+ color: "#A0522D",
+ behavior: elements.slime.behavior,
+ viscosity: 24000,
+ tempHigh: 55,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.5
+};
+
+elements.furryGoo10 = {
+ color: "#F5DEB3",
+ behavior: elements.slime.behavior,
+ viscosity: 23000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.4
+};
+
+elements.furryGoo11 = {
+ color: "#D2B48C",
+ behavior: elements.slime.behavior,
+ viscosity: 25000,
+ tempHigh: 55,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1250,
+ stain: 0.6
+};
+
+elements.furryGoo12 = {
+ color: "#F4A460",
+ behavior: elements.slime.behavior,
+ viscosity: 27000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.7
+};
+
+elements.furryGoo13 = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 24000,
+ tempHigh: 55,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1150,
+ stain: 0.5
+};
+
+elements.furryGoo14 = {
+ color: "#C2B280",
+ behavior: elements.slime.behavior,
+ viscosity: 25000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.4
+};
+
+elements.furryGoo15 = {
+ color: "#D2691E",
+ behavior: elements.slime.behavior,
+ viscosity: 22000,
+ tempHigh: 55,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1250,
+ stain: 0.6
+};
+
+elements.furryGoo16 = {
+ color: "#F5DEB3",
+ behavior: elements.slime.behavior,
+ viscosity: 26000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.7
+};
+
+elements.furryGoo17 = {
+ color: "#B5651D",
+ behavior: elements.slime.behavior,
+ viscosity: 23000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.5
+};
+
+elements.furryGoo18 = {
+ color: "#A0522D",
+ behavior: elements.slime.behavior,
+ viscosity: 24000,
+ tempHigh: 55,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1150,
+ stain: 0.4
+};
+
+elements.furryGoo19 = {
+ color: "#8B4513",
+ behavior: elements.slime.behavior,
+ viscosity: 25000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1300,
+ stain: 0.6
+};
+
+elements.furryGoo20 = {
+ color: "#D2B48C",
+ behavior: elements.slime.behavior,
+ viscosity: 28000,
+ tempHigh: 55,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1250,
+ stain: 0.5
+};
+
+elements.furryGoo21 = {
+ color: "#F4A460",
+ behavior: elements.slime.behavior,
+ viscosity: 27000,
+ tempHigh: 60,
+ stateHigh: "liquid",
+ tempLow: -5,
+ category: "solids",
+ state: "liquid",
+ density: 1200,
+ stain: 0.4
+};
+
+elements.furryGoo22 = {
+ color: "#B5651D",
+ behavior: elements.slime.behavior,
+ viscosity: 26000,
+ tempHigh: 50,
+ stateHigh: "liquid",
+ tempLow: -10,
+ category: "solids",
+ state: "liquid",
+ density: 1150,
+ stain: 0.6
+};
From d8cdb411f0b6295b07b60ecad0e94c150776d733 Mon Sep 17 00:00:00 2001
From: Nekonico <163950752+DBNekonico@users.noreply.github.com>
Date: Tue, 20 Aug 2024 12:46:04 -0700
Subject: [PATCH 40/56] Added my heavily worked on mod to the mod list
just needed a bit more exposure and my mod is pretty high quality in my eyes so I added it to the mod list. If you don't want it there I'm fine with it, but I'd like it there so a few people can see it and use it.
---
mod-list.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/mod-list.html b/mod-list.html
index 23a32119..2b0dcaaa 100644
--- a/mod-list.html
+++ b/mod-list.html
@@ -280,6 +280,7 @@
flowers_and_forests.js adds trees and flowers and things to do with nature pixelegend4 and SquareScreamYT
fwibblen.js Adds a flying creature that turns nickel into itself, and a second creature that does the same to the first one Alice
human_edit.js Improvements to humans Alice
+Humanitize.js Makes humans cultured and able to craft, mine, build houses, trade, and much more. Nekonico
kopalstuff.js Adds creatures, spirits, DNA, foods, and more DaviStudios
lost_souls.js Adds souls and related elements, the mod can also be found on Github pixelegend4, SquareScreamYT, salmonfishy
miscible_psoup_and_birthpool.js Makes Primordial Soup and Birthpool mix instead of the birthpool settling to the bottom. Will be deprecated upon the release of Magical Menagerie Alice
From 3597e2af96e394a84299a9130553a875e635a4e9 Mon Sep 17 00:00:00 2001
From: shad0wdev <145654135+shad0wdev@users.noreply.github.com>
Date: Wed, 21 Aug 2024 07:38:27 +1000
Subject: [PATCH 41/56] Create aussieAdditions.js
---
mods/aussieAdditions.js | 123 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 123 insertions(+)
create mode 100644 mods/aussieAdditions.js
diff --git a/mods/aussieAdditions.js b/mods/aussieAdditions.js
new file mode 100644
index 00000000..d8d3a0e8
--- /dev/null
+++ b/mods/aussieAdditions.js
@@ -0,0 +1,123 @@
+// This is the code for the Sandboxels mod AussieAdditions.
+// All code was written by AussieBox, taken from free-to-use code, or taken from the example mod file found at the bottom of the modlist on the Sandboxels website (sandboxels.r74n.com).
+// Please do not steal this code or any ideas from the mod and claim they are yours!
+// With love, from AussieBox. :]
+// (And that means no copying the file, tampering with one line, re-uploading it and claiming it as yours!)
+
+// Oh, by the way, AA just means AussieAdditions. Any other mods are adressed by their full name, including the ".js" at the end. I just used this to make notes in the code a little shorter and simpler! Hope you understand, fellow github browser. ;]
+
+
+// Log entry (all mods loaded)
+// This code runs after all mods in the Sandboxels instance are loaded.
+
+runAfterLoad(function() {
+ console.log("Mods loaded, Hello World!");
+});
+runAfterLoad(function() {
+ console.log("By the way, thanks for using AussieAdditions!");
+});
+
+
+// Log entry (when using survival.js)
+// This code runs when the instance includes survival.js
+
+if (enabledMods.includes("mods/survival.js")) {
+ runAfterLoad(function() {
+ console.log("AussieAdditions may not entirely support survival.js at the moment. I may add an option in Settings that makes the mod work with survival.js eventually, but it's probably coming in a loooong time. Still, hang tight! :]");
+ });
+}
+
+
+// Log entry (when using subspace.js)
+// This code runs when the instance includes subspace.js
+
+if (enabledMods.includes("mods/subspace.js")) {
+ runAfterLoad(function() {
+ console.log("bruh what");
+ });
+}
+
+
+// Log entry (when using sus.js)
+// This code runs when the instance includes sus.js... why?
+
+if (enabledMods.includes("mods/sus.js")) {
+ runAfterLoad(function() {
+ console.log("bro. that meme died out in 2021.");
+ });
+}
+
+
+
+// Add item (Red Corruption)
+// This code adds the item "red_corruption"
+
+elements.red_corruption = {
+ color: "#db0707",
+ behavior: behaviors.POWDER,
+ category: "corruption",
+ viscosity: 1,
+ state: "powder",
+ density: 100,
+};
+
+// Add item (Blue Corruption)
+// This code adds the item "blue_corruption"
+
+elements.blue_corruption = {
+ color: "#0404bf",
+ behavior: behaviors.POWDER,
+ category: "corruption",
+ viscosity: 1,
+ state: "powder",
+ density: 100,
+};
+
+// Add item (Corruption)
+// This code adds the item "corruption"
+
+elements.blue_corruption = {
+ color: "#4d0991",
+ behavior: behaviors.POWDER,
+ category: "corruption",
+ viscosity: 1,
+ state: "powder",
+ density: 100,
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// Oh, hey! You reached the bottom of the code!
+// Thanks for reviewing (or just scrolling to the bottom of) my code, I appreciate it! (Not if you did the second option.)
+// Anyway, here are some dedications...
+
+// R74N, for creating Sandboxels and keeping it up on their website, despite how much it likely costs...
+
+// My dad, who suggested naming my first YouTube video a reference for all the coders out there by naming it "Hello World!" (He's also the reason I used the famous phrase in the "Log entry (all mods loaded)" section!)
+
+// Me (also known as AussieBox), for coming up with ideas for this mod, writing the code for them, getting frustrated when said code didn't work, asking for help with the code, "borrowing" code from others when nobody helped me, finally getting stuff to work, and filling the massive hellhole known as "the massive amount of bugs that always occur when you write any code, no matter how small"...
+// (It took me so long to make this mod, so I put myself here, deal with it. And if you can't, what are you gonna do about it? >:] *laughs in chaotic silly*)
+
+// My friends, for not caring in the slightest about what I do out of school hours... (this is a joke, dad, i'm fine, I promise)
+
+// The Sandboxels modding community, for creating amazing modifications for our favourite sandbox website...
+
+// And finally... YOU! :]
+
+// Anyway, that's all the dedications, so I'm gonna go now. Hope you enjoy the mod!
+
+// ... and don't forget to subscribe to AussieBox. Gotta get my self promo in somewhere, don't blame me, haha ;P
+// Plus, you can say that you found out about my channel in one of the dumbest ways possible. I don't think many people are going to find me because of a javascript file.
+
+// Uh, anyway, been here too long, my bad. Bye.
From 2c9be5538e3b720da53e8a99ab22a7599764b109 Mon Sep 17 00:00:00 2001
From: Nekonico <163950752+DBNekonico@users.noreply.github.com>
Date: Wed, 21 Aug 2024 11:04:52 -0700
Subject: [PATCH 42/56] Update Humanitize.js
---
mods/Humanitize.js | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/mods/Humanitize.js b/mods/Humanitize.js
index 02540336..32719643 100644
--- a/mods/Humanitize.js
+++ b/mods/Humanitize.js
@@ -1,4 +1,4 @@
-/* mod by nekonico aka doobienecoarc */
+/* mod by nekonico, do not steal without credit */
behaviors.BODY_DELETE = function(pixel) {
if (pixel.willbuildhouse == true) {
@@ -312,7 +312,7 @@ elements.c_body = {
doHeat(pixel);
doBurning(pixel);
doElectricity(pixel);
- if (pixel.dead) {
+ if (pixel.dead) { // by nekonico
// Turn into rotten_meat if pixelTicks-dead > 500
if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) {
changePixel(pixel,"rotten_meat");
@@ -781,9 +781,9 @@ elements.workbench = {
"loose_straw": { elem2:"basket", chance:0.25 },
"rock": { elem2:"pickaxe", chance:0.1 },
"oven": { elem1:"allpurposestation", elem2:null, chance:0.5 },
- },
- temp:40,
- tempHigh: 1000,
+ },// by
+ temp:40, //neko
+ tempHigh: 1000, //nico
stateHigh: "magma",
category: "human",
state: "solid",
@@ -951,3 +951,9 @@ elements.body.name = "dumb_body"
elements.grass.properties.h = 1
elements.rotten_meat.density = 1200
+
+/* yo, thanks for scrolling to the end. If you have any ideas to add to this mod, or wanna contact me in general, you can DM my discord account "nekonico" or just ping me in the r74n discord
+peace
+ ^ ^
+(*w*) /
+*/
From 903b3ced9e11c88d38a1a79879537b68bc604fe7 Mon Sep 17 00:00:00 2001
From: slweeb <91897291+slweeb@users.noreply.github.com>
Date: Thu, 22 Aug 2024 14:05:35 -0400
Subject: [PATCH 43/56] Update Random_quicksands.js
---
mods/Random_quicksands.js | 310 --------------------------------------
1 file changed, 310 deletions(-)
diff --git a/mods/Random_quicksands.js b/mods/Random_quicksands.js
index 55bdf26d..c00c5028 100644
--- a/mods/Random_quicksands.js
+++ b/mods/Random_quicksands.js
@@ -930,313 +930,3 @@ elements.polyurethane = {
density: 1000,
stain: 0.4
};
-elements.furryGoo1 = {
- color: "#A0522D",
- behavior: elements.slime.behavior,
- viscosity: 20000,
- tempHigh: 60,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1100,
- stain: 0.5
-};
-
-elements.furryGoo2 = {
- color: "#8B4513",
- behavior: elements.slime.behavior,
- viscosity: 25000,
- tempHigh: 55,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1200,
- stain: 0.4
-};
-elements.furryGoo1 = {
- color: "#A0522D",
- behavior: elements.slime.behavior,
- viscosity: 20000,
- tempHigh: 60,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1100,
- stain: 0.5
-};
-
-elements.furryGoo2 = {
- color: "#8B4513",
- behavior: elements.slime.behavior,
- viscosity: 25000,
- tempHigh: 55,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1200,
- stain: 0.4
-};
-
-elements.furryGoo3 = {
- color: "#6F4F28",
- behavior: elements.slime.behavior,
- viscosity: 30000,
- tempHigh: 50,
- stateHigh: "liquid",
- tempLow: -5,
- category: "solids",
- state: "liquid",
- density: 1250,
- stain: 0.6
-};
-
-elements.furryGoo4 = {
- color: "#D2691E",
- behavior: elements.slime.behavior,
- viscosity: 22000,
- tempHigh: 60,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1150,
- stain: 0.5
-};
-
-elements.furryGoo5 = {
- color: "#F4A460",
- behavior: elements.slime.behavior,
- viscosity: 27000,
- tempHigh: 55,
- stateHigh: "liquid",
- tempLow: -5,
- category: "solids",
- state: "liquid",
- density: 1300,
- stain: 0.6
-};
-
-elements.furryGoo6 = {
- color: "#C2B280",
- behavior: elements.slime.behavior,
- viscosity: 28000,
- tempHigh: 50,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1100,
- stain: 0.4
-};
-
-elements.furryGoo7 = {
- color: "#B5651D",
- behavior: elements.slime.behavior,
- viscosity: 26000,
- tempHigh: 60,
- stateHigh: "liquid",
- tempLow: -5,
- category: "solids",
- state: "liquid",
- density: 1200,
- stain: 0.5
-};
-
-elements.furryGoo8 = {
- color: "#8B4513",
- behavior: elements.slime.behavior,
- viscosity: 25000,
- tempHigh: 50,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1250,
- stain: 0.6
-};
-
-elements.furryGoo9 = {
- color: "#A0522D",
- behavior: elements.slime.behavior,
- viscosity: 24000,
- tempHigh: 55,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1300,
- stain: 0.5
-};
-
-elements.furryGoo10 = {
- color: "#F5DEB3",
- behavior: elements.slime.behavior,
- viscosity: 23000,
- tempHigh: 50,
- stateHigh: "liquid",
- tempLow: -5,
- category: "solids",
- state: "liquid",
- density: 1200,
- stain: 0.4
-};
-
-elements.furryGoo11 = {
- color: "#D2B48C",
- behavior: elements.slime.behavior,
- viscosity: 25000,
- tempHigh: 55,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1250,
- stain: 0.6
-};
-
-elements.furryGoo12 = {
- color: "#F4A460",
- behavior: elements.slime.behavior,
- viscosity: 27000,
- tempHigh: 60,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1300,
- stain: 0.7
-};
-
-elements.furryGoo13 = {
- color: "#8B4513",
- behavior: elements.slime.behavior,
- viscosity: 24000,
- tempHigh: 55,
- stateHigh: "liquid",
- tempLow: -5,
- category: "solids",
- state: "liquid",
- density: 1150,
- stain: 0.5
-};
-
-elements.furryGoo14 = {
- color: "#C2B280",
- behavior: elements.slime.behavior,
- viscosity: 25000,
- tempHigh: 60,
- stateHigh: "liquid",
- tempLow: -5,
- category: "solids",
- state: "liquid",
- density: 1200,
- stain: 0.4
-};
-
-elements.furryGoo15 = {
- color: "#D2691E",
- behavior: elements.slime.behavior,
- viscosity: 22000,
- tempHigh: 55,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1250,
- stain: 0.6
-};
-
-elements.furryGoo16 = {
- color: "#F5DEB3",
- behavior: elements.slime.behavior,
- viscosity: 26000,
- tempHigh: 60,
- stateHigh: "liquid",
- tempLow: -5,
- category: "solids",
- state: "liquid",
- density: 1300,
- stain: 0.7
-};
-
-elements.furryGoo17 = {
- color: "#B5651D",
- behavior: elements.slime.behavior,
- viscosity: 23000,
- tempHigh: 50,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1200,
- stain: 0.5
-};
-
-elements.furryGoo18 = {
- color: "#A0522D",
- behavior: elements.slime.behavior,
- viscosity: 24000,
- tempHigh: 55,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1150,
- stain: 0.4
-};
-
-elements.furryGoo19 = {
- color: "#8B4513",
- behavior: elements.slime.behavior,
- viscosity: 25000,
- tempHigh: 60,
- stateHigh: "liquid",
- tempLow: -5,
- category: "solids",
- state: "liquid",
- density: 1300,
- stain: 0.6
-};
-
-elements.furryGoo20 = {
- color: "#D2B48C",
- behavior: elements.slime.behavior,
- viscosity: 28000,
- tempHigh: 55,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1250,
- stain: 0.5
-};
-
-elements.furryGoo21 = {
- color: "#F4A460",
- behavior: elements.slime.behavior,
- viscosity: 27000,
- tempHigh: 60,
- stateHigh: "liquid",
- tempLow: -5,
- category: "solids",
- state: "liquid",
- density: 1200,
- stain: 0.4
-};
-
-elements.furryGoo22 = {
- color: "#B5651D",
- behavior: elements.slime.behavior,
- viscosity: 26000,
- tempHigh: 50,
- stateHigh: "liquid",
- tempLow: -10,
- category: "solids",
- state: "liquid",
- density: 1150,
- stain: 0.6
-};
From 5082c23afd81d2c94b992ce0876e61f37814f18e Mon Sep 17 00:00:00 2001
From: Rain <58303213+rainingBrackets@users.noreply.github.com>
Date: Thu, 22 Aug 2024 21:48:47 +0200
Subject: [PATCH 44/56] Add files via upload
---
moving_pixels.js | 179 +++++++++++++++++++++++++++++++++++++++++++++++
nitroglycerin.js | 54 ++++++++++++++
plastic.js | 93 ++++++++++++++++++++++++
3 files changed, 326 insertions(+)
create mode 100644 moving_pixels.js
create mode 100644 nitroglycerin.js
create mode 100644 plastic.js
diff --git a/moving_pixels.js b/moving_pixels.js
new file mode 100644
index 00000000..3c8d6e65
--- /dev/null
+++ b/moving_pixels.js
@@ -0,0 +1,179 @@
+
+// created by Rain :o 20/8 2024
+
+elements.car = {
+ //color: ["#E37F6F", "#B075DF", "#4F8FEF"],
+ color: ["#ee70aa", "#ab33ef", "#5e6eee"],
+ category: "special",
+ density: 10000,
+ state: "solid",
+ tempHigh: 400,
+ stateHigh: ["steel", "molten_plastic", "glass"],
+ breakInto: ["steel", "plastic", "glass_shard"],
+ reactions: {
+ "water": { elem1: "rust", chance: 0.003 },
+ "dirty_water": { elem1: "rust", chance: 0.003 },
+ "salt_water": { elem1: "rust", chance: 0.006 },
+ "grape": { elem2: "juice", chance: 0.1, color2: "#291824" },
+ "tomato": { elem2: "sauce", chance: 0.1 },
+ "egg": { elem2: "yolk", chance: 0.1 },
+ "malware": {elem1: "explosion"},
+ },
+ flippableX: true,
+ tick: function (pixel) {
+
+ if (pixel.carFlip === undefined) {
+ pixel.carFlip = 1; //it's the "pixel." that gives the variable to each car instance, very important :)
+ }
+ tryMove(pixel, pixel.x, pixel.y + 1); //try to move down (fall)
+ if (!isEmpty(pixel.x, pixel.y + 1)) { //if it didn't work (if the car is on the ground):
+
+ if (isEmpty(pixel.x + pixel.carFlip, pixel.y + 1)) {
+ tryMove(pixel, pixel.x + pixel.carFlip, pixel.y + 1); // move diagonally down to avoid falling when going downhill
+ }
+ else if (isEmpty(pixel.x + pixel.carFlip, pixel.y)) {
+ tryMove(pixel, pixel.x + pixel.carFlip, pixel.y); //move to the side (which side is derived from current carFlip state)
+
+ } else if (isEmpty(pixel.x + pixel.carFlip, pixel.y - 1)) {
+ tryMove(pixel, pixel.x + pixel.carFlip, pixel.y - 1); //move diagonally up the hill
+
+ } else { //if no movement possible (like when hitting a wall):
+ pixel.carFlip = pixel.carFlip * -1; // Update carFlip for this car instance
+ }
+
+ doDefaults(pixel);
+ }
+ },
+};
+
+elements.tram = {
+ color: "#93E493",
+ conduct: 1,
+ category: "special",
+ density: 10000,
+ state: "solid",
+ tempHigh: 400,
+ stateHigh: ["molten_aluminum", "molten_plastic", "glass"],
+ breakInto: ["aluminum", "plastic", "glass_shard"],
+ flippableX: true,
+ desc: "Powered by electricity. Can hang on conductive materials for suspension railway",
+ reactions: {
+ "malware": { elem2: "electric" },
+ },
+ tick: function (pixel) {
+
+ if (pixel.tramFlip === undefined) {
+ pixel.tramFlip = 1; //tramFlip works like carFlip for the car
+ }
+
+ if (pixel.charge > 0) { //only if powered by electricity
+
+ if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1) && !isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 2)) {
+ var diUpPixel = pixelMap[pixel.x + 1 * pixel.tramFlip][pixel.y - 2] //establishes the variable. Must be down here because it would crash if there is no diUpPixel
+ if (elements[diUpPixel.element].conduct && diUpPixel.element !== "tram") { //^ is also the reason this is a seperate if statement
+ tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y - 1); //move diagonally upwards if there is support
+ }
+ else {
+ pixel.tramFlip = pixel.tramFlip * -1;
+ }
+ }
+ else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y) && !isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1)) {
+ var sidePixel = pixelMap[pixel.x + 1 * pixel.tramFlip][pixel.y - 1]
+ if (elements[sidePixel.element].conduct && sidePixel.element !== "tram") {
+ tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y); //move to the side if there is support
+ }
+ else {
+ pixel.tramFlip = pixel.tramFlip * -1;
+ }
+ }
+ else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y + 1) && !isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y)) {
+ var diDownPixel = pixelMap[pixel.x + 1 * pixel.tramFlip][pixel.y]
+ if (elements[diDownPixel.element].conduct && diDownPixel.element !== "tram") {
+ tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y + 1); //move diagonally downwards if there is support
+ }
+ else {
+ pixel.tramFlip = pixel.tramFlip * -1;
+ }
+ }
+
+ else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y + 1) && isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y)) {
+ tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y + 1); //move diagonally downwards if there isn't support
+ }
+ else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y) && isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1)) {
+ tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y); //move to the side if there isn't support
+ }
+ else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1) && isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 2)) {
+ tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y - 1); //move diagonally upwards if there isn't support (uphill)
+ }
+ else {
+ pixel.tramFlip = pixel.tramFlip * -1;
+ }
+
+ }
+ else { //if not powered
+ if (!isEmpty(pixel.x, pixel.y - 1)) {
+ var upPixel = pixelMap[pixel.x][pixel.y - 1] //looks at the properties of the pixel above
+ if (elements[upPixel.element].conduct > 0.1 && upPixel.element !== "tram") { //if the pixel above is conductive but not tram
+ //nothing happens ie it doesn't fall
+ }
+ else {
+ tryMove(pixel, pixel.x, pixel.y + 1); //it falls down
+ }
+ }
+ else {
+ tryMove(pixel, pixel.x, pixel.y + 1); //it falls down (same as above)
+ }
+
+ }
+ doDefaults(pixel)
+ },
+};
+elements.bouncy_ball = {
+ color: "#e35693",
+ behavior: behaviors.WALL,
+ tempHigh: 250,
+ stateHigh: ["borax", "glue"],
+ category: "special",
+ conduct: 1,
+ tick: function (pixel) {
+ if (pixel.fallDist === undefined) {
+ pixel.fallDist = 0;
+ }
+ if (pixel.isFalling === undefined) {
+ pixel.isFalling = true;
+ }
+
+ if (pixel.isFalling) { //main loop of a bouncy ball. Functions are defined below
+ falling()
+ } else {
+ rising()
+ }
+ if (pixel.charge > 0) { //will bounce on electricity (doesn't work on real bouncy balls :/)
+ pixel.fallDist = (pixel.fallDist + 1)
+ rising()
+ }
+
+ function falling() {
+
+ if (isEmpty(pixel.x, pixel.y + 1)) {
+ tryMove(pixel, pixel.x, pixel.y + 1)
+ pixel.fallDist += 1; //counts how many pixels the ball has fallen so far
+ } else { //if it touched the ground
+ pixel.isFalling = false; //will change the outcome of the main if statement and make ball start rising
+ pixel.fallDist = pixel.fallDist * 3 / 4; //dynamically decreases bounce height based on how high it is, instead of constant 1 per bounce
+ }
+ }
+ function rising() {
+ if (pixel.fallDist > 0) {
+ tryMove(pixel, pixel.x, pixel.y - 1)
+ pixel.fallDist -= 1
+ } else {
+ pixel.isFalling = true;
+ pixel.fallDist -= 1 //makes the ball lose 1 pixel height each bounce, useful at the end when * 3/4 only results in fractions
+ }
+
+ }
+
+ }
+};
+elements.borax.reactions.slime = { elem1: "bouncy_ball", elem2: null};
\ No newline at end of file
diff --git a/nitroglycerin.js b/nitroglycerin.js
new file mode 100644
index 00000000..97befd1a
--- /dev/null
+++ b/nitroglycerin.js
@@ -0,0 +1,54 @@
+
+// created by Rain :o 20/8 2024
+
+elements.glycerol = {
+ color: "#eeeeee",
+ behavior: behaviors.LIQUID,
+ viscosity: 1412,
+ category: "liquids",
+ state: "liquid",
+ density: 1261,
+ tempLow: 18,
+ tempHigh: 290,
+ tick: function (pixel) {
+ pixel.color = "rgba(250, 250, 250, 0.7)";
+ },
+ reactions: {
+ },
+ burn: 5,
+ burnTime: 40,
+};
+
+elements.nitro.tempHigh = 218; //More accurate detonation temperature
+elements.salt_water.tempLow = -20; //melting point depression
+
+elements.nitro.tick = function (pixel) { // Exothermic decomposition of nitroglycerin when above 60
+ if (pixel.temp > 60) {
+ pixel.temp += 1;
+ if (Math.random() > 0.999) {
+ var possibleElements = ["oxygen", "nitrogen", "nitrogen", "steam", "steam", "steam", "carbon_dioxide", "carbon_dioxide", "carbon_dioxide"]; //array of possibilities for changing the nitroglycerin pixel
+
+ var randomElement = possibleElements[Math.floor(Math.random() * possibleElements.length)]; //randomly selecting an element from the array
+
+ changePixel(pixel, randomElement); // Change the pixel to the randomly selected element
+ }
+ }
+}
+
+if (enabledMods.includes("mods/chem.js")) {
+ runAfterLoad(function () {
+ elements.glycerol.reactions.nitric_acid = { elem1: "nitro", chance: 0.05, temp1: 70 }; //nitric acid nitrates glycerol to make nitroglycerin
+ elements.nitric_acid.ignore.push("glycerol", "nitro") //added my glycerol and nitro to allow for making nitroglycerin
+
+ elements.copper.reactions.sulfuric_acid = { elem1: "copper_sulfate", elem2: null, chance: 0.1 }; //this is how you can actually make CuSO4
+ elements.sulfuric_acid.ignore.push("copper_sulfate")
+
+ elements.grease.reactions.sodium_hydroxide = { elem1: "soap", elem2: "null", chance: 0.04, tempMin: 40 };
+ elements.sodium_hydroxide.ignore.push("grease", "soap", "fat");
+
+
+ });
+} else {
+ elements.glycerol.reactions.acid = { elem1: "nitro", chance: 0.05, temp1: 70 }; //if we don't have nitric acid from chem.js, "acid" is a good approximation
+ elements.acid.ignore.push("glycerol", "nitro")
+}
\ No newline at end of file
diff --git a/plastic.js b/plastic.js
new file mode 100644
index 00000000..ed90927b
--- /dev/null
+++ b/plastic.js
@@ -0,0 +1,93 @@
+
+// created by Rain :o 20/8 2024
+
+elements.water_bottle = {
+ color: "#a8d2e3",
+ behavior: behaviors.STURDYPOWDER,
+ category: "powders",
+ state: "solid",
+ density: 800,
+ breakInto: ["water_everywhere", "water_everywhere", "water_everywhere", "water_everywhere", "microplastic"],
+ tempHigh: 250,
+ stateHigh: ["molten_plastic", "water_everywhere", "water_everywhere"],
+};
+elements.head.reactions.water_bottle = { elem2: ["plastic", "water", null, null, null], chance: 0.1 };
+elements.body.reactions.water_bottle = { elem2: ["plastic", "water", null, null, null], chance: 0.1 };
+
+elements.water_everywhere = {
+ color: "#8882e3",
+ behavior: [
+ "CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water",
+ "CR:water_everywhere%20 AND CR:water|XX%20 AND CH:water|CR:water_everywhere%20 AND CR:water",
+ "CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water",
+ ],
+ category: "liquids",
+ state: "solid",
+ density: 800,
+ hidden: true,
+};
+elements.microplastic = {
+ color: ["#adc7c9", "#cadadb", "#6cbda8", "#62d5d4", "#b3b47b"],
+ behavior: [
+ "XX|XX|XX",
+ "XX|XX|XX",
+ "M2%25|M1%50|M2%25",
+ ],
+ category: "powders",
+ state: "solid",
+ density: 700,
+ tempHigh: 250,
+ stateHigh: "molten_plastic",
+ reactions: {
+ "fish": { elem1: null, elem2: "meat", chance: 0.01 },
+ "glue": { elem1: "bead", elem2: null, chance: 0.03 },
+ },
+};
+elements.plastic.breakInto = "microplastic";
+
+elements.cellulose.reactions.vinegar = { elem1: "bioplastic", elem2: null, tempMin: 40, chance: 0.1};
+
+elements.bioplastic = {
+ color: "#eeeeaa",
+ behavior: behaviors.WALL,
+ category: "solids",
+ tempHigh: 180,
+ stateHigh: "molten_bioplastic",
+ breakInto: "bioplastic_crumbs",
+ alias: "Cellulose acetate",
+ desc: "It's biodegradable :)",
+};
+elements.bioplastic_crumbs = {
+ color: ["#dfd499", "#c0e8a0", "#dfab87"],
+ hidden: true,
+ behavior: behaviors.POWDER,
+ category: "powders",
+ tempHigh: 180,
+ stateHigh: "molten_bioplastic",
+ desc: "small pieces of cellulose acetate"
+};
+
+elements.worm.reactions.bioplastic = { elem2: ["carbon_dioxide", null, null], chance: 0.05, func: behaviors.FEEDPIXEL };
+elements.worm.reactions.bioplastic_crumbs = { elem2: ["carbon_dioxide", null, null], chance: 0.05, func: behaviors.FEEDPIXEL };
+elements.worm.behavior = [
+ "SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic%3|XX|SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic,bioplastic_crumbs%3",
+ "M2%10|XX|M2%10",
+ "SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic%3|M1|SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic,bioplastic_crumbs%3",
+];
+elements.cell.reactions.bioplastic = { elem2: ["carbon_dioxide", null, null], chance: 0.02, func: behaviors.FEEDPIXEL };
+elements.cell.reactions.bioplastic_crumbs = { elem2: ["carbon_dioxide", null, null], chance: 0.02, func: behaviors.FEEDPIXEL };
+
+elements.molten_bioplastic = {
+ color: "#ccccac",
+ behavior: behaviors.LIQUID,
+ viscosity: 300,
+ category: "states",
+ state: "liquid",
+ tempLow: 150,
+ stateLow: "bioplastic",
+ temp: 160,
+ density: 1300,
+ hidden: true,
+};
+
+
From 150ff5e1ef5b3d416c130fcbe7fe037dc26e38d0 Mon Sep 17 00:00:00 2001
From: Rain <58303213+rainingBrackets@users.noreply.github.com>
Date: Thu, 22 Aug 2024 21:52:39 +0200
Subject: [PATCH 45/56] Add files via upload
---
mods/moving_pixels.js | 179 ++++++++++++++++++++++++++++++++++++++++++
mods/nitroglycerin.js | 54 +++++++++++++
mods/plastic.js | 93 ++++++++++++++++++++++
3 files changed, 326 insertions(+)
create mode 100644 mods/moving_pixels.js
create mode 100644 mods/nitroglycerin.js
create mode 100644 mods/plastic.js
diff --git a/mods/moving_pixels.js b/mods/moving_pixels.js
new file mode 100644
index 00000000..3c8d6e65
--- /dev/null
+++ b/mods/moving_pixels.js
@@ -0,0 +1,179 @@
+
+// created by Rain :o 20/8 2024
+
+elements.car = {
+ //color: ["#E37F6F", "#B075DF", "#4F8FEF"],
+ color: ["#ee70aa", "#ab33ef", "#5e6eee"],
+ category: "special",
+ density: 10000,
+ state: "solid",
+ tempHigh: 400,
+ stateHigh: ["steel", "molten_plastic", "glass"],
+ breakInto: ["steel", "plastic", "glass_shard"],
+ reactions: {
+ "water": { elem1: "rust", chance: 0.003 },
+ "dirty_water": { elem1: "rust", chance: 0.003 },
+ "salt_water": { elem1: "rust", chance: 0.006 },
+ "grape": { elem2: "juice", chance: 0.1, color2: "#291824" },
+ "tomato": { elem2: "sauce", chance: 0.1 },
+ "egg": { elem2: "yolk", chance: 0.1 },
+ "malware": {elem1: "explosion"},
+ },
+ flippableX: true,
+ tick: function (pixel) {
+
+ if (pixel.carFlip === undefined) {
+ pixel.carFlip = 1; //it's the "pixel." that gives the variable to each car instance, very important :)
+ }
+ tryMove(pixel, pixel.x, pixel.y + 1); //try to move down (fall)
+ if (!isEmpty(pixel.x, pixel.y + 1)) { //if it didn't work (if the car is on the ground):
+
+ if (isEmpty(pixel.x + pixel.carFlip, pixel.y + 1)) {
+ tryMove(pixel, pixel.x + pixel.carFlip, pixel.y + 1); // move diagonally down to avoid falling when going downhill
+ }
+ else if (isEmpty(pixel.x + pixel.carFlip, pixel.y)) {
+ tryMove(pixel, pixel.x + pixel.carFlip, pixel.y); //move to the side (which side is derived from current carFlip state)
+
+ } else if (isEmpty(pixel.x + pixel.carFlip, pixel.y - 1)) {
+ tryMove(pixel, pixel.x + pixel.carFlip, pixel.y - 1); //move diagonally up the hill
+
+ } else { //if no movement possible (like when hitting a wall):
+ pixel.carFlip = pixel.carFlip * -1; // Update carFlip for this car instance
+ }
+
+ doDefaults(pixel);
+ }
+ },
+};
+
+elements.tram = {
+ color: "#93E493",
+ conduct: 1,
+ category: "special",
+ density: 10000,
+ state: "solid",
+ tempHigh: 400,
+ stateHigh: ["molten_aluminum", "molten_plastic", "glass"],
+ breakInto: ["aluminum", "plastic", "glass_shard"],
+ flippableX: true,
+ desc: "Powered by electricity. Can hang on conductive materials for suspension railway",
+ reactions: {
+ "malware": { elem2: "electric" },
+ },
+ tick: function (pixel) {
+
+ if (pixel.tramFlip === undefined) {
+ pixel.tramFlip = 1; //tramFlip works like carFlip for the car
+ }
+
+ if (pixel.charge > 0) { //only if powered by electricity
+
+ if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1) && !isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 2)) {
+ var diUpPixel = pixelMap[pixel.x + 1 * pixel.tramFlip][pixel.y - 2] //establishes the variable. Must be down here because it would crash if there is no diUpPixel
+ if (elements[diUpPixel.element].conduct && diUpPixel.element !== "tram") { //^ is also the reason this is a seperate if statement
+ tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y - 1); //move diagonally upwards if there is support
+ }
+ else {
+ pixel.tramFlip = pixel.tramFlip * -1;
+ }
+ }
+ else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y) && !isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1)) {
+ var sidePixel = pixelMap[pixel.x + 1 * pixel.tramFlip][pixel.y - 1]
+ if (elements[sidePixel.element].conduct && sidePixel.element !== "tram") {
+ tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y); //move to the side if there is support
+ }
+ else {
+ pixel.tramFlip = pixel.tramFlip * -1;
+ }
+ }
+ else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y + 1) && !isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y)) {
+ var diDownPixel = pixelMap[pixel.x + 1 * pixel.tramFlip][pixel.y]
+ if (elements[diDownPixel.element].conduct && diDownPixel.element !== "tram") {
+ tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y + 1); //move diagonally downwards if there is support
+ }
+ else {
+ pixel.tramFlip = pixel.tramFlip * -1;
+ }
+ }
+
+ else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y + 1) && isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y)) {
+ tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y + 1); //move diagonally downwards if there isn't support
+ }
+ else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y) && isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1)) {
+ tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y); //move to the side if there isn't support
+ }
+ else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1) && isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 2)) {
+ tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y - 1); //move diagonally upwards if there isn't support (uphill)
+ }
+ else {
+ pixel.tramFlip = pixel.tramFlip * -1;
+ }
+
+ }
+ else { //if not powered
+ if (!isEmpty(pixel.x, pixel.y - 1)) {
+ var upPixel = pixelMap[pixel.x][pixel.y - 1] //looks at the properties of the pixel above
+ if (elements[upPixel.element].conduct > 0.1 && upPixel.element !== "tram") { //if the pixel above is conductive but not tram
+ //nothing happens ie it doesn't fall
+ }
+ else {
+ tryMove(pixel, pixel.x, pixel.y + 1); //it falls down
+ }
+ }
+ else {
+ tryMove(pixel, pixel.x, pixel.y + 1); //it falls down (same as above)
+ }
+
+ }
+ doDefaults(pixel)
+ },
+};
+elements.bouncy_ball = {
+ color: "#e35693",
+ behavior: behaviors.WALL,
+ tempHigh: 250,
+ stateHigh: ["borax", "glue"],
+ category: "special",
+ conduct: 1,
+ tick: function (pixel) {
+ if (pixel.fallDist === undefined) {
+ pixel.fallDist = 0;
+ }
+ if (pixel.isFalling === undefined) {
+ pixel.isFalling = true;
+ }
+
+ if (pixel.isFalling) { //main loop of a bouncy ball. Functions are defined below
+ falling()
+ } else {
+ rising()
+ }
+ if (pixel.charge > 0) { //will bounce on electricity (doesn't work on real bouncy balls :/)
+ pixel.fallDist = (pixel.fallDist + 1)
+ rising()
+ }
+
+ function falling() {
+
+ if (isEmpty(pixel.x, pixel.y + 1)) {
+ tryMove(pixel, pixel.x, pixel.y + 1)
+ pixel.fallDist += 1; //counts how many pixels the ball has fallen so far
+ } else { //if it touched the ground
+ pixel.isFalling = false; //will change the outcome of the main if statement and make ball start rising
+ pixel.fallDist = pixel.fallDist * 3 / 4; //dynamically decreases bounce height based on how high it is, instead of constant 1 per bounce
+ }
+ }
+ function rising() {
+ if (pixel.fallDist > 0) {
+ tryMove(pixel, pixel.x, pixel.y - 1)
+ pixel.fallDist -= 1
+ } else {
+ pixel.isFalling = true;
+ pixel.fallDist -= 1 //makes the ball lose 1 pixel height each bounce, useful at the end when * 3/4 only results in fractions
+ }
+
+ }
+
+ }
+};
+elements.borax.reactions.slime = { elem1: "bouncy_ball", elem2: null};
\ No newline at end of file
diff --git a/mods/nitroglycerin.js b/mods/nitroglycerin.js
new file mode 100644
index 00000000..97befd1a
--- /dev/null
+++ b/mods/nitroglycerin.js
@@ -0,0 +1,54 @@
+
+// created by Rain :o 20/8 2024
+
+elements.glycerol = {
+ color: "#eeeeee",
+ behavior: behaviors.LIQUID,
+ viscosity: 1412,
+ category: "liquids",
+ state: "liquid",
+ density: 1261,
+ tempLow: 18,
+ tempHigh: 290,
+ tick: function (pixel) {
+ pixel.color = "rgba(250, 250, 250, 0.7)";
+ },
+ reactions: {
+ },
+ burn: 5,
+ burnTime: 40,
+};
+
+elements.nitro.tempHigh = 218; //More accurate detonation temperature
+elements.salt_water.tempLow = -20; //melting point depression
+
+elements.nitro.tick = function (pixel) { // Exothermic decomposition of nitroglycerin when above 60
+ if (pixel.temp > 60) {
+ pixel.temp += 1;
+ if (Math.random() > 0.999) {
+ var possibleElements = ["oxygen", "nitrogen", "nitrogen", "steam", "steam", "steam", "carbon_dioxide", "carbon_dioxide", "carbon_dioxide"]; //array of possibilities for changing the nitroglycerin pixel
+
+ var randomElement = possibleElements[Math.floor(Math.random() * possibleElements.length)]; //randomly selecting an element from the array
+
+ changePixel(pixel, randomElement); // Change the pixel to the randomly selected element
+ }
+ }
+}
+
+if (enabledMods.includes("mods/chem.js")) {
+ runAfterLoad(function () {
+ elements.glycerol.reactions.nitric_acid = { elem1: "nitro", chance: 0.05, temp1: 70 }; //nitric acid nitrates glycerol to make nitroglycerin
+ elements.nitric_acid.ignore.push("glycerol", "nitro") //added my glycerol and nitro to allow for making nitroglycerin
+
+ elements.copper.reactions.sulfuric_acid = { elem1: "copper_sulfate", elem2: null, chance: 0.1 }; //this is how you can actually make CuSO4
+ elements.sulfuric_acid.ignore.push("copper_sulfate")
+
+ elements.grease.reactions.sodium_hydroxide = { elem1: "soap", elem2: "null", chance: 0.04, tempMin: 40 };
+ elements.sodium_hydroxide.ignore.push("grease", "soap", "fat");
+
+
+ });
+} else {
+ elements.glycerol.reactions.acid = { elem1: "nitro", chance: 0.05, temp1: 70 }; //if we don't have nitric acid from chem.js, "acid" is a good approximation
+ elements.acid.ignore.push("glycerol", "nitro")
+}
\ No newline at end of file
diff --git a/mods/plastic.js b/mods/plastic.js
new file mode 100644
index 00000000..ed90927b
--- /dev/null
+++ b/mods/plastic.js
@@ -0,0 +1,93 @@
+
+// created by Rain :o 20/8 2024
+
+elements.water_bottle = {
+ color: "#a8d2e3",
+ behavior: behaviors.STURDYPOWDER,
+ category: "powders",
+ state: "solid",
+ density: 800,
+ breakInto: ["water_everywhere", "water_everywhere", "water_everywhere", "water_everywhere", "microplastic"],
+ tempHigh: 250,
+ stateHigh: ["molten_plastic", "water_everywhere", "water_everywhere"],
+};
+elements.head.reactions.water_bottle = { elem2: ["plastic", "water", null, null, null], chance: 0.1 };
+elements.body.reactions.water_bottle = { elem2: ["plastic", "water", null, null, null], chance: 0.1 };
+
+elements.water_everywhere = {
+ color: "#8882e3",
+ behavior: [
+ "CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water",
+ "CR:water_everywhere%20 AND CR:water|XX%20 AND CH:water|CR:water_everywhere%20 AND CR:water",
+ "CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water",
+ ],
+ category: "liquids",
+ state: "solid",
+ density: 800,
+ hidden: true,
+};
+elements.microplastic = {
+ color: ["#adc7c9", "#cadadb", "#6cbda8", "#62d5d4", "#b3b47b"],
+ behavior: [
+ "XX|XX|XX",
+ "XX|XX|XX",
+ "M2%25|M1%50|M2%25",
+ ],
+ category: "powders",
+ state: "solid",
+ density: 700,
+ tempHigh: 250,
+ stateHigh: "molten_plastic",
+ reactions: {
+ "fish": { elem1: null, elem2: "meat", chance: 0.01 },
+ "glue": { elem1: "bead", elem2: null, chance: 0.03 },
+ },
+};
+elements.plastic.breakInto = "microplastic";
+
+elements.cellulose.reactions.vinegar = { elem1: "bioplastic", elem2: null, tempMin: 40, chance: 0.1};
+
+elements.bioplastic = {
+ color: "#eeeeaa",
+ behavior: behaviors.WALL,
+ category: "solids",
+ tempHigh: 180,
+ stateHigh: "molten_bioplastic",
+ breakInto: "bioplastic_crumbs",
+ alias: "Cellulose acetate",
+ desc: "It's biodegradable :)",
+};
+elements.bioplastic_crumbs = {
+ color: ["#dfd499", "#c0e8a0", "#dfab87"],
+ hidden: true,
+ behavior: behaviors.POWDER,
+ category: "powders",
+ tempHigh: 180,
+ stateHigh: "molten_bioplastic",
+ desc: "small pieces of cellulose acetate"
+};
+
+elements.worm.reactions.bioplastic = { elem2: ["carbon_dioxide", null, null], chance: 0.05, func: behaviors.FEEDPIXEL };
+elements.worm.reactions.bioplastic_crumbs = { elem2: ["carbon_dioxide", null, null], chance: 0.05, func: behaviors.FEEDPIXEL };
+elements.worm.behavior = [
+ "SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic%3|XX|SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic,bioplastic_crumbs%3",
+ "M2%10|XX|M2%10",
+ "SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic%3|M1|SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic,bioplastic_crumbs%3",
+];
+elements.cell.reactions.bioplastic = { elem2: ["carbon_dioxide", null, null], chance: 0.02, func: behaviors.FEEDPIXEL };
+elements.cell.reactions.bioplastic_crumbs = { elem2: ["carbon_dioxide", null, null], chance: 0.02, func: behaviors.FEEDPIXEL };
+
+elements.molten_bioplastic = {
+ color: "#ccccac",
+ behavior: behaviors.LIQUID,
+ viscosity: 300,
+ category: "states",
+ state: "liquid",
+ tempLow: 150,
+ stateLow: "bioplastic",
+ temp: 160,
+ density: 1300,
+ hidden: true,
+};
+
+
From 7df6ea9f1857ee1f335771b4a08ed05c5dbfa27e Mon Sep 17 00:00:00 2001
From: Rain <58303213+rainingBrackets@users.noreply.github.com>
Date: Thu, 22 Aug 2024 21:53:56 +0200
Subject: [PATCH 46/56] Delete nitroglycerin.js
---
nitroglycerin.js | 54 ------------------------------------------------
1 file changed, 54 deletions(-)
delete mode 100644 nitroglycerin.js
diff --git a/nitroglycerin.js b/nitroglycerin.js
deleted file mode 100644
index 97befd1a..00000000
--- a/nitroglycerin.js
+++ /dev/null
@@ -1,54 +0,0 @@
-
-// created by Rain :o 20/8 2024
-
-elements.glycerol = {
- color: "#eeeeee",
- behavior: behaviors.LIQUID,
- viscosity: 1412,
- category: "liquids",
- state: "liquid",
- density: 1261,
- tempLow: 18,
- tempHigh: 290,
- tick: function (pixel) {
- pixel.color = "rgba(250, 250, 250, 0.7)";
- },
- reactions: {
- },
- burn: 5,
- burnTime: 40,
-};
-
-elements.nitro.tempHigh = 218; //More accurate detonation temperature
-elements.salt_water.tempLow = -20; //melting point depression
-
-elements.nitro.tick = function (pixel) { // Exothermic decomposition of nitroglycerin when above 60
- if (pixel.temp > 60) {
- pixel.temp += 1;
- if (Math.random() > 0.999) {
- var possibleElements = ["oxygen", "nitrogen", "nitrogen", "steam", "steam", "steam", "carbon_dioxide", "carbon_dioxide", "carbon_dioxide"]; //array of possibilities for changing the nitroglycerin pixel
-
- var randomElement = possibleElements[Math.floor(Math.random() * possibleElements.length)]; //randomly selecting an element from the array
-
- changePixel(pixel, randomElement); // Change the pixel to the randomly selected element
- }
- }
-}
-
-if (enabledMods.includes("mods/chem.js")) {
- runAfterLoad(function () {
- elements.glycerol.reactions.nitric_acid = { elem1: "nitro", chance: 0.05, temp1: 70 }; //nitric acid nitrates glycerol to make nitroglycerin
- elements.nitric_acid.ignore.push("glycerol", "nitro") //added my glycerol and nitro to allow for making nitroglycerin
-
- elements.copper.reactions.sulfuric_acid = { elem1: "copper_sulfate", elem2: null, chance: 0.1 }; //this is how you can actually make CuSO4
- elements.sulfuric_acid.ignore.push("copper_sulfate")
-
- elements.grease.reactions.sodium_hydroxide = { elem1: "soap", elem2: "null", chance: 0.04, tempMin: 40 };
- elements.sodium_hydroxide.ignore.push("grease", "soap", "fat");
-
-
- });
-} else {
- elements.glycerol.reactions.acid = { elem1: "nitro", chance: 0.05, temp1: 70 }; //if we don't have nitric acid from chem.js, "acid" is a good approximation
- elements.acid.ignore.push("glycerol", "nitro")
-}
\ No newline at end of file
From cf5bee5b403ffa79c2577709a0fa193bc0c157fa Mon Sep 17 00:00:00 2001
From: Rain <58303213+rainingBrackets@users.noreply.github.com>
Date: Thu, 22 Aug 2024 21:54:56 +0200
Subject: [PATCH 47/56] Delete moving_pixels.js
---
moving_pixels.js | 179 -----------------------------------------------
1 file changed, 179 deletions(-)
delete mode 100644 moving_pixels.js
diff --git a/moving_pixels.js b/moving_pixels.js
deleted file mode 100644
index 3c8d6e65..00000000
--- a/moving_pixels.js
+++ /dev/null
@@ -1,179 +0,0 @@
-
-// created by Rain :o 20/8 2024
-
-elements.car = {
- //color: ["#E37F6F", "#B075DF", "#4F8FEF"],
- color: ["#ee70aa", "#ab33ef", "#5e6eee"],
- category: "special",
- density: 10000,
- state: "solid",
- tempHigh: 400,
- stateHigh: ["steel", "molten_plastic", "glass"],
- breakInto: ["steel", "plastic", "glass_shard"],
- reactions: {
- "water": { elem1: "rust", chance: 0.003 },
- "dirty_water": { elem1: "rust", chance: 0.003 },
- "salt_water": { elem1: "rust", chance: 0.006 },
- "grape": { elem2: "juice", chance: 0.1, color2: "#291824" },
- "tomato": { elem2: "sauce", chance: 0.1 },
- "egg": { elem2: "yolk", chance: 0.1 },
- "malware": {elem1: "explosion"},
- },
- flippableX: true,
- tick: function (pixel) {
-
- if (pixel.carFlip === undefined) {
- pixel.carFlip = 1; //it's the "pixel." that gives the variable to each car instance, very important :)
- }
- tryMove(pixel, pixel.x, pixel.y + 1); //try to move down (fall)
- if (!isEmpty(pixel.x, pixel.y + 1)) { //if it didn't work (if the car is on the ground):
-
- if (isEmpty(pixel.x + pixel.carFlip, pixel.y + 1)) {
- tryMove(pixel, pixel.x + pixel.carFlip, pixel.y + 1); // move diagonally down to avoid falling when going downhill
- }
- else if (isEmpty(pixel.x + pixel.carFlip, pixel.y)) {
- tryMove(pixel, pixel.x + pixel.carFlip, pixel.y); //move to the side (which side is derived from current carFlip state)
-
- } else if (isEmpty(pixel.x + pixel.carFlip, pixel.y - 1)) {
- tryMove(pixel, pixel.x + pixel.carFlip, pixel.y - 1); //move diagonally up the hill
-
- } else { //if no movement possible (like when hitting a wall):
- pixel.carFlip = pixel.carFlip * -1; // Update carFlip for this car instance
- }
-
- doDefaults(pixel);
- }
- },
-};
-
-elements.tram = {
- color: "#93E493",
- conduct: 1,
- category: "special",
- density: 10000,
- state: "solid",
- tempHigh: 400,
- stateHigh: ["molten_aluminum", "molten_plastic", "glass"],
- breakInto: ["aluminum", "plastic", "glass_shard"],
- flippableX: true,
- desc: "Powered by electricity. Can hang on conductive materials for suspension railway",
- reactions: {
- "malware": { elem2: "electric" },
- },
- tick: function (pixel) {
-
- if (pixel.tramFlip === undefined) {
- pixel.tramFlip = 1; //tramFlip works like carFlip for the car
- }
-
- if (pixel.charge > 0) { //only if powered by electricity
-
- if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1) && !isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 2)) {
- var diUpPixel = pixelMap[pixel.x + 1 * pixel.tramFlip][pixel.y - 2] //establishes the variable. Must be down here because it would crash if there is no diUpPixel
- if (elements[diUpPixel.element].conduct && diUpPixel.element !== "tram") { //^ is also the reason this is a seperate if statement
- tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y - 1); //move diagonally upwards if there is support
- }
- else {
- pixel.tramFlip = pixel.tramFlip * -1;
- }
- }
- else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y) && !isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1)) {
- var sidePixel = pixelMap[pixel.x + 1 * pixel.tramFlip][pixel.y - 1]
- if (elements[sidePixel.element].conduct && sidePixel.element !== "tram") {
- tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y); //move to the side if there is support
- }
- else {
- pixel.tramFlip = pixel.tramFlip * -1;
- }
- }
- else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y + 1) && !isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y)) {
- var diDownPixel = pixelMap[pixel.x + 1 * pixel.tramFlip][pixel.y]
- if (elements[diDownPixel.element].conduct && diDownPixel.element !== "tram") {
- tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y + 1); //move diagonally downwards if there is support
- }
- else {
- pixel.tramFlip = pixel.tramFlip * -1;
- }
- }
-
- else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y + 1) && isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y)) {
- tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y + 1); //move diagonally downwards if there isn't support
- }
- else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y) && isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1)) {
- tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y); //move to the side if there isn't support
- }
- else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1) && isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 2)) {
- tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y - 1); //move diagonally upwards if there isn't support (uphill)
- }
- else {
- pixel.tramFlip = pixel.tramFlip * -1;
- }
-
- }
- else { //if not powered
- if (!isEmpty(pixel.x, pixel.y - 1)) {
- var upPixel = pixelMap[pixel.x][pixel.y - 1] //looks at the properties of the pixel above
- if (elements[upPixel.element].conduct > 0.1 && upPixel.element !== "tram") { //if the pixel above is conductive but not tram
- //nothing happens ie it doesn't fall
- }
- else {
- tryMove(pixel, pixel.x, pixel.y + 1); //it falls down
- }
- }
- else {
- tryMove(pixel, pixel.x, pixel.y + 1); //it falls down (same as above)
- }
-
- }
- doDefaults(pixel)
- },
-};
-elements.bouncy_ball = {
- color: "#e35693",
- behavior: behaviors.WALL,
- tempHigh: 250,
- stateHigh: ["borax", "glue"],
- category: "special",
- conduct: 1,
- tick: function (pixel) {
- if (pixel.fallDist === undefined) {
- pixel.fallDist = 0;
- }
- if (pixel.isFalling === undefined) {
- pixel.isFalling = true;
- }
-
- if (pixel.isFalling) { //main loop of a bouncy ball. Functions are defined below
- falling()
- } else {
- rising()
- }
- if (pixel.charge > 0) { //will bounce on electricity (doesn't work on real bouncy balls :/)
- pixel.fallDist = (pixel.fallDist + 1)
- rising()
- }
-
- function falling() {
-
- if (isEmpty(pixel.x, pixel.y + 1)) {
- tryMove(pixel, pixel.x, pixel.y + 1)
- pixel.fallDist += 1; //counts how many pixels the ball has fallen so far
- } else { //if it touched the ground
- pixel.isFalling = false; //will change the outcome of the main if statement and make ball start rising
- pixel.fallDist = pixel.fallDist * 3 / 4; //dynamically decreases bounce height based on how high it is, instead of constant 1 per bounce
- }
- }
- function rising() {
- if (pixel.fallDist > 0) {
- tryMove(pixel, pixel.x, pixel.y - 1)
- pixel.fallDist -= 1
- } else {
- pixel.isFalling = true;
- pixel.fallDist -= 1 //makes the ball lose 1 pixel height each bounce, useful at the end when * 3/4 only results in fractions
- }
-
- }
-
- }
-};
-elements.borax.reactions.slime = { elem1: "bouncy_ball", elem2: null};
\ No newline at end of file
From 1ecf777b11e364b35d8e54013fe62fa62ae2753a Mon Sep 17 00:00:00 2001
From: Rain <58303213+rainingBrackets@users.noreply.github.com>
Date: Thu, 22 Aug 2024 21:55:23 +0200
Subject: [PATCH 48/56] Delete plastic.js
---
plastic.js | 93 ------------------------------------------------------
1 file changed, 93 deletions(-)
delete mode 100644 plastic.js
diff --git a/plastic.js b/plastic.js
deleted file mode 100644
index ed90927b..00000000
--- a/plastic.js
+++ /dev/null
@@ -1,93 +0,0 @@
-
-// created by Rain :o 20/8 2024
-
-elements.water_bottle = {
- color: "#a8d2e3",
- behavior: behaviors.STURDYPOWDER,
- category: "powders",
- state: "solid",
- density: 800,
- breakInto: ["water_everywhere", "water_everywhere", "water_everywhere", "water_everywhere", "microplastic"],
- tempHigh: 250,
- stateHigh: ["molten_plastic", "water_everywhere", "water_everywhere"],
-};
-elements.head.reactions.water_bottle = { elem2: ["plastic", "water", null, null, null], chance: 0.1 };
-elements.body.reactions.water_bottle = { elem2: ["plastic", "water", null, null, null], chance: 0.1 };
-
-elements.water_everywhere = {
- color: "#8882e3",
- behavior: [
- "CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water",
- "CR:water_everywhere%20 AND CR:water|XX%20 AND CH:water|CR:water_everywhere%20 AND CR:water",
- "CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water",
- ],
- category: "liquids",
- state: "solid",
- density: 800,
- hidden: true,
-};
-elements.microplastic = {
- color: ["#adc7c9", "#cadadb", "#6cbda8", "#62d5d4", "#b3b47b"],
- behavior: [
- "XX|XX|XX",
- "XX|XX|XX",
- "M2%25|M1%50|M2%25",
- ],
- category: "powders",
- state: "solid",
- density: 700,
- tempHigh: 250,
- stateHigh: "molten_plastic",
- reactions: {
- "fish": { elem1: null, elem2: "meat", chance: 0.01 },
- "glue": { elem1: "bead", elem2: null, chance: 0.03 },
- },
-};
-elements.plastic.breakInto = "microplastic";
-
-elements.cellulose.reactions.vinegar = { elem1: "bioplastic", elem2: null, tempMin: 40, chance: 0.1};
-
-elements.bioplastic = {
- color: "#eeeeaa",
- behavior: behaviors.WALL,
- category: "solids",
- tempHigh: 180,
- stateHigh: "molten_bioplastic",
- breakInto: "bioplastic_crumbs",
- alias: "Cellulose acetate",
- desc: "It's biodegradable :)",
-};
-elements.bioplastic_crumbs = {
- color: ["#dfd499", "#c0e8a0", "#dfab87"],
- hidden: true,
- behavior: behaviors.POWDER,
- category: "powders",
- tempHigh: 180,
- stateHigh: "molten_bioplastic",
- desc: "small pieces of cellulose acetate"
-};
-
-elements.worm.reactions.bioplastic = { elem2: ["carbon_dioxide", null, null], chance: 0.05, func: behaviors.FEEDPIXEL };
-elements.worm.reactions.bioplastic_crumbs = { elem2: ["carbon_dioxide", null, null], chance: 0.05, func: behaviors.FEEDPIXEL };
-elements.worm.behavior = [
- "SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic%3|XX|SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic,bioplastic_crumbs%3",
- "M2%10|XX|M2%10",
- "SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic%3|M1|SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic,bioplastic_crumbs%3",
-];
-elements.cell.reactions.bioplastic = { elem2: ["carbon_dioxide", null, null], chance: 0.02, func: behaviors.FEEDPIXEL };
-elements.cell.reactions.bioplastic_crumbs = { elem2: ["carbon_dioxide", null, null], chance: 0.02, func: behaviors.FEEDPIXEL };
-
-elements.molten_bioplastic = {
- color: "#ccccac",
- behavior: behaviors.LIQUID,
- viscosity: 300,
- category: "states",
- state: "liquid",
- tempLow: 150,
- stateLow: "bioplastic",
- temp: 160,
- density: 1300,
- hidden: true,
-};
-
-
From a558c844229dbfebb8da1f119c0cb2c54fd78dc3 Mon Sep 17 00:00:00 2001
From: redbirdly <155550833+redbirdly@users.noreply.github.com>
Date: Fri, 23 Aug 2024 17:15:07 +0800
Subject: [PATCH 49/56] Add files via upload
---
mods/circuitcore_displays.js | 146 +++++++++++++++++++++++++++++++++++
1 file changed, 146 insertions(+)
create mode 100644 mods/circuitcore_displays.js
diff --git a/mods/circuitcore_displays.js b/mods/circuitcore_displays.js
new file mode 100644
index 00000000..252ba699
--- /dev/null
+++ b/mods/circuitcore_displays.js
@@ -0,0 +1,146 @@
+if (!enabledMods.includes("mods/circuitcore.js")) { enabledMods.unshift("mods/circuitcore.js"); localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); window.location.reload() };
+var lightmapEnabled = enabledMods.includes("mods/lightmap.js") || enabledMods.includes("mods/fast_lightmap.js");
+
+function general_display(w, h, colorMode) { // colorMode: 0 for monochrome, 1 for 3-bit, 2 for 4-bit
+ return function(pixel) {
+ var pins = [];
+
+ // X input (expands right)
+ for (var i = 0; i < Math.ceil(Math.log2(w)); i++) {
+ pins.push([-1, (i * 2) + 1, true]);
+ }
+
+ // Y input (expands downward)
+ for (var i = 0; i < Math.ceil(Math.log2(h)); i++) {
+ pins.push([(i * 2) + 1, -1, true]);
+ }
+
+ if (colorMode === 1) { // 3-bit color
+ pins.push([-1, 11, true]); // Red
+ pins.push([-1, 13, true]); // Green
+ pins.push([-1, 15, true]); // Blue
+ } else if (colorMode === 2) { // 4-bit color
+ for (var i = 0; i < 4; i++) {
+ pins.push([-1, 11 + (i * 2), true]); // 4-bit color input
+ }
+ } else { // Monochrome
+ pins.push([w - 4, -1, true]);
+ }
+
+ // Reset pin
+ pins.push([w - 2, -1, true]);
+
+ // Clock input
+ pins.push([w, -1, true]);
+
+ initializeCircuit(pixel, pins, w + 2, h + 2, false, pixel.circuitRotation, addDisplayCallback);
+
+ var X = [];
+ for (var i = 0; i < Math.ceil(Math.log2(w)); i++) {
+ X.push(checkPin(pixel, pins, i));
+ }
+
+ var Y = [];
+ for (var i = 0; i < Math.ceil(Math.log2(h)); i++) {
+ Y.push(checkPin(pixel, pins, Math.ceil(Math.log2(w)) + i));
+ }
+
+ var color;
+ if (colorMode === 1) {
+ var red = checkPin(pixel, pins, Math.ceil(Math.log2(w)) + Math.ceil(Math.log2(h)));
+ var green = checkPin(pixel, pins, Math.ceil(Math.log2(w)) + Math.ceil(Math.log2(h)) + 1);
+ var blue = checkPin(pixel, pins, Math.ceil(Math.log2(w)) + Math.ceil(Math.log2(h)) + 2);
+ color = `rgb(${red ? 255 : 0}, ${green ? 255 : 0}, ${blue ? 255 : 0})`;
+ } else if (colorMode === 2) {
+ var colorIndex = 0;
+ for (var i = 0; i < 4; i++) {
+ colorIndex += checkPin(pixel, pins, Math.ceil(Math.log2(w)) + Math.ceil(Math.log2(h)) + i) ? Math.pow(2, i) : 0;
+ }
+ color = colorPalette_4bit[colorIndex];
+ } else {
+ color = checkPin(pixel, pins, Math.ceil(Math.log2(w)) + Math.ceil(Math.log2(h))) ? "rgb(16, 230, 120)" : "rgb(16, 24, 32)";
+ }
+
+ var reset = checkPin(pixel, pins, Math.ceil(Math.log2(w)) + Math.ceil(Math.log2(h)) + (colorMode === 1 ? 3 : (colorMode === 2 ? 4 : 1)));
+ var clock = checkPin(pixel, pins, Math.ceil(Math.log2(w)) + Math.ceil(Math.log2(h)) + (colorMode === 1 ? 4 : (colorMode === 2 ? 5 : 2)));
+
+ var x_pos = 0;
+ for (var i = 0; i < X.length; i++) {
+ x_pos += X[i] ? Math.pow(2, (X.length - 1) - i) : 0;
+ }
+
+ var y_pos = 0;
+ for (var i = 0; i < Y.length; i++) {
+ y_pos += Y[i] ? Math.pow(2, (Y.length - 1) - i) : 0;
+ }
+
+ if (x_pos >= w || y_pos >= h) return;
+
+ var px = pixel.x + 1 + x_pos;
+ var py = pixel.y + 1 + y_pos;
+
+ if (reset) {
+ for (var y = 1; y <= h; y++) {
+ for (var x = 1; x <= w; x++) {
+ var reset_px = pixel.x + x;
+ var reset_py = pixel.y + y;
+ if (pixelMap[reset_px] && pixelMap[reset_px][reset_py] && pixelMap[reset_px][reset_py].element == "displayPixel") {
+ pixelMap[reset_px][reset_py].color = "rgb(16, 24, 32)";
+ }
+ }
+ }
+ return;
+ }
+
+ if (clock) {
+ if (pixelMap[px] && pixelMap[px][py] && pixelMap[px][py].element == "displayPixel") {
+ pixelMap[px][py].color = color;
+ }
+ }
+ };
+}
+
+elements.gridDisplay = {
+ color: "#33FF66",
+ category: "logic",
+ maxSize: 1,
+ onSelect: function() {
+ // Prompt the user for display width, height, and color depth
+ var width = parseInt(prompt("Enter the display width (e.g., 16, 32, 64):", "16"));
+ var height = parseInt(prompt("Enter the display height (e.g., 16, 32, 64):", "16"));
+ var colorDepth = parseInt(prompt("Enter the color depth (1 for monochrome, 3 for 3-bit, 4 for 4-bit):", "4"));
+
+ // Set these values for the pixel
+ elements.gridDisplay.displayWidth = width;
+ elements.gridDisplay.displayHeight = height;
+ elements.gridDisplay.displayColorDepth = colorDepth;
+ },
+ cc_stableTick: function(pixel) {
+ // Get the display properties
+ var width = elements.gridDisplay.displayWidth || 16;
+ var height = elements.gridDisplay.displayHeight || 16;
+ var colorDepth = elements.gridDisplay.displayColorDepth || 4;
+
+ // Call general_display with the appropriate parameters
+ var displayFunction = general_display(width, height, colorDepth === 1 ? 0 : (colorDepth === 3 ? 1 : 2));
+ displayFunction(pixel);
+ }
+};
+
+elements.displayPixel = {
+ color: "#000000",
+ category: "logic",
+ state: "solid",
+ behavior: behaviors.WALL,
+ tick: function(pixel) {
+ if (pixel.start == pixelTicks) {
+ pixel.color = "rgb(16, 24, 32)";
+ }
+
+// if (lightmapEnabled && pixel.color) {
+// var x = Math.floor(pixel.x / lightmapScale);
+// var y = Math.floor(pixel.y / lightmapScale);
+// lightmap[y][x] = { color: scaleList(rgbToArray(pixel.color), 2) };
+// }
+ }
+};
From e99e08ae710cfa5e11e300561ed05e749945b4f7 Mon Sep 17 00:00:00 2001
From: redbirdly <155550833+redbirdly@users.noreply.github.com>
Date: Fri, 23 Aug 2024 17:15:43 +0800
Subject: [PATCH 50/56] Update circuitcore.js
---
mods/circuitcore.js | 337 ++++++++++++++++++++++++--------------------
1 file changed, 186 insertions(+), 151 deletions(-)
diff --git a/mods/circuitcore.js b/mods/circuitcore.js
index c214cc5c..39c4b35b 100644
--- a/mods/circuitcore.js
+++ b/mods/circuitcore.js
@@ -11,9 +11,11 @@ cc_settingsTab.registerSettings("OverHeating", cc_setting1);
//cc_settingsTab.registerSettings("Setting 2", cc_setting2);
settingsManager.registerTab(cc_settingsTab);
-var dataVisualizationPalette16 = [
- "#000000", "#ff0000", "#ff7700", "#ffff00", "#00ff00", "#00ffff", "#0000ff", "#ff00ff",
- "#777777", "#770000", "#773300", "#777700", "#007700", "#007777", "#000077", "#770077",
+var colorPalette_4bit = [
+ "#101820", "#37175F", "#5F1717", "#6F175F",
+ "#005F00", "#1563BF", "#7F401A", "#525252",
+ "#8F8F8F", "#EE8822", "#FF3027", "#FF47FF",
+ "#58E618", "#27FFDF", "#FFFF27", "#FFFFFF"
];
function hueLerp(value) {
@@ -217,6 +219,61 @@ function setPin(pixel, pins, index, value, rotation=pixel.circuitRotation) {
}
// Circuits
+elements.four_bit_selector_circuit = {
+ cc_stableTick: function(pixel) {
+ var pins = [
+ // First 4-bit input (A)
+ [-1, -2, true], // A0
+ [-3, -2, true], // A1
+ [-5, -2, true], // A2
+ [-7, -2, true], // A3
+
+ // Second 4-bit input (B)
+ [7, -2, true], // B0
+ [5, -2, true], // B1
+ [3, -2, true], // B2
+ [1, -2, true], // B3
+
+ // Selection pin (Sel)
+ [9, 0, true], // Selection (Sel)
+
+ // Output (O)
+ [-3, 2, false], // O0 (centered)
+ [-1, 2, false], // O1 (centered)
+ [1, 2, false], // O2 (centered)
+ [3, 2, false], // O3 (centered)
+ ];
+
+ initializeCircuit(pixel, pins, 17, 3);
+
+ // Read inputs
+ var A = [
+ checkPin(pixel, pins, 0),
+ checkPin(pixel, pins, 1),
+ checkPin(pixel, pins, 2),
+ checkPin(pixel, pins, 3)
+ ];
+
+ var B = [
+ checkPin(pixel, pins, 4),
+ checkPin(pixel, pins, 5),
+ checkPin(pixel, pins, 6),
+ checkPin(pixel, pins, 7)
+ ];
+
+ var Sel = checkPin(pixel, pins, 8); // Selection pin
+
+ // Select between A and B based on Sel
+ var output = Sel ? B : A;
+
+ // Output the selected 4-bit value
+ setPin(pixel, pins, 9, output[0]); // O0
+ setPin(pixel, pins, 10, output[1]); // O1
+ setPin(pixel, pins, 11, output[2]); // O2
+ setPin(pixel, pins, 12, output[3]); // O3
+ }
+};
+
elements.four_bit_enabler_circuit = {
centered: true,
cc_stableTick: function(pixel) {
@@ -442,9 +499,9 @@ elements.temperature_sensor = {
var cellData = pixel.romData[cellAddress];
if (!(0 <= px && px < width && 0 <= py && py < height)) {continue;}
- if (pixelMap[px][py] && pixelMap[px][py].element == "art") {
+ if (pixelMap[px][py] && pixelMap[px][py].element == "displayPixel") {
// if (address == cellAddress) {}
- pixelMap[px][py].color = dataVisualizationPalette16[binaryArrayToNumber(cellData)];
+ pixelMap[px][py].color = colorPalette_4bit[binaryArrayToNumber(cellData)];
}
}
}
@@ -1277,6 +1334,70 @@ elements.four_bit_adder_circuit = {
}
};
+elements.four_bit_subtractor_circuit = {
+ cc_stableTick: function(pixel) {
+ var pins = [
+ // First 4-bit number (A)
+ [-1, -2, true], // A3
+ [-3, -2, true], // A2
+ [-5, -2, true], // A1
+ [-7, -2, true], // A0
+
+ // Second 4-bit number (B)
+ [7, -2, true], // B3
+ [5, -2, true], // B2
+ [3, -2, true], // B1
+ [1, -2, true], // B0
+
+ // Borrow-in (B_in)
+ [9, 0, true], // Borrow-in (B_in)
+
+ // Output difference (D)
+ [-1, 2, false], // D3
+ [-3, 2, false], // D2
+ [-5, 2, false], // D1
+ [-7, 2, false], // D0
+ [1, 2, false], // Borrow Out (B4)
+ ];
+
+ initializeCircuit(pixel, pins, 17, 3);
+
+ // Read inputs
+ var A = [
+ checkPin(pixel, pins, 0),
+ checkPin(pixel, pins, 1),
+ checkPin(pixel, pins, 2),
+ checkPin(pixel, pins, 3)
+ ];
+
+ var B = [
+ checkPin(pixel, pins, 4),
+ checkPin(pixel, pins, 5),
+ checkPin(pixel, pins, 6),
+ checkPin(pixel, pins, 7)
+ ];
+
+ var B_in = checkPin(pixel, pins, 8); // Borrow-in
+
+ // Calculate the difference and borrow
+ var difference = [];
+ var borrow = B_in;
+
+ for (var i = 0; i < 4; i++) {
+ var bitDifference = A[i] - B[i] - borrow;
+ difference[i] = (bitDifference + 2) % 2; // Current bit difference
+ borrow = bitDifference < 0 ? 1 : 0; // Borrow for next bit
+ }
+
+ // Output the difference
+ setPin(pixel, pins, 9, difference[0]); // D0
+ setPin(pixel, pins, 10, difference[1]); // D1
+ setPin(pixel, pins, 11, difference[2]); // D2
+ setPin(pixel, pins, 12, difference[3]); // D3
+ setPin(pixel, pins, 13, borrow); // Borrow Out (B4)
+ }
+};
+
function general_clock(speed, s2) {
return function(pixel){
for (var i = 0; i < adjacentCoords.length; i++) {
@@ -1343,6 +1464,7 @@ elements.custom_RGB_led = {
];
var color = { color: cc_scaleList([(l[0] * 2) + l[1], (l[2] * 2) + l[3], (l[4] * 2) + l[5]], (255 / 3) * 10) };
+ if (color.color.some(value => isNaN(value))) {return;}
if (lightmapEnabled && color.color[0] && color.color[1], color.color[2]) {
lightmap[Math.floor(pixel.y / lightmapScale)][Math.floor(pixel.x / lightmapScale)] = color;
@@ -1372,7 +1494,7 @@ var addDisplayCallback = function(pixel, pins, w, h) {
if (!(0 <= px && px < width && 0 <= py && py < height)) {continue;}
deletePixel(px, py);
- createPixel("art", px, py);
+ createPixel("displayPixel", px, py);
pixelMap[px][py].color = "rgb(16, 24, 32)";
}
}
@@ -1408,7 +1530,7 @@ elements.simple_seven_segment_display = {
var px = pixel.x + x;
var py = pixel.y + y;
- if (pixelMap[px][py] && pixelMap[px][py].element == "art") {
+ if (pixelMap[px][py] && pixelMap[px][py].element == "displayPixel") {
if (hexGrid[y - 2][x - 1]) {
pixelMap[px][py].color = "rgb(16, 230, 120)";
} else {
@@ -1460,7 +1582,7 @@ elements.simple_double_seven_segment_display = {
var px = pixel.x + x;
var py = pixel.y + y;
- if (pixelMap[px][py] && pixelMap[px][py].element == "art") {
+ if (pixelMap[px][py] && pixelMap[px][py].element == "displayPixel") {
if (hexGrid[y - 2][x - 1]) {
pixelMap[px][py].color = "rgb(16, 230, 120)";
} else {
@@ -1476,7 +1598,7 @@ elements.simple_double_seven_segment_display = {
var px = pixel.x + x;
var py = pixel.y + y;
- if (pixelMap[px][py] && pixelMap[px][py].element == "art") {
+ if (pixelMap[px][py] && pixelMap[px][py].element == "displayPixel") {
if (hexGrid2[y - 2][x - 5]) {
pixelMap[px][py].color = "rgb(16, 230, 120)";
} else {
@@ -1488,117 +1610,6 @@ elements.simple_double_seven_segment_display = {
}
};
-function general_display(w, h) {
- return function(pixel) {
- var pins = [];
-
- // X input (X0-Xn)
- for (var i = 0; i < Math.ceil(Math.log2(w)); i++) {
- pins.push([-1, (Math.ceil(Math.log2(w)) - i) * 2 - 1, true]);
- }
-
- // Y input (Y0-Yn)
- for (var i = 0; i < Math.ceil(Math.log2(h)); i++) {
- pins.push([(Math.ceil(Math.log2(h)) - i) * 2 - 1, -1, true]);
- }
-
- // Color input
- pins.push([11, -1, true]);
-
- // Reset pin
- pins.push([13, -1, true]);
-
- // Clock input
- pins.push([15, -1, true]);
-
- // Initialize the circuit with the necessary pins
- initializeCircuit(pixel, pins, w + 2, h + 2, false, pixel.circuitRotation, addDisplayCallback);
-
- // Read inputs
- var X = [];
- for (var i = 0; i < Math.ceil(Math.log2(w)); i++) {
- X.push(checkPin(pixel, pins, i));
- }
-
- var Y = [];
- for (var i = 0; i < Math.ceil(Math.log2(h)); i++) {
- Y.push(checkPin(pixel, pins, Math.ceil(Math.log2(w)) + i));
- }
-
- var color = checkPin(pixel, pins, pins.length - 3);
- var reset = checkPin(pixel, pins, pins.length - 2);
- var clock = checkPin(pixel, pins, pins.length - 1);
-
- // Decode X and Y inputs to determine the pixel position
- var x_pos = 0;
- for (var i = 0; i < X.length; i++) {
- x_pos += (X[i] ? 1 : 0) << i;
- }
-
- var y_pos = 0;
- for (var i = 0; i < Y.length; i++) {
- y_pos += (Y[i] ? 1 : 0) << i;
- }
-
- // Display dimension check
- if (x_pos >= w || y_pos >= h) return;
-
- var px = pixel.x + 1 + x_pos; // Adjust for the display position
- var py = pixel.y + 1 + y_pos;
-
- // Handle reset functionality
- if (reset) {
- for (var y = 1; y <= h; y++) {
- for (var x = 1; x <= w; x++) {
- var reset_px = pixel.x + x;
- var reset_py = pixel.y + y;
- if (pixelMap[reset_px] && pixelMap[reset_px][reset_py] && pixelMap[reset_px][reset_py].element == "art") {
- pixelMap[reset_px][reset_py].color = "rgb(16, 230, 120)";
- }
- }
- }
- return;
- }
-
- // Update display on clock pulse
- if (clock) {
- if (pixelMap[px] && pixelMap[px][py] && pixelMap[px][py].element == "art") {
- // Set the pixel color
- pixelMap[px][py].color = color ? "rgb(16, 230, 120)" : "rgb(16, 230, 120)";
- }
- }
- };
-}
-
-elements.basic_mono_display_8x8 = {
- cc_stableTick: general_display(8, 8),
-};
-
-elements.basic_mono_display_16x8 = {
- cc_stableTick: general_display(16, 8),
-};
-
-elements.basic_mono_display_16x16 = {
- cc_stableTick: general_display(16, 16),
-};
-
-elements.basic_mono_display_32x16 = {
- cc_stableTick: general_display(32, 16),
-};
-
-elements.basic_mono_display_32x32 = {
- cc_stableTick: general_display(32, 32),
-};
-
-elements.basic_mono_display_64x32 = {
- cc_stableTick: general_display(64, 32),
-};
-
-elements.basic_mono_display_64x64 = {
- cc_stableTick: general_display(64, 64),
-};
-
-
function malfunction_chip(pixel) {
var emptySpaces = [];
@@ -1629,18 +1640,23 @@ function malfunction_chip(pixel) {
}
}
-//elements.display = {
-// color: "#444444",
-// category: "logic",
-// state: "solid",
-// behavior: behaviors.WALL,
-// hoverStat: function(pixel) {
-// return `Circuit: ${pixel.corePosition}`;
-// },
-// cc_stableTick: function(pixel) {
-//
-// }
-//};
+elements.displayPixel = {
+ color: "#000000",
+ category: "logic",
+ state: "solid",
+ behavior: behaviors.WALL,
+ tick: function(pixel) {
+ if (pixel.start == pixelTicks) {
+ pixel.color = "rgb(16, 24, 32)";
+ }
+
+ if (lightmapEnabled && pixel.color) {
+ var x = Math.floor(pixel.x / lightmapScale);
+ var y = Math.floor(pixel.y / lightmapScale);
+ lightmap[y][x] = { color: scaleList(rgbToArray(pixel.color), 0.2) };
+ }
+ }
+};
elements.circuit_material = {
color: "#444444",
@@ -1777,13 +1793,24 @@ elements.logic_corrupter_machine = {
},
}
-elements.circuitCoreTutorial = {
- color: "#33FF66",
- category: "logic",
- onSelect: function() {
- window.open("https://redbirdly.github.io/circuitcore_tutorial.html");
- },
-}
+// Create a new anchor element
+var tutorialLink = document.createElement("a");
+
+// Set the link's text content
+tutorialLink.textContent = "CircuitCore Tutorial";
+
+// Set the link's href attribute to point to the tutorial
+tutorialLink.href = "https://redbirdly.github.io/circuitcore_tutorial.html";
+
+// Set the link to open in a new tab
+tutorialLink.target = "_blank";
+
+// Style the link (optional)
+tutorialLink.style.color = "#33FF66"; // Set the color of the link
+tutorialLink.style.fontSize = "14px"; // Set the font size
+
+// Append the link to the body of the webpage
+document.body.appendChild(tutorialLink);
// cc_ is circuit core prefix
const cc_BROWN = "#773317";
@@ -1800,6 +1827,7 @@ const cc_WHITE = "#DDDDDD";
var circuits = [
// Misc and I/O: brown
+ { circuit: elements.four_bit_selector_circuit, color: cc_BROWN, size: [17, 3, true] },
{ circuit: elements.four_bit_enabler_circuit, color: cc_BROWN, size: [9, 3, true] },
{ circuit: elements.randomizer, color: cc_BROWN },
{ circuit: elements.four_bit_randomizer_circuit, color: cc_BROWN, size: [9, 3, true] },
@@ -1841,6 +1869,7 @@ var circuits = [
{ circuit: elements.four_bit_D_flip_flop_circuit, color: cc_LIGHT_BLUE, size: [9, 3, true] },
// Addition/subtraction arithmetic: blue
{ circuit: elements.four_bit_adder_circuit, color: cc_BLUE, size: [17, 3, true] },
+ { circuit: elements.four_bit_subtractor_circuit, color: cc_BLUE, size: [17, 3, true] },
{ circuit: elements.four_bit_incrementer_circuit, color: cc_BLUE, size: [9, 3, true] },
// Complex circuits: lavender
// Clocks: pink
@@ -1852,13 +1881,6 @@ var circuits = [
{ circuit: elements.simple_seven_segment_display, color: cc_WHITE, size: [5, 9, false] },
{ circuit: elements.simple_double_seven_segment_display, color: cc_WHITE, size: [9, 9, false] },
{ circuit: elements.custom_RGB_led, color: cc_WHITE, size: [3, 3, true] },
- { circuit: elements.basic_mono_display_8x8, color: cc_WHITE, size: [10, 10, false] },
- { circuit: elements.basic_mono_display_16x8, color: cc_WHITE, size: [18, 10, false] },
- { circuit: elements.basic_mono_display_16x16, color: cc_WHITE, size: [18, 18, false] },
- { circuit: elements.basic_mono_display_32x16, color: cc_WHITE, size: [34, 18, false] },
- { circuit: elements.basic_mono_display_32x32, color: cc_WHITE, size: [34, 34, false] },
- { circuit: elements.basic_mono_display_64x32, color: cc_WHITE, size: [66, 34, false] },
- { circuit: elements.basic_mono_display_64x64, color: cc_WHITE, size: [66, 66, false] },
];
circuits.forEach(circuitInfo => {
@@ -1947,15 +1969,28 @@ function drawCircuitExtras() {
}
function runLogicTick() {
- for (var i = 0;i < currentPixels.length;i++) {
- var pixel = currentPixels[i];
- if (elements[pixel.element].category == "logic") {
- if (elements[pixel.element].cc_stableTick) {
- elements[pixel.element].cc_stableTick(pixel);
+ if (paused) {return;}
+ for (var j = 0;j < 1;j++) {
+ for (var i = 0;i < currentPixels.length;i++) {
+ var pixel = currentPixels[i];
+ if (elements[pixel.element].category == "logic") {
+ if (elements[pixel.element].cc_stableTick) {
+ elements[pixel.element].cc_stableTick(pixel);
+ }
}
}
}
}
+function stabilizeLogicGates() {
+ var logicgatesElements = ["output","logic_wire","not_gate","and_gate","xor_gate","or_gate","nand_gate","nor_gate","nxor_gate","E2L_lever","E2L_button","L2E_constant","logic_transmitter","logic_receiver","logic_shock","logic_unshock"]
+
+ for (var i = 0;i < logicgatesElements.length;i++) {
+ elements[logicgatesElements[i]].cc_stableTick = elements[logicgatesElements[i]].tick;
+ elements[logicgatesElements[i]].tick = null;
+ }
+}
+
renderPostPixel(drawCircuitExtras);
runEveryTick(runLogicTick);
+runAfterLoad(stabilizeLogicGates);
From 9d369de6e2cb080b0b6314136ab6041f6a663865 Mon Sep 17 00:00:00 2001
From: JustAGenericUsername
<92590792+JustAGenericUsername@users.noreply.github.com>
Date: Sat, 24 Aug 2024 15:14:04 -0400
Subject: [PATCH 51/56] ye
---
mods/minecraft.js | 162 +++++++++++++++++++++++++++++++++++++++++-
mods/nousersthings.js | 162 ++++++++++++++++++++++++++++++++++--------
mods/ores.js | 8 +--
3 files changed, 299 insertions(+), 33 deletions(-)
diff --git a/mods/minecraft.js b/mods/minecraft.js
index 82c4f9c0..42d84d9e 100644
--- a/mods/minecraft.js
+++ b/mods/minecraft.js
@@ -591,7 +591,7 @@ let channelVar = "0"
elements.sculk_wifi_transmitter = {
color: "#142c47",
category: "minecraft",
- behaviors: behaviors.WALL,
+ behavior: behaviors.WALL,
tempHigh: 250,
stateHigh: "dirt",
hoverStat: function(pixel){
@@ -643,4 +643,164 @@ elements.sculk_wifi_receiver = {
tick: function(pixel){
if (!pixel.channel){pixel.channel = channelVar}
}
+}
+drawRectangle = function(ctx, color, x, y, width, height, xoffset, yoffset){
+ ctx.fillStyle = color;
+ ctx.fillRect(canvasCoord(x+xoffset), canvasCoord(y+yoffset), pixelSize*width, pixelSize*height)
+}
+autoFillDrawRectangle = function(ctx, pixel, width, height, xoffset, yoffset){
+ ctx.fillStyle = pixel.color;
+ ctx.fillRect(canvasCoord(pixel.x+xoffset), canvasCoord(pixel.y+yoffset), pixelSize*width, pixelSize*height)
+}
+autoFillColorRectangle = function(ctx, pixel, color, width, height, xoffset, yoffset){
+ ctx.fillStyle = color;
+ ctx.fillRect(canvasCoord(pixel.x+xoffset), canvasCoord(pixel.y+yoffset), pixelSize*width, pixelSize*height)
+}
+grabDistances = function(pixel){
+ let element = pixel.element
+ // first we find upper not the same
+ let results = {}
+ for (let i = 0; i < height; i++){
+ if (isEmpty(pixel.x, pixel.y-i, true) || pixelMap[pixel.x][pixel.y-i].element != element){
+ results.top = i
+ if (isEmpty(pixel.x, pixel.y-i, true)){
+ results.topelement = "air"
+ } else {
+ results.topelement = pixelMap[pixel.x][pixel.y-i].element
+ }
+ break;
+ }
+ }
+ // now bottom not same
+ for (let i = 0; i < height; i++){
+ if (isEmpty(pixel.x, pixel.y+i, true) || pixelMap[pixel.x][pixel.y + i].element != element){
+ results.bottom = i
+ if (isEmpty(pixel.x, pixel.y+i, true)){
+ results.bottomelement = "air"
+ } else {
+ results.bottomelement = pixelMap[pixel.x][pixel.y + i].element
+ }
+ break;
+ }
+ }
+ return results
+}
+elements.dripstone_spike = {
+ color: "#927965",
+ category: "minecraft",
+ behavior: behaviors.WALL,
+ tempHigh: 1810,
+ stateHigh: "molten_dripstone",
+ density: 2550,
+ renderer: function(pixel, ctx){
+ if (pixel.spikeType == 1){
+ autoFillDrawRectangle(ctx, pixel, 1, 1/3, 0, 0)
+ autoFillDrawRectangle(ctx, pixel, 2/3, 1, 1/6, 0)}
+ else if (pixel.spikeType == 2){
+ autoFillDrawRectangle(ctx, pixel, 2/3, 1, 1/6, 0)
+ }
+ else if (pixel.spikeType == 3){
+ autoFillDrawRectangle(ctx, pixel, 2/3, 5/6, 1/6, 0)
+ autoFillDrawRectangle(ctx, pixel, 0.5, 1/3, 1/3, 2/3)
+ }
+ else if (pixel.spikeType == 4){
+ autoFillDrawRectangle(ctx, pixel, 0.5, 1/3, 1/3, 0)
+ autoFillDrawRectangle(ctx, pixel, 1/3, 1/3, 1/3, 1/6)
+ autoFillDrawRectangle(ctx, pixel, 1/6, 0.5, 1/3, 1/3)
+ }
+ else{
+ drawSquare(ctx, pixel.color, pixel.x, pixel.y)
+ }
+ },
+ tick: function(pixel){
+ let distance = grabDistances(pixel);
+ if (distance.bottom == 1)
+ {pixel.spikeType = 4}
+ else if (distance.bottom == 2)
+ {pixel.spikeType = 3}
+ else if (distance.bottom >= 3 && distance.top > 1)
+ {pixel.spikeType = 2}
+ else
+ {pixel.spikeType = 1}
+ if (!pixel.spikeType){console.log(distance)}
+ if (distance.topelement == "air" && distance.top == 1){
+ // make the entire spike fall
+ let fallList = []
+ for (let i = 0; i < height; i++){
+ if (!isEmpty(pixel.x, pixel.y+i, true) && pixelMap[pixel.x][pixel.y+i].element == "dripstone_spike"){
+ fallList.push(pixelMap[pixel.x][pixel.y+i])
+ } else {break}
+ }
+ fallList = fallList.reverse();
+ for (let i = 0; i 2 * (pixel.x - mousePos.x) + 0.5 * mouseSize) && (pixel.y - mousePos.y + mouseSize > -2 * (pixel.x - mousePos.x) + 0.5 * mouseSize)) {
+ deletePixel(pixel.x, pixel.y)
+ createPixel(circleElem, pixel.x, pixel.y)
+ } else {
+ deletePixel(pixel.x, pixel.y)
+ }
+ }
+}
function randomIntFromInterval(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min)
}
@@ -3098,6 +3119,36 @@ let pistonStart = 0
let pistonEnd = 0
let pistonDistance = 1
let pistonCooldown = 10
+let pistonRepeat = 1
+let pistonRepeatCooldown = 1
+function pistonEmit(pixel, i){
+ pixel.cooldown = pixel.pistonCooldown
+ pixel.rcooldown = pixel.pistonRepeatCooldown
+ var dir = [0-squareCoords[i][0], 0-squareCoords[i][1]]
+ var startx = pixel.x+(dir[0]*(pixel.pistonStart+1))
+ var starty = pixel.y+(dir[1]*(pixel.pistonStart+1))
+ var magnitude = pixel.pistonEnd
+ var endx = startx+(magnitude*dir[0])
+ var endy = starty+(magnitude*dir[1])
+ // console.log("Direction seems to be " + dir)
+ var jcoords
+ if (pixel.pullOrPush == 1){jcoords = lineCoords(startx, starty, endx, endy, 1)}
+ else {jcoords = lineCoords(endx, endy, startx, starty, 1)}
+
+
+ // console.log(startx + " is the starting x, " + starty + " is the starting y, " + endx + " is the ending x, " + endy + " is the ending y. Result is " + jcoords)
+ let pCoord = jcoords[0]
+ for (var j = 0; j < jcoords.length; j++) {
+ var lcoord = jcoords[j];
+ var lx = lcoord[0];
+ var ly = lcoord[1];
+ if (!isEmpty(lx, ly, true)){
+ tryMove(pixelMap[lx][ly], pCoord[0], pCoord[1], null, true)
+ }
+ pCoord[0] = lx;
+ pCoord[1] = ly;
+ }
+}
elements.specific_piston_ray_emitter = {
color: "#517597",
behavior: behaviors.WALL,
@@ -3115,6 +3166,12 @@ elements.specific_piston_ray_emitter = {
pistonDistance = ans4
var ans5 = parseInt(prompt("How many ticks should it wait to be charged again?", "6"))
pistonCooldown = ans5
+ var ans6 = parseInt(prompt("How many times should it repeat the push/pulling?", "1"))
+ pistonRepeat = ans6
+ if (pistonRepeat != 1){
+ var ans7 = parseInt(prompt("How many ticks should it wait between repeats?", "1"))
+ pistonRepeatCooldown = ans7
+ }
},
tick: function(pixel){
if (pixelTicks == pixel.start){
@@ -3123,8 +3180,13 @@ elements.specific_piston_ray_emitter = {
pixel.pistonEnd = pistonEnd
pixel.pistonDistance = pistonDistance
pixel.pistonCooldown = pistonCooldown
+ pixel.pistonRepeat = pistonRepeat
+ pixel.pistonRepeatCooldown = pistonRepeatCooldown
}
if (!pixel.cooldown){pixel.cooldown = 0}
+ if (!pixel.rcooldown){pixel.rcooldown = 0}
+ if (!pixel.repeatAmounts){pixel.repeatAmounts = 0}
+ if (!pixel.fakei){pixel.fakei = 0}
if (pixel.cooldown < 1){
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = squareCoords[i];
@@ -3132,34 +3194,21 @@ elements.specific_piston_ray_emitter = {
var y = pixel.y+coord[1];
if (!isEmpty(x,y, true)){
if (pixelMap[x][y].charge && (pixelMap[x][y].element == "wire" || pixelMap[x][y].element == "insulated_wire")){
+ pixel.repeatAmounts = pixel.pistonRepeat
+ pixel.fakei = i
for (let r = 0; r < pixel.pistonDistance; r++){
- pixel.cooldown = pixel.pistonCooldown
- var dir = [0-squareCoords[i][0], 0-squareCoords[i][1]]
- var startx = pixel.x+(dir[0]*(pixel.pistonStart+1))
- var starty = pixel.y+(dir[1]*(pixel.pistonStart+1))
- var magnitude = pixel.pistonEnd
- var endx = startx+(magnitude*dir[0])
- var endy = starty+(magnitude*dir[1])
- // console.log("Direction seems to be " + dir)
- var jcoords
- if (pixel.pullOrPush == 1){jcoords = lineCoords(startx, starty, endx, endy, 1)}
- else {jcoords = lineCoords(endx, endy, startx, starty, 1)}
-
- // console.log(startx + " is the starting x, " + starty + " is the starting y, " + endx + " is the ending x, " + endy + " is the ending y. Result is " + jcoords)
- let pCoord = jcoords[0]
- for (var j = 0; j < jcoords.length; j++) {
- var lcoord = jcoords[j];
- var lx = lcoord[0];
- var ly = lcoord[1];
- if (!isEmpty(lx, ly, true)){
- tryMove(pixelMap[lx][ly], pCoord[0], pCoord[1], null, true)
- }
- pCoord[0] = lx;
- pCoord[1] = ly;
- }}
+ pistonEmit(pixel, i);
+ }
+ pixel.repeatAmounts--
}
}
- }} else {pixel.cooldown -= 1}
+ }} else {pixel.cooldown --}
+ if (pixel.rcooldown < 1 && pixel.repeatAmounts > 0){
+ for (let r = 0; r < pixel.pistonDistance; r++){
+ pistonEmit(pixel, pixel.fakei);
+ }
+ pixel.repeatAmounts--
+ } else {pixel.rcooldown --}
},
insulate: true,
}
@@ -3610,4 +3659,61 @@ elements.copycat_filler = {
}
}
}
+}
+/*
+top left: canvasCoord(x), canvasCoord(y)
+top right: canvasCoord(x)+pixelSize, canvasCoord(y)
+bottom left: canvasCoord(x), canvasCoord(y)+pixelSize
+bottom right: canvasCoord(x)+pixelSize, canvasCoord(y)+pixelSize
+*/
+adjacentSidesToCanvas = function(x, y, px, py){
+ if (x == 0 && y == -1){
+ return [canvasCoord(px)+(0.5*pixelSize), canvasCoord(py)]
+ }
+ else if (x == 0 && y == 1){
+ return [canvasCoord(px)+(0.5*pixelSize), canvasCoord(py)+pixelSize]
+ }
+ else if (x == -1 && y == 0){
+ return [canvasCoord(px), canvasCoord(py)+(0.5*pixelSize)]
+ }
+ else if (x == 1 && y == 0){
+ return [canvasCoord(px)+pixelSize, canvasCoord(py)+(0.5*pixelSize)]
+ }
+}
+drawRectangle = function(ctx, color, x, y, width, height, xoffset, yoffset){
+ ctx.fillStyle = color;
+ ctx.fillRect(canvasCoord(x+xoffset), canvasCoord(y+yoffset), pixelSize*width, pixelSize*height)
+}
+elements.thin_pixel = {
+ color: "#747474",
+ behavior: behaviors.WALL,
+ category: "special",
+ renderer: function(pixel, ctx){
+ let differentAdjacent = [];
+ for (let i = 0; i < adjacentCoords.length; i++) {
+ let x = adjacentCoords[i][0] + pixel.x;
+ let y = adjacentCoords[i][1] + pixel.y;
+ if (!isEmpty(x, y, true) && pixelMap[x][y].element == "thin_pixel") {
+ differentAdjacent.push(adjacentCoords[i]);
+ }
+ }
+ ctx.globalAlpha = 1
+ differentAdjacent.forEach(adj => {
+ let canvasadjacentCoords = adjacentSidesToCanvas(adj[0], adj[1], pixel.x, pixel.y);
+ // if (!canvasadjacentCoords){
+ // console.log(adj)
+ // return;
+ // }
+ //console.log(canvasadjacentCoords);
+ ctx.beginPath();
+ ctx.moveTo(canvasCoord(pixel.x)+(0.5*pixelSize), canvasCoord(pixel.y)+(0.5*pixelSize));
+ ctx.lineTo(canvasadjacentCoords[0], canvasadjacentCoords[1]);
+ ctx.strokeStyle = pixel.color;
+ if (pixelSize*0.24>=2){ctx.lineWidth = pixelSize*0.24}else{ctx.lineWidth = 2}
+ ctx.stroke();
+ //console.log("line")
+ });
+ ctx.fillStyle = pixel.color;
+ ctx.fillRect(canvasCoord(pixel.x+0.38), canvasCoord(pixel.y+0.38), pixelSize*0.24, pixelSize*0.24);
+ }
}
\ No newline at end of file
diff --git a/mods/ores.js b/mods/ores.js
index 4461c9ea..0174e51e 100644
--- a/mods/ores.js
+++ b/mods/ores.js
@@ -141,10 +141,10 @@ renderEachPixel(function(pixel, ctx) {
}
differentAdjacent.forEach(adj => {
let canvasadjacentCoords = adjacentToCanvas(adj[0], adj[1], pixel.x, pixel.y);
- if (!canvasadjacentCoords){
- console.log(adj)
- return;
- }
+ // if (!canvasadjacentCoords){
+ // console.log(adj)
+ // return;
+ // }
//console.log(canvasadjacentCoords);
ctx.beginPath();
ctx.moveTo(canvasadjacentCoords[0][0], canvasadjacentCoords[0][1]);
From c6e738e67ab8f76b3586cc1a803b3749a1499ade Mon Sep 17 00:00:00 2001
From: JustAGenericUsername
<92590792+JustAGenericUsername@users.noreply.github.com>
Date: Sat, 24 Aug 2024 15:15:21 -0400
Subject: [PATCH 52/56] a
---
mods/nousersthings.js | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mods/nousersthings.js b/mods/nousersthings.js
index c7a0b060..f0229f3a 100644
--- a/mods/nousersthings.js
+++ b/mods/nousersthings.js
@@ -3183,6 +3183,10 @@ elements.specific_piston_ray_emitter = {
pixel.pistonRepeat = pistonRepeat
pixel.pistonRepeatCooldown = pistonRepeatCooldown
}
+ if (!pixel.pistonRepeat){
+ pixel.pistonRepeat = pistonRepeat
+ pixel.pistonRepeatCooldown = pistonRepeatCooldown
+ }
if (!pixel.cooldown){pixel.cooldown = 0}
if (!pixel.rcooldown){pixel.rcooldown = 0}
if (!pixel.repeatAmounts){pixel.repeatAmounts = 0}
From 4da0a57e957d805abcaa851890a4b0321890d311 Mon Sep 17 00:00:00 2001
From: JustAGenericUsername
<92590792+JustAGenericUsername@users.noreply.github.com>
Date: Sat, 24 Aug 2024 16:03:27 -0400
Subject: [PATCH 53/56] ye
---
mods/logicgates.js | 34 ++++++++++++++--------------------
1 file changed, 14 insertions(+), 20 deletions(-)
diff --git a/mods/logicgates.js b/mods/logicgates.js
index a88458bc..24698421 100644
--- a/mods/logicgates.js
+++ b/mods/logicgates.js
@@ -303,43 +303,37 @@ elements.E2L_button = {
state: "solid",
category: "logic",
tick: function(pixel){
- if (pixel.start === pixelTicks){
- pixel.cooldown = 0;
- pixel.toggleMode = 1;
- }
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x,y,true)) {
- if ((pixelMap[x][y].charge || pixelMap[x][y].chargeCD) && pixel.cooldown == 0){
- for (var i = 0; i < adjacentCoords.length; i++) {
- var coord = adjacentCoords[i];
+ if ((pixelMap[x][y].charge || pixelMap[x][y].chargeCD)){
+ for (var j = 0; j < adjacentCoords.length; j++) {
+ var coord = adjacentCoords[j];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x,y,true)) {
if (pixelMap[x][y].element == "logic_wire"){
- if (pixel.toggleMode == 1){
pixelMap[x][y].lstate = 2
pixelMap[x][y].color = pixelColorPick(pixel, "#ffe49c");
- } else {
- pixelMap[x][y].lstate = -2
- pixelMap[x][y].color = pixelColorPick(pixel, "#3d4d2c");
- }
}
}
}
- pixel.cooldown = 5
- if (pixel.toggleMode){
- pixel.toggleMode = 0;
- } else {
- pixel.toggleMode = 1;
- }
+ return;
}
}
}
- if (pixel.cooldown){
- pixel.cooldown = pixel.cooldown - 1
+ for (var i = 0; i < adjacentCoords.length; i++) {
+ var coord = adjacentCoords[i];
+ var x = pixel.x+coord[0];
+ var y = pixel.y+coord[1];
+ if (!isEmpty(x,y,true)) {
+ if (pixelMap[x][y].element == "logic_wire" && pixelMap[x][y].lstate > 0){
+ pixelMap[x][y].lstate = -2
+ pixelMap[x][y].color = pixelColorPick(pixel, "#3d4d2c");
+ }
+ }
}
}
}
From e1f9be1ec21eed37c775a641fa2edd0db752c65f Mon Sep 17 00:00:00 2001
From: redbirdly <155550833+redbirdly@users.noreply.github.com>
Date: Sun, 25 Aug 2024 14:01:28 +0800
Subject: [PATCH 54/56] Add files via upload
---
mods/planet.js | 270 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 270 insertions(+)
create mode 100644 mods/planet.js
diff --git a/mods/planet.js b/mods/planet.js
new file mode 100644
index 00000000..d51913a6
--- /dev/null
+++ b/mods/planet.js
@@ -0,0 +1,270 @@
+// Define the corrected biomes with heights
+var mercuryLayers = [
+ { layers: ["basalt", "iron"], height: 0.6 },
+ { layers: ["nickel"], height: 0.2 },
+ { layers: ["iron"], height: 0.2 }
+];
+
+var venusLayers = [
+ { layers: ["basalt", "limestone"], height: 0.5 },
+ { layers: ["sand", "ash", "clay"], height: 0.25 },
+ { layers: ["tuff"], height: 0.15 },
+ { layers: ["sulfur", ["basalt", "sand"]], height: 0.1 }
+];
+
+var earthLayers = [
+ { layers: ["rock", "basalt", "tuff", "limestone"], height: 0.55 },
+ { layers: ["clay", "mudstone", "clay_soil"], height: 0.3 },
+ { layers: [["sand", "wet_sand", "clay"], ["grass", "gravel", "dirt"]], height: 0.15 }
+];
+
+var marsLayers = [
+ { layers: ["iron", "nickel"], height: 0.3 },
+ { layers: ["iron", "nickel", "rust"], height: 0.15 },
+ { layers: ["iron", "nickel", "rust", "rust"], height: 0.15 },
+ { layers: ["rust"], height: 0.4 }
+];
+
+function tryCreateStaticPixel(pixelType, x, y) {
+ var staticPixelType = "static_" + pixelType;
+
+ // Check if the static version of the pixel type exists
+ if (!elements[staticPixelType]) {
+ // Create the static version of the pixel type
+ elements[staticPixelType] = Object.assign({}, elements[pixelType], {
+ behavior: behaviors.WALL,
+ tick: undefined
+ });
+ }
+
+ // Create the static pixel
+ tryCreatePixel(staticPixelType, x, y);
+}
+
+function getRandomWeightedElement(weightedList) {
+ // Parse the input string into an array of objects with name and weight properties
+ const elements = weightedList.split(',').map(item => {
+ const [name, weight] = item.split('%');
+ return { name: name.trim(), weight: parseFloat(weight) };
+ });
+
+ // Calculate the total weight
+ const totalWeight = elements.reduce((total, element) => total + element.weight, 0);
+
+ // Generate a random number between 0 and totalWeight
+ const randomWeight = Math.random() * totalWeight;
+
+ // Find the element corresponding to the random weight
+ let cumulativeWeight = 0;
+ for (const element of elements) {
+ cumulativeWeight += element.weight;
+ if (randomWeight < cumulativeWeight) {
+ return element.name;
+ }
+ }
+}
+
+// Function to load a script dynamically
+function loadScript(url) {
+ var script = document.createElement("script");
+ script.type = "text/javascript";
+ script.src = url;
+ document.head.appendChild(script);
+}
+
+function circleSimplexNoise1D(simplex, theta) {
+ return simplex.noise2D(Math.cos(theta * Math.PI / 180), Math.sin(theta * Math.PI / 180));
+}
+
+// Load the simplex-noise library
+loadScript("https://cdnjs.cloudflare.com/ajax/libs/simplex-noise/2.4.0/simplex-noise.min.js");
+
+function getRandomElement(layer) {
+ if (!layer || layer.length === 0) {
+ return null; // Return null or handle the error case
+ }
+ return layer[Math.floor(Math.random() * layer.length)];
+}
+
+function generatePlanet(config, x, y, radius) {
+ var simplex = new SimplexNoise();
+
+ var centerX = x;
+ var centerY = y;
+ var planetRadius = radius;
+ var cloudStartRadius = planetRadius + 7;
+ var cloudEndRadius = planetRadius + 14;
+
+ // Generate terrain
+ for (var r = 0; r <= planetRadius; r++) {
+ var step = 0.5;
+ if (r <= 50) { step = 1; }
+ if (r <= 20) { step = 2; }
+ for (var theta = 0; theta <= 360; theta += step) {
+ var x = Math.round(centerX + r * Math.cos(theta * Math.PI / 180));
+ var y = Math.round(centerY + r * Math.sin(theta * Math.PI / 180));
+
+ if (x >= 0 && x < width && y >= 0 && y < height) {
+ var distance = Math.sqrt(Math.pow(x - centerX, 2) + Math.pow(y - centerY, 2));
+ var noise = (-Math.abs(circleSimplexNoise1D(simplex, theta * 0.7)) * 0.5) + (-Math.abs(circleSimplexNoise1D(simplex, theta * 2.5)) * 0.3);
+ var noisyDistance = distance - (noise * planetRadius * 0.3);
+
+ if (noisyDistance <= planetRadius) {
+ // Determine the layer based on distance from center
+ var totalHeight = 0;
+ for (var i = 0; i < config.biomes.length; i++) {
+ totalHeight += config.biomes[i].height;
+ }
+
+ var cumulativeHeight = 0;
+ var chosenLayer = null;
+
+ for (var i = 0; i < config.biomes.length; i++) {
+ var biome = config.biomes[i];
+ var layerHeight = (biome.height / totalHeight) * planetRadius;
+
+ if (noisyDistance >= cumulativeHeight && noisyDistance < cumulativeHeight + layerHeight) {
+ chosenLayer = biome.layers;
+
+ // If chosenLayer is a list of lists, pick a sublayer based on noise
+ if (Array.isArray(chosenLayer) && Array.isArray(chosenLayer[0])) {
+ var sublayerNoise = (circleSimplexNoise1D(simplex, theta) + 1) / 2;
+ var sublayerIndex = Math.floor(sublayerNoise * chosenLayer.length);
+ if (sublayerIndex < 0) {
+ sublayerIndex = 0;
+ } else if (sublayerIndex >= chosenLayer.length) {
+ sublayerIndex = chosenLayer.length - 1;
+ }
+ chosenLayer = chosenLayer[sublayerIndex];
+ }
+ break;
+ }
+
+ cumulativeHeight += layerHeight;
+ }
+
+ var element = getRandomElement(chosenLayer);
+ if (element) {
+ tryCreateStaticPixel(element, x, y);
+ }
+ }
+ }
+ }
+ }
+
+ if (config.oceanElements) {
+ for (var i = centerX - planetRadius; i <= centerX + planetRadius; i++) {
+ for (var j = centerY - planetRadius; j <= centerY + planetRadius; j++) {
+ if (i >= 0 && i < width && j >= 0 && j < height) {
+ var distanceFromCenter = Math.sqrt(Math.pow(i - centerX, 2) + Math.pow(j - centerY, 2));
+ if (distanceFromCenter > planetRadius - 40 && distanceFromCenter <= planetRadius - 4) {
+ // Place ocean in the ring around the planet
+ tryCreateStaticPixel(getRandomWeightedElement(config.oceanElements), i, j);
+ }
+ }
+ }
+ }
+ }
+
+ if (config.cloudElements) {
+ for (var r = cloudStartRadius; r <= cloudEndRadius; r++) {
+ var step = 1;
+ for (var theta = 0; theta <= 360; theta += step) {
+ var x = Math.round(centerX + r * Math.cos(theta * Math.PI / 180));
+ var y = Math.round(centerY + r * Math.sin(theta * Math.PI / 180));
+
+ if (x >= 0 && x < width && y >= 0 && y < height) {
+ var distance = Math.sqrt(Math.pow(x - centerX, 2) + Math.pow(y - centerY, 2));
+ var cloudNoise = simplex.noise2D(x * 0.05, y * 0.05) + simplex.noise2D(x * 0.17, y * 0.17);
+
+ // Adjust cloud density based on distance from planet
+ var minCloudThreshold = 0.5 + config.cloudDensityBias; // Minimum threshold closer to the planet
+ var maxCloudThreshold = 0.8 + config.cloudDensityBias; // Maximum threshold further from the planet
+
+ // Interpolate threshold based on distance from planet
+ var t = (r - cloudStartRadius) / (cloudEndRadius - cloudStartRadius);
+ var threshold = minCloudThreshold + t * (maxCloudThreshold - minCloudThreshold);
+
+ if (cloudNoise > threshold) {
+ tryCreateStaticPixel(getRandomWeightedElement(config.cloudElements), x, y);
+ }
+ }
+ }
+ }
+ }
+}
+
+
+var mercuryConfig = {
+ biomes: mercuryLayers,
+ cloudElements: "",
+ cloudDensityBias: 0.0
+};
+
+var venusConfig = {
+ biomes: venusLayers,
+ cloudElements: "ammonia%70,acid_cloud%30",
+ cloudDensityBias: 0.2
+};
+
+var earthConfig = {
+ biomes: earthLayers,
+ oceanElements: "salt_water%80,water%20",
+ cloudElements: "cloud%100",
+ cloudDensityBias: 0.0
+};
+
+var marsConfig = {
+ biomes: marsLayers,
+ cloudElements: "",
+ cloudDensityBias: 0.0
+};
+
+
+elements.planetMercury = {
+ behavior: behaviors.WALL,
+ category: "special",
+ maxSize: 1,
+ tick: function(pixel) {
+ if (pixel.start === pixelTicks) {
+ deletePixel(pixel.x, pixel.y);
+ generatePlanet(mercuryConfig, pixel.x, pixel.y, 13);
+ }
+ }
+};
+
+elements.planetVenus = {
+ behavior: behaviors.WALL,
+ category: "special",
+ maxSize: 1,
+ tick: function(pixel) {
+ if (pixel.start === pixelTicks) {
+ deletePixel(pixel.x, pixel.y);
+ generatePlanet(venusConfig, pixel.x, pixel.y, 30);
+ }
+ }
+};
+
+elements.planetEarth = {
+ behavior: behaviors.WALL,
+ category: "special",
+ maxSize: 1,
+ tick: function(pixel) {
+ if (pixel.start === pixelTicks) {
+ deletePixel(pixel.x, pixel.y);
+ generatePlanet(earthConfig, pixel.x, pixel.y, 33);
+ }
+ }
+};
+
+elements.planetMars = {
+ behavior: behaviors.WALL,
+ category: "special",
+ maxSize: 1,
+ tick: function(pixel) {
+ if (pixel.start === pixelTicks) {
+ deletePixel(pixel.x, pixel.y);
+ generatePlanet(marsConfig, pixel.x, pixel.y, 20);
+ }
+ }
+};
From 1c0694701b8db36e4e02c4c89c96efcf6d3d8231 Mon Sep 17 00:00:00 2001
From: redbirdly <155550833+redbirdly@users.noreply.github.com>
Date: Sun, 25 Aug 2024 14:10:49 +0800
Subject: [PATCH 55/56] Add files via upload
---
mods/element_UI.js | 140 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 140 insertions(+)
create mode 100644 mods/element_UI.js
diff --git a/mods/element_UI.js b/mods/element_UI.js
new file mode 100644
index 00000000..9ee61e0a
--- /dev/null
+++ b/mods/element_UI.js
@@ -0,0 +1,140 @@
+// element_UI.js - Redbirdly's Mod that adds an alternative square element UI
+
+// Convert any html-valid color into RGB
+function cssColorToRGB(color) {
+ const div = document.createElement('div');
+ div.style.color = color;
+ document.body.appendChild(div);
+ const computedColor = window.getComputedStyle(div).color;
+ document.body.removeChild(div);
+ const rgbValues = computedColor.match(/\d+/g).map(Number);
+ return rgbValues;
+}
+
+function getColorBrightness(color) {
+ const [r, g, b] = cssColorToRGB(color);
+ return (r * 299 + g * 587 + b * 114) / 1000;
+}
+
+function createButtons(elements, inputDivId, currentCategory) {
+ const elementControls = document.getElementById('elementControls');
+ const existingContainer = document.getElementById('grid-container');
+ if (existingContainer) {
+ existingContainer.remove();
+ }
+
+ const container = document.createElement('div');
+ container.id = 'grid-container';
+ Object.assign(container.style, {
+ display: 'grid',
+ gap: '5px',
+ maxHeight: '280px',
+ overflowY: 'hidden',
+ overflowX: 'auto',
+ scrollbarColor: 'rgba(255, 255, 255, 0.25) rgba(255, 255, 255, 0.1)',
+ scrollbarWidth: 'thin'
+ });
+
+ const buttonNames = [];
+ let numButtons = 0;
+ let numColumns = 0;
+
+ for (let index in elements) {
+ if (elements.hasOwnProperty(index) && elements[index].category !== "tools" && elements[index].category === currentCategory) {
+ const name = index.replace(/_/g, ' ');
+ numButtons++;
+ let color = 'gray';
+ if (elements[index].color !== undefined) {
+ if (typeof elements[index].color === 'string') {
+ color = elements[index].color;
+ } else if (Array.isArray(elements[index].color)) {
+ color = elements[index].color[0];
+ }
+ }
+ buttonNames.push({ name, color });
+ }
+ }
+
+ numColumns = Math.ceil(numButtons / 3);
+ container.style.gridTemplateColumns = `repeat(${numColumns}, 60px)`;
+ container.style.gridTemplateRows = 'repeat(3, 60px)';
+
+ buttonNames.forEach((buttonInfo, index) => {
+ const button = document.createElement('div');
+ button.className = 'grid-item';
+ button.style.backgroundColor = buttonInfo.color;
+ button.innerText = buttonInfo.name;
+ const brightness = getColorBrightness(buttonInfo.color);
+ button.style.color = brightness > 210 ? 'black' : 'white';
+ Object.assign(button.style, {
+ width: '60px',
+ height: '60px',
+ display: 'flex',
+ justifyContent: 'center',
+ alignItems: 'center',
+ fontSize: '8px',
+ cursor: 'pointer',
+ border: '4px solid transparent',
+ borderRadius: '0px',
+ textAlign: 'center',
+ wordWrap: 'break-word',
+ transition: 'background-color 0.3s, color 0.3s, border 0.3s'
+ });
+
+ button.addEventListener('click', function() {
+ document.querySelectorAll('.grid-item').forEach(btn => {
+ btn.classList.remove('selected');
+ btn.style.border = '4px solid transparent';
+ });
+ button.classList.add('selected');
+ button.style.border = '4px solid white';
+ currentElement = buttonInfo.name.replace(' ', '_');
+ const element = elements[currentElement];
+ if (element && typeof element.onSelect === 'function') {
+ element.onSelect();
+ }
+ });
+
+ container.appendChild(button);
+ });
+
+ const inputDiv = document.createElement('div');
+ inputDiv.id = inputDivId;
+
+ elementControls.insertAdjacentElement('afterend', container);
+ container.insertAdjacentElement('afterend', inputDiv);
+ elementControls.style.display = 'none';
+}
+
+function getCurrentCategory() {
+ const categoryButtons = document.querySelectorAll('[current="true"]');
+ if (categoryButtons.length === 0) {
+ return null;
+ }
+ return categoryButtons[0].id.replace("categoryButton-", "");
+}
+
+function selectCategory(category) {
+ if (!category) { return; }
+ const categoryButton = document.getElementById("categoryButton-"+category);
+ if (!categoryButton) { return; }
+ if (categoryButton.classList.contains("notify")) {
+ categoryButton.classList.remove("notify");
+ }
+ const categoryDiv = document.getElementById("category-"+category);
+ for (let i = 0; i < categoryButton.parentNode.children.length; i++) {
+ const e = categoryDiv.parentNode.children[i];
+ e.style.display = "none";
+ document.getElementById("categoryButton-"+e.getAttribute("category")).setAttribute("current", false);
+ }
+ categoryDiv.style.display = "block";
+ categoryButton.setAttribute("current", true);
+ createButtons(elements, 'input-div', category);
+}
+
+const initialCategory = getCurrentCategory();
+if (initialCategory) {
+ selectCategory(initialCategory);
+}
+
+selectElement("sand");
\ No newline at end of file
From 13a09a04e352cdafa0bfaee58361415a5c17d1e3 Mon Sep 17 00:00:00 2001
From: Nekonico <163950752+DBNekonico@users.noreply.github.com>
Date: Sun, 25 Aug 2024 17:54:01 -0700
Subject: [PATCH 56/56] totally garnular mod
---
mods/garn47.js | 325 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 325 insertions(+)
create mode 100644 mods/garn47.js
diff --git a/mods/garn47.js b/mods/garn47.js
new file mode 100644
index 00000000..0a0b817d
--- /dev/null
+++ b/mods/garn47.js
@@ -0,0 +1,325 @@
+// mod by nekonico :3
+
+behaviors.CAR_DELETE = function(pixel) {
+ if (carDieSound) { createPixel("car_explosion",pixel.x, pixel.y), carDieSound.play(); }
+},
+
+behaviors.CARFEEDPIXEL = function(pixel) {
+ if (!pixel.food) { pixel.food = 1, carDieSound.play(); }
+ else { pixel.food ++, carDieSound.play(); }
+ if (pixel.food > (elements[pixel.element].foodNeed||30)) {
+ // loop through adjacentCoords and check each pixel to lay an egg
+ for (var i = 0; i < adjacentCoords.length; i++) {
+ var x = pixel.x+adjacentCoords[i][0];
+ var y = pixel.y+adjacentCoords[i][1];
+ if (isEmpty(x, y)) {
+ if (elements[pixel.element].egg) {
+ createPixel(elements[pixel.element].egg,x,y)
+ }
+ else {
+ createPixel("egg",x,y)
+ pixelMap[x][y].animal = elements[pixel.element].baby || pixel.element;
+ if (elements[pixel.element].eggColor) {
+ pixelMap[x][y].color = pixelColorPick(pixelMap[x][y],elements[pixel.element].eggColor)
+ }
+ }
+ pixel.food = 0;
+ break;
+ }
+ }
+ }
+},
+
+document.onkeydown = function(ki)/*keyboard_input*/ {
+ //w
+ if (ki.keyCode == 87) {
+ KW = true;
+ //vY ++;
+ }
+ //s
+ if (ki.keyCode == 83) {
+ KS = true;
+ //vY ++;
+ }
+}
+document.onkeyup = function(i2)/*keyboard_input*/ {
+ //w
+ if (i2.keyCode == 87) {
+ garnWalkSound.pause()
+ KW = false
+ //vY = 0;
+ }
+ //s
+ if (i2.keyCode == 83) {
+ garnWalkSound.pause()
+ KS = false
+ //vY = 0;
+ }
+}
+var KA = false;
+var KD = false;
+var KW = false;
+var KS = false;
+var vX = 1;
+var vY = 1;
+elements.garn = {
+ name: "garn47",
+ color: "#52562B",
+ category: "special",
+ properties: {
+ dead: false,
+ dir: 1,
+ panic: 0
+ },
+ onPlace: function(pixel) {
+ if (isEmpty(pixel.x, pixel.y+1)) {
+ createPixel("garn_body", pixel.x, pixel.y+1);
+ pixel.element = "garn_head";
+ }
+ else if (isEmpty(pixel.x, pixel.y-1)) {
+ createPixel("garn_head", pixel.x, pixel.y-1);
+ pixelMap[pixel.x][pixel.y-1].color = pixel.color;
+ pixel.element = "garn_body";
+ pixel.color = pixelColorPick(pixel)
+ }
+ else {
+ deletePixel(pixel.x, pixel.y);
+ }
+ },
+ related: ["garn_body","garn_head"],
+ cooldown: defaultCooldown,
+ forceSaveColor: true,
+},
+
+elements.garn_body = {
+ name: "garn",
+ 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 == "garn_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 (vX === 3) {
+ vX --;
+ }
+ if (vY === 3) {
+ vY --;
+ }*/
+ if (KS === true && isEmpty(pixel.x-2, pixel.y-1) && isEmpty(pixel.x-2, pixel.y)) {
+ tryMove (pixel,pixel.x-1,pixel.y)
+ garnWalkSound.play();
+ }
+ if (KW === true && isEmpty(pixel.x+2, pixel.y-1) && isEmpty(pixel.x+2, pixel.y)) {
+ tryMove (pixel,pixel.x+1,pixel.y)
+ garnWalkSound.play();
+ }
+ },
+ category: "special",
+ states:"solid",
+ color:"#52562B",
+}
+
+elements.garn_head = {
+ name: "garn",
+ tick: function(pixel) {
+ /*if (vX === 3) {
+ vX --;
+ }
+ if (vY === 3) {
+ vY --;
+ }*/
+ if (KS === true && isEmpty(pixel.x-2, pixel.y+1) && isEmpty(pixel.x-2, pixel.y)) {
+ tryMove (pixel,pixel.x-1,pixel.y)
+ garnWalkSound.play();
+ }
+ if (KW === true && isEmpty(pixel.x+2, pixel.y+1) && isEmpty(pixel.x+2, pixel.y)) {
+ tryMove (pixel,pixel.x+1,pixel.y)
+ garnWalkSound.play();
+ }
+ },
+ category: "special",
+ states:"solid",
+ color:"#52562B",
+}
+
+elements.car = { // totally carnular
+ color: ["#9F8578","#A07D6A"],
+ behavior: [
+ "XX|XX|XX",
+ "XX|FX%0.25 AND CH:car_slide%1|XX",
+ "XX|M1|XX",
+ ],
+ reactions: {
+ "meat": { elem2:null, chance:0.2, func:behaviors.CARFEEDPIXEL },
+ "cooked_meat": { elem2:null, chance:0.2, func:behaviors.CARFEEDPIXEL },
+ "": { elem2:null, chance:0.2, func:behaviors.CARFEEDPIXEL },
+ "meat": { elem2:null, chance:0.2, func:behaviors.CARFEEDPIXEL },
+ "oxygen": { elem2:"carbon_dioxide", chance:0.3 },
+ "uranium": { elem2:null, chance:0.1, func:behaviors.CARFEEDPIXEL },
+ "milk": { elem2:null, chance:0.1, func:behaviors.CARFEEDPIXEL },
+ },
+ onDelete: behaviors.CAR_DELETE,
+ tick: function(pixel) {
+ if (pixel.start === pixelTicks) {return}
+ if (!tryMove(pixel, pixel.x, pixel.y+1)) {
+ if (pixel.fall < 20) {
+ if (Math.random() < 0.5) {
+ if (!tryMove(pixel, pixel.x+1, pixel.y+1)) {
+ tryMove(pixel, pixel.x-1, pixel.y+1);
+ }
+ } else {
+ if (!tryMove(pixel, pixel.x-1, pixel.y+1)) {
+ tryMove(pixel, pixel.x+1, pixel.y+1);
+ }
+ }
+ pixel.fall = 0;
+ }
+ else if (outOfBounds(pixel.x,pixel.y+1) || (!isEmpty(pixel.x,pixel.y+1,true) && elements.egg.ignore.indexOf(pixelMap[pixel.x][pixel.y+1].element) === -1 && elements[pixelMap[pixel.x][pixel.y+1].element].state === "solid")) {
+ pixel.element = "car_explosion"
+ carDieSound.play();
+ }
+ else {pixel.fall = 0}
+ }
+ else {pixel.fall ++}
+ doDefaults(pixel);
+ },
+ ignore: ["paper","sponge","straw","wheat","rat","frog","pollen","clay","snow","mud","wet_sand","tinder","feather","bread","ice_cream","dough"],
+ innerColor: "#9F8578",
+ properties: { "fall":0 },
+ egg: "car",
+ foodNeed: 100,
+ maxSize: 1,
+ cooldown: 10,
+ temp: 20,
+ tempHigh: 1500,
+ stateHigh: "car_explosion",
+ category:"life",
+ burn:15,
+ burnTime:300,
+ state: "solid",
+ density: 1450,
+ conduct: 0.2
+}
+
+elements.car_slide = {
+ name: "car",
+ hidden: true,
+ color: ["#9F8578","#A07D6A"],
+ behavior: [
+ "XX|XX|XX",
+ "XX|FX%0.25 AND CH:car%10|M2 AND BO",
+ "XX|M1|XX",
+ ],
+ reactions: {
+ "meat": { elem2:null, chance:0.2, func:behaviors.CARFEEDPIXEL },
+ "cooked_meat": { elem2:null, chance:0.2, func:behaviors.CARFEEDPIXEL },
+ "oxygen": { elem2:"carbon_dioxide", chance:0.3 },
+ "uranium": { elem2:null, chance:0.1, func:behaviors.CARFEEDPIXEL },
+ "milk": { elem2:null, chance:0.1, func:behaviors.CARFEEDPIXEL },
+ },
+ onDelete: behaviors.CAR_DELETE,
+ tick: function(pixel) {
+ if (pixel.start === pixelTicks) {return}
+ if (!tryMove(pixel, pixel.x, pixel.y+1)) {
+ if (pixel.fall < 20) {
+ if (Math.random() < 0.5) {
+ if (!tryMove(pixel, pixel.x+1, pixel.y+1)) {
+ tryMove(pixel, pixel.x-1, pixel.y+1);
+ }
+ } else {
+ if (!tryMove(pixel, pixel.x-1, pixel.y+1)) {
+ tryMove(pixel, pixel.x+1, pixel.y+1);
+ }
+ }
+ pixel.fall = 0;
+ }
+ else if (outOfBounds(pixel.x,pixel.y+1) || (!isEmpty(pixel.x,pixel.y+1,true) && elements.egg.ignore.indexOf(pixelMap[pixel.x][pixel.y+1].element) === -1 && elements[pixelMap[pixel.x][pixel.y+1].element].state === "solid")) {
+ pixel.element = "car_explosion"
+ carDieSound.play();
+ }
+ else {pixel.fall = 0}
+ }
+ else {pixel.fall ++}
+ doDefaults(pixel);
+ },
+ ignore: ["paper","sponge","straw","wheat","rat","frog","pollen","clay","snow","mud","wet_sand","tinder","feather","bread","ice_cream","dough"],
+ innerColor: "#9F8578",
+ properties: { "fall":0 },
+ egg: "car",
+ foodNeed: 100,
+ maxSize: 1,
+ cooldown: 10,
+ tempHigh: 1500,
+ stateHigh: "car_explosion",
+ category:"life",
+ burn:15,
+ burnTime:300,
+ state: "solid",
+ density: 1450,
+ conduct: 0.2
+}
+
+elements.car_explosion = {
+ name: "explosion",
+ color: ["#9F8578","#A07D6A"],
+ behavior: [
+ "XX|XX|XX",
+ "XX|EX:5>smoke,fire,smoke,fire,fire,car_shard|XX",
+ "XX|XX|XX",
+ ],
+ temp: 300,
+ category: "energy",
+ state: "gas",
+ density: 1000,
+ excludeRandom: true,
+ noMix: true
+},
+elements.car_shard = {
+ name: "glass_shard",
+ color: ["#9F8578","#A07D6A"],
+ behavior: behaviors.POWDER,
+ reactions: {
+ "radiation": { elem1:"rad_shard", chance:0.33 },
+ "rad_steam": { elem1:"rad_shard", elem2:null, chance:0.33 },
+ "fallout": { elem1:"rad_shard", elem2:"radiation", chance:0.1 }
+ },
+ tempHigh: 1500,
+ stateHigh: "molten_glass",
+ category: "powders",
+ state: "solid",
+ density: 2500
+},
+
+carSound = null;
+carDieSound = null;
+carEatSound = null;
+
+elements.car.onSelect = function() {
+ carSound = new Audio("https://static.wikia.nocookie.net/garn47/images/b/b9/Hello-its-me-car-made-with-Voicemod.mp3/revision/latest?cb=20240824212531");
+ carDieSound = new Audio("https://static.wikia.nocookie.net/garn47/images/3/3e/Car-scream-made-with-Voicemod.mp3/revision/latest?cb=20240824214753");
+ carEatSound = new Audio("https://static.wikia.nocookie.net/garn47/images/1/1e/Car-eating-made-with-Voicemod.mp3/revision/latest?cb=20240824220937");
+}
+elements.car.onMouseDown = function() {
+ if (carSound) { carSound.play(); }
+}
+
+garnSound = null;
+garnWalkSound = null;
+
+elements.garn.onSelect = function() {
+ garnSound = new Audio("https://static.wikia.nocookie.net/garn47/images/1/17/Garnular2.mp3/revision/latest?cb=20240614060855");
+ garnWalkSound = new Audio("https://static.wikia.nocookie.net/garn47/images/8/8b/Garn47-Ingame-Walking.mp3/revision/latest?cb=20240606045834");
+}
+elements.garn.onMouseDown = function() {
+ if (garnSound) { garnSound.play(); }
+}
+
+// totally garnular
\ No newline at end of file