Merge branch 'R74nCom:main' into main

This commit is contained in:
sq 2024-11-03 19:26:46 +08:00 committed by GitHub
commit 53f22f358e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 10856 additions and 45905 deletions

View File

@ -109,6 +109,66 @@
<p>The original <a href="https://sandboxels.r74n.com/changelog.txt">plain text version</a> of this is still maintained.</p>
</div>
<h2 id="1.10.1">[Version 1.10.1 - October 5, 2024 - Creepy Crawlies]</h2>
<ul>
<li>[Crawly]</li>
<li>+ Spider, will climb and create Webs</li>
<li>+ Web (Hidden), will trap bugs</li>
<li>+ Ants can climb walls</li>
<li>[Creepy]</li>
<li>+ Soul (Hidden), from Humans</li>
<li>+ Ectoplasm (Hidden)</li>
<li>+ Tombstone, spawns Souls</li>
<li>~ Note: Soul features will move to the souls.js mod after October</li>
<li>+ Candy is candy corn-colored</li>
<li>+ Humans will wear orange shirts on Halloween</li>
<li>[Changes]</li>
<li>+ Fire can heat existing pixels when placed over them</li>
<li>+ Wet Sand and Mud release Steam when heated</li>
<li>+ Smashing Clouds can release their Water</li>
<li>+ Water will create Bubbles before boiling</li>
<li>+ Dirty Water can be purified before boiling</li>
<li>+ Panicking humans will cause others to panic</li>
<li>+ Rice can be fermented</li>
<li>+ Rats can eat Vines</li>
<li>+ Bleach kills Algae</li>
<li>+ Salt slowly dissolves in Bleach</li>
<li>+ Bleach destroys Ink and Dye</li>
<li>+ Bleach stains Porcelain Shards brown</li>
<li>+ Caramel dissolves in Vinegar</li>
<li>+ Image tool set to Paint will recolor pixels</li>
<li>+ Midas Touch converts hot liquids to Molten Gold</li>
<li>~ Thermite can no longer form Slag</li>
<li>~ Milk boils more realistically</li>
<li>~ Increased minimum temperature for Meat to make Grease</li>
<li>~ Blaster explodes into less Plasma</li>
<li>~ Moved Hive to after Bee when unhidden</li>
<li>+ Rust alias 'Iron Oxide'</li>
<li>[Bug Fixes]</li>
<li>~ Fixed: Mix with Replace Mode deletes pixels</li>
<li>~ Fixed: Cannot Erase lines on mobile</li>
<li>~ Fixed: Heat glow appears in inappropriate views</li>
<li>~ Fixed: Void can be dragged</li>
<li>~ Fixed: Oxidized Copper can't sink in liquids</li>
<li>~ Fixed: Pressure Plate doesn't conduct Heat or sink</li>
<li>~ Fixed: Fire created by molten pixels isn't hot enough</li>
<li>~ Fixed: Mods added with backslash can't be removed</li>
<li>~ Fixed: Single Sponge pixels have NaN moisture</li>
<li>~ Fixed: Non-string hoverStat values crash simulation</li>
<li>~ Fixed: Crash when pixel changes state into a customColor element</li>
<li>[Technical]</li>
<li>+ URL parameter ?holiday=false disables holiday events</li>
<li>+ Pressure Plate 'min' attribute for minimum density</li>
<li>+ 'onStateHigh' and 'onStateLow' element properties</li>
<li>+ 'buttonGlow' element property</li>
<li>+ Saves with abnormally large canvases display a warning</li>
<li>+ createPixel and changePixel functions accept null values</li>
<li>~ Corn updated to use 'onStateHigh' property</li>
<li>~ Pixel 'glow' attribute can be false to override default</li>
<li>~ Pixel 'glow' attribute is removed when pixel changes</li>
<li>~ Random element is no longer hard-coded</li>
</ul>
<h2 id="1.10">[Version 1.10 - August 2, 2024 - Return of the Sand]</h2>
<ul>
<li>+ Rice</li>

View File

@ -6,6 +6,64 @@ See sneak peaks for upcoming updates on the Discord: https://discord.gg/ejUc6YPQ
A fancier version of this changelog can be found here: https://sandboxels.R74n.com/changelog
[Version 1.10.1 - October 5, 2024 - Creepy Crawlies]
[Crawly]
+ Spider, will climb and create Webs
+ Web (Hidden), will trap bugs
+ Ants can climb walls
[Creepy]
+ Soul (Hidden), from Humans
+ Ectoplasm (Hidden)
+ Tombstone, spawns Souls
~ Note: Soul features will move to the souls.js mod after October
+ Candy is candy corn-colored
+ Humans will wear orange shirts on Halloween
[Changes]
+ Fire can heat existing pixels when placed over them
+ Wet Sand and Mud release Steam when heated
+ Smashing Clouds can release their Water
+ Water will create Bubbles before boiling
+ Dirty Water can be purified before boiling
+ Panicking humans will cause others to panic
+ Rice can be fermented
+ Rats can eat Vines
+ Bleach kills Algae
+ Salt slowly dissolves in Bleach
+ Bleach destroys Ink and Dye
+ Bleach stains Porcelain Shards brown
+ Caramel dissolves in Vinegar
+ Image tool set to Paint will recolor pixels
+ Midas Touch converts hot liquids to Molten Gold
~ Thermite can no longer form Slag
~ Milk boils more realistically
~ Increased minimum temperature for Meat to make Grease
~ Blaster explodes into less Plasma
~ Moved Hive to after Bee when unhidden
+ Rust alias 'Iron Oxide'
[Bug Fixes]
~ Fixed: Mix with Replace Mode deletes pixels
~ Fixed: Cannot Erase lines on mobile
~ Fixed: Heat glow appears in inappropriate views
~ Fixed: Void can be dragged
~ Fixed: Oxidized Copper can't sink in liquids
~ Fixed: Pressure Plate doesn't conduct Heat or sink
~ Fixed: Fire created by molten pixels isn't hot enough
~ Fixed: Mods added with backslash can't be removed
~ Fixed: Single Sponge pixels have NaN moisture
~ Fixed: Non-string hoverStat values crash simulation
~ Fixed: Crash when pixel changes state into a customColor element
[Technical]
+ URL parameter ?holiday=false disables holiday events
+ Pressure Plate 'min' attribute for minimum density
+ 'onStateHigh' and 'onStateLow' element properties
+ 'buttonGlow' element property
+ Saves with abnormally large canvases display a warning
+ createPixel and changePixel functions accept null values
~ Corn updated to use 'onStateHigh' property
~ Pixel 'glow' attribute can be false to override default
~ Pixel 'glow' attribute is removed when pixel changes
~ Random element is no longer hard-coded
[Version 1.10 - August 2, 2024 - Return of the Sand]
+ Rice
+ Galvanized Steel (Hidden)

1398
index.html

File diff suppressed because it is too large Load Diff

View File

@ -548,5 +548,10 @@
"galvanized_steel": "Acier galvanisé",
"rice": "Le riz",
"midas_touch": "Touche de Midas",
"liquid_ozone": "Ozone liquide"
"liquid_ozone": "Ozone liquide",
"web": "Toile",
"soul": "Âme",
"spider": "Araignée",
"ectoplasm": "Ectoplasme",
"tombstone": "Pierre tombale"
}

View File

@ -549,5 +549,10 @@
"galvanized_steel": "Thép mạ kẽm",
"rice": "Gạo",
"midas_touch": "Bàn tay của Midas",
"liquid_ozone": "Ozone lỏng"
"liquid_ozone": "Ozone lỏng",
"web": "Tơ Nhện",
"soul": "Linh hồn",
"spider": "Nhện",
"ectoplasm": "Ngoại chất",
"tombstone": "Bia mộ"
}

View File

@ -14,6 +14,7 @@
"machines":"機器",
"special":"特別",
"other":"別徳",
"states":"狀態",
"heat":"加熱",
"cool":"冷卻",
"erase":"擦",
@ -549,5 +550,11 @@
"rice":"米",
"galvanized_steel":"鍍鋅鋼",
"midas_touch":"點石成金",
"liquid_ozone":"液臭氧"
"liquid_ozone":"液臭氧",
"ectoplasm":"外質",
"soul":"鬼",
"tombstone":"墳墓",
"spider":"蜘蛛",
"web":"蜘蛛網"
}

View File

@ -128,6 +128,7 @@
<tr><td>fools.js</td><td>Adds back FOOLS Mode</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
<tr><td>fools24.js</td><td>Adds back the 2024 Multiversal Update (v5.9.1)</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
<tr><td>smooth_water.js</td><td>Changes water mechanics so that it flows in one direction until it bounces off of something</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
<tr><td>souls.js</td><td>Adds Human Souls, Ectoplasm, and Tombstones</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
<tr><td>spring.js</td><td>Many nature elements, like sakura trees, butterflies, beehives, and more</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
<tr><td>survival.js</td><td>With limited resources, you must craft, sell, and buy to progress</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
<tr><td>velocity.js</td><td>Beta for explosion velocity, and later wind, which may come to the base game in the future</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
@ -276,6 +277,7 @@
<tr><td>bananas.js</td><td>Adds bananas and banana plants</td><td>Alice</td></tr>
<tr><td>cat.js</td><td>Adds cats and cat food</td><td>SquareScreamYT</td></tr>
<tr><td>cells.js</td><td>Adds several experimental edits of the Cell element</td><td>Alice</td></tr>
<tr><td>colonies.js</td><td>Adds rockets that contain settlers to terraform a planet.</td><td>Nekonico</td></tr>
<tr><td>crimson.js</td><td>Adds elements relating to the Crimson from Terraria</td><td>Alice</td></tr>
<tr><td>dogs.js</td><td>Adds a simple dog and dog food</td><td>hedera-ivy</td></tr>
<tr><td>fairy_chain.js</td><td>Adds way too many fairies to fey_and_more.js</td><td>Alice</td></tr>
@ -284,6 +286,7 @@
<tr><td>fey_and_more.js</td><td>Adds fairies, magic, and a lot of other things</td><td>Melecie</td></tr>
<tr><td>flowers_and_forests.js</td><td>adds trees and flowers and things to do with nature</td><td>pixelegend4 and SquareScreamYT</td></tr>
<tr><td>fwibblen.js</td><td>Adds a flying creature that turns nickel into itself, and a second creature that does the same to the first one</td><td>Alice</td></tr>
<tr><td>genetics.js</td><td>Adds an organism that evolves and changes as it creates more of itself by eating, and adapts to environment.</td><td>Nekonico</td></tr>
<tr><td>human_edit.js</td><td>Improvements to humans</td><td>Alice</td></tr>
<tr><td>Humanitize.js</td><td>Makes humans cultured and able to craft, mine, build houses, trade, and much more.</td><td>Nekonico</td></tr>
<tr><td>kopalstuff.js</td><td>Adds creatures, spirits, DNA, foods, and more</td><td>DaviStudios</td></tr>
@ -338,6 +341,7 @@
<!----><tr><td class="modCat" colspan="3">Visual Effects</td></tr><!---->
<tr><td>acid_and_shapes.js</td><td>Weird visual effects. Enable in Settings</td><td>Alice</td></tr>
<tr><td>customBackground.js</td><td>Set your background to an image link</td><td>Jayd</td></tr>
<tr><td>heatglow.js</td><td>Red glowing effect for hot metals</td><td>nousernamefound</td></tr>
<tr><td>invisible_dye.js</td><td>Adds elements like Dye and Spray Paint that take the color of the background</td><td>Alice</td></tr>
<tr><td>invisible_wall.js</td><td>Adds an element like Wall that takes the color of the background</td><td>Alice</td></tr>
@ -349,6 +353,9 @@
<tr><td>shader_by_jayd.js</td><td>Adds a glow around light elements</td><td>Jayd</td></tr>
<tr><td>Shroomboxels.js</td><td>A variant of acid_and_shapes.js that uses a different trigonometric function</td><td>Alice</td></tr>
<tr><td>singleColor.js</td><td>Makes all elements pick one color each time they're drawn</td><td>stefanblox</td></tr>
<tr><td>texture_pack_by_jayd.js</td><td>Adds a cool background</td><td>Jayd</td></tr>
<tr><td>UwUify.js</td><td>Adds an "UwU" background</td><td>Jayd</td></tr>
<!----><tr><td class="modCat" colspan="3">Compilations</td></tr><!---->
<tr><td>a_mod_by_alice.js</td><td>A mod combining most of Alices mods, and some other things</td><td>Alice</td></tr>

View File

@ -24,7 +24,7 @@ elements.change_count = {
var choosebehaviors = behaviors
delete choosebehaviors.KILLPIXEL2
delete choosebehaviors.KILLPIXEL1
if (!settings.randomcount){settings.randomcount = 10000; saveSettings()}
if (!settings.randomcount || settings.randomcount > 50000){settings.randomcount = 10000; saveSettings()}
var color = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e","f"]
var states = ["solid", "liquid", "gas"]
var essentialelements = ["molten_gallium", "gallium", "gallium_gas", "change_count"]
@ -162,4 +162,4 @@ document.getElementById("extraInfo").querySelectorAll("small")[1].replaceChildre
}
}
})
}
}

View File

