This commit is contained in:
JustAGenericUsername 2025-07-31 11:07:49 -04:00
commit cb3084c0f9
17 changed files with 2646 additions and 1727 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 973 B

View File

@ -109,7 +109,7 @@
<script> // PWA things
// add service worker service-worker.js
if (typeof navigator !== 'undefined') {
if (typeof navigator !== 'undefined' && !standalone) {
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/service-worker.js');
@ -13248,7 +13248,7 @@ SEEDRISE: function(pixel) {
};
// detect if discord activity
if (location.hostname.match(/discordsays/i)) {
if (!standalone && location.hostname.match(/discordsays/i)) {
standalone = true;
standaloneType = "discord";
}
@ -13263,6 +13263,11 @@ if (standalone) {
script.src = "mods/steam_port.js";
document.head.appendChild(script);
}
else if (standaloneType === "discord") {
var script = document.createElement('script');
script.src = "mods/discord_port.js";
document.head.appendChild(script);
}
document.documentElement.classList.add("standalone");
}
@ -17923,7 +17928,13 @@ for (var k = 0; k < b0.split(" AND ").length; k++) {
function escapeHTML(unsafe) {return unsafe.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");}
const rtf = new Intl.RelativeTimeFormat(langCode||"en", { style:"short", numeric:"auto" });
rtf = null;
try {
rtf = new Intl.RelativeTimeFormat(langCode||"en", { style:"short", numeric:"auto" });
}
catch {
rtf = new Intl.RelativeTimeFormat("en", { style:"short", numeric:"auto" });
}
function saveMenuOptions(item) {
if (item.workshop && standalone && !item.localFile) {
@ -18065,7 +18076,7 @@ for (var k = 0; k < b0.split(" AND ").length; k++) {
}
saveDiscordList.setAttribute("data-page",page.toString());
let url = "https://sandboxels.live/browser/api/threads?limit=10&";
let url = (standaloneType === "discord" ? "/.proxy/api" : "https://sandboxels.live/browser/api") + "/threads?limit=10&";
url += "page="+page+"&";
if (sort) url += "sort="+sort+"&";
if (tag) url += "tags="+tag+"&";
@ -20243,7 +20254,16 @@ if (document.referrer && document.referrer.indexOf("r74n.") === -1) {
document.getElementById("gameDiv").classList.add("mobile");
}
if (standaloneType === "discord") {
document.getElementById("savesButton").style.display = "none";
// document.getElementById("savesButton").style.display = "none";
// document.querySelector("#savesMenu .menuTabs").style.display = "none";
document.querySelector("#savesMenu div.menuTab[data-tab='local']").classList.remove("selected");
document.querySelector("#savesMenu div.menuTab[data-tab='discord']").classList.add("selected");
document.querySelector("#savesMenu button.menuTab[data-tab='local']").classList.remove("selected");
document.querySelector("#savesMenu button.menuTab[data-tab='discord']").classList.add("selected");
document.querySelectorAll("#savesMenu button.menuTab").forEach((e) => {
if (e.id !== "savesTabDiscord") e.style.display = "none";
})
document.getElementById("savesButton").addEventListener("click", showDiscordSaves);
document.getElementById("modsButton").style.display = "none";
}
if (standaloneType === "steam") {

View File

@ -231,6 +231,7 @@
<tr><td>neutronium_compressor.js</td><td>Compressor from Minecraft's Avaritia mod that compresses 10,000 pixels of an element into a singularity</td><td>Alice</td></tr>
<tr><td>noblegas.js</td><td>The missing noble gases</td><td>nousernamefound</td></tr>
<tr><td>nousersthings.js</td><td>Many chemical elements, compounds, and more</td><td>nousernamefound</td></tr>
<tr><td>petal_dye.js</td><td>Boil petals to make dye</td><td>Suss</td></tr>
<tr><td>radioactive.js</td><td>Radioactive elements on the periodic table [WIP]</td><td>kaeud</td></tr>
<tr><td>random_rocks.js</td><td>Randomly generates rocks on game load</td><td>Alice</td></tr>
<tr><td>roseyiede.js</td><td>Several variants of a substance called roseyiede</td><td>Alice</td></tr>
@ -246,6 +247,7 @@
<tr><td>conveyance.js</td><td>Conveyors, operated with and without electricity</td><td>Melecie</td></tr>
<tr><td>drill.js</td><td>Drills made out of several materials</td><td>Suss</td></tr>
<tr><td>ExtraMachines.js</td><td>Sensors, energy resources, materials, and more</td><td>Mecoolnotcool</td></tr>
<tr><td>fans.js</td><td>Fans</td><td>Cube14yt</td></tr>
<tr><td>fine_tuned_cloner.js</td><td>Cloner that can spawn at different rates and prevent unwanted cloning</td><td>BatteRaquette58</td></tr>
<tr><td>flipflop.js</td><td>Toggleable switches <a href="https://github.com/R74nCom/sandboxels/pull/134">[More Info]</a></td><td>Flix</td></tr>
<tr><td>fueled_generators.js</td><td>Fuel powered generators</td><td>guzzo86</td></tr>
@ -339,6 +341,7 @@
<tr><td>nograssgrow.js</td><td>Prevents Grass from growing</td><td>mollthecoder</td></tr>
<tr><td>ocean.js</td><td>Marine life</td><td>SquareScreamYT</td></tr>
<tr><td>ores.js</td><td>Ore generation along with tools to mine them</td><td>nousernamefound</td></tr>
<tr><td>petal_dye.js</td><td>Boil petals to make dye</td><td>Suss</td></tr>
<tr><td>pizzasstuff.js</td><td>New animals, foods, and plants</td><td>_ilikepizza_</td></tr>
<tr><td>plants.js</td><td>Wide variety of new plants and fruits</td><td>Adora</td></tr>
<tr><td>primordial_birthpool.js</td><td>Cross between Primordial Soup and Birthpool. Requires fey_and_more.js</td><td>Alice</td></tr>
@ -356,6 +359,7 @@
<tr><td>bfdi.js</td><td>Several references to Battle for Dream Island</td><td>Taterbob</td></tr>
<tr><td>citybuilding.js</td><td>Seeds that create miniature buildings and other city-related items</td><td>SquareScreamYT</td></tr>
<tr><td>collab_mod.js</td><td>Created by multiple people, adds random things</td><td>mrapple, ilikepizza, stefanblox</td></tr>
<tr><td>cubesstuff.js</td><td>Some random stuff like disco ball, pyrite, and nordic gold.</td><td>Cube14yt</td></tr>
<tr><td>doom.js</td><td>As seen on TikTok - Select the Doom element to start [WASD to move]</td><td>ggod</td></tr>
<tr><td>elem3.js</td><td>All elements and combinations from Elemental 3 [Very Large]</td><td>Sophie</td></tr>
<tr><td>explosionsound.js</td><td>Sound effects for explosions</td><td>nousernamefound</td></tr>

401
mods/LimesAdditions.js Normal file
View File

@ -0,0 +1,401 @@
function sendAlert() {
alert("This mod can be weird with TPS. It won't crash, but not everything will work perfectly. Thank you for your understanding. :)")
}
sendAlert()
function coolArea(centerPixel, radius = 3, amount = 10) {
for (let dx = -radius; dx <= radius; dx++) {
for (let dy = -radius; dy <= radius; dy++) {
let x = centerPixel.x + dx;
let y = centerPixel.y + dy;
let target = pixelMap[x]?.[y];
if (target && typeof target.temp === "number") {
target.temp -= amount;
pixelTempCheck(target); // ensures proper state update
}
}
}
}
elements.EXPLODE = {
color: "#FF5555",
behavior: [
"XX|XX|XX",
"XX|EX: 20>plasma|XX",
"XX|XX|XX"
],
category: "tools",
/*tool: function(pixel) {
if (pixel.element === "dirt"){
createPixel("plasma")
}
}
*/
}
elements.admantine = {
color: ["#5c5c5c", "#676469", "#747373"],
behavior: behaviors.WALL,
category: "solids",
tempHigh: 3140,
stateHigh: "molten_admantine",
reactions: {
"hydrogen": {elem1: null, elem2: null},
},
density: 10000,
conduct: 1,
hardness: 10,
}
elements.molten_admantine = {
color: ["#d1521b", "#b68421", "#b14b77", "#e3aa38"],
behavior: behaviors.MOLTEN,
category: "liquids",
tempHigh: 5900,
tempLow: 3139,
stateLow: "admantine",
stateHigh: "admantine_gas",
reactions: {
"hydrogen": {elem1: null, elem2: null}
},
density: 100,
hidden: true,
}
elements.admantine_gas = {
color: ["#535353", "#a9a9a9", "#0b0b0b"],
behavior: behaviors.GAS,
category: "gases",
tempLow: 5899,
stateLow: "molten_admantine",
reactions: {
"hydrogen": {elem1: null, elem2: null}
},
density: 10,
hidden: true,
}
elements.superlight_liquid = {
color: ["#7dadd4", "#a0cedc", "#72bdef", "#d8e1f5"],
behavior: behaviors.LIQUID,
category: "liquids",
tempLow: -100,
tempHigh: 10000,
reactions: {
"admantine": {elem1: null, elem2: "iron"}
},
density: 0.00000001,
}
elements.left_powder = {
color: "#555555",
category: "powders",
behavior: [
"M2|XX|XX",
"M1|XX|XX",
"M2|XX|XX"
],
tempHigh: 1000,
}
elements.right_powder = {
color: "#555555",
category: "powders",
behavior: [
"XX|XX|M2",
"XX|XX|M1",
"XX|XX|M2"
],
tempHigh: 1000,
}
elements.volcano = {
color: "#2e2e2e",
category: "weapons",
cooldown: defaultCooldown,
maxSize: 1,
temp: 0,
//insulate: true,
tick: function(pixel) {
if (!pixelMap[pixel.x]?.[pixel.y]) {return}
if (!pixel.isPlaced) {
if (!tryMove(pixel,pixel.x,pixel.y+1)) {
movePixel(pixel, pixel.x, pixel.y - 5)
pixel.isPlaced = true
}
}
if (!pixel.hasRun && pixel.isPlaced) {
createPixel("basalt", pixel.x, pixel.y+4)
createPixel("basalt", pixel.x, pixel.y+3)
createPixel("basalt", pixel.x, pixel.y+2)
createPixel("basalt", pixel.x-1, pixel.y+1)
createPixel("basalt", pixel.x, pixel.y+1)
createPixel("basalt", pixel.x+1, pixel.y+1)
createPixel("basalt", pixel.x+1, pixel.y+2)
createPixel("basalt", pixel.x-1, pixel.y+2)
createPixel("basalt", pixel.x-2, pixel.y+2)
createPixel("basalt", pixel.x+2, pixel.y+2)
createPixel("basalt", pixel.x, pixel.y+2)
createPixel("basalt", pixel.x, pixel.y+3)
createPixel("basalt", pixel.x+1, pixel.y+3)
createPixel("basalt", pixel.x+2, pixel.y+3)
createPixel("basalt", pixel.x+3, pixel.y+3)
createPixel("basalt", pixel.x-1, pixel.y+3)
createPixel("basalt", pixel.x-2, pixel.y+3)
createPixel("basalt", pixel.x-3, pixel.y+3)
createPixel("basalt", pixel.x, pixel.y+4)
createPixel("basalt", pixel.x+1, pixel.y+4)
createPixel("basalt", pixel.x+2, pixel.y+4)
createPixel("basalt", pixel.x+3, pixel.y+4)
createPixel("basalt", pixel.x+4, pixel.y+4)
createPixel("basalt", pixel.x-1, pixel.y+4)
createPixel("basalt", pixel.x-2, pixel.y+4)
createPixel("basalt", pixel.x-3, pixel.y+4)
createPixel("basalt", pixel.x-4, pixel.y+4)
createPixel("basalt", pixel.x, pixel.y+5)
createPixel("basalt", pixel.x+1, pixel.y+5)
createPixel("basalt", pixel.x+2, pixel.y+5)
createPixel("basalt", pixel.x+3, pixel.y+5)
createPixel("basalt", pixel.x+4, pixel.y+5)
createPixel("basalt", pixel.x+5, pixel.y+5)
createPixel("basalt", pixel.x-1, pixel.y+5)
createPixel("basalt", pixel.x-2, pixel.y+5)
createPixel("basalt", pixel.x-3, pixel.y+5)
createPixel("basalt", pixel.x-4, pixel.y+5)
createPixel("basalt", pixel.x-5, pixel.y+5)
pixel.hasRun = true
}
if (pixel.hasRun && pixel.isPlaced) {
let left = pixelMap[pixel.x - 1]?.[pixel.y];
let right = pixelMap[pixel.x + 1]?.[pixel.y];
if (
(left?.element === "basalt" || left?.element === "rock") &&
(right?.element === "basalt" || right?.element === "rock")
){
if (typeof pixel.height !== "number") {
pixel.height = 0
}
let oldY = pixel.y;
deletePixel(pixel.x, oldY - 1);
movePixel(pixel, pixel.x, oldY - 1);
createPixel("basalt", pixel.x, oldY + 1);
pixel.height ++
}
if (pixel.height >= 7) {
deletePixel(pixel.x, pixel.y)
let select = pixelMap[pixel.x]?.[pixel.y+5]
coolArea(pixel, 20, 150)
/*if (select) {
select.temp = -273
pixelTempCheck(select)
togglePause();
console.log("x: "+pixel.x+" y: "+(pixel.y+5))
}
return
*/
}
let target = pixelMap[pixel.x]?.[pixel.y]
if (typeof pixel.cool !== "number") {
pixel.cool = 0
}
pixel.cool += 0.25
//console.log(Math.round(pixel.cool))
if (target && Number.isInteger(pixel.cool)) {
target.temp -= Math.round(pixel.cool)
}
/*let target2 = pixelMap[pixel.x-2]?.[pixel.y+3]
if (target2) {
target2.temp -= 40
}
let target3 = pixelMap[pixel.x+2]?.[pixel.y+3]
if (target3) {
target3.temp -= 40
}
let target4 = pixelMap[pixel.x-1]?.[pixel.y]
if (target4) {
target4.temp -= 40
}
let target5 = pixelMap[pixel.x+1]?.[pixel.y]
if (target5) {
target5.temp -= 40
}
*/
pixel.spread = 1
if (!pixelMap[pixel.x]?.[pixel.y-1]) {
createPixel("magma", pixel.x, pixel.y-1)
}
if (!pixelMap[pixel.x-(pixel.spread*-1)]?.[pixel.y-1]) {
createPixel("magma", pixel.x-(pixel.spread*-1), pixel.y-1)
}
if (!pixelMap[pixel.x+(pixel.spread*1)]?.[pixel.y-1]) {
createPixel("magma", pixel.x+(pixel.spread*1), pixel.y-1)
}
if (!pixelMap[pixel.x-(pixel.spread*-1)]?.[pixel.y-2]) {
createPixel("magma", pixel.x+(pixel.spread*1), pixel.y-2)
}
if (!pixelMap[pixel.x+(pixel.spread*1)]?.[pixel.y-2]) {
createPixel("magma", pixel.x+(pixel.spread*1), pixel.y-2)
}
if (!pixelMap[pixel.x]?.[pixel.y-2]) {
createPixel("magma", pixel.x, pixel.y-2)
}
if (!pixelMap[pixel.x]?.[pixel.y-3]) {
createPixel("magma", pixel.x, pixel.y-3)
}
if (!pixelMap[pixel.x-(pixel.spread*-1)]?.[pixel.y-3]) {
createPixel("magma", pixel.x-(pixel.spread*-1), pixel.y-3)
}
if (!pixelMap[pixel.x+(pixel.spread*1)]?.[pixel.y-3]) {
createPixel("magma", pixel.x+(pixel.spread*1), pixel.y-3)
}
pixel.spread++
}
}
}
elements.cat = {
color: ["#FFFFFF", "#caa022", "#afafaf", "#baa974"],
category: "life",
tempHigh: 40,
tempLow: -5,
stateHigh: "cooked_meat",
stateLow: "frozen_meat",
breakInto: ["meat", "bone", "vomit", "hairball", "blood", "bone", "stench", "infection", "flea"],
tick: function(pixel) {
let lr
if (Math.random() < 0.2) {
lr = Math.random() < 0.5 ? -1 : 1
}
else {
lr = 0
}
if (!tryMove(pixel, pixel.x, pixel.y+1)) {
if (lr === -1) {
if (isEmpty(pixel.x + lr, pixel.y)) {
if (!tryMove(pixel, pixel.x + lr + lr, pixel.y)) {
if (!tryMove(pixel, pixel.x + lr, pixel.y - 1)) {
if (!tryMove(pixel, pixel.x + lr, pixel.y + 1)) {
}
}
}
}
if (!tryMove(pixel, pixel.x + lr, pixel.y - 1)) {
lr = 1
}
}
else if (lr === 1) {
if (isEmpty(pixel.x + lr, pixel.y)) {
if (!tryMove(pixel, pixel.x + lr + lr, pixel.y)) {
if (!tryMove(pixel, pixel.x + lr, pixel.y - 1)) {
if (!tryMove(pixel, pixel.x + lr, pixel.y + 1)) {
}
}
}
}
if (!tryMove(pixel, pixel.x + lr, pixel.y - 1)) {
lr = -1
}
}
}
if (Math.random() < 0.0001) {
if (isEmpty(pixel.x-1, pixel.y, true)) {
createPixel("stench", pixel.x - 1, pixel.y)
}
else if (isEmpty(pixel.x+1, pixel.y, true)) {
createPixel("stench", pixel.x + 1, pixel.y)
}
}
if (Math.random() < 0.0005) {
if (isEmpty(pixel.x-1, pixel.y, true)) {
createPixel("vomit", pixel.x - 1, pixel.y)
}
else if (isEmpty(pixel.x+1, pixel.y, true)) {
createPixel("vomit", pixel.x + 1, pixel.y)
}
}
if (Math.random() < 0.0005) {
if (isEmpty(pixel.x-1, pixel.y, true)) {
createPixel("hairball", pixel.x - 1, pixel.y)
}
else if (isEmpty(pixel.x+1, pixel.y, true)) {
createPixel("hairball", pixel.x + 1, pixel.y)
}
}
},
reactions: {
"milk": {elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL},
"meat": {elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL},
"cooked_meat": {elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL},
"rotten_meat": {elem2: "stench", chance: 0.5, func: behaviors.FEEDPIXEL},
"bird": {elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL},
"rat": {elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL},
"beans": {elem2: "stench", chance: 0.5, func: behaviors.FEEDPIXEL},
"fish": {elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL},
"poison": {elem1: "rotten_meat", chance: 0.25},
"acid": {elem1: "rotten_meat", chance: 0.8, elem2: null},
"landmine": {elem2: null},
}
}
elements.vomit = {
color: ["#6b722f", "#92700b", "#a3944d", "#6a654e"],
category: "liquids",
tempHigh: 100,
tempLow: 0,
stateHigh: "stench",
stateLow: "vomit_ice",
hidden: true,
behavior: behaviors.LIQUID
}
elements.hairball = {
color: ["#958b71", "#868977"],
category: "powders",
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"M2|M1|M2"
],
tempHigh: 250,
stateHigh: "ash",
hidden: true,
burn: 50,
burnTime: 600,
}
elements.hot_stuff = {
color: ["#a5d6a7", "#ffffff"],
category: "solids",
behavior: behaviors.WALL,
temp: 0,
}

View File

@ -73,6 +73,10 @@ function poisonOther(pixel1, pixel2) {
pixel2.poisoned ??= 30;
}
function isInBounds(x, y) {
return x >= 0 && x < width && y >= 0 && y < height;
}
elements.human.reactions.snake =
{ attr1: { panic: 5 } }
@ -700,6 +704,11 @@ elements.turtle = {
state: "solid",
category: "life",
foodNeed: 10,
tempHigh: 100,
stateHigh: "cooked_meat",
tempLow: -10,
stateLow: "frozen_meat",
breakInto: ["scute", "blood", "meat", "limestone"],
reactions: {
"fish": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.1 },
"kelp": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.5 },
@ -717,16 +726,44 @@ elements.turtle = {
"poison": { elem1: "limestone" },
"poison_gas": { elem1: "limestone" },
},
tick: function (pixel) {
pixel.cd ??= 600;
pixel.cd--;
for (let i = 0; i < squareCoords.length; i++) {
let x = pixel.x + squareCoords[i][0];
let y = pixel.y + squareCoords[i][1];
if (isEmpty(x, y) && pixel.cd <= 0 && Math.random() <= 0.005) {
createPixel("scute", x, y);
pixel.cd = 600;
}
}
}
elements.tortoise = {
color: ["#47b000", "#406000"],
behavior: [
"XX|XX|XX",
"XX|FX%1|M2%5",
"M2|M1|M2",
],
density: 1080,
state: "solid",
category: "life",
foodNeed: 10,
tempHigh: 100,
stateHigh: "cooked_meat",
tempLow: -10,
stateLow: "frozen_meat",
breakInto: ["blood", "meat", "limestone"],
reactions: {
"grass": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"plant": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"evergreen": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"pistil": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"petal": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"lettuce": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"tomato": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"pumpkin": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"radiation": { elem1: ["ash", "meat", "cooked_meat", "rotten_meat", "limestone"], chance: 0.4 },
"oxygen": { elem2: "carbon_dioxide", chance: 0.5 },
"mercury": { elem1: "rotten_meat", chance: 0.1 },
"bleach": { elem1: "rotten_meat", chance: 0.1 },
"infection": { elem1: "rotten_meat", chance: 0.025 },
"uranium": { elem1: "rotten_meat", chance: 0.1 },
"cyanide": { elem1: "rotten_meat", chance: 0.1 },
"chlorine": { elem1: "meat", chance: 0.1 },
"alcohol": { elem1: "meat", chance: 0.025 },
"vinegar": { elem1: "rotten_meat", chance: 0.001 },
"poison": { elem1: "limestone" },
"poison_gas": { elem1: "limestone" },
}
}

View File

@ -10,7 +10,7 @@ function pluckMatrix(x, y, w, h) {
for (var i = 0; i < w; i++) {
var px = pixelMap[x + i]?.[y + j];
if (px) {
row.push({ element: px.element, temp: px.temp, color: px.color });
row.push({ element: px.element, temp: px.temp, color: px.color, clone: px?.clone });
} else {
row.push("#");
}
@ -53,7 +53,7 @@ document.addEventListener("mousedown", (event) => {
var matrix = pluckMatrix(x - (size-1)/2, y - (size-1)/2, size, size);
var payload = JSON.stringify({ matrix, x, y });
navigator.clipboard.writeText(payload)
.then(() => alert("Copied " + size + "×" + size))
.then(() => logMessage("Copied " + size + "×" + size))
.catch(e => console.error("Copy failed:", e));
}
@ -72,15 +72,17 @@ document.addEventListener("mousedown", (event) => {
if (cell !== "#" && cell.element) {
var px = createPixel(cell.element, x + i - (size-1)/2, y + j - (size-1)/2);
if (px) {
if (typeof cell.temp === "number") px.temp = cell.temp;
if (typeof cell.color === "string") px.color = cell.color;
var px2 = pixelMap[x + i - (size-1)/2][y + j - (size-1)/2];
if (px2) {
px2.temp = cell.temp;
px2.clone = cell.clone;
px2.color = cell.color;
}
}
}
}
alert("Pasted at", x, y);
logMessage("Pasted Successfully");

611
mods/cubesstuff.js Normal file
View File

@ -0,0 +1,611 @@
elements.button = {
color: "#970000",
conduct: 1,
charge: 0,
category: "machines",
behavior: behaviors.WALL,
state: "solid",
onSelect: function () {
logMessage("Click the button with no elements equipped to charge the button.")
},
properties: {
clicked: false,
clickTime: 1,
},
onClicked: function (pixel) {
pixel.clicked = true
pixel.clickTime = 1
},
tick: function (pixel) {
if (pixel.clicked == true && pixel.clickTime > 0) {
pixel.charge = 1
pixel.clickTime--
}
else if (pixel.clicked == true && pixel.clickTime <= 0) {
pixel.clicked = false
pixel.charge = 0
}
}
}
function isPressable(pixel) {
if (elements[pixel.element].pressInto !== undefined) return true;
}
elements.aerogel = {
color: "#79ffff",
category: "solids",
behavior: behaviors.WALL,
state: "solid",
tempHigh: 1200,
stateHigh: "ash",
insulate: true,
density: 0.2,
hardness: 0.1,
breakInto: "dust",
onPlace: function (pixel) {
if (pixel.alpha === undefined) { pixel.alpha = Math.random() * (0.5 - 0.4) + 0.4 }
}
}
let oldCopperReactions = elements.copper.reactions
elements.molten_copper.reactions.molten_aluminum = { elem1: "molten_nordic_gold", elem2: null, chance: 0.5 }
elements.acid.ignore.push("nordic_gold")
elements.acid.ignore.push("nordic_gold_coin")
elements.nordic_gold = {
color: ["#f1db7c", "#e5c34b", "#d2a742", "#b98c31", "#a47320"],
tempHigh: 1060,
behavior: behaviors.WALL,
category: "solids",
state: "solid",
density: 8800,
conduct: 0.90,
breakInto: "nordic_gold_coin"
}
elements.nordic_gold_coin = {
color: ["#f1db7c", "#e5c34b", "#d2a742", "#b98c31", "#a47320"],
tempHigh: 1060,
stateHigh: "molten_nordic_gold",
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
density: 8800,
conduct: 0.90,
alias: "euro_coin",
reactions: {
"glue": { elem1: "nordic_gold", elem2: null }
}
}
function randomColor() {
const letters = "0123456789ABCDEF";
let color = "#";
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
elements.disco_ball = {
color: "#ebebc3",
buttonColor: ["#ff0000", "#ff8800", "#ffff00", "#00ff00", "#00ffff", "#0000ff", "#ff00ff"],
renderer: renderPresets.LED,
behavior: behaviors.WALL,
category: "machines",
tempHigh: 1500,
stateHigh: ["molten_glass", "molten_glass", "molten_copper"],
conduct: 1,
breakInto: "glass_shard",
forceSaveColor: true,
tick: function (pixel) {
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x + coord[0];
var y = pixel.y + coord[1];
if (pixel.charge > 0) {
pixel.color = randomColor()
if (isEmpty(x, y)) {
createPixel("light", x, y)
let p = getPixel(x, y)
if (p !== null && p.element == "light") {
p.color = pixel.color
}
}
}
else { pixel.color = "#ebebc3" }
}
}
}
elements.molten_iron.reactions.sulfur = { elem1: "pyrite", elem2: null, chance: 0.25 }
elements.molten_iron.reactions.molten_sulfur = { elem1: "pyrite", elem2: null, chance: 0.25 }
elements.molten_iron.reactions.sulfur_gas = { elem1: "pyrite", elem2: null, chance: 0.25 }
elements.pyrite = {
color: ["#d8c25e", "#bbaa49", "#998f3e"],
alias: ["fools_gold", "Iron Disulfide"],
density: 5000,
tempHigh: 1177,
stateHigh: ["iron", "molten_sulfur"],
grain: 0.4,
state: "solid",
behavior: behaviors.WALL,
category: "solids"
}
elements.fire_extinguisher_powder = {
color: "#ececec",
behavior: [
"XX|XX|XX",
"XX|DL%1|XX",
"M2%30|M1%30|M2%30"
],
extinguish: true,
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 (getPixel(x, y)?.burning === true) {
let elem = getPixel(x, y)
elem.burning = false
}
}
},
tool: function (pixel) {
if (pixel.burning === true) {
delete pixel.burning;
delete pixel.burnStart;
}
},
canPlace: true,
category: "powders"
}
elements.pie_crust = {
color: "#f1f192",
breakInto: "crumb",
tempHigh: 500,
stateHigh: "ash",
burn: 5,
burnTime: 400,
burnInto: ["smoke", "smoke", "smoke", "ash"],
category: "food",
state: "solid",
behavior: behaviors.STURDYPOWDER,
isFood: true,
hidden: true,
density: 230,
reactions: {
"pumpkin": { elem1: "pie", elem2: null, tempMin: 200 },
"cooked_meat": { elem1: "pie", elem2: null, tempMin: 200 },
"meat": { elem1: "pie", elem2: null, tempMin: 200 },
"potato": { elem1: "pie", elem2: null, tempMin: 200 },
"mashed_potato": { elem1: "pie", elem2: null, tempMin: 200 },
"baked_potato": { elem1: "pie", elem2: null, tempMin: 200 },
"grape": { elem1: "pie", elem2: null, tempMin: 200 }
}
}
elements.pie = {
color: "#fac145",
darkText: false,
behavior: behaviors.STURDYPOWDER,
category: "food",
isFood: true,
density: 240,
burn: 5,
burnTime: 400,
burnInto: ["smoke", "smoke", "smoke", "ash"],
state: "solid",
tempHigh: 500,
stateHigh: "ash",
breakInto: "sauce",
breakIntoColor: ["#ff822e", "#ff8c2e"]
}
elements.gasoline = {
color: ["#ffff66", "#ffff55", "#ffff44"],
behavior: behaviors.LIQUID,
burn: 80,
burnTime: 100,
burnInto: ["fire", "fire", "fire", "explosion"],
viscosity: 0.7,
density: 750,
category: "liquids",
state: "liquid",
conduct: 0.02,
behaviorOn: [
"XX|XX|XX",
"XX|EX:10|XX",
"XX|XX|XX"
]
}
// Make molten sulfur stinky
elements.molten_sulfur.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) && Math.random() <= 0.0005) {
createPixel("stench", x, y)
p = getPixel(x, y)
if (p !== null && p.element == "stench") {
p.temp = pixel.temp
}
}
}
}
elements.disco_floor = {
color: ["#ff0000", "#ff8800", "#ffff00", "#00ff00", "#00ffff", "#0000ff", "#ff00ff"],
breakInto: "glass_shard",
category: "machines",
forceSaveColor: true,
conduct: 1,
behavior: behaviors.WALL,
tick: function (pixel) {
pixel.changeCd ??= 20;
pixel.changeCd--;
if (pixel.changeCd <= 0) {
let colors = elements.disco_floor.color;
pixel.color = colors[Math.floor(Math.random() * colors.length)];
pixel.changeCd = 20;
}
}
};
elements.moss = {
color: ["#007900", "#006000", "#008300"],
behavior: behaviors.POWDER,
tick: function (pixel) {
for (var i = 0; i < squareCoords.length; i++) {
var coords = squareCoords[i];
var x = pixel.x + coords[0];
var y = pixel.y + coords[1];
if (isEmpty(x, y) && Math.random() <= 0.01 && getPixel(pixel.x, pixel.y + 1) && getPixel(pixel.x, pixel.y + 1).element !== "moss") {
createPixel('moss', x, y)
}
}
},
tempHigh: 70,
stateHigh: "dead_plant",
extraTempHigh: {
"100": ["dead_plant", "dead_plant", "steam"]
},
tempLow: -10,
stateLow: "frozen_plant",
burn: 50,
burnTime: 30,
reactions: {
"carbon_dioxide": { elem2: "oxygen", chance: 0.1 },
"rock": { elem2: "dirt", chance: 0.0025 },
"rock_wall": { elem2: "dirt", chance: 0.0025 },
"gravel": { elem2: "dirt", chance: 0.0025 },
},
category: "life"
}
elements.magma.extraTempLow = { "700": "obsidian" }
elements.obsidian = {
color: ["#1f1f1f", "#1f1f1f", "#1f1f1f", "#1f1f1f", "#292929"],
buttonColor: ["#1a1a1a", "#2b2b2b", "#3b3b3b"],
colorPattern: textures.GLASS,
colorKey: {
"g": "#1f1f1f",
"s": "#292929",
"S": "#252525"
},
grain: 0,
behavior: behaviors.WALL,
category: "solids",
tempHigh: 1200,
stateHigh: "magma",
state: "solid",
density: 2500,
breakInto: "obsidian_shard"
}
elements.obsidian_shard = {
color: ["#1f1f1f", "#1f1f1f", "#1f1f1f", "#1f1f1f", "#292929"],
behavior: behaviors.POWDER,
grain: 0,
category: "powders",
tempHigh: 1200,
stateHigh: "magma",
state: "solid",
density: 2500,
}
elements.cardboard = {
color: ["#9E6B34"],
burn: 70,
burnTime: 300,
burnInto: ["fire", "fire", "fire", "fire", "fire", "ash"],
behavior: behaviors.WALL,
reactions: {
"water": { elem1: "cellulose", elem2: null },
"dirty_water": { elem1: "cellulose", elem2: null },
"salt_water": { elem1: "cellulose", elem2: null },
"sugar_water": { elem1: "cellulose", elem2: null },
"seltzer": { elem1: "cellulose", elem2: null },
"soda": { elem1: "cellulose", elem2: null },
"blood": { elem1: "cellulose", elem2: null },
"foam": { elem1: "cellulose", elem2: null },
"bubble": { elem1: "cellulose", elem2: null },
"oil": { elem1: "cellulose", elem2: null },
"alcohol": { elem1: "cellulose", elem2: null },
"vinegar": { elem1: "cellulose", elem2: null }
},
category: "solids",
tempHigh: 248,
stateHigh: ["fire", "fire", "fire", "fire", "fire", "ash"],
state: "solid",
density: 1200
}
elements.paper.pressInto = "cardboard"
elements.press = {
color: ["#999999", "#c0c0c0", "#999999"],
category: "tools",
tool: function (pixel) {
// edited smash code
if (isPressable(pixel)) {
if (elements[pixel.element].pressInto === undefined) { return; }
// if it is an array, choose a random item, else just use the value
let result;
if (elements[pixel.element].pressInto !== undefined) {
if (Array.isArray(elements[pixel.element].pressInto)) {
result = elements[pixel.element].pressInto[Math.floor(Math.random() * elements[pixel.element].pressInto.length)];
}
else {
result = elements[pixel.element].pressInto;
}
}
// change the pixel to the result
if (result === null) {
deletePixel(pixel.x, pixel.y);
return;
}
else if (result !== undefined) {
changePixel(pixel, result);
}
}
}
}
elements.malware.reactions.wire = { elem2: [null, "faulty_wire"], chance: 0.01 };
elements.faulty_wire = {
color: ["#4d0a03", "#4d0a03", "#4d0a03", "#4d0a03", "#4d0a03", "#4d0a03", "#4d0a03", "#4d0a03", "#4d0a03", "#a95232",],
buttonColor: "#4d0a03",
behavior: behaviors.WALL,
behaviorOn: [
"XX|CR:electric,flash%1|XX",
"CR:electric,flash%1|XX|CR:electric,flash%1",
"XX|CR:electric,flash%1|XX"
],
category: "machines",
insulate: true,
conduct: 0.7,
noMix: true,
}
elements.lighter_fluid = {
color: "#f1e185",
behavior: [
"XX|XX|XX",
"M2 AND SW:lighter_fluid_gas|XX|M2 AND SW:lighter_fluid_gas",
"M1 AND SW:lighter_fluid_gas|M1 AND SW:lighter_fluid_gas|M1 AND SW:lighter_fluid_gas"
],
category: "liquids",
state: "liquid",
density: 750,
tick: function (pixel) {
pixel.gasMade ??= 0
for (var i = 0; i < squareCoordsShuffle.length; i++) {
var coord = squareCoordsShuffle[i];
var x = pixel.x + coord[0];
var y = pixel.y + coord[1];
if (isEmpty(x, y)) {
createPixel("lighter_fluid_gas", x, y)
pixel.gasMade += 1
}
}
if (pixel.gasMade > 100 && Math.random() <= 0.01) {
deletePixel(pixel.x, pixel.y)
}
}
}
elements.lighter_fluid_gas = {
color: "#f1e185",
alpha: 0.1,
behavior: behaviors.GAS,
category: "gases",
state: "gas",
burn: 100,
isGas: true,
hidden: true,
density: 20,
tick: function (pixel) {
if (Math.random() <= 0.25) {
deletePixel(pixel.x, pixel.y)
}
}
}
elements.mold = {
color: "#054e05",
category: "life",
behavior: behaviors.POWDER,
state: "solid",
burn: 70,
burnTime: 100,
tempHigh: 200,
stateHigh: "fire",
tempLow: -10,
stateLow: "frozen_plant",
reactions: {
"meat": { elem1: "rotten_meat", elem2: "rotten_meat" },
"cheese": { elem1: "rotten_cheese", elem2: "rotten_cheese" }
},
tick: function (pixel) {
let moldable = ["meat", "cheese", "rotten_meat", "rotten_cheese"]
for (var i = 0; i < squareCoords.length; i++) {
var coords = squareCoords[i];
var x = pixel.x + coords[0];
var y = pixel.y + coords[1];
if (isEmpty(x, y) && Math.random() <= 0.01 && getPixel(pixel.x, pixel.y + 1) && moldable.includes(getPixel(pixel.x, pixel.y + 1).element)) {
createPixel('mold', x, y)
}
}
}
}
elements.glow_stick = {
color: ["#00ff00", "#ea00ff", "#00eeff"],
glow: true,
behavior: behaviors.POWDER,
breakInto: "glow_stick_liquid",
category: "powders"
}
elements.glow_stick_liquid = {
color: ["#00ff00", "#ea00ff", "#00eeff"],
glow: true,
behavior: behaviors.LIQUID,
breakInto: "glow_stick_liquid",
category: "liquids"
}
// Add TPS keybind
keybinds["KeyT"] = function () {
tpsPrompt()
}
function addRow() {
const table = document.getElementById("controlsTable");
const rowCount = table.rows.length;
const newRow = table.insertRow(rowCount - 1);
const cell1 = newRow.insertCell(0);
const cell2 = newRow.insertCell(1);
cell1.textContent = "Change TPS";
cell2.innerHTML = "<kbd>T</kbd>";
}
addRow()
elements.randomizer = {
buttonColor: ["#ff0000", "#ff8800", "#ffff00", "#00ff00", "#00ffff", "#0000ff", "#ff00ff"],
excludeRandom: true,
onSelect: function () {
logMessage("Warning: It can fill up the screen with random elements")
},
tick: function (pixel) {
pixel.color = randomColor()
for (var i = 0; i < adjacentCoords.length; i++) {
var coords = adjacentCoords[i];
var x = pixel.x + coords[0];
var y = pixel.y + coords[1];
let p = getPixel(x, y)
if (!isEmpty(x, y) && !outOfBounds(x, y)) {
if (p.element !== "randomizer") {
changePixel(p, "random")
}
}
}
},
behavior: behaviors.WALL,
insulate: true,
hardness: 1,
category: "special"
}
elements.cloner.ignore.push("randomizer")
elements.ecloner.ignore.push("randomizer")
elements.floating_cloner.ignore.push("randomizer")
elements.slow_cloner.ignore.push("randomizer")
elements.rocket.ignore.push("randomizer")
elements.antibomb.tick = function (pixel) {
doDefaults(pixel)
if (!tryMove(pixel, pixel.x, pixel.y + 1)) {
if (!outOfBounds(pixel.x, pixel.y + 1)) {
var elem = pixelMap[pixel.x][pixel.y + 1].element;
if (elements[elem].isGas) { return }
}
else {
var elem = "smoke";
}
if (elem !== "antibomb" && elem !== "randomizer") {
explodeAt(pixel.x, pixel.y, 8, elem)
}
}
}
function drawCircle(x0, y0, radius, element) {
for (let y = -radius; y <= radius; y++) {
for (let x = -radius; x <= radius; x++) {
if (x * x + y * y <= radius * radius) {
let px = x0 + x;
let py = y0 + y;
if (isEmpty(px, py)) {
createPixel(element, px, py);
}
}
}
}
}
let circleRad = 7;
let circleElem = "wood";
elements.circle = {
color: "#FF0000",
behavior: behaviors.WALL,
category: "special",
onSelect: function() {
let ans1 = Number(prompt("Select the radius you want your circle to be:"));
let ans2 = prompt("Now give the element your circle should be made of:");
// Validate radius
if (Number.isInteger(ans1) && ans1 > 0) {
circleRad = ans1;
} else {
logMessage("Invalid radius, using default/last size: " + circleRad);
}
// Validate element
let similar = mostSimilarElement(ans2);
if (similar && elements[similar]) {
circleElem = similar;
} else {
logMessage("Invalid element, using default/last element: " + circleElem);
}
},
onPlace: function(pixel) {
drawCircle(pixel.x, pixel.y, circleRad, circleElem);
changePixel(pixel, circleElem);
},
maxSize: 1
};
runAfterReset(function() {
circleRad = 7;
circleElem = "wood";
})

36
mods/discord_port.js Normal file
View File

@ -0,0 +1,36 @@
// For the Sandboxels Discord activity: https://discord.com/oauth2/authorize?client_id=1360770918732796117
function convertListeners() {
document.querySelectorAll("*[onclick]").forEach((e) => {
e.addEventListener("click", e.onclick);
e.removeAttribute("onclick");
})
document.querySelectorAll("*[oninput]").forEach((e) => {
e.addEventListener("input", e.oninput);
e.removeAttribute("oninput");
})
document.querySelectorAll("*[onchange]").forEach((e) => {
e.addEventListener("change", e.onchange);
e.removeAttribute("onchange");
})
}
_showPromptScreen = showPromptScreen;
showPromptScreen = function() {
_showPromptScreen();
convertListeners();
}
_showInfo = showInfo;
showInfo = function() {
_showInfo();
convertListeners();
}
_getDiscordSaves = getDiscordSaves;
getDiscordSaves = function() {
_getDiscordSaves();
convertListeners();
}
window.addEventListener("load", convertListeners);

204
mods/fans.js Normal file
View File

@ -0,0 +1,204 @@
function getSelfMovingBehaviorFunctionNames() {
return Object.entries(behaviors)
.filter(([name, func]) => {
if (typeof func !== "function") return false;
if (["SEEDRISE"].includes(name)) return false;
const code = func.toString();
// Only allow if it's moving its own pixel
const selfMove = /movePixel\s*\(\s*pixel\s*,/.test(code) || /tryMove\s*\(\s*pixel\s*,/.test(code)
|| /pixel\.(x|y)\s*[\+\-]=/.test(code);
return selfMove;
})
.map(([name]) => name);
}
const builtInMovementBehaviors = [
"M1", "M2","BO", "SP", "XX|M1", "M1|M2", "M1%", "M2%", "M1%|M2",
"M1|M2%", "M1%|M2%", 'XX|M1%', 'M1%|XX', 'XX|M2%', 'M2%|XX'
];
function behaviorIncludesMovement(behaviorMatrix, movementFunctionNames) {
if (!Array.isArray(behaviorMatrix)) return false;
for (const row of behaviorMatrix) {
if (!Array.isArray(row)) continue;
for (const cell of row) {
if (typeof cell !== "string") continue;
// Handle "AND" logic: multiple behaviors in one cell
const andParts = cell.split("AND");
for (const andPart of andParts) {
const parts = andPart.trim().split("|").map(p => p.trim());
if (parts.some(p => builtInMovementBehaviors.includes(p) || movementFunctionNames.includes(p))) {
return true;
}
}
}
}
return false;
}
runAfterAutogen(function () {
const movementFunctionNames = getSelfMovingBehaviorFunctionNames();
const movableElements = Object.entries(elements).filter(([name, elem]) => {
const behavior = elem.behavior;
const tick = elem.tick || elem.tickFunc;
let movesSelf = false;
// Check behavior matrix
if (Array.isArray(behavior)) {
movesSelf = behaviorIncludesMovement(behavior, movementFunctionNames);
}
// Check single string
else if (typeof behavior === "string") {
const parts = behavior.split("|").map(p => p.trim());
movesSelf = parts.some(p => builtInMovementBehaviors.includes(p) || movementFunctionNames.includes(p));
}
// Check function-type behavior
else if (typeof behavior === "function") {
movesSelf = movementFunctionNames.includes(behavior.name);
}
// Check tick function
if (!movesSelf && typeof tick === "function") {
const code = tick.toString();
if (/movePixel\s*\(\s*pixel\s*,/.test(code) || /tryMove\s*\(\s*pixel\s*,/.test(code) || /pixel\.(x|y)\s*[\+\-]=/.test(code)) {
movesSelf = true;
}
}
return movesSelf;
}).map(([name]) => name);
window.movableElementsByBehavior = movableElements;
});
// Create a global map to track delay for each position
if (!window.fanPushDelays) {
window.fanPushDelays = new Map();
}
elements.fan_right = {
behavior: behaviors.WALL,
color: "#c5c5c5",
tick: function (pixel) {
const fan_strength = 10;
const delay_ticks = 2;
for (let i = 1; i <= fan_strength; i++) {
const x = pixel.x + i;
const y = pixel.y;
// SKIP if position is empty
if (isEmpty(x, y)) continue;
const delem = pixelMap[x]?.[y];
if (!delem) continue;
// Skip non-movable elements
if (!window.movableElementsByBehavior.includes(delem.element)) continue;
// Use position key for delay tracking
const key = `${x},${y}`;
const currentDelay = window.fanPushDelays.get(key) || 0;
if (currentDelay >= delay_ticks) {
window.fanPushDelays.set(key, 0);
const newX = x + 1;
if (isEmpty(newX, y)) {
movePixel(delem, newX, y);
}
} else {
window.fanPushDelays.set(key, currentDelay + 1);
}
}
},
category: "machines"
};
elements.fan_left = {
behavior: behaviors.WALL,
color: "#c5c5c5",
tick: function (pixel) {
const fan_strength = 10;
const delay_ticks = 2;
for (let i = 0; i >= -fan_strength; i--) {
const x = pixel.x + i;
const y = pixel.y;
// SKIP if position is empty
if (isEmpty(x, y)) continue;
const delem = pixelMap[x]?.[y];
if (!delem) continue;
// Skip non-movable elements
if (!window.movableElementsByBehavior.includes(delem.element)) continue;
// Use position key for delay tracking
const key = `${x},${y}`;
const currentDelay = window.fanPushDelays.get(key) || 0;
if (currentDelay >= delay_ticks) {
window.fanPushDelays.set(key, 0);
const newX = x - 1;
if (isEmpty(newX, y)) {
movePixel(delem, newX, y);
}
} else {
window.fanPushDelays.set(key, currentDelay + 1);
}
}
},
category: "machines"
};
/*
elements.fan_up = {
behavior: behaviors.WALL,
tick: function (pixel) {
let fan_strength = 10;
let delay_ticks = 0; // delay between pushes per pixel row
if (!pixel._fan_delay) pixel._fan_delay = 0;
if (pixel._fan_delay > 0) {
pixel._fan_delay--;
return;
}
for (let i = 1; i <= fan_strength; i++) {
const tx = pixel.x;
const ty = pixel.y - i;
if (!isEmpty(tx, ty)) {
const delem = pixelMap[tx]?.[ty];
if (!delem || !window.movableElementsByBehavior.includes(delem.element)) break;
const above = ty - 1;
if (isEmpty(tx, above)) {
movePixel(delem, tx, above);
pixel._fan_delay = delay_ticks;
break; // only move one per tick
}
}
}
}
};
*/

File diff suppressed because it is too large Load Diff

321
mods/mush_infection.js Normal file
View File

@ -0,0 +1,321 @@
behaviorRules.CHF = function() {
if (!isEmpty(btemp.newCoords.x,btemp.newCoords.y,true)) {
var newPixel = pixelMap[btemp.newCoords.x][btemp.newCoords.y];
if (btemp.info.ignore && btemp.info.ignore.indexOf(newPixel.element) !== -1) {
return;
}
if (!elements[newPixel.element].hardness || Math.random() > elements[newPixel.element].hardness || (btemp.newCoords.x == btemp.pixel.x && btemp.newCoords.y == btemp.pixel.y)) {
if (btemp.arg.indexOf(">") !== -1) {
var argfrom = btemp.arg.split(">")[0];
if (argfrom.indexOf(",") !== -1) {
if (argfrom.split(",").indexOf(newPixel.element) === -1) {
return;
}
}
else if (argfrom !== newPixel.element) {
return;
}
var argto = btemp.arg.split(">")[1];
}
else {
var argfrom = null;
var argto = btemp.arg;
}
if (argto.indexOf(",") !== -1) {
var argto = choose(argto.split(","));
}
if (elements[argto]) {
if (elements[newPixel.element].id !== elements[argto].id) {
if (Math.random() < (1-(elements[newPixel.element].hardness || 0)) / (shiftDown ? 1 : 4)) {
changePixel(newPixel,argto);
}
}
}
}
}
}
elements.mush_spore = {
color: ["#b4d4ae","#b98aba","#805236"],
behavior: [
"XX|M2%1.5|XX",
"XX|L2:mush_stalk AND C2:mush_gill%20|XX",
"XX|M1|XX",
],
tick: function(pixel) {
if (Math.random() < 0.02) {
let x = 0;
if (Math.random() < 0.25) {
x += Math.random() < 0.5 ? -1 : 1;
}
if (!isEmpty(pixel.x+x,pixel.y-1,true) && eLists.SOIL.includes(pixelMap[pixel.x+x][pixel.y-1].element)) {
let soil = pixelMap[pixel.x+x][pixel.y-1];
swapPixels(pixel,soil);
changePixel(soil,"mush_hyphae");
}
else if (!isEmpty(pixel.x+x,pixel.y-1,true) && !outOfBounds(pixel.x+x,pixel.y-1,true) && Math.random() < (1-(elements[pixelMap[pixel.x+x][pixel.y-1].element].hardness || 0)) / (shiftDown ? 1 : 4)) {
let soil = pixelMap[pixel.x+x][pixel.y-1];
swapPixels(pixel,soil);
changePixel(soil,"mush_hyphae");
}
}
},
reactions: {
"wood": { elem2:"mush_hyphae", chance:0.04 },
"tree_branch": { elem2:"mush_hyphae", chance:0.04 },
"plant": { elem2:"mush_hyphae", chance:0.07 },
"evergreen": { elem2:"mush_hyphae", chance:0.07 },
"root": { elem2:"mush_hyphae", chance:0.07 },
"grass": { elem2:"mush_hyphae", chance:0.08 },
"grass_seed": { elem2:"mush_hyphae", chance:0.08 },
"epsom_salt": { elem1:null, chance:0.1 },
"skin": { stain2:"#cc564b" },
},
category: "life",
tempHigh: 225,
stateHigh: "fire",
burn: 10,
burnTime: 20,
state: "solid",
density: 123.6,
cooldown: defaultCooldown,
seed: true,
darkText: true,
mush: true
}
elements.mush_stalk = {
color: "#BDC4B6",
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"XX|CHF:mush_hyphae%1 AND M1|XX",
],
ignore:["mush_hyphae","mush_cap","mush_gill","mush_mulch","mush_stalk","mush_spore"],
reactions: {
"wood": { elem2:"mush_hyphae", chance:0.04 },
"tree_branch": { elem2:"mush_hyphae", chance:0.04 },
"plant": { elem2:"mush_hyphae", chance:0.07 },
"evergreen": { elem2:"mush_hyphae", chance:0.07 },
"root": { elem2:"mush_hyphae", chance:0.07 },
"grass": { elem2:"mush_hyphae", chance:0.08 },
"grass_seed": { elem2:"mush_hyphae", chance:0.08 },
"ash": { elem2:"mush_hyphae", chance:0.04 },
"water": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] },
"salt_water": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] },
"sugar_water": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] },
"seltzer": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] },
"skin": { stain2:"#cc564b" },
},
category: "life",
hidden: true,
tempHigh: 225,
stateHigh: "fire",
burn: 10,
burnTime: 65,
state: "solid",
density: 90.445,
seed: "mush_spore",
breakInto: [null,null,"mush_mulch"],
mush: true
}
elements.mush_gill = {
color: "#BFC395",
tick: function(pixel) {
if (!pixel.mColor) {
// make it a hsl random hue, 54% saturation, 52% lightness
pixel.mColor = "hsl(" + Math.floor(Math.random()*200+180)%360 + ",54%,52%)";
}
if (isEmpty(pixel.x,pixel.y-1) && Math.random() < 0.1) {
createPixel("mush_cap",pixel.x,pixel.y-1);
pixelMap[pixel.x][pixel.y-1].color = pixel.mColor;
}
if (isEmpty(pixel.x-1,pixel.y) && Math.random() < 0.02) {
// create either mush_gill or mush_cap
if (Math.random() < 0.5) {
createPixel("mush_gill",pixel.x-1,pixel.y);
pixelMap[pixel.x-1][pixel.y].mColor = pixel.mColor;
} else {
createPixel("mush_cap",pixel.x-1,pixel.y);
pixelMap[pixel.x-1][pixel.y].color = pixel.mColor;
}
}
if (isEmpty(pixel.x+1,pixel.y) && Math.random() < 0.02) {
if (Math.random() < 0.5) {
createPixel("mush_gill",pixel.x+1,pixel.y);
pixelMap[pixel.x+1][pixel.y].mColor = pixel.mColor;
} else {
createPixel("mush_cap",pixel.x+1,pixel.y);
pixelMap[pixel.x+1][pixel.y].color = pixel.mColor;
}
}
if (!isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y+1) && (pixel.start + 10) > pixelTicks && pixel.main !== true) {
pixel.main = true
}
if (isEmpty(pixel.x,pixel.y+1) && pixel.main == true) {
createPixel("mush_stalk",pixel.x,pixel.y+1);
}
doDefaults(pixel);
},
reactions: {
"water": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] },
"salt_water": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] },
"sugar_water": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] },
"seltzer": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] }
},
category: "life",
hidden: true,
movable: false,
tempHigh: 225,
stateHigh: "fire",
burn: 10,
burnTime: 65,
burnInto: "mush_spore",
state: "solid",
density: 90.445,
seed: "mush_spore",
breakInto: [null,"mush_mulch","mush_spore","poison"],
mush: true
}
elements.mush_cap = {
color: ["#c76243","#c74442","#c7437e","#c043c7","#7c43c7","#5FEA5F","#c76243","#c74442","#c7437e","#c043c7","#7c43c7","#4543c7","#5FEA5F"],
singleColor: true,
behavior: behaviors.WALL,
reactions: {
"water": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] },
"salt_water": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] },
"sugar_water": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] },
"seltzer": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] }
},
category: "life",
hidden: true,
tempHigh: 225,
stateHigh: "fire",
burn: 10,
burnTime: 65,
burnInto: "mush_spore",
state: "solid",
density: 90.445,
seed: "mush_spore",
breakInto: [null,null,"mush_mulch"],
mush: true
}
elements.mush_hyphae = {
color: "#AB8A70",
behavior: [
"CHF:mush_hyphae,mush_hyphae,mush_mulch%5 AND CH:mush_mulch>mush_hyphae%0.05 AND CR:mush_hyphae%0.05|CR:mush_spore,mush_mulch%0.01 AND CH:mush_hyphae>mush_mulch%0.5|CHF:mush_hyphae,mush_hyphae,mush_mulch%5 AND CH:mush_mulch>mush_hyphae%0.05 AND CR:mush_hyphae%0.05",
"CHF:mush_mulch%0.5 AND CR:mush_mulch%0.01 AND CH:mush_hyphae>mush_mulch%5|XX|CHF:mush_mulch%0.5 AND CR:mush_mulch%0.01 AND CH:mush_hyphae>mush_mulch%5",
"CHF:mush_hyphae,mush_hyphae,mush_mulch%5 AND CH:mush_mulch>mush_hyphae%0.05 AND CR:mush_hyphae%0.5|CH:mush_hyphae>mush_mulch%0.5 AND CR:mush_mulch%0.01|CHF:mush_hyphae,mush_hyphae,mush_mulch%5 AND CH:mush_mulch>mush_hyphae%0.05 AND CR:mush_hyphae%0.5",
],
ignore:["mush_hyphae","mush_cap","mush_gill","mush_mulch","mush_stalk","mush_spore"],
reactions: {
"wood": { elem2:"mush_mulch", chance:0.04 },
"tree_brake": { elem2:"mush_mulch", chance:0.04 },
"plant": { elem2:"mush_mulch", chance:0.07 },
"evergreen": { elem2:"mush_mulch", chance:0.07 },
"root": { elem2:"mush_mulch", chance:0.07 },
"grass": { elem2:"mush_mulch", chance:0.08 },
"grass_seed": { elem2:"mush_mulch", chance:0.08 },
"ash": { elem2:"mush_mulch", chance:0.04 },
"water": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] },
"salt_water": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] },
"sugar_water": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] },
"seltzer": { elem2:"broth", tempMin:70, color2:["#CC9978","#CD8C6F","#BE785E"] },
"skin": { stain2:"#cc564b" },
},
category: "life",
hidden: true,
tempHigh: 225,
stateHigh: "fire",
burn: 30,
burnTime: 20,
state: "solid",
density: 462,
seed: "mush_spore",
conduct: 0.1,
breakInto: ["mush_mulch","mush_mulch","mush_mulch"],
mush: true
}
elements.mush_mulch = {
color: ["#7F494C","#764042","#693A3F"],
behavior: [
"XX|ST:mush_hyphae%75|XX",
"ST:mush_hyphae%75|FX%0.25|ST:mush_hyphae%75",
"M2%50|ST:mush_hyphae AND M1%75|M1%50",
],
reactions: {
"dead_plant": { elem2:[null,null,null,"mush_mulch","mush_hyphae"], chance:0.0025 },
"rotten_meat": { elem2:[null,null,null,"mush_mulch","mush_hyphae"], chance:0.0025 },
"dead_bug": { elem2:[null,null,null,"mush_mulch","mush_hyphae"], chance:0.0025 },
"wood": { elem2:[null,"mush_mulch","mush_hyphae"], chance:0.0025 },
"skin": { stain2:"#cc564b" },
},
tick: function(pixel) {
if ((isEmpty(pixel.x+1,pixel.y) || isEmpty(pixel.x-1,pixel.y) || !isEmpty(pixel.x+1,pixel.y) || !isEmpty(pixel.x-1,pixel.y)) && isEmpty(pixel.x,pixel.y-1) && Math.random() < 0.01) {
if (isEmpty(pixel.x+1,pixel.y) && isEmpty(pixel.x-1,pixel.y) && !isEmpty(pixel.x,pixel.y+1)) {
if (!outOfBounds(pixel.x,pixel.y+1)) {
if (elements[pixelMap[pixel.x][pixel.y+1].element].mush !== true) {
changePixel(pixel,"mush_spore")
}
}
else {
changePixel(pixel,"mush_spore")
}
}
if (!isEmpty(pixel.x+1,pixel.y) && !isEmpty(pixel.x-1,pixel.y) && !isEmpty(pixel.x,pixel.y+1)) {
if (!outOfBounds(pixel.x,pixel.y+1)) {
if (elements[pixelMap[pixel.x][pixel.y+1].element].mush !== true) {
if (!isEmpty(pixel.x+1,pixel.y) && !outOfBounds(pixel.x+1,pixel.y)) {
if (elements[pixelMap[pixel.x+1][pixel.y].element].mush !== true) {
changePixel(pixel,"mush_spore")
}
}
if (!isEmpty(pixel.x-1,pixel.y) && !outOfBounds(pixel.x-1,pixel.y)) {
if (elements[pixelMap[pixel.x-1][pixel.y].element].mush !== true) {
changePixel(pixel,"mush_spore")
}
}
}
}
else {
if (!isEmpty(pixel.x+1,pixel.y) && !outOfBounds(pixel.x+1,pixel.y)) {
if (elements[pixelMap[pixel.x+1][pixel.y].element].mush !== true) {
if (!isEmpty(pixel.x-1,pixel.y) && !outOfBounds(pixel.x-1,pixel.y)) {
if (elements[pixelMap[pixel.x-1][pixel.y].element].mush !== true) {
changePixel(pixel,"mush_spore")
}
}
else {
changePixel(pixel,"mush_spore")
}
}
}
if (!isEmpty(pixel.x-1,pixel.y) && !outOfBounds(pixel.x-1,pixel.y)) {
if (elements[pixelMap[pixel.x-1][pixel.y].element].mush !== true) {
if (!isEmpty(pixel.x+1,pixel.y) && !outOfBounds(pixel.x+1,pixel.y)) {
if (elements[pixelMap[pixel.x+1][pixel.y].element].mush !== true) {
changePixel(pixel,"mush_spore")
}
}
else {
changePixel(pixel,"mush_spore")
}
}
}
}
}
}
doDefaults(pixel);
},
tempHigh:235,
stateHigh: "dirt",
tempLow: -45,
stateLow: "permafrost",
burn: 20,
burnTime: 40,
burnInto: "dirt",
category:"land",
state: "solid",
density: 462,
seed: "mush_spore",
mush: true
}

40
mods/petal_dye.js Normal file
View File

@ -0,0 +1,40 @@
elements.water.reactions.petal = {
func: function(pixel1, pixel2) {
if (pixel1.temp > 64) {
deletePixel(pixel1.x, pixel1.y);
pixel2.element = "dye";
}
}
}
elements.salt_water.reactions.petal = {
func: function(pixel1, pixel2) {
if (pixel1.temp > 64) {
deletePixel(pixel1.x, pixel1.y);
pixel2.element = "dye";
}
}
}
elements.sugar_water.reactions.petal = {
func: function(pixel1, pixel2) {
if (pixel1.temp > 64) {
deletePixel(pixel1.x, pixel1.y);
pixel2.element = "dye";
}
}
}
elements.seltzer.reactions.petal = {
func: function(pixel1, pixel2) {
if (pixel1.temp > 64) {
deletePixel(pixel1.x, pixel1.y);
pixel2.element = "dye";
}
}
}
elements.pool_water.reactions.petal = {
func: function(pixel1, pixel2) {
if (pixel1.temp > 64) {
deletePixel(pixel1.x, pixel1.y);
pixel2.element = "dye";
}
}
}

View File

@ -1,3 +1,6 @@
/*
Version 2.1.0
*/
let is2d = (arr)=>{
return arr.some(item => Array.isArray(item));
}