@ -467,18 +467,7 @@ elements.mushy_mud = {
density: 1200,
stain: 0.3
};
elements.mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 1050,
tempHigh: 58,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1000,
stain: 0.3
};
elements.quicksand_mud = {
color: "#DAA520",
behavior: elements.slime.behavior,
@ -515,7 +504,7 @@ elements.sticky_quicksand = {
density: 1100,
stain: 0.25
};
elements.fluff_mud = {
elements.pluff_mud = {
color: "#964B00",
behavior: elements.slime.behavior,
viscosity: 10000,
@ -527,55 +516,6 @@ elements.fluff_mud = {
density: 1300,
stain: 0.2
};
elements.bog = {
color: "#556B2F",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 45,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1400,
stain: 0.25
};
elements.mire = {
color: "#2E8B57",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1500,
stain: 0.3
};
elements.oobleck = {
color: "#008000",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 25,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1600,
stain: 0.15
};
elements.spiderwebs = {
color: "#D3D3D3",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 20,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1700,
stain: 0.1
};
elements.silt_quicksand = {
color: "#DAA520",
behavior: elements.slime.behavior,
@ -1104,3 +1044,312 @@ elements.murky_marsh_mixture = {
density: 1900,
stain: 0.2
};
elements.mud = {
color: "#8B4513",
reactions: {
"water": { "elem1": "wet_mud" },
"mire": { "elem1": "mire_mud" },
"dirt": { "elem1": "thick_mud" },
"plant": { "elem1": "pluff_mud" },
"bog": { "elem1": "boggy_mud" },
"sand": { "elem1": "sandy_mud" },
},
behavior: elements.slime.behavior,
viscosity: 1050,
tempHigh: 58,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1000,
stain: 0.3
};
elements.marsh = {
color: "#556B2F",
behavior: elements.slime.behavior,
reactions: {
"slime": { "elem1": "marshy_slime" },
},
viscosity: 13500,
tempHigh: 75,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1900,
stain: 0.2
};
elements.peat = {
color: "#556B2F",
behavior: elements.slime.behavior,
viscosity: 13500,
tempHigh: 75,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1900,
stain: 0.2
};
elements.goo = {
color: "#556B2F",
behavior: behavior.POWDER,
viscosity: 13500,
tempHigh: 75,
stateHigh: "powder",
tempLow: 0,
category: "powders",
state: "powder",
density: 1900,
stain: 0.2
};
elements.ooze = {
color: "#556B2F",
behavior: elements.slime.behavior,
viscosity: 13500,
tempHigh: 75,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1900,
stain: 0.2
};
elements.spiderwebs = {
color: "#D3D3D3",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 20,
stateHigh: "liquid",
reactions: {
"ooze": { "elem1": "sticky_spider_ooze" },
"goo": { "elem1": "sticky_spider_goo" },
},
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1700,
stain: 0.1
};
elements.bog = {
color: "#556B2F",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 45,
stateHigh: "liquid",
tempLow: 0,
reactions: {
"quicksand": { "elem1": "bog_quicksand" },
},
category: "liquids",
state: "liquid",
density: 1400,
stain: 0.25
};
elements.mire = {
color: "#2E8B57",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1500,
stain: 0.3
};
elements.oobleck = {
color: "#008000",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 25,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1600,
stain: 0.15
};
elements.quicksand = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 1050,
tempHigh: 58,
stateHigh: "liquid",
reactions: {
"water": { "elem1": "wet_quicksand" },
"peat": { "elem1": "peat_quicksand" },
"mud": { "elem1": "quicksand_mud" },
},
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1574,
stain: 0.3
};
elements.gel = {
color: "#008000",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 25,
reactions: {
"spider_webbing": { "elem1": "webbing_gel" },
},
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1600,
stain: 0.15
};
elements.silly_putty = {
color: "#FFD700",
behavior: behaviors.LIQUID,
viscosity: 4000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 900, // Adjusted density
stain: 0.1
};
elements.kinetic_sand = {
color: "#FFD700",
behavior: behaviors.LIQUID,
viscosity: 5000,
tempHigh: 55,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1200, // Adjusted density
stain: 0.15
};
elements.gak = {
color: "#FF69B4",
behavior: behaviors.LIQUID,
viscosity: 6000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 950,
stain: 0.2
};
elements.flubber = {
color: "#FF4500",
behavior: behaviors.LIQUID,
viscosity: 3000,
tempHigh: 65,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 800,
stain: 0.1
};
elements.play_doh = {
color: "#FFC0CB",
behavior: behaviors.LIQUID,
viscosity: 5000,
tempHigh: 55,
reactions: {
"sand": { "elem1": "sandy_play_doh" },
},
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 950,
stain: 0.2
};
elements.floam = {
color: "#98FB98",
behavior: behaviors.LIQUID,
viscosity: 4000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1000,
stain: 0.15
};
elements.moon_sand = {
color: "#D3D3D3",
behavior: behaviors.LIQUID,
viscosity: 4500,
tempHigh: 60,
reactions: {
"water": { "elem1": "moon_quicksand" },
"kinetic_sand": { "elem1": "moon_kinetic_sand" },
},
stateHigh: "liquid",
tempLow: 0,
category: "powders",
state: "powder",
density: 950,
stain: 0.1
};
elements.moon_quicksand = {
color: "#98FB98",
behavior: behaviors.LIQUID,
viscosity: 4000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1000,
stain: 0.15
};
elements.moon_kinetic_sand = {
color: "#D3D3D3",
behavior: behaviors.LIQUID,
viscosity: 4500,
tempHigh: 60,
reactions: {
"water": { "elem1": "kinetic_moon_quicksand" },
},
stateHigh: "liquid",
tempLow: 0,
category: "powders",
state: "powder",
density: 950,
stain: 0.1
};
elements.kinetic_moon_quicksand = {
color: "#98FB98",
behavior: behaviors.LIQUID,
viscosity: 4000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1000,
stain: 0.15
};
elements.sandy_play_doh = {
color: "#FFC0CB",
behavior: behaviors.LIQUID,
viscosity: 5000,
tempHigh: 55,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 950,
stain: 0.2
};

83
mods/UwUify.js Normal file
View File

@ -0,0 +1,83 @@
document.body.style.backgroundImage = 'url("https://jayd-rubies.github.io/image/uwuify.png")';
document.body.style.backgroundSize = 'cover';
gameDiv.style.border = "1px solid #ffffff00";
window.addEventListener("load",function(){
document.querySelectorAll(".categoryButton").forEach(e => {
e.style.backgroundColor = "#ffc0cb40";
})
});
function drawCursor() {
canvas.style.backgroundColor = "transparent";
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 = "#ffc0cb";
layerCtx.fillStyle = "#ffc0cb40";
layerCtx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize);
layerCtx.beginPath();
layerCtx.lineWidth = 3;
layerCtx.stroke();
layerCtx.fillRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize);
layerCtx.fill();
// draw one transparent pixel in the center
if (settings.precision) {
layerCtx.fillStyle = "#ffc0cb80";
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 = "#ffc0cb";
layerCtx.lineWidth = 3;
layerCtx.moveTo(shapeStart.x*pixelSize+pixelSizeHalf, shapeStart.y*pixelSize+pixelSizeHalf);
layerCtx.lineTo(mousePos.x*pixelSize+pixelSizeHalf, mousePos.y*pixelSize+pixelSizeHalf);
layerCtx.stroke()
}
}
}
function pixelColorPick(pixel,customColor=null) {
var element = pixel.element;
var elementInfo = elements[element];
//if (elementInfo.behavior instanceof Array) {
if (pixel.charge && elementInfo.colorOn) {
customColor = elementInfo.colorOn;
}
if (customColor != null) {
if (Array.isArray(customColor)) {
customColor = customColor[Math.floor(Math.random() * customColor.length)];
}
if (customColor.startsWith("#")) {
customColor = hexToRGB(customColor);
}
var rgb = customColor;
}
else {
var rgb = elements[element].colorObject; // {r, g, b}
// If rgb is an array, choose a random item
if (Array.isArray(rgb)) {
rgb = rgb[Math.floor(Math.random() * rgb.length)];
}
}
// Randomly darken or lighten the RGB color
var coloroffset = Math.floor(Math.random() * (Math.random() > 0.5 ? -1 : 1) * Math.random() * 1);
var r = rgb.r + coloroffset;
var g = rgb.g + coloroffset;
var b = rgb.b + coloroffset;
// Make sure the color is within the RGB range
r = Math.max(0, Math.min(255, r));
g = Math.max(0, Math.min(255, g));
b = Math.max(0, Math.min(255, b));
var color = "rgb("+r+","+g+","+b+")";
/*}
else {
var color = elementInfo.color;
if (Array.isArray(color)) {
color = color[Math.floor(Math.random() * color.length)];
}
}*/
return color;
}

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@ function updateStatsNew() {
if (pixelMap[mousePos.x] != undefined) {
var currentPixel = pixelMap[mousePos.x][mousePos.y];
if (currentPixel != undefined) {
stats += "<span id='stat-element' class='stat'>Elem:" + (elements[currentPixel.element].name || currentPixel.element).toUpperCase() + "</span>";
stats += "<span id='stat-element' class='stat'>Elem:" + (elements[currentPixel.element].name || currentPixel.element).toString().toUpperCase() + "</span>";
stats += "<span id='stat-temperature' class='stat'>Temp:" + formatTemp(currentPixel.temp) + "</span>";
if (currentPixel.charge) {
stats += "<span id='stat-charge' class='stat'>C" + currentPixel.charge + "</span>";
@ -49,7 +49,7 @@ function updateStatsNew() {
}
// If the view is not null, show the view in all caps
if (view != null) {
stats += "<span id='stat-view' class='stat'>" + viewKey[view].toUpperCase() + "</span>";
stats += "<span id='stat-view' class='stat'>" + viewKey[view].toString().toUpperCase() + "</span>";
}
statsDiv.innerHTML = stats;
}

620
mods/cannibal_cooking.js Normal file
View File

@ -0,0 +1,620 @@
elements.knife = {
color: ["#cbcdcd","#bdbdbd"],
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"XX|M1 AND SM%0.005|XX",
],
reactions: {
"head": { elem2:["brain","bone"], chance:0.5 },
"body": { elem2:["heart","bone"], chance:0.5 },
"decapitated_head": { elem2:["brain","bone"], chance:0.8 },
"human_corpse": { elem2:["heart","bone"], chance:0.8 },
"water": { elem1:"rust", chance:0.0025 },
"salt_water": { elem1:"rust", chance:0.005 },
"dirty_water": { elem1:"rust", chance:0.04 },
"pool_water": { elem1:"rust", chance:0.04 },
"sugar_water": { elem1:"rust", chance:0.0035 },
"seltzer": { elem1:"rust", chance:0.006 },
"salt": { elem1:"rust", chance:0.004 },
"blood": { elem1:"rust", chance:0.003 },
"infection": { elem1:"rust", chance:0.003 },
"antibody": { elem1:"rust", chance:0.003 },
"fire": { elem1:"rust", chance:0.0025 },
"coffee": { elem1:"rust", chance:0.0003 },
"tea": { elem1:"rust", chance:0.0003 },
"broth": { elem1:"rust", chance:0.0003 },
"juice": { elem1:"rust", chance:0.0003 },
"nut_milk": { elem1:"rust", chance:0.0003 },
},
tempHigh: 1200,
stateHigh: ["molten_steel","molten_steel","ash","charcoal"],
category: "weapons",
density: 2500,
conduct: 0.15,
hardness: 0.2,
darkText: true
}
elements.brain = {
color: ["#deb6c5","#F5CED5","#e87b8f"],
behavior: [
"XX|XX|XX",
"XX|CH:rotten_human_flesh%0.00005|XX",
"M2%75|M1|M2%75",
],
reactions: {
"dirty_water": { "elem1":"rotten_human_flesh", "chance":0.1 },
"fly": { "elem1":"rotten_human_flesh", "chance":0.2 },
"dioxin": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 },
"uranium": { "elem1":"rotten_human_flesh", "chance":0.1 },
"cancer": { "elem1":"rotten_human_flesh", "chance":0.1 },
"plague": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.3 },
"ant": { "elem1":"rotten_human_flesh", "chance":0.1 },
"worm": { "elem1":"rotten_human_flesh", "chance":0.1 },
"rat": { "elem1":"rotten_human_flesh", "chance":0.3 },
"mushroom_spore": { "elem1":"rotten_human_flesh", "chance":0.1 },
"mushroom_stalk": { "elem1":"rotten_human_flesh", "chance":0.1 },
"mercury": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.2 },
"mercury_gas": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 },
"virus": { "elem1":"rotten_human_flesh", "chance":0.1 },
"poison": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.5 },
"infection": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 },
"ink": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 },
"acid": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.5 },
"acid_gas": { "elem1":"rotten_human_flesh", "chance":0.4 },
"cyanide": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.5 },
},
tempHigh: 100,
stateHigh: "cooked_brain",
tempLow: -18,
stateLow: "frozen_human_flesh",
category:"life",
hidden: true,
breakInto: ["human_flesh", "blood"],
burn:10,
burnTime:200,
burnInto:["cooked_brain","cooked_brain","cooked_brain","steam","salt"],
state: "solid",
density: 1081,
conduct: 1,
};
elements.heart = {
color: ["#e31b23","#98002e","#6f1200","#551900","#e31b23","#98002e","#6f1200","#551900","#e31b23","#98002e","#6f1200","#551900","#532e63"],
behavior: [
"CR:blood%0.01|CR:blood%0.02|CR:blood%0.01",
"CR:blood%0.01|CH:rotten_human_flesh%0.00005|CR:blood%0.01",
"M2%75 AND CR:blood%0.02|M1 AND CR:blood%0.05|M2%75AND CR:blood%0.02",
],
reactions: {
"dirty_water": { "elem1":"rotten_human_flesh", "chance":0.1 },
"fly": { "elem1":"rotten_human_flesh", "chance":0.2 },
"dioxin": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 },
"uranium": { "elem1":"rotten_human_flesh", "chance":0.1 },
"cancer": { "elem1":"rotten_human_flesh", "chance":0.1 },
"plague": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.3 },
"ant": { "elem1":"rotten_human_flesh", "chance":0.1 },
"worm": { "elem1":"rotten_human_flesh", "chance":0.1 },
"rat": { "elem1":"rotten_human_flesh", "chance":0.3 },
"mushroom_spore": { "elem1":"rotten_human_flesh", "chance":0.1 },
"mushroom_stalk": { "elem1":"rotten_human_flesh", "chance":0.1 },
"mercury": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.2 },
"mercury_gas": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 },
"virus": { "elem1":"rotten_human_flesh", "chance":0.1 },
"poison": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.5 },
"infection": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 },
"ink": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.1 },
"acid": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.5 },
"acid_gas": { "elem1":"rotten_human_flesh", "chance":0.4 },
"cyanide": { "elem1":"rotten_human_flesh", "elem2":null, "chance":0.5 },
},
tempHigh: 110,
stateHigh: "cooked_heart",
tempLow: -18,
stateLow: "frozen_human_flesh",
category:"life",
hidden: true,
breakInto: ["human_flesh","blood","blood"],
burn:10,
burnTime:200,
burnInto:["cooked_heart","cooked_heart","cooked_heart","blood"],
state: "solid",
density: 1075,
conduct: 1,
};
elements.sweet_blood = {
color: "#ff4040",
behavior: behaviors.LIQUID,
reactions: {
"yeast": { elem1:"alcohol", chance:0.005 },
"plague": { elem1:"infection", elem2:null },
"rotten_meat": { elem1:"infection" },
"rotten_cheese": { elem1:"infection" },
"virus": { elem1:"infection", elem2:null },
"cancer": { elem1:"infection" },
"cyanide": { elem1:"infection", elem2:null },
"cyanide_gas": { elem1:"infection", elem2:null },
"mushroom_spore": { elem1:"infection", elem2:null },
"mushroom_gill": { elem1:"infection" },
"dirty_water": { elem1:"infection", elem2:null },
"rad_steam": { elem1:"infection" },
"rad_glass": { elem1:"infection" },
"rad_shard": { elem1:"infection" },
"rad_cloud": { elem1:"infection" },
"fallout": { elem1:"infection" },
"rust": { elem1:"infection", chance:0.05 },
"oxidized_copper": { elem1:"infection", chance:0.05 },
"rat": { elem1:"infection", chance:0.075 },
"flea": { elem1:"infection", chance:0.03 },
"worm": { elem1:"infection", chance:0.03 },
"mercury": { elem1:"infection", elem2:null, chance:0.05 },
"lead": { elem1:"infection", elem2:null, chance:0.01 },
"oxygen": { elem2:null, chance:0.05 },
"carbon_dioxide": { elem2:null, chance:0.05 },
"alcohol": { elem1:[null,"sugar","dna"], chance:0.02 }
},
viscosity: 12,
tempHigh: 120,
stateHigh: ["steam","sugar","oxygen","steam","sugar","oxygen","steam","salt","oxygen"],
tempLow: -5,
stateLow: "candy",
category:"food",
state: "liquid",
density: 1080,
stain: 0.05,
isFood: true,
hidden: true
}
elements.mellified_man = {
color: ["#f4f8db","#f8fbd0","#fbebba","#e8ce96","#b18f56","#936d43","#715234","#4b422a"],
behavior: [
"XX|CR:honey%0.0001|XX",
"CR:honey%0.0001|XX|CR:honey%0.0001",
"XX|M1 AND CR:honey%0.0001|XX",
],
reactions: {
"water": { elem2:"sugar_water", tempMin:70, color2:"#d7db69" },
"salt_water": { elem2:"sugar_water", tempMin:70, color2:"#d7db69"},
"sugar_water": { elem2:"sugar_water", tempMin:70, color2:"#d7db69" },
"seltzer": { elem2:"sugar_water", tempMin:70, color2:"#d7db69" },
},
tempHigh: 200,
stateHigh: ["cooked_human","cooked_human","honey",],
category:"food",
burn:15,
burnTime:200,
burnInto:["cooked_human","cooked_human","honey",],
breakInto: ["blood","human_flesh","bone","honey","human_flesh","bone"],
state: "solid",
density: 1020,
conduct: 0.1,
isFood: true,
hidden: true
}
elements.human_flesh = {
color: ["#9e4839","#ba6449","#d2856c","#a14940"],
behavior: [
"XX|XX|XX",
"SP|XX|SP",
"XX|M1|XX",
],
reactions: {
"honey": { elem1:"mellified_man", elem2:["honey","honey",null], chance:0.0001 },
"dirty_water": { elem1:"rotten_human_flesh", chance:0.1 },
"fly": { elem1:"rotten_human_flesh", chance:0.2 },
"dioxin": { elem1:"rotten_human_flesh", elem2:null, chance:0.1 },
"uranium": { elem1:"rotten_human_flesh", chance:0.1 },
"cancer": { elem1:"rotten_human_flesh", chance:0.1 },
"plague": { elem1:"rotten_human_flesh", elem2:null, chance:0.3 },
"ant": { elem1:"rotten_human_flesh", chance:0.1 },
"worm": { elem1:"rotten_human_flesh", chance:0.1 },
"rat": { elem1:"rotten_human_flesh", chance:0.3 },
"mushroom_spore": { elem1:"rotten_human_flesh", chance:0.1 },
"mushroom_stalk": { elem1:"rotten_human_flesh", chance:0.1 },
"mycelium": { elem1:"rotten_human_flesh", chance:0.1 },
"hyphae": { elem1:"rotten_human_flesh", chance:0.1 },
"mercury": { elem1:"rotten_human_flesh", elem2:null, chance:0.2 },
"mercury_gas": { elem1:"rotten_human_flesh", elem2:null, chance:0.1 },
"virus": { elem1:"rotten_human_flesh", chance:0.1 },
"poison": { elem1:"rotten_human_flesh", elem2:null, chance:0.5 },
"infection": { elem1:"rotten_human_flesh", elem2:null, chance:0.1 },
"ink": { elem1:"rotten_human_flesh", elem2:null, chance:0.1 },
"acid": { elem1:"rotten_human_flesh", elem2:null, chance:0.5 },
"acid_gas": { elem1:"rotten_human_flesh", chance:0.4 },
"cyanide": { elem1:"rotten_human_flesh", elem2:null, chance:0.5 },
"cyanide_gas": { elem1:"rotten_human_flesh", elem2:null, chance:0.5 },
"rotten_cheese": { elem1:"rotten_human_flesh", chance:0.02 },
"fallout": { elem1:"rotten_human_flesh", chance:0.2 },
"water": { elem2:"broth", tempMin:70 },
"salt_water": { elem2:"broth", tempMin:70 },
"sugar_water": { elem2:"broth", tempMin:70 },
"seltzer": { elem2:"broth", tempMin:70 },
"salt": { elem1:"cured_human_flesh" },
"vinegar": { elem1:"cured_human_flesh", chance:0.1 },
},
tempHigh: 100,
stateHigh: "cooked_human",
tempLow: -18,
stateLow: "frozen_human_flesh",
category:"food",
burn:15,
burnTime:200,
burnInto:"cooked_human",
state: "solid",
density: 1050,
conduct: 0.2,
isFood: true,
hidden: true
}
elements.cooked_brain = {
color: ["#C37C6E","#B77269","#AE625C"],
behavior: behaviors.STURDYPOWDER,
tick: function(pixel) {
if (pixel.temp > 100 && Math.random() < 0.0025 && isEmpty(pixel.x,pixel.y-1)) {
changePixel(pixel,"grease")
}
},
reactions: {
"water": { elem2:"broth", tempMin:70 },
"salt_water": { elem2:"broth", tempMin:70 },
"sugar_water": { elem2:"broth", tempMin:70 },
"dirty_water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"seltzer": { elem2:"broth", tempMin:70 }
},
tempHigh: 300,
stateHigh: "ash",
category:"food",
hidden:true,
burn:10,
burnTime:200,
burnInto: "ash",
state: "solid",
density: 1005,
isFood: true
}
elements.cooked_heart = {
color: ["#A44447","#9A4546","#8A2A30"],
behavior: behaviors.STURDYPOWDER,
tick: function(pixel) {
if (pixel.temp > 100 && Math.random() < 0.0025 && isEmpty(pixel.x,pixel.y-1)) {
changePixel(pixel,"grease")
}
},
reactions: {
"water": { elem2:"broth", tempMin:70 },
"salt_water": { elem2:"broth", tempMin:70 },
"sugar_water": { elem2:"broth", tempMin:70 },
"dirty_water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"seltzer": { elem2:"broth", tempMin:70 }
},
tempHigh: 300,
stateHigh: "ash",
category:"food",
hidden:true,
burn:10,
burnTime:200,
burnInto: "ash",
state: "solid",
density: 1005,
isFood: true
}
elements.cooked_human = {
color: ["#ae7d5b","#9b6d54","#7e4d31"],
behavior: behaviors.STURDYPOWDER,
tick: function(pixel) {
if (pixel.temp > 100 && Math.random() < 0.0025 && isEmpty(pixel.x,pixel.y-1)) {
changePixel(pixel,"grease")
}
},
reactions: {
"water": { elem2:"broth", tempMin:70 },
"salt_water": { elem2:"broth", tempMin:70 },
"sugar_water": { elem2:"broth", tempMin:70 },
"dirty_water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"seltzer": { elem2:"broth", tempMin:70 }
},
tempHigh: 300,
stateHigh: "ash",
category:"food",
hidden:true,
burn:10,
burnTime:200,
burnInto: "ash",
state: "solid",
density: 1005,
isFood: true
}
elements.frozen_human_flesh = {
color: ["#399e8f","#49baa9","#6cd2c6","#40a197"],
behavior: behaviors.STURDYPOWDER,
temp: -18,
tempHigh: 0,
stateHigh: "human_flesh",
category:"food",
hidden:true,
state: "solid",
density: 1070,
isFood: true
}
elements.rotten_human_flesh = {
color: ["#b8b165","#b89765"],
behavior: [
"XX|CR:plague,stench,stench,stench,fly%0.25 AND CH:meat>rotten_meat%1 AND CH:human_flesh>rotten_human_flesh%1|XX",
"SP%99 AND CH:meat>rotten_meat%1 AND CH:human_flesh>rotten_human_flesh%1|XX|SP%99 AND CH:meat>rotten_meat%1 AND CH:human_flesh>rotten_human_flesh%1",
"XX|M1 AND CH:meat>rotten_meat%1 AND CH:human_flesh>rotten_human_flesh%1|XX",
],
reactions: {
"water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"salt_water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"sugar_water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"dirty_water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"seltzer": { elem2:"broth", tempMin:70, color2:"#d7db69" }
},
tempHigh: 300,
stateHigh: ["plague","ash","ammonia"],
category:"food",
hidden: true,
burn:12,
burnTime:200,
burnInto:["plague","ash","ammonia"],
state: "solid",
density: 1005,
conduct: 0.1,
isFood: true
}
elements.cured_human_flesh = {
name: "cured_meat",
color: ["#be5c4b","#c8846f","#dda592","#bc6157"],
behavior: [
"XX|XX|XX",
"SP|XX|SP",
"XX|M1|XX",
],
reactions: {
"honey": { elem1:"mellified_man", elem2:["honey","honey",null], chance:0.0001 },
"water": { elem2:"broth", tempMin:70 },
"salt_water": { elem2:"broth", tempMin:70 },
"sugar_water": { elem2:"broth", tempMin:70 },
"seltzer": { elem2:"broth", tempMin:70 },
},
tempHigh: 100,
stateHigh: "cooked_human",
category:"food",
burn:15,
burnTime:200,
burnInto:"cooked_human",
state: "solid",
density: 1019.5,
conduct: 0.3,
isFood: true,
hidden: true
}
elements.human_corpse = {
color: ["#069469","#047e99","#7f5fb0"],
behavior: [
"XX|XX|XX",
"XX|CH:rotten_human_flesh%0.0001|XX",
"XX|M1|XX",
],
tick: function(pixel) {
if (isEmpty(pixel.x, pixel.y-1)) {
if (Math.random() < 0.01 && !pixel.charge) {
createPixel("blood", pixel.x, pixel.y-1);
}
}
},
category: "life",
hidden: true,
density: 1500,
state: "solid",
conduct: .05,
temp: 37,
tempHigh: 200,
stateHigh: "cooked_human",
tempLow: -30,
stateLow: "frozen_human_flesh",
burn: 10,
burnTime: 250,
burnInto: "cooked_human",
breakInto: ["blood","human_flesh","bone"],
forceSaveColor: true,
reactions: {
"honey": { elem1:"mellified_man", elem2:["honey","honey",null], chance:0.0005 },
"cancer": { elem1:"cancer", chance:0.005 },
"radiation": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_human"], chance:0.4 },
"neutron": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_human"], chance:0.01 },
"fallout": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_human"], chance:0.01 },
"plague": { elem1:["plague","plague","rotten_human_flesh"], chance:0.05 },
"stink_bug": { elem2:"stench", oneway:true },
"sun": { elem1:"cooked_human" },
},
}
elements.decapitated_head = {
color: ["#f3e7db","#f7ead0","#eadaba","#d7bd96","#a07e56","#825c43","#604134","#3a312a"],
behavior: [
"XX|XX|XX",
"XX|CH:rotten_human_flesh%0.0001|XX",
"M2%90|M1|M2%90",
],
tick: function(pixel) {
if (tryMove(pixel, pixel.x, pixel.y+1)) {
if (isEmpty(pixel.x, pixel.y+1) && Math.random() < 0.01) {
createPixel("blood", pixel.x, pixel.y+1);
}
}
},
category: "life",
hidden: true,
density: 1080,
state: "solid",
conduct: .05,
temp: 37,
tempHigh: 200,
stateHigh: "cooked_human",
tempLow: -30,
stateLow: "frozen_human_flesh",
burn: 10,
burnTime: 250,
burnInto: "cooked_human",
breakInto: ["blood","human_flesh","bone"],
forceSaveColor: true,
reactions: {
"honey": { elem1:"mellified_man", elem2:["honey","honey",null], chance:0.0005 },
"cancer": { elem1:"cancer", chance:0.005 },
"radiation": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_human"], chance:0.4 },
"neutron": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_human"], chance:0.03 },
"fallout": { elem1:["ash","human_flesh","rotten_human_flesh","cooked_human"], chance:0.03 },
"plague": { elem1:"plague", chance:0.05 },
"sun": { elem1:"cooked_human" },
"light": { stain1:"#825043" },
},
}
elements.head.tick = function(pixel) {
doHeat(pixel);
doBurning(pixel);
doElectricity(pixel);
if (pixel.dead) {
// Turn into rotten_meat if pixelTicks-dead > 500
if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) {
pixel.element = "decapitated_head";
return
}
}
// Find the body
if (!isEmpty(pixel.x, pixel.y+1, true) && pixelMap[pixel.x][pixel.y+1].element == "body") {
var body = pixelMap[pixel.x][pixel.y+1];
if (body.dead) { // If body is dead, kill head
pixel.dead = body.dead;
}
}
else { var body = null }
if (tryMove(pixel, pixel.x, pixel.y+1)) {
// create blood if severed 10% chance
if (isEmpty(pixel.x, pixel.y+1) && !pixel.dead && Math.random() < 0.1 && !pixel.charge) {
createPixel("blood", pixel.x, pixel.y+1);
// set dead to true 15% chance
if (Math.random() < 0.15) {
pixel.dead = pixelTicks;
}
}
}
// homeostasis
if (pixel.temp > 37) { pixel.temp -= 1; }
else if (pixel.temp < 37) { pixel.temp += 1; }
}
elements.body.tick = function(pixel) {
if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall
if (!isEmpty(pixel.x, pixel.y-2, true)) { // Drag head down
var headpixel = pixelMap[pixel.x][pixel.y-2];
if (headpixel.element == "head") {
if (isEmpty(pixel.x, pixel.y-1)) {
movePixel(pixelMap[pixel.x][pixel.y-2], pixel.x, pixel.y-1);
}
else {
swapPixels(pixelMap[pixel.x][pixel.y-2], pixelMap[pixel.x][pixel.y-1]);
}
}
}
}
doHeat(pixel);
doBurning(pixel);
doElectricity(pixel);
if (pixel.dead) {
// Turn into rotten_meat if pixelTicks-dead > 500
if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) {
pixel.element = "human_corpse";
}
return
}
// Find the head
if (!isEmpty(pixel.x, pixel.y-1, true) && pixelMap[pixel.x][pixel.y-1].element == "head") {
var head = pixelMap[pixel.x][pixel.y-1];
if (head.dead) { // If head is dead, kill body
pixel.dead = head.dead;
}
}
else { var head = null }
if (pixel.burning) {
pixel.panic += 0.1;
if (head && pixelTicks-pixel.burnStart > 240) {
pixel.color = head.color;
}
}
else if (pixel.panic > 0) {
pixel.panic -= 0.1;
}
if (isEmpty(pixel.x, pixel.y-1)) {
// create blood if decapitated 10% chance
if (Math.random() < 0.1 && !pixel.charge) {
createPixel("blood", pixel.x, pixel.y-1);
// set dead to true 15% chance
if (Math.random() < 0.15) {
pixel.dead = pixelTicks;
}
}
}
else if (head == null) { return }
else if (Math.random() < 0.1*(isEmpty(pixel.x, pixel.y+1) ? 1 : pixel.panic+1)) { // Move 10% chance
var movesToTry = [
[1*pixel.dir,0],
[1*pixel.dir,-1],
];
// While movesToTry is not empty, tryMove(pixel, x, y) with a random move, then remove it. if tryMove returns true, break.
while (movesToTry.length > 0) {
var move = movesToTry.splice(Math.floor(Math.random() * movesToTry.length), 1)[0];
if (isEmpty(pixel.x+move[0], pixel.y+move[1]-1)) {
var origx = pixel.x+move[0];
var origy = pixel.y+move[1];
if (tryMove(pixel, pixel.x+move[0], pixel.y+move[1]) && pixel.x===origx && pixel.y===origy) {
movePixel(head, head.x+move[0], head.y+move[1]);
break;
}
}
}
// 15% chance to change direction
if (Math.random() < 0.15) {
pixel.dir *= -1;
}
// homeostasis
if (pixel.temp > 37) { pixel.temp -= 1; }
else if (pixel.temp < 37) { pixel.temp += 1; }
}
}
elements.body.stateHigh = "cooked_human"
elements.head.stateHigh = "cooked_human"
elements.body.breakInto = ["blood","human_flesh","bone","blood","human_flesh","bone","blood","heart","bone",]
elements.head.breakInto = ["blood","brain","bone"]
elements.body.stateLow = "frozen_human_flesh"
elements.head.stateLow = "frozen_human_flesh"
if (!elements.blood.reactions) { elements.blood.reactions = {} }
elements.blood.reactions.caramel = { "elem1": "sweet_blood", "elem2": null, chance:0.001 };
elements.blood.reactions.sugar = { "elem1": "sweet_blood", "elem2": null, chance:0.0005};
if (!elements.head.reactions) { elements.head.reactions = {} }
elements.head.reactions.human_flesh = { "elem2": null, chance:0.01 };
elements.head.reactions.cooked_human = { "elem2": null, chance:0.05 };
elements.head.reactions.cooked_brain = { "elem2": null, chance:0.03 };
elements.head.reactions.cooked_heart = { "elem2": null, chance:0.04 };