581
mods/variety_mod.js Normal file
View File

@ -0,0 +1,581 @@
//update 0: Variety Mod!
//update 1: First Update!
//update 2: Moss Update
//update 3: hello_world
//Update 4: Fly Update
//update 5: Maggots and Eggs Update
//update 6: Disinfectant Update
//update 7: hello_world_2
//update 8: Infested Meat Update (scrapped)
//update 9: Zombie Update
//update 10: Bananas Update! (scrapped)
//update 11: Garbage Update (scrapped)
//update 12: Strange Update
//update 12.5: Strange Fix
//update 13: Big Update
//update 14: Garbage and Flies!
//update 15: Compilation (scrapped)
//update 16: Fruit and Flies
//update 17: Mold
//update 18: Updated Flies!
elements.moss = {
//debut: update 2
color: ["#6B7A1A", "#60742E", "#5E823C"],
excludeRandom: false,
behavior: [
["XX","SA","XX"],
["SA AND CL%0.2","XX","SA AND CL%0.2"],
["CL%0.2","M1 AND SA","CL%0.2"]
],
category: "variety_mod",
state: "solid",
tempHigh: 55,
stateHigh: "grass",
tempLow: -20,
stateLow: "ice"
},
elements.hello_world = {
//debut: update 3
color: "#ff0000",
desc:"If you see this, just know the upload worked, and you can use the Variety Mod!",
excludeRandom: false,
behavior: [["XX","SP","XX"],["SP","CH:random%0.1","SP"],["M1","M1","M1"]],
category: "land",
state: "solid",
reactions: {
"water": { elem1: "male_fly", elem2: "female_fly", elem3: "fly_egg", elem4: "maggot" },
}
},
elements.female_fly = {
//debut: update 4
color: "#4B4B4B",
excludeRandom: false,
behavior: [["M1%20","XX","M1%20"],["M1%20","CH:female_fly>dead_fly%0.01","M1%20"],["M1%20","CR:fly_egg%0.06","M1%20"]],
category: "variety_mod",
state: "solid",
breakInto: "dead_fly",
reactions: {
"disinfectant": { elem1: "dead_fly", elem2: "ammonia", elem3: "stench"},
},
tempHigh: 100,
stateHigh:"dead_fly",
tempLow: 10,
stateLow: "ice",
},
elements.male_fly = {
//debut: update 14
color: "#4B4B4B",
excludeRandom: false,
behavior: [["M1","M2","M1"],["M2","CH:dead_fly%0.01","M2"],["M1","M2","M1"]],
category: "variety_mod",
state: "solid",
reactions: {
"disinfectant": { elem1: "dead_fly", elem2: "dead_fly"},
}
},
elements.fly_egg = {
//debut: update 5
color: "#E2EAF4",
excludeRandom: false,
behavior: [["XX","ST","XX"],["ST","CH:maggot%0.036","ST"],["M1","M1 AND ST","M1"]],
category: "variety_mod",
state: "solid",
breakInto: "slime,maggot,female_fly",
reactions: {
"disinfectant": { elem1: "dead_fly", elem2: "ammonia", elem3: "stench"},
"growth_Fluid": { elem1: "maggot", elem2: "female_fly", elem3: "female_fly"}
}
},
elements.maggot = {
//debut:update 16
color: "#F0EEE8",
excludeRandom: false,
behavior: [["M2%10 AND SA%50","SA%50 AND SW: maggot,fly_egg,meat,rotten_meat,cooked_meat","M2%10 AND SA%50"],["M2%50 AND CH:meat,rotten_meat,cooked_meat,cheese,melted_cheese,cheese_powder,rotten_cheese,bread,crumb,toast,garbage_juice,banana,mashed_banana,rotten_banana>stench,stench,stench,plague%0.1","CC: #F9E6D4%0.08 AND CH:fly_pupa%0.05,CR:stench%10","M2%50 AND CH:meat,rotten_meat,cooked_meat,cheese,melted_cheese,cheese_powder,rotten_cheese,bread,crumb,toast,banana,mashed_banana,rotten_banana>stench,plaque%0.1"],["M1 AND CH:meat>rotten_meat%1","M1 AND CH:meat,rotten_meat,cooked_meat,cheese,melted_cheese,cheese_powder,rotten_cheese,bread,crumb,toast,>stench,plaque AND CH:cheese,cheese_powder,melted_cheese>rotten_cheese","M1"]],
category: "variety_mod",
state: "solid",
breakInto: "slime",
tempHigh: 80,
stateHigh: "female_fly",
reactions: {
"disinfectant": { elem1: "stench", elem2: "ammonia", elem3: "stench"},
"growth_Fluid": {elem1: "female_fly", elem2: "female_fly"}
}
},
elements.fly_pupa = {
//debut:update 18
color: "#B1834D",
excludeRandom: false,
behavior: [["XX","SP","XX"],["SP","CH:crawl_fly%0.006 AND CC:#5D5247%0.01","SP"],["M1","M1","M1"]],
category: "variety_mod",
state: "solid",
reactions:{
"disinfectant": {elem1:"mold", elem2:"dead_fly", elem3:"dirt"}
}
},
elements.crawl_fly = {
//update 18
color: "#5D5247",
excludeRandom: false,
behavior: [["M2%0.5","XX","M2%0.5"],["M2%1","CH:male_fly,female_fly%0.06","M2%1"],["XX","M1","XX"]],
category: "variety_mod",
state: "solid",
reactions:{
"disinfectant": {elem1:"mold", elem2:"dead_fly", elem3:"dirt"}
}
},
elements.female_fruitfly = {
//debut: update 16
color: "#EEC758",
excludeRandom: false,
behavior: [["M1%20","SW:grape,juice,fruit_milk,banana,mashed_banana,rotten_banana,dirt,mold%10","M1%20"],["M1%20","CH:female_fruitfly>dead_fly%0.01","M1%20"],["M1%20","CR:fruitfly_egg%0.06","M1%20"]],
category: "variety_mod",
state: "solid",
breakInto: "dead_fly",
reactions: {
"disinfectant": { elem1: "dead_fly", elem2: "dead_fly", elem3: "stench"},
},
tempHigh: 100,
stateHigh:"dead_fly",
tempLow: 10,
stateLow: "ice",
},
elements.male_fruitfly = {
//debut: update 16
color: "#D4A930",
excludeRandom: false,
behavior: [["M1","M2 AND SW:grape,juice,fruit_milk,banana,mashed_banana,rotten_banana,dirt,mold"%10,"M1"],["M2","CH:dead_fly%0.01","M2"],["M1","M2","M1"]],
category: "variety_mod",
breakInto:"dead_bug",
state: "solid",
reactions: {
"disinfectant": { elem1: "dead_fly", elem2: "dead_fly"},
}
},
elements.fruitfly_egg = {
//debut: update 16
color: "#E2EAF4",
excludeRandom: false,
behavior: [["XX","ST","XX"],["ST","CH:fruitfly_maggot%0.018","ST"],["M1","M1 AND ST","M1"]],
category: "variety_mod",
state: "solid",
breakInto: "slime,maggot,female_fruitfly",
reactions: {
"disinfectant": { elem1: "plague", elem2: "slime", elem3: "stench"},
"growth_Fluid": { elem1: "fruitfly_maggot", elem2: "female_fruitfly", elem3: "female_fruitfly"}
}
},
elements.fruitfly_maggot = {
//debut:update 16
color: "#F0EEE8",
excludeRandom: false,
behavior: [["M2%10 AND SA%50 AND SW:grape,juice,fruit_milk,banana,mashed_banana,rotten_banana%10","SA%50","M2%10 AND SA%50 AND SW:grape,juice,fruit_milk,banana,mashed_banana,rotten_banana"],["M2%50 AND CH:cheese,melted_cheese,cheese_powder,rotten_cheese,bread,crumb,toast,grape,banana,mashed_banana,rotten_banana>stench,stench,stench,plague%0.1","CH:fruitfly_pupa%0.05,CR:stench%10","M2%50 AND CH:cheese,melted_cheese,cheese_powder,rotten_cheese,bread,crumb,toast,grape,banana>stench,plaque%0.1"],["M1 AND CH:banana>rotten_banana%1 AND SW:grape,juice,banana,mashed_banana,rotten_banana","M1 AND CH:cheese,melted_cheese,cheese_powder,rotten_cheese,bread,crumb,toast,grape,banana>stench,plaque%0.1 AND CH:cheese,cheese_powder,melted_cheese>rotten_cheese AND CH:banana>rotten_banana,mashed_banana%0.01","M1 AND SW:grape,juice,banana,mashed_banana,rotten_banana"]],
category: "variety_mod",
state: "solid",
breakInto: "slime",
tempHigh: 80,
stateHigh: "female_fruitfly",
reactions: {
"disinfectant": { elem1: "stench", elem2: "plague", elem3: "stench"},
"growth_Fluid": {elem1: "female_fruitfly", elem2: "female_fruitfly"}
}
},
elements.fruitfly_pupa = {
//update 18
color: "#CBAD91",
excludeRandom: false,
behavior: [["XX","SP","XX"],["SP","CH:crawl_fly%0.006 AND CC:#5D5247%0.01","SP"],["M1","M1","M1"]],
category: "variety_mod",
state: "solid"
},
elements.crawl_fruitfly = {
//update 18
color: "#64571c",
excludeRandom: false,
behavior: [["XX","XX","XX"],["M2%2","CH:male_fly,female_fly%0.004","M2%2"],["M1","M1","M1"]],
category: "variety_mod",
state: "solid",
},
elements.dead_fly = {
//debut: update 16
color: "#4B4A4B",
excludeRandom: false,
behavior: [["XX","XX","XX"],["XX","CH:dirt%0.1","XX"],["M1","M1 AND SA","M1"]],
category: "variety_mod",
state: "solid",
reactions: {
"disinfectant": { elem1: "dirt"},
}
},
elements.disinfectant = {
//debut: update 6
color: "#E2EAF4",
excludeRandom: false,
behavior: behaviors.FOAM,
category: "variety_mod",
state: "gas",
stain: -1,
reactions: {
"water": { elem1: "water", elem2: "seltzer"}
}
};
elements.garbage_bag = {
//debut: update 14(failed debut: update 11)
color: "#4B4B4B",
excludeRandom: false,
behavior: [["XX","CH:meat,rotten_meat,frozen_meat,salt,sugar,flour,egg,hard_yolk,rotten_cheese,cheese_powder,grape,herb,lettuce,pickle,banana,mashed_banana,rotten_banana,dirt,mud,juice,dead_bug,>stench","XX"],["XX","XX","XX"],["M1","M1","M1"]],
category: "variety_mod",
state: "solid",
burn: .01,
burnTime: 300,
burnInto: "molten_plastic",
reactions: {
"meat": { elem1: "garbage" },
"rotten_meat": { elem1: "garbage" },
"frozen_meat": { elem1: "garbage" },
"salt": { elem1: "garbage" },
"sugar": { elem1: "garbage" },
"flour": { elem1: "garbage" },
"egg": { elem1: "garbage" },
"hard_yolk": { elem1: "garbage" },
"rotten_cheese": { elem1: "garbage" },
"cheese_powder": { elem1: "garbage" },
"grape": { elem1: "garbage" },
"herb": { elem1: "garbage" },
"lettuce": { elem1: "garbage" },
"pickle": { elem1: "garbage" },
}
},
elements.garbage = {
//debut: update 14(failed debut: update 11)
color: "#4B4A4B",
excludeRandom: false,
behavior: [["XX","CR:stench%0.1","XX"],["SP%20 AND CR:garbage_juice%0.1 AND CH:water>dirty_water,garbage_juice%1","CH:maggot%0.007","SP%20 AND CR:garbage_juice%0.1 AND CH:water>dirty_water,garbage_juice%1"],["M1","M1","M1"]],
breakInto:"maggot",
category: "variety_mod",
state: "solid",
burn: .01,
burnTime: 300,
burnInto: "ash",
reactions: {
"fire": { elem1: "ash", elem2: "female_fly", elem3: "maggot", elem4: "fly_egg" },
}
},
elements.garbage_juice = {
//debut: update 14(failed debut: update 11)
color: ["#6B7A1A", "#60742E", "#5E823C"],
excludeRandom: false,
behavior: behaviors.LIQUID,
stain:0.0025,
category: "variety_mod",
state: "liquid",
reactions: {
"disinfectant": { elem1: "dirty_water", elem2: "stench"},
}
},
elements.banana = {
//debut:update 16
color: ["#FCE47D","#EEC758"],
excludeRandom: false,
behavior: [["XX","ST:vine","XX"],["ST:vine","CH:rotten_banana%0.005","ST:vine"],["M2 AND ","M1","M2"]],
category: "variety_mod",
breakInto:["mashed_banana","juice"],
breakIntoColor: "#D4A930",
state: "solid",
reactions: {
"dirty_water": { elem1: "rotten_banana" },
}
},
elements.mashed_banana = {
//debut:update 16
color: ["#FCE47D","#D4A930"],
excludeRandom: false,
behavior: [["XX","CR:juice%0.01","XX"],["ST%75","Ch:mold%0.015","ST%75"],["M1","M1","M1"]],
category: "variety_mod",
state: "solid",
reactions: {
"yogurt": { elem1: "yogurt" },
"milk": {elem1: "fruit_milk"},
}
},
elements.rotten_banana = {
//debut:update16
color: ["#7e7c29","#64571c","#4a3e16"],
excludeRandom: false,
behavior: [["XX","ST:vine AND CR:juice%0.01 AND CR:fly_egg,fruitfly_egg%0.0085 AND SP","XX"],["ST:vine AND SP","CH:dirt%0.1","ST:vine AND SP"],["M2","M1","M2"]],
category: "variety_mod",
breakInto:"mashed_banana",
state: "solid",
reactions: {
"disinfectant": { elem1: "mold" },
"worm": { elem1: "dirt", elem2: "mold"},
"maggot": { elem1: "dirt", elem2: "mold"},
"fruitfly_maggot": { elem1: "dirt", elem2: "mold"},
}
},
elements.mold = {
//debut:update 17
color: ["#6B7A1A", "#60742E", "#5E823C"],
excludeRandom: false,
behavior: [["CH:rotten_meat,rotten_cheese,rotten_banana>mold%0.07","SP","CH:rotten_meat,rotten_cheese,rotten_banana>mold%0.07"],["CH:rotten_meat,rotten_cheese,rotten_banana>mold%0.07","CH:dirt%0.001","CH:rotten_meat,rotten_cheese,rotten_banana>mold%0.07"],["M1 AND CH:rotten_meat,rotten_cheese,rotten_banana>mold%0.07","M1","M1 AND CH:rotten_meat,rotten_cheese,rotten_banana>mold%0.07"]],
category: "variety_mod",
state: "solid",
reactions: {
"disinfectant": { elem1: "dirt", elem2: "fruitfly_egg", elem3: "stench", elem4: "fruitfly_maggot", elem5: "mold", elem6: "mold" },
}
},
elements.zombie = {
//debut: update 9
hidden: false,
color: ["#75816B","#4D6B53"],
category: "variety_mod",
properties: {
dead: false,
dir: 1,
panic: 1
},
tick: function(pixel) {
if (isEmpty(pixel.x, pixel.y+1)) {
createPixel("z_body", pixel.x, pixel.y+1);
pixel.element = "z_head";
}
else if (isEmpty(pixel.x, pixel.y-1)) {
createPixel("z_head", pixel.x, pixel.y-1);
pixelMap[pixel.x][pixel.y-1].color = pixel.color;
pixel.element = "z_body";
}
else {
deletePixel(pixel.x, pixel.y);
}
},
related: ["z_body","z_head"],
cooldown: defaultCooldown
},
elements.z_head = {
//debut: update 9
hidden: true,
color: ["#75816B","#4D6B53"],
category: "variety_mod",
breakInto: ["rotten_meat","bone","bone","blood"],
properties: {
dead: false
},
tick: function(pixel) {
doHeat(pixel);
doBurning(pixel);
doElectricity(pixel);
if (pixel.dead) {
// Turn into rotten_meat if pixelTicks-dead > 500
if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) {
changePixel(pixel,"rotten_meat");
return
}
}
// Find the body
if (!isEmpty(pixel.x, pixel.y+1, true) && pixelMap[pixel.x][pixel.y+1].element == "z_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("infection", 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; }
},
density: 1030,
state: "solid",
conduct: .05,
tempHigh: 250,
stateHigh: "rotten_meat",
burn: .01,
burnTime: 200,
burnInto: "rotten_meat",
reactions: {
"head": { elem2 : "z_head" , chance:1.0 },
"body": { elem2 : "z_body" , chance:1.0 },
"disinfectant": {elem1:"head"},
},
},
elements.z_body = {
//debut: update 9
hidden: true,
color: ["#5DE2E7","#047e99","#7f5fb0"],
category: "variety_mod",
breakInto: ["rotten_meat","rotten_meat","bone","blood"],
properties: {
dead: false,
dir: 1,
panic: 0
},
tick: function(pixel) {
if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall
if (!isEmpty(pixel.x, pixel.y-2, true)) { // Drag head down
var headpixel = pixelMap[pixel.x][pixel.y-2];
if (headpixel.element == "z_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 bone 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 == "z_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("infection", 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; }
}
},
density: 1035,
state: "solid",
conduct: .05,
tempHigh: 250,
stateHigh: "rotten_meat",
burn: .01,
burnTime: 300,
burnInto: "rotten_meat",
forceSaveColor: true,
reactions: {
"head": { elem2 : "z_head" , chance:1.0 },
"body": { elem2 : "z_body" , chance:1.0 },
"disinfectant": {elem1:"body"},
},
},
elements.growth_Fluid = {
//debut: update 13
color: "#d1b74f",
excludeRandom: false,
behavior: [["XX","XX","XX"],["M2","DL%1","M2"],["M1","M1","M1"]],
category: "variety_mod",
state: "liquid",
reactions: {
"water": { elem1: "disinfectant"},
}
};
elements.strange_Cell = {
//debut: update 12
color: "#b150d4",
excludeRandom: false,
behavior: [["M1%5","ST%5 AND M1%5 AND EX:9>random","M1%5"],["SP","LB:random%0.05 AND RT:1%10","SP"],["M1%5","SW AND SH AND M1%5 AND EX:9>variety_mod%1","M1%5"]],
category: "variety_mod",
state: "solid",
tempHigh: 3000,
stateHigh:"loopy",
reactions: {
"gray_goo": { elem1: "loopy", elem2: "explosion"},
}
},
elements.variety_mod = {
//debut: update 15
color: "#ff0000",
excludeRandom: false,
behavior: [["XX","XX","XX"],["XX","CH:moss,hello_world,female_fly,male_fly,fly_egg,maggot,disinfectant,garbage_bag,garbage,garbage_juice,zombie,growth_Fluid,strange_Cell","XX"],["XX","XX","XX"]],
category: "variety_mod",
state: "solid",
related: ["moss","hello_world","female_fly","male_fly","fly_egg","maggot","fruitfly_egg","banana","mold","disinfectant","garbage_bag","garbage","garbage_juice","zombie","growth_Fluid","strange_Cell"],
cooldown: defaultCooldown
};

View File

@ -1,3 +1,6 @@
/*
Version 1.1.0
*/
Array.prototype.getClosest = function(num){
let arr = [];
for(value of this){
@ -129,7 +132,7 @@ elements.generate = {
b[b.length] = key;
}
}
promptInput("There are the following biomes available: \n"+ b.join(", "), (out)=>{
promptChoose("", b, (out)=>{
if(biomes[out] == undefined){
alert("Invalid Selection.");
} else {
@ -138,7 +141,7 @@ elements.generate = {
elements.generate.default = out;
selectElement("dirt");
}
}, "Enter biome to generate: ", elements.generate.default);
}, "Select a biome to generate: ");
}
}
for(item of enabledMods){

View File

@ -924,9 +924,9 @@ a.texticon {
a.texticon:hover, a.texticon:active, a.texticon:hover:active {
color: rgba(0,0,0,0);
}
.standalone.mobile #savesButton, .standalone.mobile #extraInfo {
/* .standalone.mobile #savesButton, .standalone.mobile #extraInfo {
display: none
}
} */
.standalone #extraLinks, .standalone #attribution {
display: none!important
}