43
mods/chemFormula.js Normal file
View File

@ -0,0 +1,43 @@
const styleElement = document.createElement('style');
styleElement.innerHTML = `
.tooltip {
z-index: 1000;
position: relative;
}
.tooltip .tooltiptext {
visibility: hidden;
background-color: rgba(0, 0, 0, 0.8);
color: #fff;
text-align: center;
padding: 0.5em;
border-radius: 0.5em;
position: absolute;
z-index: 1000;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
pointer-events: none;
text-shadow: none;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
`
document.head.appendChild(styleElement);
runAfterLoad(async () => {
const data = await fetch('mods/chemFormulas.json').then((res) => res.json());
for (const element in data) {
if (elements[element]) {
elements[element].hoverStat = () => data[element].length > 1 ? "Multiple compounds" : data[element][0].replace(/\<\/?su[bp]\>/g, "");
document.querySelector(`button[element='${element}']`)?.classList.add('tooltip');
const span = document.createElement('span');
span.classList.add('tooltiptext');
span.innerHTML = data[element].join("<br>");
document.querySelector(`button[element='${element}']`)?.appendChild(span);
}
}
});

241
mods/chemFormulas.json Normal file
View File

@ -0,0 +1,241 @@
{
"sand": ["SiO<sub>2</sub>"],
"dirt": ["Organic matter"],
"mud": ["H<sub>2</sub>O", "Organic matter"],
"wet_sand": ["SiO<sub>2</sub>", "H<sub>2</sub>O"],
"rock": ["SiO<sub>2</sub>"],
"rock_wall": ["SiO<sub>2</sub>"],
"mudstone": ["SiO<sub>2</sub>", "H<sub>2</sub>O", "Organic matter"],
"packed_sand": ["SiO<sub>2</sub>"],
"snow": ["H<sub>2</sub>O"],
"packed_snow": ["H<sub>2</sub>O"],
"gravel": ["SiO<sub>2</sub>"],
"clay": ["Al<sub>2</sub>Si<sub>2</sub>O<sub>5</sub>(OH)<sub>4</sub>", "H<sub>2</sub>O"],
"clay_soil": ["Al<sub>2</sub>Si<sub>2</sub>O<sub>5</sub>(OH)<sub>4</sub>", "H<sub>2</sub>O", "Organic matter"],
"permafrost": ["Organic matter", "SiO<sub>2</sub>", "H<sub>2</sub>O"],
"mycelium": ["Organic matter"],
"mulch": ["Organic matter"],
"basalt": ["SiO<sub>2</sub>", "FeO", "CaO"],
"tuff": ["SiO<sub>2</sub>", "Al<sub>2</sub>O<sub>3</sub>", "CaO", "K<sub>2</sub>O"],
"limestone": ["CaCO<sub>3</sub>"],
"quicklime": ["CaO"],
"slaked_lime": ["Ca(OH)<sub>2</sub>"],
"water": ["H<sub>2</sub>O"],
"salt_water": ["H<sub>2</sub>O", "NaCl"],
"sugar_water": ["H<sub>2</sub>O", "C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>"],
"seltzer": ["H<sub>2</sub>O", "CO<sub>2</sub>"],
"dirty_water": ["H<sub>2</sub>O", "Impurities"],
"pool_water": ["H<sub>2</sub>O", "Cl<sub>2</sub>"],
"slush": ["H<sub>2</sub>O"],
"magma": ["SiO<sub>2</sub>", "FeO", "CaO"],
"slime": ["H<sub>2</sub>O", "Organic matter"],
"cement": ["CaO", "SiO<sub>2</sub>", "Al<sub>2</sub>O<sub>3</sub>"],
"oil": ["C<sub>5</sub>H<sub>12</sub>", "C<sub>6</sub>H<sub>14</sub>", "C<sub>7</sub>H<sub>16</sub>", "C<sub>8</sub>H<sub>18</sub>", "C<sub>9</sub>H<sub>20</sub>", "C<sub>10</sub>H<sub>22</sub>", "C<sub>11</sub>H<sub>24</sub>", "C<sub>12</sub>H<sub>26</sub>"],
"lamp_oil": ["C<sub>12</sub>H<sub>26</sub>", "C<sub>13</sub>H<sub>28</sub>", "C<sub>14</sub>H<sub>30</sub>", "C<sub>15</sub>H<sub>32</sub>", "C<sub>16</sub>H<sub>34</sub>"],
"acid": ["HCl"],
"neutral_acid": ["H<sub>2</sub>O", "HCl"],
"glue": ["C<sub>4</sub>H<sub>6</sub>O<sub>2</sub>"],
"soda": ["H<sub>2</sub>O", "C<sub>6</sub>H<sub>12</sub>O<sub>6</sub>", "CO<sub>2</sub>"],
"melted_wax": ["C<sub>25</sub>H<sub>52</sub>"],
"vinegar": ["H<sub>2</sub>O", "C<sub>2</sub>H<sub>4</sub>O<sub>2</sub>"],
"alcohol": ["C<sub>2</sub>H<sub>5</sub>OH"],
"soap": ["C<sub>17</sub>H<sub>35</sub>COONa"],
"bleach": ["NaClO"],
"mercury": ["Hg"],
"tea": ["H<sub>2</sub>O", "C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>"],
"coffee": ["H<sub>2</sub>O", "C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>"],
"honey": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>"],
"sap": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>"],
"caramel": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>"],
"molasses": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>"],
"liquid_oxygen": ["O<sub>2</sub>"],
"liquid_nitrogen": ["N<sub>2</sub>"],
"cyanide": ["CN"],
"concrete": ["CaO", "SiO<sub>2</sub>", "Al<sub>2</sub>O<sub>3</sub>"],
"ash": ["SiO<sub>2</sub>", "CaO", "K<sub>2</sub>O"],
"charcoal": ["C"],
"hail": ["H<sub>2</sub>O"],
"wax": ["C<sub>25</sub>H<sub>52</sub>"],
"sodium": ["Na"],
"calcium": ["Ca"],
"potassium": ["K"],
"magnesium": ["Mg"],
"thermite": ["Al", "Fe<sub>2</sub>O<sub>3</sub>"],
"slag": ["CaSiO<sub>3</sub>"],
"amalgam": ["Hg", "Ag"],
"sulfur": ["S"],
"copper_sulfate": ["CuSO<sub>4</sub>"],
"uranium": ["U"],
"diamond": ["C"],
"gold coin": ["Au"],
"rust": ["Fe<sub>2</sub>O<sub>3</sub>"],
"oxidized_copper": ["CuO"],
"alga": ["AlGa"],
"glass_shard": ["SiO<sub>2</sub>"],
"rad_shard": ["SiO<sub>2</sub>", "U"],
"color_sand": ["SiO<sub>2</sub>", "Fe<sub>2</sub>O<sub>3</sub>"],
"borax": ["Na<sub>2</sub>B<sub>4</sub>O<sub>7</sub>"],
"epsom_salt": ["MgSO<sub>4</sub>"],
"potassium_salt": ["KCl"],
"caustic_potash": ["KOH"],
"sodium_acetate": ["NaC<sub>2</sub>H<sub>3</sub>O<sub>2</sub>"],
"ice": ["H<sub>2</sub>O"],
"rime": ["H<sub>2</sub>O"],
"glass": ["SiO<sub>2</sub>"],
"rad_glass": ["SiO<sub>2</sub>", "U"],
"stained_glass": ["SiO<sub>2</sub>", "Metal oxides"],
"plastic": ["(C<sub>8</sub>H<sub>8</sub>)<sub>n</sub>", "(C<sub>4</sub>H<sub>6</sub>)<sub>n</sub>", "(C<sub>3</sub>H<sub>3</sub>N)<sub>n</sub>"],
"iron": ["Fe"],
"copper": ["Cu"],
"gold": ["Au"],
"steel": ["Fe", "C"],
"galvanized_steel": ["Fe", "Zn"],
"zinc": ["Zn"],
"silver": ["Ag"],
"tin": ["Sn"],
"lead": ["Pb"],
"nickel": ["Ni"],
"aluminum": ["Al"],
"tungsten": ["W"],
"brass": ["Cu", "Zn"],
"bronze": ["Cu", "Sn"],
"sterling": ["Ag", "Cu"],
"gallium": ["Ga"],
"rose_gold": ["Au", "Cu"],
"purple_gold": ["Au", "Al"],
"blue_gold": ["Au", "Ga"],
"electrum": ["Au", "Ag"],
"pyrite": ["FeS<sub>2</sub>"],
"solder": ["Sn", "Pb"],
"dry ice": ["CO<sub>2</sub>"],
"nitrogen_ice": ["N<sub>2</sub>"],
"light": ["γ"],
"liquid_light": ["γ"],
"laser": ["γ"],
"radiation": ["α", "β", "γ"],
"neutron": ["n"],
"proton": ["p"],
"electric": ["e<sup>-</sup>"],
"lightning": ["e<sup>-</sup>"],
"positron": ["e<sup>+</sup>"],
"flash": ["γ"],
"tnt": ["C<sub>7</sub>H<sub>5</sub>N<sub>3</sub>O<sub>6</sub>"],
"c4": ["C<sub>3</sub>H<sub>6</sub>N<sub>6</sub>O<sub>6</sub>"],
"dynamite": ["C<sub>3</sub>H<sub>5</sub>N<sub>3</sub>O<sub>9</sub>"],
"gunpowder": ["KNO<sub>3</sub>", "S", "C"],
"nitro": ["C<sub>3</sub>H<sub>5</sub>N<sub>3</sub>O<sub>9</sub>"],
"steam": ["H<sub>2</sub>O"],
"hydrogen": ["H<sub>2</sub>"],
"oxygen": ["O<sub>2</sub>"],
"nitrogen": ["N<sub>2</sub>"],
"helium": ["He"],
"anesthesia": ["N<sub>2</sub>O"],
"carbon_dioxide": ["CO<sub>2</sub>"],
"bubble": ["CO<sub>2</sub>"],
"ammonia": ["NH<sub>3</sub>"],
"propane": ["C<sub>3</sub>H<sub>8</sub>"],
"methane": ["CH<sub>4</sub>"],
"acid_gas": ["HCl"],
"dioxin": ["C<sub>4</sub>H<sub>4</sub>O<sub>2</sub>"],
"chlorine": ["Cl<sub>2</sub>"],
"neon": ["Ne"],
"smog": ["CO<sub>2</sub>", "CO", "NO<sub>2</sub>", "O<sub>3</sub>"],
"cyanide_gas": ["HCN"],
"ozone": ["O<sub>3</sub>"],
"rad_steam": ["H<sub>2</sub>O", "U"],
"salt": ["NaCl"],
"sugar": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>"],
"chocolate": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>", "C<sub>7</sub>H<sub>8</sub>N<sub>4</sub>O<sub>2</sub>", "C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>", "C<sub>18</sub>H<sub>36</sub>O<sub>2</sub>", "C<sub>16</sub>H<sub>32</sub>O<sub>2</sub>"],
"baking_soda": ["NaHCO<sub>3</sub>"],
"antipowder": ["Ry<sub>2</sub>O<sub>3</sub>"],
"antimolten": ["Ry<sub>2</sub>O<sub>3</sub>"],
"antiice": ["Ry<sub>7</sub>O<sub>12</sub>"],
"antifluid": ["Ry<sub>7</sub>O<sub>12</sub>"],
"antigas": ["Ry<sub>7</sub>O<sub>12</sub>"],
"molten_glass": ["SiO<sub>2</sub>"],
"molten_rad_glass": ["SiO<sub>2</sub>", "U"],
"molten_salt": ["NaCl"],
"molten_ash": ["SiO<sub>2</sub>", "CaO", "K<sub>2</sub>O"],
"liquid_ammonia": ["NH<sub>3</sub>"],
"liquid_propane": ["C<sub>3</sub>H<sub>8</sub>"],
"liquid_methane": ["CH<sub>4</sub>"],
"molten_stained_glass": ["SiO<sub>2</sub>", "Metal oxides"],
"molten_plastic": ["(C<sub>8</sub>H<sub>8</sub>)<sub>n</sub>", "(C<sub>4</sub>H<sub>6</sub>)<sub>n</sub>", "(C<sub>3</sub>H<sub>3</sub>N)<sub>n</sub>"],
"molten_tungsten": ["W"],
"molten_gallium": ["Ga"],
"gallium_gas": ["Ga"],
"molten_copper": ["Cu"],
"molten_copper_sulfate": ["CuSO<sub>4</sub>"],
"molten_gold": ["Au"],
"molten_silver": ["Ag"],
"molten_iron": ["Fe"],
"molten_nickel": ["Ni"],
"molten_tin": ["Sn"],
"molent_lead": ["Pb"],
"molten_solder": ["Sn", "Pb"],
"alcohol_gas": ["C<sub>2</sub>H<sub>5</sub>OH"],
"molten_tuff": ["SiO<sub>2</sub>", "Al<sub>2</sub>O<sub>3</sub>", "CaO", "K<sub>2</sub>O"],
"liquid_chlorine": ["Cl<sub>2</sub>"],
"mercury_gas": ["Hg"],
"solid_mercury": ["Hg"],
"fat": ["C<sub>55</sub>H<sub>98</sub>O<sub>6</sub>"],
"molten_chocolate": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>", "C<sub>7</sub>H<sub>8</sub>N<sub>4</sub>O<sub>2</sub>", "C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>", "C<sub>18</sub>H<sub>36</sub>O<sub>2</sub>", "C<sub>16</sub>H<sub>32</sub>O<sub>2</sub>"],
"liquid_hydrogen": ["H<sub>2</sub>"],
"liquid_helium": ["He"],
"molten_sodium": ["Na"],
"sodium_gas": ["Na"],
"molten_calcium": ["Ca"],
"molten_potassium": ["K"],
"potassium_gas": ["K"],
"molten_magnesium": ["Mg"],
"molten_thermite": ["Al", "Fe<sub>2</sub>O<sub>3</sub>"],
"molten_aluminum": ["Al"],
"molten_zinc": ["Zn"],
"liquid_neon": ["Ne"],
"liquid_ozone": ["O<sub>3</sub>"],
"molten_sulfur": ["S"],
"sulfur_gas": ["S"],
"molten_uranium": ["U"],
"molten_slag": ["CaSiO<sub>3</sub>"],
"molten_dirt": ["Organic matter"],
"salt_ice": ["NaCl", "H<sub>2</sub>O"],
"sugar_ice": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>", "H<sub>2</sub>O"],
"seltzer_ice": ["H<sub>2</sub>O", "CO<sub>2</sub>"],
"dirty_ice": ["H<sub>2</sub>O", "Impurities"],
"pool_ice": ["H<sub>2</sub>O", "Cl<sub>2</sub>"],
"antiice_ice": ["Ry<sub>2</sub>O"],
"ammonia_ice": ["NH<sub>3</sub>"],
"propane_ice": ["C<sub>3</sub>H<sub>8</sub>"],
"methane_ice": ["CH<sub>4</sub>"],
"acid_ice": ["HCl"],
"soda_ice": ["H<sub>2</sub>O", "C<sub>6</sub>H<sub>12</sub>O<sub>6</sub>", "CO<sub>2</sub>"],
"molten_steel": ["Fe", "C"],
"molten_galvanized_steel": ["Fe", "Zn"],
"molten_brass": ["Cu", "Zn"],
"molten_bronze": ["Cu", "Sn"],
"molten_sterling": ["Ag", "Cu"],
"molten_rose_gold": ["Au", "Cu"],
"molten_purple_gold": ["Au", "Al"],
"molten_blue_gold": ["Au", "Ga"],
"molten_electrum": ["Au", "Ag"],
"molten_pyrite": ["FeS<sub>2</sub>"],
"frozen_vinegar": ["H<sub>2</sub>O", "C<sub>2</sub>H<sub>4</sub>O<sub>2</sub>"],
"alcohol_ice": ["C<sub>2</sub>H<sub>5</sub>OH"],
"bleach_ice": ["NaClO"],
"chlorine_ice": ["Cl<sub>2</sub>"],
"tea_ice": ["H<sub>2</sub>O", "C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>"],
"coffee_ice": ["H<sub>2</sub>O", "C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>"],
"hydrogen_ice": ["H<sub>2</sub>"],
"oxygen_ice": ["O<sub>2</sub>"],
"molten_amalgam": ["Hg", "Ag"],
"neon_ice": ["Ne"],
"cyanide_ice": ["CN"],
"slime_ice": ["H<sub>2</sub>O", "Organic matter"],
"molten_alga": ["AlGa"],
"molten_borax": ["Na<sub>2</sub>B<sub>4</sub>O<sub>7</sub>"],
"molten_epsom_salt": ["MgSO<sub>4</sub>"],
"molten_potassium_salt": ["KCl"],
"molten_caustic_potash": ["KOH"],
"molten_sodium_acetate": ["NaC<sub>2</sub>H<sub>3</sub>O<sub>2</sub>"],
"frozen_nitro": ["C<sub>3</sub>H<sub>5</sub>N<sub>3</sub>O<sub>9</sub>"]
}

574
mods/colonies.js Normal file
View File

@ -0,0 +1,574 @@
var modName = "mods/colonies.js";
var exoplanetMod = "mods/exoplanet.js";
if(enabledMods.includes(exoplanetMod)) {
window.addEventListener("load", () => {
document.getElementById("elementButton-base")?.remove()
})
window.addEventListener("load", () => {
document.getElementById("elementButton-empty_room")?.remove()
})
window.addEventListener("load", () => {
document.getElementById("elementButton-cafeteria")?.remove()
})
window.addEventListener("load", () => {
document.getElementById("elementButton-terraformer_room")?.remove()
})
window.addEventListener("load", () => {
document.getElementById("elementButton-base_door_left")?.remove()
})
window.addEventListener("load", () => {
document.getElementById("elementButton-base_door_right")?.remove()
})
elements.base = {
hidden: true,
color: "#ff0000",
behavior: [
"XX|XX|CR:glass|CR:glass|CR:rocket_gate|CR:rocket_gate|CR:rocket_gate|CR:glass|CR:glass|XX|XX",
"XX|CR:glass|CR:glass|CR:air_filter|XX|XX|XX|XX|CR:glass|CR:glass|XX",
"XX|CR:glass|XX|XX|XX|XX|XX|XX|XX|CR:glass|XX",
"CR:glass|CR:glass|XX|XX|XX|XX|XX|XX|XX|CR:glass|CR:glass",
"CR:glass AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>glass|XX|XX|XX|XX|XX|XX|XX|XX|XX|CR:glass AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>glass",
"CR:base_door_left,base_door,base_door AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>base_door_left,base_door,base_door|XX|XX|XX|XX|CH:leaving_rocket%25|XX|XX|XX|XX|CR:base_door_right,base_door AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>base_door_right,base_door",
"CR:concrete|CR:glass AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>glass|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:glass AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>glass|CR:concrete",
"CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete",
"XX|XX|XX|XX|XX|XX|XX|XX|XX|XX|XX",
"XX|XX|XX|XX|XX|XX|XX|XX|XX|XX|XX",
"XX|XX|XX|XX|XX|XX|XX|XX|XX|XX|XX",
],
category: "colonies",
state: "solid",
}
elements.empty_room = {
hidden: true,
color: "#ff0000",
behavior: [
"XX|XX|CR:glass|CR:glass|CR:glass|CR:glass|CR:glass|XX|XX",
"XX|CR:glass|CR:glass|XX|XX|XX|CR:glass|CR:glass|XX",
"CR:glass|CR:glass|CR:air_filter|XX|XX|XX|XX|CR:glass|CR:glass",
"CR:glass|XX|XX|XX|XX|XX|XX|XX|CR:glass",
"CR:base_door|XX|XX|XX|DL|XX|XX|XX|CR:base_door",
"CR:concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete",
"CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete",
"XX|XX|XX|XX|XX|XX|XX|XX|XX",
"XX|XX|XX|XX|XX|XX|XX|XX|XX",
],
category: "colonies",
state: "solid",
}
elements.cafeteria = {
hidden: true,
color: "#ff0000",
behavior: [
"XX|CR:glass|CR:glass|CR:glass|CR:glass|CR:glass|CR:glass|CR:glass|XX",
"CR:glass|CR:glass|CR:food_dispenser|CR:food_dispenser|CR:air_filter|CR:food_dispenser|CR:food_dispenser|CR:glass|CR:glass",
"CR:glass|XX|XX|XX|XX|XX|XX|XX|CR:glass",
"CR:glass|XX|XX|XX|XX|XX|XX|XX|CR:glass",
"CR:base_door|XX|XX|XX|DL|XX|XX|XX|CR:base_door",
"CR:concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|DL:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass,concrete,mulch|DL:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass,concrete,mulch|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|DL:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass,concrete,mulch|DL:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass,concrete,mulch|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete",
"CR:concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete",
"XX|XX|XX|XX|XX|XX|XX|XX|XX",
"XX|XX|XX|XX|XX|XX|XX|XX|XX",
],
category: "colonies",
state: "solid",
}
elements.terraformer_room = {
hidden: true,
color: "#ff0000",
behavior: [
"XX|XX|CR:glass|CR:glass|CR:glass|CR:glass|CR:glass|XX|XX",
"XX|CR:glass|CR:glass|XX|XX|XX|CR:glass|CR:glass|XX",
"CR:glass|CR:glass|CR:air_filter|XX|XX|XX|XX|CR:glass|CR:glass",
"CR:glass|XX|XX|XX|XX|XX|XX|XX|CR:glass",
"CR:base_door|XX|XX|XX|DL|XX|XX|XX|CR:base_door",
"CR:concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:room_temper AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>room_temper|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:nanobot_terraformers AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>nanobot_terraformers|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:room_temper AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>room_temper|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete",
"CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete",
"XX|XX|XX|XX|XX|XX|XX|XX|XX",
"XX|XX|XX|XX|XX|XX|XX|XX|XX",
],
category: "colonies",
state: "solid",
}
elements.air_filter = {
hidden: true,
color: ["#d1c6be","#b5c0ad","#b9b8bc"],
reactions: {
"carbon_dioxide": { elem2:"oxygen" },
"dust_cloud": { elem2:["oxygen",null], },
"exoplanetary_dust": { elem2:null, },
"dust": { elem2:null, },
"radiation": { elem2:"electric", temp1:200 }
},
behavior: [
"XX|ST|XX",
"ST AND CR:oxygen%1|XX|ST AND CR:oxygen%1",
"XX|CR:oxygen%1|XX",
],
tempHigh: 500,
stateHigh: "molten_aluminum",
category: "colonies",
density: 2710,
conduct: 0.73,
hardness: 0.01,
breakInto: "metal_scrap",
fireColor: "#A7B3BF",
superconductAt: -271.95,
state: "solid",
}
elements.rocket_gate = {
hidden: true,
color: ["#d1c6be","#b5c0ad","#b9b8bc"],
behavior: behaviors.WALL,
tempHigh: 500,
stateHigh: "molten_aluminum",
category: "colonies",
density: 2710,
conduct: 0.73,
hardness: 0.05,
breakInto: "metal_scrap",
fireColor: "#A7B3BF",
superconductAt: -271.95,
state: "solid",
}
elements.base_door = {
hidden: true,
color: ["#d1c6be","#b5c0ad","#b9b8bc"],
behavior: behaviors.WALL,
tempHigh: 500,
stateHigh: "molten_aluminum",
category: "colonies",
density: 2710,
conduct: 0.73,
hardness: 0.04,
breakInto: "metal_scrap",
fireColor: "#A7B3BF",
superconductAt: -271.95,
state: "solid",
}
elements.base_door_left = {
hidden: true,
color: "#ff0000",
behavior: [
"XX|XX|XX|XX|XX|XX|XX|XX|XX",
"XX|XX|XX|XX|XX|XX|XX|XX|XX",
"CR:empty_room,cafeteria,cafeteria,terraformer_room,terraformer_room|XX|XX|XX|CH:base_door|XX|XX|XX|XX",
"XX|XX|XX|XX|XX|XX|XX|XX|XX",
"XX|XX|XX|XX|XX|XX|XX|XX|XX",
],
category: "colonies",
state: "solid",
}
elements.base_door_right = {
hidden: true,
color: "#ff0000",
behavior: [
"XX|XX|XX|XX|XX|XX|XX|XX|XX",
"XX|XX|XX|XX|XX|XX|XX|XX|XX",
"XX|XX|XX|XX|CH:base_door|XX|XX|XX|CR:empty_room,cafeteria,cafeteria,cafeteria,terraformer_room,terraformer_room,terraformer_room",
"XX|XX|XX|XX|XX|XX|XX|XX|XX",
"XX|XX|XX|XX|XX|XX|XX|XX|XX",
],
category: "colonies",
state: "solid",
}
elements.settler = {
color: ["#A8A7AB","#878689"],
category: "colonies",
tick: function(pixel) {
if (tryMove(pixel, pixel.x, pixel.y+1)) {} // Fall
doHeat(pixel);
doBurning(pixel);
doElectricity(pixel);
if (pixel.oxygen > 0.1 && Math.random() < 0.025) { pixel.oxygen -= 0.5 } // consume oxygen
else if (pixel.oxygen < 0.1) { pixel.dead = true }
if (pixel.dead) {
// Turn into rotten_meat if pixelTicks-dead > 500
if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) {
if (Math.random() < 0.5) {
changePixel(pixel,"metal_scrap");
}
else {
changePixel(pixel,"rotten_meat");
}
}
return
}
if (pixel.burning) {
pixel.panic += 0.1;
}
else if (pixel.oxygen < 25.1) {
pixel.panic += 0.1;
}
else if (pixel.panic > 0) {
pixel.panic -= 0.1;
if (pixel.panic < 0) { pixel.panic = 0; }
}
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) {
break;
}
}
else if (!isEmpty(pixel.x+move[0], pixel.y+move[1], true)) {
var hitPixel = pixelMap[pixel.x+move[0]][pixel.y+move[1]];
if (hitPixel.element === "settler") {
// interact with other settlers
hitPixel.panic = pixel.panic;
}
else if (hitPixel.element === "base_door") {
if (pixel.dir === -1 && Math.random() > 0.5) {
tryMove(pixel,pixel.x-2,pixel.y);
}
else if (pixel.dir === 1 && Math.random() > 0.5) {
tryMove(pixel,pixel.x+2,pixel.y);
}
}
else if (hitPixel.element === "leaving_rocket" && pixel.ogcrew === false) {
if (Math.random() > 0.75) {
deletePixel(pixel.x,pixel.y);
hitPixel.passengers += 1;
}
}
else if (elements[hitPixel.element].state === "gas") {
swapPixels(pixel,hitPixel);
}
else if (elements[hitPixel.element].state === "liquid") {
swapPixels(pixel,pixelMap[hitPixel.x][hitPixel.y-1]);
}
}
}
// 15% chance to change direction
if (Math.random() < 0.15) {
pixel.dir *= -1;
}
// spacesuit A/C
if (pixel.temp > 40) { pixel.temp -= 3; }
else if (pixel.temp < 32) { pixel.temp += 3; }
}
},
foodNeed: 50,
egg: "settler",
density: 2710,
state: "solid",
conduct: .05,
temp: 37,
tempHigh: 300,
stateHigh: ["cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","molten_aluminum","smoke","dioxin","smoke","stench","ash","melted_plastic"],
tempLow: -75,
stateLow: "frozen_meat",
burn: 10,
burnTime: 250,
burnInto: ["cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","molten_aluminum","smoke","dioxin","smoke","stench","ash","melted_plastic"],
hardness: 0.02,
breakInto: ["blood","meat","bone","blood","meat","bone","metal_scrap"],
forceSaveColor: true,
reactions: {
"cancer": { elem1:"cancer", chance:0.0005 },
"radiation": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.04 },
"neutron": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.003 },
"fallout": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.003 },
"plague": { elem1:"plague", chance:0.005 },
"oxygen": { func:function(pixel,air){pixel.oxygen += 5}, elem2:"carbon_dioxide", chance:0.5 },
"carbon_dioxide": { func:function(pixel,air){pixel.oxygen -= 1}, chance:0.05 },
"dust_cloud": { func:function(pixel,air){pixel.oxygen -= 5}, elem2:null, chance:0.05 },
"exoplanetary_dust": { elem2:"dust_cloud", chance:0.001 },
"meat": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"cooked_meat": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"cured_meat": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"sugar": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"broth": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"yolk": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"hard_yolk": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"dough": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"batter": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"butter": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"melted_butter": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"chocolate": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"melted_chocolate": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL },
"grape": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"tomato": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"herb": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"lettuce": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"corn": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"popcorn": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"potato": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"baked_potato": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"bread": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"toast": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"gingerbread": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"baked_batter": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"wheat": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"candy": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"yogurt": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"frozen_yogurt": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"ice_cream": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"beans": { elem2:[null,null,null,null,null,null,null,null,null,null,null,null,null,null,"stench"], chance:0.2, func:behaviors.FEEDPIXEL },
"tea": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"coffee": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"milk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"cream": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"soda": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"chocolate_milk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"fruit_milk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"pilk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"eggnog": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"juice": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"cheese": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"melted_cheese": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"alcohol": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"antidote": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"honey": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"caramel": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"molasses": { elem2:null, chance:0.05, func:behaviors.FEEDPIXEL },
"ketchup": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"pumpkin_seed": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"nut": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"nut_meat": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"nut_butter": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"nut_milk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"jelly": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"mayo": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"mashed_potato": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"sauce": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"pickle": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"food_container": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"sun": { elem1:["cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","molten_aluminum","smoke","dioxin","smoke","stench","ash","melted_plastic"] },
"water": { func:function(pixel,water){pixel.oxygen -= 1}, elem2:"bubble", attr2:{"clone":"water"}, chance:0.0002 },
"salt_water": { func:function(pixel,water){pixel.oxygen -= 2}, elem2:"bubble", attr2:{"clone":"salt_water"}, chance:0.0002 },
"sugar_water": { func:function(pixel,water){pixel.oxygen -= 2}, elem2:"bubble", attr2:{"clone":"sugar_water"}, chance:0.0002 },
"seltzer": { func:function(pixel,water){pixel.oxygen -= 4}, elem2:"bubble", attr2:{"clone":["seltzer","seltzer","carbon_dioxide"]}, chance:0.0002 },
"pool_water": { func:function(pixel,water){pixel.oxygen -= 1}, elem2:"bubble", attr2:{"clone":"pool_water"}, chance:0.0002 },
"dirty_water": { func:function(pixel,water){pixel.oxygen -= 4}, elem2:"bubble", color2:["#0e824e","#07755a","#0c6934"], attr2:{"clone":"dirty_water"}, chance:0.0003 },
"blood": { func:function(pixel,water){pixel.oxygen -= 5}, elem2:"bubble", color2:["#ff0000","#ee0000","#ff4040"], attr2:{"clone":"blood"}, chance:0.0003 },
},
properties: {
dead: false,
dir: 1,
panic: 0,
oxygen: 100,
ogcrew: false,
},
}
elements.nanobot_terraformers = {
color: "#c0c0c0",
hidden: true,
behavior: [
"CH:exoplanetary_dust>nanobot_terraformers%50|CH:exoplanetary_dust>nanobot_terraformers%50 AND CR:oxygen%5|CH:exoplanetary_dust>nanobot_terraformers%50",
"CH:exoplanetary_dust>nanobot_terraformers%50|XX|CH:exoplanetary_dust>nanobot_terraformers%50",
"CH:exoplanetary_dust,exoplanetary_rock>nanobot_terraformers%50 AND M2|CH:exoplanetary_dust>nanobot_terraformers%50 AND M1|CH:exoplanetary_dust>nanobot_terraformers%50 AND M2",
],
reactions: {
"exoplanetary_rock": { elem2:"nanobot_terraformers", attr2:{"clone":"rock"}},
"dusty_water": { elem2:"nanobot_terraformers", attr2:{"clone":"water"}},
"dusty_ice": { elem2:"nanobot_terraformers", attr2:{"clone":"ice"}},
"exoplanetary_sand": { elem2:"nanobot_terraformers", attr2:{"clone":"sand"} },
},
tick: function(pixel) {
if (pixel.age > 25 || (pixel.clone && isEmpty(pixel.x,pixel.y-1))) {
if (pixel.clone) {
changePixel(pixel,pixel.clone);
return;
}
changePixel(pixel,"dirt");
}
pixel.age ++;
},
properties: {
"age": 0,
},
category: "colonies",
state: "solid",
density: 21450,
excludeRandom: true,
conduct: 0.25,
darkText: true,
tempHigh: 1456,
stateHigh: "molten_steel"
}
elements.room_temper = {
color: "#29632f",
behavior: behaviors.WALL,
tick: function(pixel) {
// from nouserthings.js <3
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x,y, true)) {
if(pixelMap[x][y].temp < -230) {
pixelMap[x][y].temp = (pixelMap[x][y].temp + 7)
} else if(pixelMap[x][y].temp > 270) {
pixelMap[x][y].temp = (pixelMap[x][y].temp - 7)
} else if (pixelMap[x][y].temp < 20) {
pixelMap[x][y].temp = (pixelMap[x][y].temp + 2)
} else if (pixelMap[x][y].temp > 20) {
pixelMap[x][y].temp = (pixelMap[x][y].temp - 2)
}
}
}
},
category:"colonies",
state:"solid",
insulate: true,
noMix: true,
movable: false,
};
elements.food_dispenser = {
color: "#606378",
behavior: [
"XX|ST|XX",
"ST|XX|ST",
"XX|XX|XX",
],
tick: function(pixel) {
if (isEmpty(pixel.x, pixel.y+4) && isEmpty(pixel.x, pixel.y+1) && Math.random() > 0.95) {
createPixel("food_container",pixel.x,pixel.y+1);
}
},
category:"colonies",
tempHigh: 1455.5,
stateHigh: "molten_steel",
conduct: 0.42
}
elements.food_container = {
behavior: behaviors.STURDYPOWDER,
category: "colonies",
hidden: true,
state: "solid",
color: ["#2b1107","#5c3322","#2b1107","#5c3322","#2b1107","#5c3322"],
tempHigh: 250,
stateHigh: ["sugar","cooked_meat","dead_plant","ash","ash","charcoal"],
burn: 10,
burnTime: 200,
burnInto: ["sugar","cooked_meat","dead_plant","ash","ash","charcoal"],
breakInto: ["sugar","cooked_meat","dead_plant","sugar","cooked_meat","dead_plant","sugar","cooked_meat","dead_plant","sawdust","sawdust","sawdust","sawdust"],
breakIntoColor: ["#2b1107","#5c3322","#5c3322","#5c3322","#5c3322","#5c3322","#5c3322","#5c3322","#41770B","#774C35"],
isFood: true
}
elements.leaving_rocket = {
name: "rocket",
hidden: true,
color: "#ff6f47",
tick: function(pixel) {
if (pixel.passengers > 14) {
if (!tryMove(pixel, pixel.x, pixel.y-1)) {
if (outOfBounds(pixel.x,pixel.y-1)) {
deletePixel(pixel.x,pixel.y);
}
else if (pixelMap[pixel.x][pixel.y-1].element === "rocket_gate") {
tryMove(pixel, pixel.x, pixel.y-2);
}
else {
// tryMove again to the top left or top right
tryMove(pixel, pixel.x+(Math.random() < 0.5 ? -1 : 1), pixel.y-1);
}
}
if (Math.random() > 0.5 && isEmpty(pixel.x,pixel.y+1)) {
createPixel("smoke", pixel.x, pixel.y+1);
}
}
else {
if (!tryMove(pixel, pixel.x, pixel.y+1)) {
// tryMove again to the bottom left or bottom right
tryMove(pixel, pixel.x+(Math.random() < 0.5 ? -1 : 1), pixel.y+1);
}
}
doDefaults(pixel)
},
properties: {
"passengers": 0,
},
conduct: 0.5,
ignore: ["cloner","ecloner","slow_cloner","clone_powder","floating_cloner"],
category: "colonies",
state: "solid",
density: 7300,
cooldown: defaultCooldown
}
elements.arriving_rocket = {
name: "rocket",
color: "#ff6f47",
tick: function(pixel) {
if (!tryMove(pixel, pixel.x, pixel.y+1)) {
tryMove(pixel, pixel.x+(Math.random() < 0.5 ? -1 : 1), pixel.y+1);
pixel.age++;
}
if (Math.random() > 0.5 && pixel.age < 10) {
createPixel("smoke", pixel.x, pixel.y-1);
}
if (pixel.age > 250 && pixel.base_established === false) {
if (isEmpty(pixel.x, pixel.y-1)) {
createPixel("base",pixel.x, pixel.y-1);
pixel.base_established = true;
}
}
if (pixel.age > 500 && pixel.passengers > 0) {
if (isEmpty(pixel.x+1, pixel.y-1)) {
createPixel("settler",pixel.x+1, pixel.y-1);
pixelMap[pixel.x+1][pixel.y-1].ogcrew = true;
pixel.passengers -= 1;
}
else if (isEmpty(pixel.x-1, pixel.y-1)) {
createPixel("settler",pixel.x-1, pixel.y-1);
pixelMap[pixel.x-1][pixel.y-1].ogcrew = true;
pixel.passengers -= 1;
}
}
if (pixel.passengers < 1) {
changePixel(pixel,"concrete");
}
},
properties: {
"passengers": 5,
"age": 0,
"base_established": false,
},
conduct: 0.5,
ignore: ["cloner","ecloner","slow_cloner","clone_powder","floating_cloner"],
category: "colonies",
state: "solid",
density: 7300,
cooldown: defaultCooldown
}
} else {
enabledMods.splice(enabledMods.indexOf(modName),0,exoplanetMod)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The ${exoplanetMod} mod is required and has been automatically inserted (reload for this to take effect).`)
};

45
mods/customBackground.js Normal file
View File

@ -0,0 +1,45 @@
var imgVar = "https://i.ytimg.com/vi/fx2Z5ZD_Rbo/hqdefault.jpg?sqp=-oaymwEmCOADEOgC8quKqQMa8AEB-AH-BIAC6AKKAgwIABABGGUgZShlMA8=&rs=AOn4CLD7X0AtWZAmVxLAt0LRvN8nrco_8Q";
gameDiv.style.border = "1px solid #ffffff00";
document.body.style.backgroundSize = 'cover';
window.addEventListener("load",function(){
document.querySelectorAll(".categoryButton").forEach(e => {
e.style.backgroundColor = "transparent";
})
});
function drawCursor() {
document.body.style.backgroundImage = 'url('+ imgVar +')';
canvas.style.backgroundColor = "transparent";
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 = "#808080";
layerCtx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize);
layerCtx.beginPath();
layerCtx.lineWidth = 1;
layerCtx.stroke();
// draw one transparent pixel in the center
if (settings.precision) {
layerCtx.fillStyle = "#80808080";
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 = "#808080";
layerCtx.lineWidth = 1;
layerCtx.moveTo(shapeStart.x*pixelSize+pixelSizeHalf, shapeStart.y*pixelSize+pixelSizeHalf);
layerCtx.lineTo(mousePos.x*pixelSize+pixelSizeHalf, mousePos.y*pixelSize+pixelSizeHalf);
layerCtx.stroke()
}
}
}
elements.change_background = {
color:"#ffffff",
category: "customBackground",
tool: function(pixel) {},
onSelect: function() {
imgVar = prompt("Please input an image link to set as background.");
}
}

220
mods/exoplanet.js Normal file
View File

@ -0,0 +1,220 @@
elements.dusty_water = {
color: "#7C7C95",
behavior: behaviors.LIQUID,
tempHigh: 105,
stateHigh: ["steam","dust_cloud"],
tempLow: 0,
stateLowName: "dusty_ice",
viscosity: 10,
reactions: {
"rock": { elem2: "wet_sand", chance: 0.0004 },
"exoplanetary_rock": { elem2: "exoplanetary_sand", chance: 0.0004 },
"limestone": { elem2: "wet_sand", chance: 0.0004 },
"plant": { elem1:"water", chance:0.05 },
"algae": { elem1:"water", chance:0.05 },
"kelp": { elem1:"water", chance:0.05 },
"charcoal": { elem1:"water", chance:0.02 },
"gravel": { elem1:"water", chance:0.01 },
"fly": { elem2:"dead_bug", chance:0.1, oneway:true },
"firefly": { elem2:"dead_bug", chance:0.1, oneway:true },
"bee": { elem2:"dead_bug", chance:0.05, oneway:true },
"stink_bug": { elem2:"dead_bug", chance:0.1, oneway:true },
},
hidden: true,
state: "liquid",
density: 1005,
conduct: 0.01,
extinguish: true,
category: "exoplanet",
}
elements.exoplanetary_sand = {
color: ["#A29C7D","#c0c0c0","#808080","#4f4f4f","#808080","#949494","#A29C7D"],
behavior: behaviors.POWDER,
reactions: {
"tornado":{elem1:"sandstorm", oneway:true},
},
tempHigh: 1700,
stateHigh: "molten_exoplanetary_glass",
category: "exoplanet",
state: "solid",
density: 1602
}
elements.exoplanetary_glass = {
color: ["#6F807F","#6F807F","#748F8D","#6F807F","#6F807F"],
colorPattern: textures.GLASS,
colorKey: {
"g": "#6F807F",
"s": "#728886",
"S": "#748F8D"},
behavior: behaviors.WALL,
reactions: {
"radiation": { elem1:"rad_glass", chance:0.33 },
"rad_steam": { elem1:"rad_glass", elem2:null, chance:0.33 },
"fallout": { elem1:"rad_glass", elem2:"radiation", chance:0.1 }
},
tempHigh: 1500,
category: "exoplanet",
state: "solid",
density: 2500,
breakInto: "exoplanetary_sand",
noMix: true,
hidden: true,
}
elements.molten_exoplanetary_glass = {
reactions: {
"radiation": { elem1:"molten_rad_glass", chance:0.66 },
"rad_steam": { elem1:"molten_rad_glass", elem2:null, chance:0.33 },
"molten_uranium": { elem1:"molten_rad_glass", elem2:null },
"fallout": { elem1:"molten_rad_glass", elem2:"radiation" }
},
hidden: true,
category: "exoplanet",
}
elements.dust_cloud = {
color: ["#808080","#2e2e2e","#2e2e2e"],
behavior: [
"XX|M1%0.5|M2%0.5",
"XX|CH:exoplanetary_dust%0.075|M1%2.5 AND BO",
"XX|M1%0.5|M2%0.5",
],
reactions: {
"fireball": { elem1:null, elem2:"fire_cloud", chance:0.25 }
},
category: "exoplanet",
tempHigh: 825,
stateHigh: ["exoplanetary_rock","exoplanetary_rock","fire",],
hidden: true,
state: "gas",
density: 0.7,
ignoreAir: true
}
elements.exoplanetary_dust = {
color: "#808080",
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"M2|M1|M2",
],
reactions: {
"water": { elem2: "dusty_water", elem1: null },
},
category: "exoplanet",
breakInto: ["exoplanetary_dust","exoplanetary_dust","exoplanetary_dust","dust_cloud"],
burn: 10,
burnTime: 1,
tempHigh: 700,
burnInto:"exoplanetary_rock",
stateHigh: "exoplanetary_rock",
state: "solid",
density: 1490
}
elements.exoplanetary_rock = {
color: ["#c0c0c0","#4f4f4f","#949494"],
behavior: behaviors.POWDER,
reactions: {
"fly": { elem2:"dead_bug", chance:0.25, oneway:true },
"firefly": { elem2:"dead_bug", chance:0.2, oneway:true },
"stink_bug": { elem2:"dead_bug", chance:0.15, oneway:true },
"bee": { elem2:"dead_bug", chance:0.1, oneway:true },
"bird": { elem2:"feather", chance:0.025, oneway:true },
"egg": { elem2:"yolk", oneway:true },
"grass": { elem2:null, chance:0.005, oneway:true },
"bone": { elem2:"oil", tempMin:300, chance:0.005, oneway:true },
"dead_plant": { elem2:"charcoal", tempMin:200, chance:0.005, oneway:true },
"charcoal": { elem2:"diamond", tempMin:800, tempMax:900, chance:0.005, oneway:true },
"sand": { elem2:"packed_sand", tempMin:500, chance:0.005, oneway:true },
"wet_sand": { elem2:"packed_sand", chance:0.005, oneway:true },
},
tempHigh: 950,
stateHigh: "exoplanetary_magma",
category: "exoplanet",
state: "solid",
density: 2550,
hardness: 0.5,
breakInto: ["exoplanetary_sand","exoplanetary_sand","exoplanetary_dust","dust_cloud"]
}
elements.exoplanetary_magma = {
color: ["#ff6f00","#ff8c00","#ff4d00"],
behavior: behaviors.MOLTEN,
reactions: {
"ice": { elem1: "basalt" },
"ash": { elem1: "molten_tuff", "elem2":null },
"molten_ash": { elem1: "molten_tuff", "elem2":null },
"charcoal": { elem2:"diamond", tempMin:800, tempMax:900, chance:0.005, oneway:true },
},
temp: 1200,
tempLow: 800,
stateLow: ["basalt","exoplanetary_rock","exoplanetary_rock","exoplanetary_rock"],
viscosity: 10000,
state: "liquid",
density: 2725,
alias: "alien lava",
category: "exoplanet",
hidden: true,
}
elements.exoplanetary_rock = {
color: ["#c0c0c0","#4f4f4f","#949494"],
behavior: behaviors.POWDER,
reactions: {
"fly": { elem2:"dead_bug", chance:0.25, oneway:true },
"firefly": { elem2:"dead_bug", chance:0.2, oneway:true },
"stink_bug": { elem2:"dead_bug", chance:0.15, oneway:true },
"bee": { elem2:"dead_bug", chance:0.1, oneway:true },
"bird": { elem2:"feather", chance:0.025, oneway:true },
"egg": { elem2:"yolk", oneway:true },
"grass": { elem2:null, chance:0.005, oneway:true },
"bone": { elem2:"oil", tempMin:300, chance:0.005, oneway:true },
"dead_plant": { elem2:"charcoal", tempMin:200, chance:0.005, oneway:true },
"charcoal": { elem2:"diamond", tempMin:800, tempMax:900, chance:0.005, oneway:true },
"sand": { elem2:"packed_sand", tempMin:500, chance:0.005, oneway:true },
"wet_sand": { elem2:"packed_sand", chance:0.005, oneway:true },
},
tempHigh: 950,
stateHigh: "exoplanetary_magma",
category: "exoplanet",
state: "solid",
density: 2550,
hardness: 0.5,
breakInto: ["exoplanetary_sand","exoplanetary_sand","exoplanetary_dust","dust_cloud"]
}
worldgentypes.exoplanet = {
layers: [
[0.9, "exoplanetary_dust"],
[0.1, "exoplanetary_sand", 0.15],
[0.2, "dusty_ice", 0.075],
[0.05, "exoplanetary_rock"],
[0, "basalt"],
],
decor: [
["exoplanetary_dust", 0.05],
["dust_cloud", 0.25]
],
baseHeight: 0.5,
temperature: -15
}
worldgentypes.exo_ocean = {
layers: [
[0.99, "exoplanetary_dust"],
[0.40, "dusty_ice"],
[0.25, "bone", 0.01],
[0.25, "dusty_ice"],
[0.1, "exoplanetary_sand"],
[0.03, "exoplanetary_rock", 0.5],
[0.03, "exoplanetary_rock"],
[0, "basalt"],
],
decor: [
["dust_cloud", 0.1, 10],
],
temperature: -15
}

645
mods/flesh_infection.js Normal file
View File

@ -0,0 +1,645 @@
// by Nekonico
eLists.FESTER = ["fleshy_dirt","dirt","rock","rock_wall","basalt","limestone","steel","iron","glass_shard","dead_bug","mud","sand","wet_sand","clay_soil","clay","mycelium","skin","meat","rotten_meat","wood","ant_wall","dead_plant","plant","hair","bone","cancer","straw","cloth","brick","bamboo","sponge","paper","plastic","concrete"],
elements.fleshy_dirt = {
color: ["#81512F","#895933","#825231","#906159"],
behavior: [
"CH:dirt,mud>fleshy_dirt%1|CH:grass>flesh_mound%0.5 AND CH:root>vein_root%0.5 AND CH:fiber>fibrous_flesh%0.5|CH:dirt,mud>fleshy_dirt%1",
"XX|XX|XX",
"M2 AND CH:dirt,mud>fleshy_dirt%1|M1 AND CH:dirt,mud>fleshy_dirt%0.5|M2 AND CH:dirt,mud>fleshy_dirt%1",
],
category: "flesh",
state: "solid",
density: 2000,
tempHigh: 225,
stateHigh: "dirt",
tempLow: -50,
stateLow: "permafrost",
burn: 20,
burnTime: 40,
burnInto: "dirt",
};
elements.teeth = {
color: "#d9d9d9",
behavior: [
"XX|SM%0.75|XX",
"ST:flesh_mound|XX|ST:flesh_mound",
"XX|ST:flesh_mound AND M1|XX",
],
reactions: {
"acid": { elem1: "quicklime", elem2: null },
"head": { elem2:["flesh_mound",null,null,null], chance:0.01 },
"body": { elem2:["flesh_mound",null,null,null], chance:0.01 },
"frog": { elem2:["flesh_mound",null,null,null], chance:0.05 },
"tadpole": { elem2:["flesh_mound",null,null,null], chance:0.05 },
"fish": { elem2:["flesh_mound",null,null,null], chance:0.05 },
"rat": { elem2:["flesh_mound",null,null,null], chance:0.05 },
"bird": { elem2:["flesh_mound",null,null,null], chance:0.05 },
"worm": { elem2:["flesh_mound",null], chance:0.1 },
"fly": { elem2:["flesh_mound",null], chance:0.1 },
"ant": { elem2:["flesh_mound",null], chance:0.1 },
"frog": { elem2:["flesh_mound",null], chance:0.05 },
"snail": { elem2:["flesh_mound","quicklime"] },
"slug": { elem2:["flesh_mound",null], chance:0.1 },
"meat": { elem2:["flesh_mound",null,null,null], chance:0.1 },
"blood": { elem2:null, chance:0.05 },
"infection": { elem2:null, chance:0.04 },
"bone": { elem2:null, chance:0.1 },
"cooked_meat": { elem2:null, chance:0.1 },
"rotten_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, 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 },
},
category:"flesh",
tempHigh: 1000,
stateHigh: ["steam","salt","meat","quicklime"],
state: "solid",
density: 2000,
hardness: 0.5,
breakInto: ["flesh_mound","quicklime"],
hidden: true,
excludeRandom: true,
},
elements.flesh_mound = {
color: ["#9e4839","#ba6449","#d2856c","#a14940","#E94336"],
behavior: [
"XX|CR:acidic_bile%0.005 AND CH:grass>flesh_mound%0.5 AND CR:fleshwood_sapling%0.0001|XX",
"CR:acidic_bile%0.005 AND CH:grass>flesh_mound%0.5|XX|CR:acidic_bile%0.005 AND CH:grass>flesh_mound%0.5",
"XX|CR:acidic_bile%0.005 AND CH:grass>flesh_mound%0.5 AND CH:dirt>fleshy_dirt%0.5|XX",
],
tick: function(pixel) {
if (pixel.start === pixelTicks && pixel.fruit === undefined && !pixel.stop) {
if (Math.random() < 0.95) {
pixel.fruit = Math.random() < 0.75 ? "flesh_beast" : "teeth";
}
else { pixel.fruit = "acidic_bile" }
}
if (!isEmpty(pixel.x-1,pixel.y,true)) {
if (pixelMap[pixel.x-1][pixel.y].fruit === undefined && pixelMap[pixel.x-1][pixel.y].element === "flesh_mound") {
pixelMap[pixel.x-1][pixel.y].fruit = pixel.fruit;
}
}
if (!isEmpty(pixel.x+1,pixel.y,true)) {
if (pixelMap[pixel.x+1][pixel.y].fruit === undefined && pixelMap[pixel.x+1][pixel.y].element === "flesh_mound") {
pixelMap[pixel.x+1][pixel.y].fruit = pixel.fruit;
}
}
if (!isEmpty(pixel.x,pixel.y+1,true)) {
if (pixelMap[pixel.x][pixel.y+1].fruit === undefined && pixelMap[pixel.x][pixel.y+1].element === "flesh_mound") {
pixelMap[pixel.x][pixel.y+1].fruit = pixel.fruit;
}
}
if (!isEmpty(pixel.x,pixel.y-1,true)) {
if (pixelMap[pixel.x][pixel.y-1].fruit === undefined && pixelMap[pixel.x][pixel.y-1].element === "flesh_mound") {
pixelMap[pixel.x][pixel.y-1].fruit = pixel.fruit;
}
}
if (isEmpty(pixel.x,pixel.y-1)) {
pixel.sp = 0; //not supported
}
else if (!outOfBounds(pixel.x,pixel.y-1) && pixelMap[pixel.x][pixel.y-1].element === "flesh_mound" && pixelMap[pixel.x][pixel.y-1].sp === 0) {
pixel.sp = 0;
}
else { pixel.sp = 1 } //supported
if (pixel.stop) {
if (pixel.sp === 0) { tryMove(pixel, pixel.x, pixel.y+1); }
return;
}
if (pixel.sp === 0) { tryMove(pixel, pixel.x, pixel.y+1); }
else {
if (pixel.fert && pixel.stage && Math.random() < 0.01 && isEmpty(pixel.x,pixel.y+1)) {
clonePixel(pixel,pixel.x,pixel.y+1);
pixelMap[pixel.x][pixel.y+1].fert = true;
pixelMap[pixel.x][pixel.y+1].stage = pixel.stage-1;
}
}
if (pixel.fert===undefined) { // able to grow down
pixel.fert = Math.random() < 0.50;
}
if (pixel.stage===undefined) {
pixel.stage = Math.floor(Math.random()*20)+10;
}
if (Math.random() < 0.03 && isEmpty(pixel.x-1,pixel.y) && !isEmpty(pixel.x-1,pixel.y-1) && (outOfBounds(pixel.x-1,pixel.y-1) || pixelMap[pixel.x-1][pixel.y-1].element !== "flesh_mound")) {
createPixel("flesh_mound",pixel.x-1,pixel.y);
pixelMap[pixel.x-1][pixel.y].fruit = pixel.fruit;
}
if (Math.random() < 0.03 && isEmpty(pixel.x+1,pixel.y) && !isEmpty(pixel.x+1,pixel.y-1) && (outOfBounds(pixel.x+1,pixel.y-1) || pixelMap[pixel.x+1][pixel.y-1].element !== "flesh_mound")) {
createPixel("flesh_mound",pixel.x+1,pixel.y);
pixelMap[pixel.x+1][pixel.y].fruit = pixel.fruit;
}
if (Math.random() < 0.03 && isEmpty(pixel.x,pixel.y-1) && (
(!isEmpty(pixel.x-1,pixel.y-1) && (outOfBounds(pixel.x-1,pixel.y-1) || pixelMap[pixel.x-1][pixel.y-1].element !== "flesh_mound")) ||
(!isEmpty(pixel.x+1,pixel.y-1) && (outOfBounds(pixel.x+1,pixel.y-1) || pixelMap[pixel.x+1][pixel.y-1].element !== "flesh_mound")))
) {
createPixel("flesh_mound",pixel.x,pixel.y-1);
pixelMap[pixel.x][pixel.y-1].fruit = pixel.fruit;
}
if (pixel.fruit && Math.random() < 0.0001) {
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)) {
createPixel(pixel.fruit,x,y)
break;
}
}
}
if (pixel.h < 2 && Math.random() < 0.0005 && isEmpty(pixel.x,pixel.y-1)) {
createPixel(pixel.element,pixel.x,pixel.y-1);
pixelMap[pixel.x][pixel.y-1].h = pixel.h+1;
}
var coords = [
[pixel.x+1,pixel.y],
[pixel.x-1,pixel.y],
[pixel.x+1,pixel.y+1],
[pixel.x-1,pixel.y+1],
];
for (var i = 0; i < coords.length; i++) {
if (Math.random() < 0.005 && isEmpty(coords[i][0],coords[i][1])) {
if (!isEmpty(coords[i][0],coords[i][1]+1,true)) {
var soil = pixelMap[coords[i][0]][coords[i][1]+1];
if (eLists.FESTER.indexOf(soil.element) !== -1) {
createPixel(pixel.element,coords[i][0],coords[i][1]);
}
}
}
}
if (Math.random() < 0.0002 && pixel.age > 500 && pixel.temp < 90 && pixel.rooting === false) {
pixel.rooting = true;
}
if (Math.random() < 0.002 && pixel.age > 500 && pixel.temp < 90 && pixel.rooting === true) {
if (!outOfBounds(pixel.x,pixel.y+1)) {
var dirtPixel = pixelMap[pixel.x][pixel.y+1];
if (dirtPixel && (eLists.FESTER.indexOf(dirtPixel.element) !== -1 || dirtPixel.element === "grass")) {
changePixel(dirtPixel,"vein_root");
}
}
}
pixel.age++;
doDefaults(pixel);
},
ignore: ["teeth","flesh_mound","flesh_beast"],
renderer: renderPresets.PLANTCHAR,
properties: {
"h": 0,
"age": 0,
"rooting": false,
"fruit": undefined,
},
reactions: {
"cell": { elem2:"flesh_mound", chance:0.005 },
"skin": { elem2:"flesh_mound", chance:0.005 },
"sugar_water": { elem2:"flesh_mound", chance:0.05 },
"acidic_bile": { elem2:null, chance:0.005 },
"plant": { elem2:["dead_plant","solid_flesh"], chance:0.005 },
"dead_plant": { elem2:"flesh_mound", chance:0.005 },
"sapling": { elem2:"fleshwood_sapling", chance:0.005 },
"wood": { elem2:"dry_fleshwood", chance:0.005 },
"tree_branch": { elem2:"fleshwood", chance:0.005 },
"head": { elem2:"flesh_mound", chance:0.001},
"body": { elem2:"flesh_mound", chance:0.001 },
"frog": { elem2:"flesh_mound", chance:0.005 },
"tadpole": { elem2:"flesh_mound", chance:0.005 },
"fish": { elem2:"flesh_mound", chance:0.005 },
"rat": { elem2:"flesh_mound", chance:0.005 },
"bird": { elem2:"flesh_mound", chance:0.005 },
},
tempHigh: 100,
stateHigh: "meat",
tempLow: -2,
stateLow: "frozen_meat",
burn:3,
burnTime:20,
breakInto: "meat",
category:"flesh",
state: "solid",
density: 1400,
}
elements.vein_root = {
color: ["#c72114","#8d3728","#a95338","#c72114","#d83225","#c1745b","#903830", "#c72114",],
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"CH:fleshy_dirt,dirt,mud,sand,wet_sand,clay_soil,clay,mycelium,grass,color_sand,skin,meat,rotten_meat,concrete,dead_plant,dead_bug,root>vein_root,fibrous_flesh%0.5 AND CR:vein_root%0.005|CH:fleshy_dirt,dirt,mud,sand,wet_sand,clay_soil,clay,mycelium,grass,color_sand,skin,meat,rotten_meat,concrete,dead_plant,dead_bug,root>vein_root,fibrous_flesh,fibrous_flesh%0.5|CH:fleshy_dirt,dirt,mud,sand,wet_sand,clay_soil,clay,mycelium,grass,color_sand,skin,meat,rotten_meat,concrete,dead_plant,dead_bug,root>vein_root,fibrous_flesh%0.5 AND CR:vein_root%0.005",
],
reactions: {
"rock": { elem2:"sand", chance:0.0008 },
"mud": { elem2:"dirt", chance:0.01 },
"wet_sand": { elem2:"sand", chance:0.01 },
"water": { elem2:null, chance:0.001 },
"blood": { elem2:null, chance:0.01 },
"sugar_water": { elem2:null, chance:0.0025 },
"acidic_bile": { elem2:null, chance:0.0025 }
},
tempHigh: 175,
stateHigh: "meat",
tempLow: -50,
stateLow: "frozen_meat",
burn: 20,
burnTime: 60,
burnInto: "meat",
breakInto: "blood",
category: "flesh",
state: "solid",
density: 1250,
conduct: 0.1,
hidden: true
}
elements.fibrous_flesh = {
color: ["#c72114","#7c2617","#984227","#c72114","#b0634a","#802720","#c72114"],
behavior: behaviors.STURDYPOWDER,
tempHigh:175,
stateHigh: "meat",
tempLow: -50,
stateLow: "frozen_meat",
burn: 20,
burnTime: 60,
burnInto: "meat",
category:"flesh",
hidden: true,
breakInto: "blood",
state: "solid",
density: 462
}
elements.solid_flesh = {
color: ["#7c2617","#984227","#c72114","#b0634a","#802720"],
behavior: behaviors.WALL,
reactions: {
"plant": { elem2:["dead_plant","solid_flesh"], chance:0.005 },
"grass": { elem2:["dead_plant","flesh_mound"], chance:0.005 },
"tree_branch": { elem1:null, elem2:"fleshwood" },
"sapling": { elem2:"fleshwood_sapling", chance:0.005 },
},
tempHigh:175,
stateHigh: "meat",
tempLow: -50,
stateLow: "frozen_meat",
burn: 20,
burnTime: 60,
burnInto: "meat",
category:"flesh",
hidden: true,
breakInto: ["blood","meat","meat"],
state: "solid",
density: 462
}
elements.flesh_beast = {
color: ["#9e4839","#ba6449","#a14940"],
behavior: [
"XX|CR:acidic_bile%0.05 AND M2%0.5|M2%5 AND SW:acidic_bile,meat,rotten_meat,blood%14",
"XX|FX%2|M2%50 AND BO",
"XX|M1|M2%50 AND SW:acidic_bile,meat,rotten_meat,blood%14",
],
reactions: {
"cell": { elem2:"flesh_mound", chance:0.05, func:behaviors.FEEDPIXEL },
"head": { elem2:["flesh_mound",null], chance:0.01, func:behaviors.FEEDPIXEL },
"body": { elem2:["flesh_mound",null], chance:0.01, func:behaviors.FEEDPIXEL },
"frog": { elem2:["flesh_mound",null], chance:0.05, func:behaviors.FEEDPIXEL },
"tadpole": { elem2:["flesh_mound",null], chance:0.05, func:behaviors.FEEDPIXEL },
"fish": { elem2:["flesh_mound",null], chance:0.05, func:behaviors.FEEDPIXEL },
"rat": { elem2:["flesh_mound",null], chance:0.05, func:behaviors.FEEDPIXEL },
"bird": { elem2:["flesh_mound",null], chance:0.05, func:behaviors.FEEDPIXEL },
"bone": { elem2:"quicklime", chance:0.005, func:behaviors.FEEDPIXEL },
"bone_marrow": { elem2:["flesh_mound","quicklime"], chance:0.005, func:behaviors.FEEDPIXEL },
"skin": { elem2:"flesh_mound", chance:0.005, func:behaviors.FEEDPIXEL },
"sugar": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL },
"sugar_water": { elem2:null, chance:0.05, func:behaviors.FEEDPIXEL },
"plant": { elem2:["dead_plant","flesh_mound",null], chance:0.005, func:behaviors.FEEDPIXEL },
"grass": { elem2:["dead_plant","flesh_mound",null], chance:0.005, func:behaviors.FEEDPIXEL },
"oxygen": { elem2:"carbon_dioxide", chance:0.5 },
"meat": { elem2:["flesh_mound",null], chance:0.01, func:behaviors.FEEDPIXEL },
"cooked_meat": { elem2:["flesh_mound",null,null,null], chance:0.1, func:behaviors.FEEDPIXEL },
"rotten_meat": { elem2:["flesh_mound","plague",null,null], chance:0.1, func:behaviors.FEEDPIXEL },
"cheese": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"rotten_cheese": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"melted_cheese": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL },
"tomato": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"sauce": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL },
"vine": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"evergreen": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"algae": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"grass_seed": { elem2:null, chance:0.3 , func:behaviors.FEEDPIXEL},
"wheat_seed": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL },
"wheat": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"potato_seed": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL },
"potato": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"corn_seed": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL },
"corn": { elem2:null, chance:0.1 , func:behaviors.FEEDPIXEL},
"lichen": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL },
"flower_seed": { elem2:null, chance:0.4 , func:behaviors.FEEDPIXEL},
"flour": { elem2:null, chance:0.1 , func:behaviors.FEEDPIXEL},
"dough": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"bread": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"toast": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"gingerbread": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"rice": { elem2:null, chance:0.1 , func:behaviors.FEEDPIXEL},
"yogurt": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"beans": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"salt": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"sugar": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"crumb": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"herb": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"popcorn": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL },
"candy": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL },
"caramel": { elem2:null, chance:0.4, func:behaviors.FEEDPIXEL },
"lichen": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"egg": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"yolk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"eggnog": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"milk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"grape": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"batter": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"baked_batter": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"butter": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"melted_butter": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL },
"lettuce": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"baked_potato": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"ice_cream": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"cream": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL },
"pumpkin": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"pumpkin_seed": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"coffee_bean": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"coffee_ground": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"nut": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"nut_meat": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"nut_butter": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"jelly": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"worm": { elem2:["flesh_mound",null], chance:0.1, func:behaviors.FEEDPIXEL },
"fly": { elem2:["flesh_mound",null], chance:0.1, func:behaviors.FEEDPIXEL },
"ant": { elem2:["flesh_mound",null], chance:0.1, func:behaviors.FEEDPIXEL },
"frog": { elem2:["flesh_mound",null], chance:0.05, func:behaviors.FEEDPIXEL },
"snail": { elem2:["flesh_mound","quicklime"], chance:0.1, func:behaviors.FEEDPIXEL },
"slug": { elem2:["flesh_mound",null], chance:0.1, func:behaviors.FEEDPIXEL },
"sapling": { elem2:"fleshwood_sapling", chance:0.005 },
"wood": { elem2:"dry_fleshwood", chance:0.005 },
"tree_branch": { elem2:"fleshwood", chance:0.005 },
},
foodNeed: 2,
egg: "flesh_beast",
category: "flesh",
temp: 37.6,
tempHigh: 120,
stateHigh: "rotten_meat",
tempLow: -18,
stateLow: "frozen_meat",
breakInto: ["acidic_bile","rotten_meat"],
burn:80,
burnTime:150,
state: "solid",
density: 1450,
conduct: 0.25
}
elements.fleshwood_sapling = {
color: ["#7c2617","#984227","#c72114","#b0634a","#802720"],
tick: function(pixel) {
if (!tryMove(pixel,pixel.x,pixel.y+1)) {
if (Math.random() < 0.02 && pixel.age > 50 && pixel.temp < 100) {
if (!outOfBounds(pixel.x,pixel.y+1)) {
var dirtPixel = pixelMap[pixel.x][pixel.y+1];
if (dirtPixel && (eLists.FESTER.indexOf(dirtPixel.element) !== -1 || dirtPixel.element === "grass")) {
changePixel(dirtPixel,"vein_root");
}
}
if (isEmpty(pixel.x,pixel.y-1)) {
if (!pixel.wc) {
var c = Math.random();
if (c < 0.01) { pixel.wc="#632e1f"; pixel.lc="#7c2617" }
else if (c < 0.05) { pixel.wc="#9e4839"; pixel.lc="#7c2617" }
else if (c < 0.1) { pixel.wc="#9e4839"; pixel.lc="#984227" }
else if (c < 0.2) { pixel.wc="#a14940"; pixel.lc="#984227" }
else if (c < 0.3) { pixel.wc="#ba6449"; pixel.lc="#c72114" }
else if (c < 0.4) { pixel.wc="#a14940"; pixel.lc="#c72114" }
else if (c < 0.45) { pixel.wc="#ba6449"; pixel.lc="#b0634a" }
else if (c < 0.5) { pixel.wc="#a14940"; pixel.lc="#b0634a" }
else { pixel.wc="#9e4839"; pixel.lc="#802720" }
pixel.color = pixelColorPick(pixel, pixel.lc);
}
movePixel(pixel,pixel.x,pixel.y-1);
createPixel(Math.random() > 0.5 ? "dry_fleshwood" : "fleshwood",pixel.x,pixel.y+1);
pixelMap[pixel.x][pixel.y+1].wc = pixel.wc;
pixelMap[pixel.x][pixel.y+1].lc = pixel.lc;
pixelMap[pixel.x][pixel.y+1].color = pixelColorPick(pixelMap[pixel.x][pixel.y+1], pixel.wc);
}
}
else if (pixel.age > 1000 && Math.random() < 0.05) {
changePixel(pixel,"dry_fleshwood");
pixel.color = pixelColorPick(pixel, pixel.wc);
}
pixel.age++;
}
doDefaults(pixel);
},
properties: {
"age":0
},
tempHigh: 100,
stateHigh: "meat",
tempLow: -25,
stateLow: "meat",
burn: 65,
burnTime: 15,
category: "flesh",
state: "solid",
density: 1500,
cooldown: defaultCooldown,
seed: true
}
elements.fleshwood = {
color: ["#9e4839","#ba6449","#a14940"],
tick: function(pixel) {
if (!pixel.burning) {
if (!pixel.lc) { pixel.lc = "#7c2617" }
if (!pixel.wc) { pixel.wc = "#ba6449" }
if (isEmpty(pixel.x-1,pixel.y-1) && Math.random() < 0.02) {
if (Math.random() < 0.55) {
createPixel("solid_flesh",pixel.x-1,pixel.y-1);
pixelMap[pixel.x-1][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x-1][pixel.y-1], pixel.lc);
}
else {
createPixel("fleshwood",pixel.x-1,pixel.y-1);
pixelMap[pixel.x-1][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x-1][pixel.y-1], pixel.wc);
pixelMap[pixel.x-1][pixel.y-1].wc = pixel.wc;
pixelMap[pixel.x-1][pixel.y-1].lc = pixel.lc;
}
}
if (isEmpty(pixel.x+1,pixel.y-1) && Math.random() < 0.02) {
if (Math.random() < 0.55) {
createPixel("solid_flesh",pixel.x+1,pixel.y-1);
pixelMap[pixel.x+1][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x+1][pixel.y-1], pixel.lc);
}
else {
createPixel("fleshwood",pixel.x+1,pixel.y-1);
pixelMap[pixel.x+1][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x+1][pixel.y-1], pixel.wc);
pixelMap[pixel.x+1][pixel.y-1].wc = pixel.wc;
pixelMap[pixel.x+1][pixel.y-1].lc = pixel.lc;
}
}
if (isEmpty(pixel.x,pixel.y-1) && Math.random() < 0.02) {
if (Math.random() < 0.8) {
createPixel("solid_flesh",pixel.x,pixel.y-1);
pixelMap[pixel.x][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x][pixel.y-1], pixel.lc);
}
else {
createPixel("fleshwood",pixel.x,pixel.y-1);
pixelMap[pixel.x][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x][pixel.y-1], pixel.wc);
pixelMap[pixel.x][pixel.y-1].wc = pixel.wc;
pixelMap[pixel.x][pixel.y-1].lc = pixel.lc;
}
}
}
doDefaults(pixel);
},
renderer: renderPresets.WOODCHAR,
reactions: {
"plant": { elem2:["dead_plant","solid_flesh"], chance:0.005 },
"grass": { elem2:["dead_plant","flesh_mound"], chance:0.005 },
"tree_branch": { elem1:null, elem2:"fleshwood" },
"sapling": { elem2:"fleshwood_sapling", chance:0.005 },
},
movable: false,
tempHigh: 175,
stateHigh: "meat",
tempLow: -30,
stateLow: "meat",
category: "flesh",
burn: 2,
burnTime: 300,
burnInto: ["blood","ash","cooked_meat","ash"],
hidden: true,
state: "solid",
density: 1500,
hardness: 0.15,
breakInto: ["blood","meat"],
forceSaveColor: true
}
elements.dry_fleshwood = {
color: ["#9e4839","#ba6449","#a14940"],
behavior: behaviors.WALL,
renderer: renderPresets.WOODCHAR,
reactions: {
"plant": { elem2:["dead_plant","solid_flesh"], chance:0.005 },
"grass": { elem2:["dead_plant","flesh_mound"], chance:0.005 },
"tree_branch": { elem1:null, elem2:"fleshwood" },
"sapling": { elem2:"fleshwood_sapling", chance:0.005 },
},
tempHigh: 400,
stateHigh: ["ash","cooked_meat","fire","fire","fire"],
tempLow: -30,
stateLow: "meat",
category: "solids",
burn: 5,
burnTime: 300,
burnInto: ["ash","cooked_meat","fire"],
state: "solid",
hardness: 0.15,
breakInto: ["blood","meat"],
forceSaveColor: true
}
elements.acidic_bile = {
color: ["#81cf63","#81cf63","#81cf63","#81cf63","#81cf63","#81cf63","#439809","#258b08","#118511","#127b12","#136d14"],
behavior: [
"XX|DB%1|XX",
"DB%1 AND M2%25|DL%0.001|DB%1 AND M2%25",
"DB%1 AND M2%25|DB%2 AND M1|DB%1 AND M2%25",
],
ignore: ["flesh_beast","flesh_mound","vein_root","glass","rad_glass","glass_shard","rad_shard","stained_glass","baked_clay","acid","acid_gas","neutral_acid","acid_cloud","water","salt_water","sugar_water","dirty_water","copper","gold","porcelain","plastic","bead","microplastic","molten_plastic","pool_water","chlorine","hydrogen","gold_coin","silver","nickel","calcium","bone","earthquake","tornado","tsunami","liquid_light","sensor"],
reactions: {
"ash": { elem1:null, elem2:null },
"limestone": { elem1:null, elem2:["calcium","carbon_dioxide"] },
"quicklime": { elem1:null, elem2:null },
"slaked_lime": { elem1:null, elem2:null },
"borax": { elem1:null, elem2:null },
"ammonia": { elem1:null, elem2:null },
"bleach": { elem1:null, elem2:null },
"cement": { elem1:null, elem2:null },
"glass": { elem1:null, elem2:"glass_shard", chance:0.05 },
"caustic_potash": { elem1:"water", elem2:"potassium_salt" },
"bone": { elem2:"flesh_mound", chance:0.01 },
"water": { elem1:null, elem2:"dirty_water" },
"salt_water": { elem1:null, elem2:"water" },
"sugar_water": { elem1:null, elem2:"water" },
"plant": { elem2:["dead_plant","flesh_mound"], chance:0.005 },
"grass": { elem2:["dead_plant","flesh_mound"], chance:0.005 },
"tree_branch": { elem1:null, elem2:["dry_fleshwood","dry_fleshwood","dead_plant","fleshwood"] },
"charcoal": { elem1:null, elem2:"carbon_dioxide" },
"rock": { elem1:null, elem2:"sand", chance:0.05 },
"baking_soda": { elem1:"salt_water", elem2:["carbon_dioxide","foam"] },
"calcium": { elem1:"chlorine", elem2:"hydrogen", chance:0.01 },
"zinc": { elem1:"hydrogen", elem2:null, chance:0.03 },
"sugar": { elem1:"steam", elem2:"carbon_dioxide" },
"sapling": { elem2:"fleshwood_sapling", chance:0.005 },
},
tempHigh: 120,
stateHigh: ["steam","steam","salt"],
tempLow: 0,
category:"flesh",
state: "liquid",
density: 1450,
stain: 0.05
}

4038
mods/genetics.js Normal file

File diff suppressed because it is too large Load Diff

79
mods/lighting_test.js Normal file
View File

@ -0,0 +1,79 @@
lightCoordsLevel1 = [
[-1,-3],[0,-3],[1,-3],
[-2,-2],[2,-2],
[-3,-1],[3,-1],
[-3,-0],[3,-0],
[-3,1],[3,1],
[-2,2],[2,2],
[-1,3],[0,3],[1,3],
]
lightCoordsLevel2 = [
[-1,-2],[0,-2],[1,-2],
[-2,-1],[2,-1],
[-2,0],[2,0],
[-2,1],[2,1],
[-1,2],[0,2],[1,2],
]
lightCoordsLevel3 = [
[-1,-1],[1,-1],
[-1,1],[1,1],
]
lightCoordsLevel3Extra = [
[1,0],[-1,0],[0,1],[0,-1]
]
glowAmount = 2;
viewInfo[4] = {
name: "lighting",
effects: true,
colorEffects: true,
pixel: viewInfo[1].pixel,
pre: function(ctx){
const pixelSize3 = pixelSize*3;
const pixelSize7 = pixelSize*7
const pixelSize5 = pixelSize*5
ctx.globalAlpha = 0.1;
for (let i = 0; i < currentPixels.length; i++) {
const pixel = currentPixels[i];
if (elements[pixel.element].id === elements.fire.id) {
ctx.fillStyle = pixel.color;
/* no occulusion: */
ctx.fillRect(canvasCoord(pixel.x-1), canvasCoord(pixel.y-3), pixelSize3, pixelSize7);
if (!isEmpty(pixel.x,pixel.y+1) && !isEmpty(pixel.x,pixel.y-1)) {
continue;
}
ctx.fillRect(canvasCoord(pixel.x-3), canvasCoord(pixel.y-1), pixelSize7, pixelSize3);
if (!isEmpty(pixel.x+1,pixel.y) && !isEmpty(pixel.x-1,pixel.y)) {
continue;
}
ctx.fillRect(canvasCoord(pixel.x-2), canvasCoord(pixel.y-2), pixelSize5, pixelSize5);
// ctx.globalAlpha = 0.1;
// lightCoordsLevel1.forEach(coords => {
// let x = pixel.x+coords[0]; let y = pixel.y+coords[1];
// if (!outOfBounds(x,y) && pixelMap[pixel.x+coords[0]][pixel.y+coords[1]] === undefined) {
// ctx.fillRect(x*pixelSize, y*pixelSize, pixelSize, pixelSize);
// }
// });
// ctx.globalAlpha = 0.2;
// lightCoordsLevel2.forEach(coords => {
// let x = pixel.x+coords[0]; let y = pixel.y+coords[1];
// if (!outOfBounds(x,y) && pixelMap[pixel.x+coords[0]][pixel.y+coords[1]] === undefined) {
// ctx.fillRect(x*pixelSize, y*pixelSize, pixelSize, pixelSize);
// }
// });
// ctx.globalAlpha = 0.3;
// lightCoordsLevel3.forEach(coords => {
// let x = pixel.x+coords[0]; let y = pixel.y+coords[1];
// if (!outOfBounds(x,y) && pixelMap[pixel.x+coords[0]][pixel.y+coords[1]] === undefined) {
// ctx.fillRect(x*pixelSize, y*pixelSize, pixelSize, pixelSize);
// }
// });
}
}
ctx.globalAlpha = 1;
}
}

258
mods/moveable_cubes.js Normal file
View File

@ -0,0 +1,258 @@
elements.steel_cube = {
color: "#71797e",
colorKey: {
"L":"#888f94",
"B":"#71797e"
},
colorPattern: [
"BBLB",
"BBBL",
"BLBB",
"LBBB"
],
reactions: {
"water": { elem1:"rust", chance:0.002 },
"salt_water": { elem1:"rust", chance:0.004 },
"dirty_water": { elem1:"rust", chance:0.03 },
"pool_water": { elem1:"rust", chance:0.03 },
"sugar_water": { elem1:"rust", chance:0.003 },
"seltzer": { elem1:"rust", chance:0.005 },
"salt": { elem1:"rust", chance:0.003 },
"blood": { elem1:"rust", chance:0.002 },
"infection": { elem1:"rust", chance:0.002 },
"antibody": { elem1:"rust", chance:0.002 },
"coffee": { elem1:"rust", chance:0.0002 },
"tea": { elem1:"rust", chance:0.0002 },
"broth": { elem1:"rust", chance:0.0002 },
"juice": { elem1:"rust", chance:0.0002 },
"nut_milk": { elem1:"rust", chance:0.0002 },
},
tempHigh: 1455.5,
stateHigh: "molten_steel",
category: "cubes",
density: 7850,
conduct: 0.42,
hardness: 0.8,
tick: function(pixel) {
if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall
if (!isEmpty(pixel.x, pixel.y-2, true)) {
var cube2 = pixelMap[pixel.x][pixel.y-2];
if (cube2.element == "steel") {
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 (!isEmpty(pixel.x+1, pixel.y-1, true)) {
var cube2 = pixelMap[pixel.x+1][pixel.y-1];
if (cube2.element == "steel") {
if (isEmpty(pixel.x+1, pixel.y)) {
movePixel(pixelMap[pixel.x+1][pixel.y-1], pixel.x+1, pixel.y);
}
else {
swapPixels(pixelMap[pixel.x+1][pixel.y-1], pixelMap[pixel.x+1][pixel.y]);
}
}
}
if (!isEmpty(pixel.x+2, pixel.y-1, true)) {
var cube2 = pixelMap[pixel.x+2][pixel.y-1];
if (cube2.element == "steel") {
if (isEmpty(pixel.x+2, pixel.y)) {
movePixel(pixelMap[pixel.x+2][pixel.y-1], pixel.x+2, pixel.y);
}
else {
swapPixels(pixelMap[pixel.x+2][pixel.y-1], pixelMap[pixel.x+2][pixel.y]);
}
}
}
if (!isEmpty(pixel.x-1, pixel.y-1, true)) {
var cube2 = pixelMap[pixel.x-1][pixel.y-1];
if (cube2.element == "steel") {
if (isEmpty(pixel.x-1, pixel.y)) {
movePixel(pixelMap[pixel.x-1][pixel.y-1], pixel.x-1, pixel.y);
}
else {
swapPixels(pixelMap[pixel.x-1][pixel.y-1], pixelMap[pixel.x-1][pixel.y]);
}
}
}
if (!isEmpty(pixel.x-2, pixel.y-1, true)) {
var cube2 = pixelMap[pixel.x-2][pixel.y-1];
if (cube2.element == "steel") {
if (isEmpty(pixel.x-2, pixel.y)) {
movePixel(pixelMap[pixel.x-2][pixel.y-1], pixel.x-2, pixel.y);
}
else {
swapPixels(pixelMap[pixel.x-2][pixel.y-1], pixelMap[pixel.x-2][pixel.y]);
}
}
}
if (!isEmpty(pixel.x+1, pixel.y-2, true)) {
var cube2 = pixelMap[pixel.x+1][pixel.y-2];
if (cube2.element == "steel") {
if (isEmpty(pixel.x+1, pixel.y-1)) {
movePixel(pixelMap[pixel.x+1][pixel.y-2], pixel.x+1, pixel.y-1);
}
else {
swapPixels(pixelMap[pixel.x+1][pixel.y-2], pixelMap[pixel.x+1][pixel.y-1]);
}
}
}
if (!isEmpty(pixel.x+2, pixel.y-2, true)) {
var cube2 = pixelMap[pixel.x+2][pixel.y-2];
if (cube2.element == "steel") {
if (isEmpty(pixel.x+2, pixel.y-1)) {
movePixel(pixelMap[pixel.x+2][pixel.y-2], pixel.x+2, pixel.y-1);
}
else {
swapPixels(pixelMap[pixel.x+2][pixel.y-2], pixelMap[pixel.x+2][pixel.y-1]);
}
}
}
if (!isEmpty(pixel.x-1, pixel.y-2, true)) {
var cube2 = pixelMap[pixel.x-1][pixel.y-2];
if (cube2.element == "steel") {
if (isEmpty(pixel.x-1, pixel.y-1)) {
movePixel(pixelMap[pixel.x-1][pixel.y-2], pixel.x-1, pixel.y-1);
}
else {
swapPixels(pixelMap[pixel.x-1][pixel.y-2], pixelMap[pixel.x-1][pixel.y-1]);
}
}
}
if (!isEmpty(pixel.x-2, pixel.y-2, true)) {
var cube2 = pixelMap[pixel.x-2][pixel.y-2];
if (cube2.element == "steel") {
if (isEmpty(pixel.x-2, pixel.y-1)) {
movePixel(pixelMap[pixel.x-2][pixel.y-2], pixel.x-2, pixel.y-1);
}
else {
swapPixels(pixelMap[pixel.x-2][pixel.y-2], pixelMap[pixel.x-2][pixel.y-1]);
}
}
}
}
}
}
elements.wood_cube = {
color: "#a0522d",
behavior: behaviors.WALL,
renderer: renderPresets.WOODCHAR,
tempHigh: 400,
stateHigh: ["ember","charcoal","fire","fire","fire"],
category: "cubes",
burn: 5,
burnTime: 300,
burnInto: ["ember","charcoal","fire"],
state: "solid",
hardness: 0.15,
breakInto: "sawdust",
forceSaveColor: true,
tick: function(pixel) {
if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall
if (!isEmpty(pixel.x, pixel.y-2, true)) {
var cube2 = pixelMap[pixel.x][pixel.y-2];
if (cube2.element == "wood") {
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 (!isEmpty(pixel.x+1, pixel.y-1, true)) {
var cube2 = pixelMap[pixel.x+1][pixel.y-1];
if (cube2.element == "wood") {
if (isEmpty(pixel.x+1, pixel.y)) {
movePixel(pixelMap[pixel.x+1][pixel.y-1], pixel.x+1, pixel.y);
}
else {
swapPixels(pixelMap[pixel.x+1][pixel.y-1], pixelMap[pixel.x+1][pixel.y]);
}
}
}
if (!isEmpty(pixel.x+2, pixel.y-1, true)) {
var cube2 = pixelMap[pixel.x+2][pixel.y-1];
if (cube2.element == "wood") {
if (isEmpty(pixel.x+2, pixel.y)) {
movePixel(pixelMap[pixel.x+2][pixel.y-1], pixel.x+2, pixel.y);
}
else {
swapPixels(pixelMap[pixel.x+2][pixel.y-1], pixelMap[pixel.x+2][pixel.y]);
}
}
}
if (!isEmpty(pixel.x-1, pixel.y-1, true)) {
var cube2 = pixelMap[pixel.x-1][pixel.y-1];
if (cube2.element == "wood") {
if (isEmpty(pixel.x-1, pixel.y)) {
movePixel(pixelMap[pixel.x-1][pixel.y-1], pixel.x-1, pixel.y);
}
else {
swapPixels(pixelMap[pixel.x-1][pixel.y-1], pixelMap[pixel.x-1][pixel.y]);
}
}
}
if (!isEmpty(pixel.x-2, pixel.y-1, true)) {
var cube2 = pixelMap[pixel.x-2][pixel.y-1];
if (cube2.element == "wood") {
if (isEmpty(pixel.x-2, pixel.y)) {
movePixel(pixelMap[pixel.x-2][pixel.y-1], pixel.x-2, pixel.y);
}
else {
swapPixels(pixelMap[pixel.x-2][pixel.y-1], pixelMap[pixel.x-2][pixel.y]);
}
}
}
if (!isEmpty(pixel.x+1, pixel.y-2, true)) {
var cube2 = pixelMap[pixel.x+1][pixel.y-2];
if (cube2.element == "wood") {
if (isEmpty(pixel.x+1, pixel.y-1)) {
movePixel(pixelMap[pixel.x+1][pixel.y-2], pixel.x+1, pixel.y-1);
}
else {
swapPixels(pixelMap[pixel.x+1][pixel.y-2], pixelMap[pixel.x+1][pixel.y-1]);
}
}
}
if (!isEmpty(pixel.x+2, pixel.y-2, true)) {
var cube2 = pixelMap[pixel.x+2][pixel.y-2];
if (cube2.element == "wood") {
if (isEmpty(pixel.x+2, pixel.y-1)) {
movePixel(pixelMap[pixel.x+2][pixel.y-2], pixel.x+2, pixel.y-1);
}
else {
swapPixels(pixelMap[pixel.x+2][pixel.y-2], pixelMap[pixel.x+2][pixel.y-1]);
}
}
}
if (!isEmpty(pixel.x-1, pixel.y-2, true)) {
var cube2 = pixelMap[pixel.x-1][pixel.y-2];
if (cube2.element == "wood") {
if (isEmpty(pixel.x-1, pixel.y-1)) {
movePixel(pixelMap[pixel.x-1][pixel.y-2], pixel.x-1, pixel.y-1);
}
else {
swapPixels(pixelMap[pixel.x-1][pixel.y-2], pixelMap[pixel.x-1][pixel.y-1]);
}
}
}
if (!isEmpty(pixel.x-2, pixel.y-2, true)) {
var cube2 = pixelMap[pixel.x-2][pixel.y-2];
if (cube2.element == "wood") {
if (isEmpty(pixel.x-2, pixel.y-1)) {
movePixel(pixelMap[pixel.x-2][pixel.y-2], pixel.x-2, pixel.y-1);
}
else {
swapPixels(pixelMap[pixel.x-2][pixel.y-2], pixelMap[pixel.x-2][pixel.y-1]);
}
}
}
}
}
}

View File

@ -106,7 +106,7 @@ elements.frozen_xenon = {
elements.radon = {
color: elements.neon.color,
behavior: behaviors.GAS,
colorOn: ["#d33d7c","#f73273","#c03190"],
colorOn: ["#3dd3cb","#32f7e7","#31c0a8"],
category: "gases",
state: "gas",
conduct: 0.8,
@ -156,7 +156,7 @@ elements.radon = {
elements.liquid_radon = {
color: elements.neon.color,
behavior: behaviors.LIQUID,
colorOn: ["#d33d7c","#f73273","#c03190"],
colorOn: ["#3dd3cb","#32f7e7","#31c0a8"],
category: "states",
state: "liquid",
tempHigh: -58,
@ -170,7 +170,7 @@ elements.liquid_radon = {
elements.frozen_radon = {
color: elements.neon.color,
behavior: behaviors.WALL,
colorOn: ["#d33d7c","#f73273","#c03190"],
colorOn: ["#3dd3cb","#32f7e7","#31c0a8"],
category: "states",
state: "solid",
tempHigh: -68,
@ -182,7 +182,7 @@ elements.frozen_radon = {
elements.oganesson = {
color: elements.neon.color,
behavior: behaviors.GAS,
colorOn: ["#5bdce6","#56a9f7","#56b0e4"],
colorOn: ["#b5e65b","#b9f756","#aee456"],
category: "gases",
state: "gas",
conduct: 0.8,

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,11 @@
/*
____ _
| _ \ __ _| |_ __ _
| | | |/ _` | __/ _` |
| |_| | (_| | || (_| |
|____/ \__,_|\__\__,_|
*/
polygonColors = function(sides){
let baseColors = [
/*
@ -33,6 +41,68 @@ polygonColors = function(sides){
return "rgb(0, 0, 0)"
}
}
const usefulMiscColors = {
playerBlue: "rgb(0, 176, 225)",
barrelGray: "rgb(153, 153, 153)",
playerGreen: "rgb(0, 224, 108)",
playerRed: "rgb(240, 79, 84)",
playerPurple: "rgb(216, 43, 207)",
bodyGray: "rgb(95, 103, 108)",
fallenGray: "rgb(192, 192, 192)",
celestialPink: "rgb(237, 110, 222)"
}
const upgrades = {
weapons: {
annihilator: [
{
theta: 0,
damage: 150,
reload: 1,
angle: 0,
spread: 0,
yoffset: 0,
xoffset: 0,
length: 1.9,
width: 1,
type: 0,
bulletHealth: 60
}
],
twin: [
{
theta: 0,
damage: 150,
reload: 1,
angle: 0,
spread: 0,
yoffset: 0,
xoffset: 0.5,
length: 1.8,
width: 0.45,
type: 0,
bulletHealth: 60
},
{
theta: 0,
damage: 150,
reload: 1,
angle: 0,
spread: 0,
yoffset: 0,
xoffset: -0.5,
length: 1.8,
width: 0.45,
type: 0,
bulletHealth: 60
}
]
},
bodies: {
}
}
polygonList = []
zoomLevel = 0.5
isKeyDown = {
w: false,
a: false,
@ -41,6 +111,66 @@ isKeyDown = {
i: false,
o: false
}
let mouseX = 0;
let mouseY = 0;
camera = [0, 0]
scenexeplayer = {
x: 0,
y: 0,
facing: 0,
vx: 0,
vy: 0,
level: 1,
rotation: 0,
radius: 40,
collisionMass: 520,
type: 1,
bodyDamage: 5,
maxHealth: 10000,
health: 10000,
regenDelay: 14,
regenSpeed: 0.0001,
timeSinceHurt: null,
color: usefulMiscColors.playerBlue,
barrels: [
{
theta: 0,
damage: 150,
reload: 1,
angle: 0,
spread: 0,
yoffset: 0,
xoffset: 0.5,
length: 1.8,
width: 0.45,
type: 0,
bulletHealth: 60
},
{
theta: 0,
damage: 150,
reload: 1,
angle: 0,
spread: 0,
yoffset: 0,
xoffset: -0.5,
length: 1.8,
width: 0.45,
type: 0,
bulletHealth: 60
}
]
}
bullets = []
debug = false
/*
_____ _ _
| ___| _ _ __ ___| |_(_) ___ _ __ ___
| |_ | | | | '_ \ / __| __| |/ _ \| '_ \/ __|
| _|| |_| | | | | (__| |_| | (_) | | | \__ \
|_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/
*/
function HSVtoRGB(h, s, v) {
var r, g, b, i, f, p, q, t;
if (arguments.length === 1) {
@ -112,6 +242,13 @@ function makeVisible(color){
colorObject.b = Math.max(40, colorObject.b)
return objectToColor(colorObject)
}
function darkenPercent(color, percent){
let colorObject = colorToObject(color)
colorObject.r = Math.floor(colorObject.r * percent)
colorObject.g = Math.floor(colorObject.g * percent)
colorObject.b = Math.floor(colorObject.b * percent)
return objectToColor(colorObject)
}
// when wasd keydown, set isKeyDown to true
document.addEventListener("keydown", (event) => {
if (event.key === "w") {
@ -161,6 +298,18 @@ document.addEventListener("keyup", (event) => {
}
}
})
document.addEventListener("mousemove", (event) => {
let rect = canvas.getBoundingClientRect();
mouseX = event.clientX - rect.left;
mouseY = event.clientY - rect.top;
});
let mouseDown = false;
document.addEventListener("mousedown", (event) => {
mouseDown = true;
});
document.addEventListener("mouseup", (event) => {
mouseDown = false;
});
orbitalSpeed = function(sides){
return 1/(1.00672*Math.pow(0.344151, sides) + 0.000002)
}
@ -210,8 +359,6 @@ function polygonCount(random){
}
}
}
polygonList = []
zoomLevel = 0.5
function newPolygon(sides){
polygonList.push({
sides: sides,
@ -236,12 +383,8 @@ function newPolygon(sides){
polygonSize = function(sides){
return 18 * Math.pow(1.47, sides - 3)
}
for (var i = 0; i <= 400; i++){
sides = polygonCount(Math.random())
newPolygon(sides)
}
function drawPolygon(ctx, polygon, index){
if (Math.abs(polygonList[index].x-camera[0]-polygon.radius<canvas.width/zoomLevel) && Math.abs(polygonList[index].y-camera[1])-polygon.radius<canvas.height/zoomLevel){
if (Math.abs(polygonList[index].x-camera[0])-polygonList[index].radius<canvas.width/zoomLevel && Math.abs(polygonList[index].y-camera[1])-polygonList[index].radius<canvas.height/zoomLevel){
let x = polygon.x
let y = polygon.y
let sides = polygon.sides
@ -255,9 +398,9 @@ function drawPolygon(ctx, polygon, index){
ctx.strokeStyle = darkenColor(polygonColors(sides))
ctx.lineWidth = 5*zoomLevel
ctx.beginPath()
ctx.moveTo(Math.sin(rotation)*radius+x, Math.cos(rotation)*radius+y)
ctx.moveTo(Math.cos(rotation)*radius+x, Math.sin(rotation)*radius+y)
for (var i = 0; i <= sides+1; i++){
ctx.lineTo(Math.sin(rotation+2*Math.PI*i/sides)*radius+x, Math.cos(rotation+2*Math.PI*i/sides)*radius+y)
ctx.lineTo(Math.cos(rotation+2*Math.PI*i/sides)*radius+x, Math.sin(rotation+2*Math.PI*i/sides)*radius+y)
}
ctx.fill()
ctx.stroke()
@ -270,10 +413,15 @@ function drawPolygon(ctx, polygon, index){
ctx.moveTo(x-radius, y+radius+(10*zoomLevel))
ctx.lineTo(x+radius, y+radius+(10*zoomLevel))
ctx.stroke()
ctx.strokeStyle = makeVisible(polygonColors(sides))
ctx.strokeStyle = darkenPercent(polygonColors(sides), 0.4)
ctx.lineWidth = 4*zoomLevel
ctx.beginPath()
ctx.moveTo(x-radius, y+radius+(10*zoomLevel))
ctx.lineTo(x+radius, y+radius+(10*zoomLevel))
ctx.stroke()
ctx.strokeStyle = makeVisible(polygonColors(sides))
ctx.beginPath()
ctx.moveTo(x-radius, y+radius+(10*zoomLevel))
ctx.lineTo(x-radius+(radius*2*hppercent), y+radius+(10*zoomLevel))
//console.log(hppercent)
ctx.stroke()
@ -284,7 +432,7 @@ function drawPolygon(ctx, polygon, index){
if(debug){
ctx.beginPath()
ctx.moveTo(x, y)
ctx.lineTo(Math.sin(rotation)*2*radius+x, Math.cos(rotation)*2*radius+y)
ctx.lineTo(Math.cos(rotation)*2*radius+x, Math.sin(rotation)*2*radius+y)
ctx.strokeStyle = "rgb(0, 0, 255)"
ctx.stroke()
// draw a line to represent velocity
@ -297,7 +445,6 @@ function drawPolygon(ctx, polygon, index){
ctx.lineWidth = 10*zoomLevel
ctx.fillStyle = "rgb(255, 255, 255)"
ctx.strokeStyle = "rgb(0, 0, 0)"
ctx.font = `bold ${zoomLevel*30}px Helvetica`
//ctx.strokeText(Math.round(polygon.collisionMass), x, y)
//ctx.fillText(Math.round(polygon.collisionMass), x, y)
// draw text on healthbar
@ -308,10 +455,92 @@ function drawPolygon(ctx, polygon, index){
}
}
}
debug = false
function rotatePoint(point, angle) {
let x = point.x;
let y = point.y;
return {
x: Math.cos(angle) * x - Math.sin(angle) * y,
y: Math.sin(angle) * x + Math.cos(angle) * y
};
}
function addPoint(point1, point2){
return {
x: point1.x + point2.x,
y: point1.y + point2.y
}
}
function drawBullet(ctx, bullet){
let x = bullet.x
let y = bullet.y
let radius = bullet.radius
let rotation = bullet.rotation
ctx.fillStyle = scenexeplayer.color
ctx.strokeStyle = darkenColor(usefulMiscColors.playerBlue)
ctx.lineWidth = 5*zoomLevel
ctx.beginPath()
ctx.arc(x, y, radius, 0, 2*Math.PI)
ctx.fill()
ctx.stroke()
}
function drawPlayer(ctx, player){
ctx.fillStyle = "rgb(0, 176, 225)"
ctx.strokeStyle = darkenColor("rgb(0, 176, 225)")
let x = player.x
let y = player.y
let radius = player.radius
// draw barrels
for (barrel of player.barrels){
if (barrel.type == 0){ // rectangular barrel
ctx.fillStyle = usefulMiscColors.barrelGray
ctx.strokeStyle = darkenColor(usefulMiscColors.barrelGray)
ctx.lineWidth = 5*zoomLevel
let playerPoint = {
x: player.x,
y: player.y
}
let barrelPoints = [
{
x: -(barrel.width*player.radius)+(barrel.xoffset*player.radius),
y: barrel.yoffset*player.radius
},
{
x: (barrel.width*player.radius)+(barrel.xoffset*player.radius),
y: barrel.yoffset*player.radius
},
{
x: (barrel.width*player.radius)+(barrel.xoffset*player.radius),
y: barrel.yoffset*player.radius+player.radius*barrel.length
},
{
x: -(barrel.width*player.radius)+(barrel.xoffset*player.radius),
y: barrel.yoffset*player.radius+player.radius*barrel.length
}
]
//console.log(barrelPoints)
let barrelPointsRotated = [
rotatePoint(barrelPoints[0], player.rotation-2*Math.PI/4+barrel.theta+barrel.angle),
rotatePoint(barrelPoints[1], player.rotation-2*Math.PI/4+barrel.theta+barrel.angle),
rotatePoint(barrelPoints[2], player.rotation-2*Math.PI/4+barrel.theta+barrel.angle),
rotatePoint(barrelPoints[3], player.rotation-2*Math.PI/4+barrel.theta+barrel.angle)
]
//console.log(barrelPointsRotated)
let barrelPointsTranslated = [
addPoint(barrelPointsRotated[0], playerPoint),
addPoint(barrelPointsRotated[1], playerPoint),
addPoint(barrelPointsRotated[2], playerPoint),
addPoint(barrelPointsRotated[3], playerPoint)
]
//console.log(barrelPointsTranslated)
ctx.beginPath()
ctx.moveTo(barrelPointsTranslated[0].x, barrelPointsTranslated[0].y)
ctx.lineTo(barrelPointsTranslated[1].x, barrelPointsTranslated[1].y)
ctx.lineTo(barrelPointsTranslated[2].x, barrelPointsTranslated[2].y)
ctx.lineTo(barrelPointsTranslated[3].x, barrelPointsTranslated[3].y)
ctx.lineTo(barrelPointsTranslated[0].x, barrelPointsTranslated[0].y)
ctx.fill()
ctx.stroke()
}
}
ctx.fillStyle = player.color
ctx.strokeStyle = darkenColor(player.color)
ctx.lineWidth = 5*zoomLevel
ctx.beginPath()
ctx.arc(player.x, player.y, player.radius, 0, 2*Math.PI)
@ -326,10 +555,15 @@ function drawPlayer(ctx, player){
ctx.moveTo(player.x-player.radius, player.y+player.radius+(10*zoomLevel))
ctx.lineTo(player.x+player.radius, player.y+player.radius+(10*zoomLevel))
ctx.stroke()
ctx.strokeStyle = makeVisible("rgb(0, 176, 225)")
ctx.strokeStyle = darkenPercent(player.color, 0.4)
ctx.lineWidth = 4*zoomLevel
ctx.beginPath()
ctx.moveTo(player.x-player.radius, player.y+player.radius+(10*zoomLevel))
ctx.lineTo(player.x+player.radius, player.y+player.radius+(10*zoomLevel))
ctx.stroke()
ctx.strokeStyle = makeVisible(player.color)
ctx.beginPath()
ctx.moveTo(player.x-player.radius, player.y+player.radius+(10*zoomLevel))
ctx.lineTo(player.x-player.radius+(player.radius*2*player.health/player.maxHealth), player.y+player.radius+(10*zoomLevel))
ctx.stroke()
}
@ -338,7 +572,7 @@ function drawPlayer(ctx, player){
// draw a line to represent angle
ctx.beginPath()
ctx.moveTo(player.x, player.y)
ctx.lineTo(Math.sin(player.rotation)*2*player.radius+player.x, Math.cos(player.rotation)*2*player.radius+player.y)
ctx.lineTo(Math.cos(player.rotation)*2*player.radius+player.x, Math.sin(player.rotation)*2*player.radius+player.y)
ctx.strokeStyle = "rgb(0, 0, 255)"
ctx.stroke()
// draw a line
@ -352,9 +586,8 @@ function drawPlayer(ctx, player){
ctx.lineWidth = 10*zoomLevel
ctx.fillStyle = "rgb(255, 255, 255)"
ctx.strokeStyle = "rgb(0, 0, 0)"
ctx.font = `bold ${zoomLevel*30}px Helvetica`
ctx.strokeText(Math.round(player.collisionMass), player.x, player.y)
ctx.fillText(Math.round(player.collisionMass), player.x, player.y)
ctx.strokeText(`${Math.round(player.collisionMass)}`, player.x, player.y)
ctx.fillText(`${Math.round(player.collisionMass)}`, player.x, player.y)
// draw text on healthbar
ctx.strokeText(Math.round(player.health)+"/"+Math.round(player.maxHealth), player.x, player.y+player.radius+(10*zoomLevel))
ctx.fillText(Math.round(player.health)+"/"+Math.round(player.maxHealth), player.x, player.y+player.radius+(10*zoomLevel))
@ -382,26 +615,24 @@ function cameraZoom(ctx, object, multiplier, camera){
objectreturn.radius = objectreturn.radius * multiplier
return objectreturn
}
camera = [0, 0]
scenexeplayer = {
x: 0,
y: 0,
vx: 0,
vy: 0,
rotation: 0,
radius: 40,
collisionMass: 520,
type: 1,
bodyDamage: 5,
maxHealth: 10000,
health: 10000,
regenDelay: 14,
regenSpeed: 0.0001,
timeSinceHurt: null
}
keybinds["KeyI"] = function(){}
keybinds["KeyM"] = function(){}
renderPostPixel(function(ctx){
/*
____ ___ _ _ _ _ _ _
/ ___| __ _ _ __ ___ ___ |_ _|_ __ (_) |_ __ _| (_)______ _| |_(_) ___ _ __
| | _ / _` | '_ ` _ \ / _ \ | || '_ \| | __/ _` | | |_ / _` | __| |/ _ \| '_ \
| |_| | (_| | | | | | | __/ | || | | | | || (_| | | |/ / (_| | |_| | (_) | | | |
\____|\__,_|_| |_| |_|\___| |___|_| |_|_|\__\__,_|_|_/___\__,_|\__|_|\___/|_| |_|
*/
for (var i = 0; i <= 400; i++){
sides = polygonCount(Math.random())
newPolygon(sides)
}
setInterval(function(){
if (ctx === null){return}
window.clearInterval(tickInterval)
window.clearInterval(renderInterval)
clearLayers()
if (pixelMap){pixelMap = [], currentPixels = [], paused = true}
ctx.fillStyle = "rgb(205, 205, 205)"
@ -445,8 +676,8 @@ renderPostPixel(function(ctx){
//calculate angle of collision
angle = Math.atan2(polygon2.y - polygon1.y, polygon2.x - polygon1.x)
// update velocity
polygon1.vx -= (Math.cos(angle) * (polygon1.radius + polygon2.radius - distance)/2)/(polygon1.collisionMass/polygon2.collisionMass**(1/2.5))
polygon1.vy -= (Math.sin(angle) * (polygon1.radius + polygon2.radius - distance)/2)/(polygon1.collisionMass/polygon2.collisionMass**(1/2.5))
polygon1.vx -= (Math.cos(angle) * (polygon1.radius + polygon2.radius - distance)/2)/Math.max(polygon1.collisionMass/polygon2.collisionMass**(1/2.5), 1/7)
polygon1.vy -= (Math.sin(angle) * (polygon1.radius + polygon2.radius - distance)/2)/Math.max(polygon1.collisionMass/polygon2.collisionMass**(1/2.5), 1/7)
if (polygon2.type != polygon1.type){
polygon1.health -= polygon2.bodyDamage
polygon1.timeSinceHurt = 0
@ -475,8 +706,8 @@ renderPostPixel(function(ctx){
let polygon = polygonList[poly]
polygon.rotation += 1/orbitalSpeed(polygon.sides)
// add some velocity towards wherever its facing
polygon.vx += Math.sin(polygon.rotation)/orbitalSpeed(polygon.sides)*8
polygon.vy += Math.cos(polygon.rotation)/orbitalSpeed(polygon.sides)*8
polygon.vx += Math.sin(polygon.rotation)/orbitalSpeed(polygon.sides)*8*(polygon.random < 0.5 ? -1 : 1)
polygon.vy += Math.cos(polygon.rotation)/orbitalSpeed(polygon.sides)*8*(polygon.random < 0.5 ? -1 : 1)
if (polygon.health <= 0){
polygonList.splice(poly, 1)
}
@ -514,8 +745,26 @@ renderPostPixel(function(ctx){
}
if (isKeyDown.i){
zoomLevel += 0.02
ctx.font = `bold ${zoomLevel*30}px Helvetica`
}
if (isKeyDown.o){
zoomLevel -= 0.02
if (zoomLevel < 0.02){
zoomLevel = 0.02
}
ctx.font = `bold ${zoomLevel*30}px Helvetica`
}
})
// angle player towards mouse
scenexeplayer.rotation = Math.atan2(mouseY - canvas.height/2, mouseX - canvas.width/2)
// if mouse down make barrels shoot bullets out
if (mouseDown){
for (barrel of scenexeplayer.barrels){
// first, calculate angle of barrel
let angle = Math.atan2(mouseY - canvas.height/2, mouseX - canvas.width/2)
angle += barrel.theta + barrel.angle
// calculate point of origin within barrel and rotate/translate accordingly
}
}
scenexeplayer.radius = (59.99*Math.pow(1.00972, scenexeplayer.level))/2
}, 1000/60)

147
mods/single_humans.js Normal file
View File

@ -0,0 +1,147 @@
elements.single_human = {
color: ["#f3e7db","#f7ead0","#eadaba","#d7bd96","#a07e56","#825c43","#604134","#3a312a"],
category: "life",
tick: function(pixel) {
if (tryMove(pixel, pixel.x, pixel.y+1)) {} // Fall
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
}
if (pixel.panic > 0) {
pixel.panic -= 0.1;
if (pixel.panic < 0) { pixel.panic = 0; }
}
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) {
break;
}
}
else if (!isEmpty(pixel.x+move[0], pixel.y+move[1], true)) {
var hitPixel = pixelMap[pixel.x+move[0]][pixel.y+move[1]];
if (hitPixel.element === "single_human") {
// interact with other humans
hitPixel.panic = pixel.panic;
}
}
}
// 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; }
}
},
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": { elem2:"carbon_dioxide", chance:0.5 },
"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": { elem2:"bubble", attr2:{"clone":"water"}, chance:0.001 },
"salt_water": { elem2:"bubble", attr2:{"clone":"salt_water"}, chance:0.001 },
"pool_water": { elem2:"bubble", attr2:{"clone":"pool_water"}, chance:0.001 },
},
properties: {
dead: false,
dir: 1,
panic: 0
},
}

147
mods/souls.js Normal file
View File

@ -0,0 +1,147 @@
elements.soul = {
color: "#87fff9",
tick: function(pixel) {
if (pixel.y <= 1) { deletePixel(pixel.x,pixel.y); return; }
if (Math.random() < 0.05) {
if (!tryMove(pixel,pixel.x,pixel.y-1)) {
if (!isEmpty(pixel.x,pixel.y-1,true)) {
var hitPixel = pixelMap[pixel.x][pixel.y-1];
if (elements[hitPixel.element].movable) {
swapPixels(pixel,hitPixel);
}
}
}
}
var dir = pixel.flipX ? -1 : 1;
if (!pixel.stage) {
if (Math.random() < 0.25) {
if (!tryMove(pixel,pixel.x+dir,pixel.y-( Math.random() < 0.33 ? 1 : 0 ))) {
pixel.flipX = !pixel.flipX;
}
if (Math.random() < 0.1) {
pixel.stage = 1;
pixel.flipX = Math.random() < 0.5;
}
}
}
else if (pixel.stage === 1) {
if (!tryMove(pixel,pixel.x+dir,pixel.y+1)) { pixel.flipX = !pixel.flipX; }
if (Math.random() < 0.25) {
pixel.stage = 2;
pixel.flipX = Math.random() < 0.5;
}
}
else if (pixel.stage === 2) {
if (Math.random() < 0.25) {
var dirX = Math.floor(Math.random() * (2 - -1) + -1);
var dirY = Math.floor(Math.random() * (2 - -1) + -1);
tryMove(pixel,pixel.x+dirX,pixel.y+dirY);
}
if (Math.random() < 0.01) {
pixel.stage = 0;
pixel.flipX = Math.random() < 0.5;
}
}
if (!pixel.glow) {
if (Math.random() < 0.25) { pixel.glow = true; }
}
else if (Math.random() < 0.01) {
pixel.glow = false;
delete pixel.glow;
}
if (Math.random() < 0.0002 && isEmpty(pixel.x,pixel.y+1)) {
createPixel("ectoplasm",pixel.x,pixel.y+1);
}
if (Math.random() < 0.001) {
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)) {
createPixel("flash",x,y);
pixelMap[x][y].temp = -10;
}
}
}
doDefaults(pixel);
},
reactions: {
"light_bulb": { charged:true, elem2:"explosion" },
"led_r": { charged:true, elem2:"explosion" },
"led_g": { charged:true, elem2:"explosion" },
"led_b": { charged:true, elem2:"explosion" },
"wire": { charge2:1, chance:0.05 },
"body": { attr2:{"panic":20} },
"proton": { elem1:null },
},
temp: -10,
hardness: 100,
flippableX: true,
glow: true,
state: "gas",
density: 1000,
ignoreAir: true,
category: "life",
insulate: true,
hidden: true
}
elements.ectoplasm = {
color: ["#ADF9E7","#c1fbed"],
behavior: behaviors.LIQUID,
tick: function(pixel) {
if (pixel.temp >= -10 && Math.random() < 0.01 && pixelTicks-pixel.start > 100) {
deletePixel(pixel.x,pixel.y)
}
},
reactions: {
"body": { attr2:{"panic":20} },
"rock_wall": { elem1:null, elem2:"tombstone" }
},
temp: -10,
category: "liquids",
state: "liquid",
density: 0.0001,
ignoreAir: true,
insulate: true,
viscosity: 1666,
hardness: 100,
hidden: true
}
elements.head.breakInto = "soul";
elements.head.burnInto = "soul";
elements.head.stateHigh = "soul";
elements.head.stateLow = "soul";
elements.head.onDelete = function(pixel) {
releaseElement(pixel,"soul");
}
elements.head.onChange = function(pixel,element) {
if (element !== "soul") {
releaseElement(pixel,"soul");
}
}
elements.bless.reactions.soul = { elem2:"human" }
elements.bless.reactions.ectoplasm = { elem2:null }
elements.bless.reactions.tombstone = { elem2:"rock_wall" }
elements.tombstone = {
color: ["#5f5f5f","#434343","#282828"],
behavior: [
"XX|CR:soul%0.01|XX",
"CR:soul%0.01|XX|CR:soul%0.01",
"XX|XX|XX",
],
category:"special",
tempHigh: 950,
stateHigh: "magma",
state: "solid",
density: 2550,
hardness: 0.5,
breakInto: ["rock","rock","rock","rock","soul","ectoplasm"],
onStateHigh: function(pixel) {
releaseElement(pixel,"soul");
},
buttonGlow: "#87fff9"
}

View File

@ -1,5 +1,5 @@
//texture_pack_by_jayd
document.body.style.backgroundImage = 'url("https://jayd-rubies.github.io/1236951076024877107.png")';
document.body.style.backgroundImage = 'url("https://jayd-rubies.github.io/image/1236951076024877107.png")';
gameDiv.style.border = "1px solid #ffffff00";
window.addEventListener("load",function(){
document.querySelectorAll(".categoryButton").forEach(e => {
@ -113,4 +113,4 @@ viewInfo[4] = { // Small Pixels
}
else{renderBall(ctx,pixel.color,pixel.x,pixel.y,0,1);}
}
}
}

61
mods/true_flashbang.js Normal file
View File

@ -0,0 +1,61 @@
// by nekonico
elements.true_flashbang = {
color: "#65665c",
onSelect: function() {
logMessage("Caution: If you have epilepsy or any similar vision issues, do not place this element for your own safety.");
},
behavior: [
"XX|EX:20>flashbang_flash%1|XX",
"XX|XX|XX",
"M2|M1 AND EX:20>flashbang_flash%1|M2",
],
category: "weapons",
state: "solid",
density: 1300,
tempHigh: 1455.5,
stateHigh: "molten_steel",
excludeRandom: true,
cooldown: defaultCooldown
}
elements.flashbang_flash = {
color: "#ffffff",
properties: {
delay: 100
},
tick: function(pixel) {
settings.bg = pixel.color;
let hex = Math.round(255 * pixel.alpha).toString(16);
pixel.color = `#${hex}${hex}${hex}` // credits to therazzler in the R74n discord for this code :3
var done = true;
if (pixel.delay) {
var delayR = pixel.delay % 1;
var delay = pixel.delay - delayR;
if (!(pixelTicks - pixel.start > (pixel.delay||1) && Math.random() < 1-delayR)) {
done = false;
}
}
if ((Math.random() < 0.75 && done) || pixel.alpha < 0.05) {
deletePixel(pixel.x, pixel.y)
settings.bg = "#000000";
}
if (pixel.delay) {
pixel.alpha = Math.max(0,1-(pixelTicks - pixel.start)/pixel.delay)
}
doHeat(pixel);
},
category: "energy",
temp: 40,
tempLow: -270,
stateLow: ["liquid_light",null],
state: "gas",
category: "energy",
density: 0.00001,
ignoreAir: true,
insulate: true,
hidden: true,
noMix: true,
excludeRandom: true
}