This commit is contained in:
JustAGenericUsername 2026-01-29 16:29:42 -05:00
commit ab9ece0a95
53 changed files with 19286 additions and 10037 deletions

44
keyBindButton.js Normal file
View File

@ -0,0 +1,44 @@
async function _kBBprompt(message, defaultValue = "") {
return new Promise(resolve => {
promptInput(message, (result) => {
resolve(result);
}, "keyBindButton.js is asking you...", defaultValue);
})
}
async function _jaydalert(message) {
promptText(message, undefined, "Jayd:");
}
runAfterLoad(async () => {
window.setTimeout(async () => {
_jaydalert("Warning! keyBindButton.js is in beta, expect bugs.")
},)
})
elements.keyBindButton = {
color: "#bebfa3",
onPlace: async (pixel) => {
pixel.thisKeyIsBinded = await _kBBprompt("Select a key to bind.",(pixel.thisKeyIsBinded||undefined))
},
tick: (pixel) => {
document.onkeydown = function(kb)/*keybind*/ {
if (kb.key.toLowerCase() == pixel.thisKeyIsBinded.toLowerCase()) {
pixel.charge = 1;
}
},
document.onkeyup = function(kb)/*keybind*/ {
if (kb.key.toLowerCase() == pixel.thisKeyIsBinded.toLowerCase()) {
}
}
doDefaults(pixel);
},
perTick: () => {
mouseSize = 1;
},
ignore: ["flash"],
conduct: 1,
movable: false,
category:"machines",
darkText: true,
maxSize: 1
}

View File

@ -196,9 +196,10 @@
<tr><td>stripe_paint.js</td><td>Tool to paint with stripes</td><td>Alice</td></tr>
<tr><td>text.js</td><td>Tools to write text</td><td>RedBirdly</td></tr>
<tr><td>texturepack.js</td><td>Tools that let you create and share custom texture packs</td><td>nousernamefound</td></tr>
<tr><td>the_ground.js</td><td>Several rock types, worldgen settings, and gemstones</td><td>Alice</td></tr>
<tr><td>the_ground_og.js</td><td>Several rock types and gemstones</td><td>Alice</td></tr>
<tr><td>worldEdit.js</td><td>Selection and editing tools</td><td>RedBirdly</td></tr>
<tr><td>worldgenlibrary.js</td><td>World generation library</td><td>Orchid</td></tr>
<tr><td>zoom.js</td><td>Buttons to zoom into and move the canvas</td><td>mnem</td></tr>
<!----><tr><td class="modCat" colspan="3">Science & Chemistry</td></tr><!---->
<tr><td>alcohol.js</td><td>Methanol, (iso-)propanol, and butanol</td><td>Alice</td></tr>
@ -225,7 +226,7 @@
<tr><td>glenn_gases.js</td><td>Most gases from the <a href="https://www.jamieswhiteshirt.com/minecraft/mods/gases/" target="_blank">Glenn's Gases</a> mod into Sandboxels</td><td>Alice</td></tr>
<tr><td>grav_mudstones.js</td><td>Various forms of mudstone with different gravities</td><td>Alice</td></tr>
<tr><td>halogen.js</td><td>The missing halogens</td><td>nousernamefound</td></tr>
<tr><td>hidden_ground.js</td><td>Hides most rock variants from the_ground.js excluding the base rocks and walls</td><td>Melecie</td></tr>
<tr><td>hidden_ground.js</td><td>Hides most rock variants from the_ground_og.js excluding the base rocks and walls</td><td>Melecie</td></tr>
<tr><td>iocalfaeus_clones.js</td><td>Iorefrius, Iolucius, and Ioradius gas</td><td>Alice</td></tr>
<tr><td>jaydstuff.js</td><td>Various chemicals and compounds</td><td>Jayd</td></tr>
<tr><td>laetium.js</td><td>Several fictional elements</td><td>Alice</td></tr>
@ -245,10 +246,10 @@
<tr><td>radioactive.js</td><td>Radioactive elements on the periodic table [WIP]</td><td>kaeud</td></tr>
<tr><td>random_rocks.js</td><td>Randomly generates rocks on game load</td><td>Alice</td></tr>
<tr><td>roseyiede.js</td><td>Several variants of a substance called roseyiede</td><td>Alice</td></tr>
<tr><td>solubility.js</td><td>Adds solubility and a simple-to-use format for other mods to use with it</td><td>Orchid</td></tr>
<tr><td>solubility.js</td><td>Solubility and a simple-to-use format for other mods to use with it</td><td>Orchid</td></tr>
<tr><td>some_tf_liquids.js</td><td>Various liquids from the Thermal Foundation Minecraft mod</td><td>Alice</td></tr>
<tr><td>stickystuff.js</td><td>Slime, Honey, and others can stick to other elements</td><td>Suss</td></tr>
<tr><td>the_ground.js</td><td>Several rocks, worldgen types, and gemstones</td><td>Alice</td></tr>
<tr><td>the_ground_og.js</td><td>Several rock types and gemstones</td><td>Alice</td></tr>
<!----><tr><td class="modCat" colspan="3">Machines & Technology</td></tr><!---->
<tr><td>circuitcore.js</td><td>Extension for logicgates.js that adds advanced circuits <a href="https://redbirdly.github.io/circuitcore_tutorial.html" target="_blank">[More Info]</a></td><td>RedBirdly</td></tr>
@ -256,7 +257,7 @@
<tr><td>colored_lightbulbs.js</td><td>Light bulb that can be painted</td><td>guzzo86, ggod</td></tr>
<tr><td>combustion.js</td><td>Components necessary for combustion engines</td><td>uptzik</td></tr>
<tr><td>conveyance.js</td><td>Conveyors, operated with and without electricity</td><td>Melecie</td></tr>
<tr><td>coresbyp.js</td><td>Adds several cores to fuel your reactors and a reactor fluid</td><td>suspasha111</td></tr>
<tr><td>coresbyp.js</td><td>Several cores to fuel your reactors and a reactor fluid</td><td>suspasha111</td></tr>
<tr><td>datawire.js</td><td>Wire that transfers data and other operators and machines for it</td><td>Orchid</td></tr>
<tr><td>drill.js</td><td>Drills made out of several materials</td><td>Suss</td></tr>
<tr><td>ExtraMachines.js</td><td>Sensors, energy resources, materials, and more</td><td>Mecoolnotcool</td></tr>
@ -303,6 +304,7 @@
<tr><td>subspace.js</td><td>The Subspace Tripmine from Roblox</td><td>nousernamefound</td></tr>
<tr><td>war_crimes.js</td><td>Tear gas and more</td><td>voidapex11</td></tr>
<tr><td>weapons.js</td><td>Variety of different weapons</td><td>Jayd</td></tr>
<tr><td>weaponsRewrite.js</td><td>BETA! weapons.js is getting an overhaul, more details soon.(hopefully)</td><td>Jayd</td></tr>
<!----><tr><td class="modCat" colspan="3">Food & Cooking</td></tr><!---->
<tr><td>aChefsDream_beta.js</td><td>Beta testing for aChefsDream.js</td><td>SquareScreamYT</td></tr>
@ -364,18 +366,18 @@
<tr><td>primordial_birthpool.js</td><td>Cross between Primordial Soup and Birthpool. Requires fey_and_more.js</td><td>Alice</td></tr>
<tr><td>scp.js</td><td>Creatures and items from the SCP Wiki</td><td>Nekonico</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>the_ground_og.js</td><td>Simplified and more stable version of the_ground.js</td><td>Alice</td></tr>
<tr><td>the_ground.js</td><td>Several rock types, worldgen settings, and gemstones</td><td>Alice</td></tr>
<tr><td>the_ground_og.js</td><td>Several rock types and gemstones</td><td>Alice</td></tr>
<tr><td>toothpaste.js</td><td>Teeth and paste</td><td>Alice</td></tr>
<tr><td>volcanic_expansion.js</td><td>Obsidian, Pumice, and Andesite rocks</td><td>Jayd</td></tr>
<!----><tr><td class="modCat" colspan="3">Fun & Games</td></tr><!---->
<tr><td>3pms_mod.js</td><td>Adds random stuff and tools</td><td>3pm</td></tr>
<tr><td>3pms_mod.js</td><td>Random stuff and tools</td><td>3pm</td></tr>
<tr><td>10kelements.js</td><td>Customizable amount of randomly generated elements</td><td>nousernamefound</td></tr>
<tr><td>all_around_fillers.js</td><td>Directional Filler variants</td><td>idk73248</td></tr>
<tr><td>allliquids.js</td><td>Made all elements liquids</td><td>Orchid</td></tr>
<tr><td>amogus.js</td><td>Small Among Us structure</td><td>Alice</td></tr>
<tr><td>bfdi.js</td><td>Several references to Battle for Dream Island</td><td>Taterbob</td></tr>
<tr><td>chess.js</td><td>Play chess in Sandboxels [Press U to start game]</td><td>ggod</td></tr>
<tr><td>citybuilding.js</td><td>Seeds that create miniature buildings and other city-related items</td><td>SquareScreamYT</td></tr>
<tr><td>collab_mod.js</td><td>Created by multiple people, adds random things</td><td>mrapple, ilikepizza, stefanblox</td></tr>
<tr><td>cubesstuff.js</td><td>Some random stuff like Disco Ball, Pyrite, and Nordic Gold</td><td>Cube14yt</td></tr>
@ -387,7 +389,6 @@
<tr><td>funny elements 2022-11-15.js</td><td>Few curated randomly-generated elements</td><td>Alice</td></tr>
<tr><td>funny_solid.js</td><td>Feces</td><td>Alice</td></tr>
<tr><td>funnynames.js</td><td>Various ways to mess with the names of elements</td><td>nousernamefound</td></tr>
<tr><td>haseulite.js</td><td>Loona-related materials with various properties</td><td>Alice</td></tr>
<tr><td>lactose_intolerance_and_celiac.js</td><td>Humans explode on contact with milk, wheat, bread, or toast</td><td>Nubo318</td></tr>
<tr><td>lattice_filler.js</td><td>Combination of lattice and filler and a destructive variant</td><td>Suss</td></tr>
<tr><td>liquid_mixing.js</td><td>Liquids can mix colors dynamically</td><td>Nekonico</td></tr>
@ -417,8 +418,6 @@
<!----><tr><td class="modCat" colspan="3">Visual Effects</td></tr><!---->
<tr><td>acid_and_shapes.js</td><td>Weird visual effects enabled in settings</td><td>Alice</td></tr>
<tr><td>asciiboxels.js</td><td>Renders pixels as ASCII characters</td><td>Nekonico</td></tr>
<tr><td>background_changer.js</td><td>Press 'B' to change canvas background to a URL</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
<tr><td>borders.js</td><td>Black borders around pixels (Use bright background)</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
<tr><td>clouds.js</td><td>Moving clouds, sky.js recommended</td><td>RedBirdly</td></tr>
<tr><td>customBackground.js</td><td>Set your background to an image link</td><td>Jayd</td></tr>
<tr><td>fractals.js</td><td>Element and tools to render fractals in game</td><td>nousernamefound</td></tr>
@ -453,7 +452,6 @@
<tr><td>all_stain.js</td><td>Every element stains solids</td><td>stefanblox</td></tr>
<tr><td>betterMenuScreens.js</td><td>Library for mods to create their own menus</td><td>ggod</td></tr>
<tr><td>changePixelDebug.js</td><td>The changePixel() function aborts and logs to console when it tries to change to a non-existent element</td><td>Alice</td></tr>
<tr><td>changeTempReactionParameter.js</td><td>The changeTemp property to modded reactions</td><td>Alice</td></tr>
<tr><td>code_library.js</td><td>Functions and variables common to some other mods</td><td>Alice</td></tr>
<tr><td>controllable_pixel_test.js</td><td>Pixel that can be controlled with the keyboard keys <a href="https://github.com/R74nCom/sandboxels/commit/58dfa9477f2ed7ec9c44b00a35162e7c63bc129c">[More Info]</a> [PC ONLY]</td><td>Alice</td></tr>
<tr><td>customexplosion.js</td><td>Custom explosion element and interface for it</td><td>Orchid</td></tr>
@ -491,13 +489,16 @@
<tr class="deprecated"><td>advanced_colonies.js</td><td>Davlers, creatures with complex colonies</td><td>DaviStudios</td></tr>
<tr class="deprecated"><td>background_changer.js</td><td>Press 'B' to change canvas background to a URL</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
<tr class="deprecated"><td>borders.js</td><td>Black borders around pixels (Use bright background)</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
<tr class="deprecated"><td>changeTempReactionParameter.js</td><td>The changeTemp property to modded reactions</td><td>Alice</td></tr>
<tr class="deprecated"><td>fast_lightmap.js</td><td>Light sources glow, but faster</td><td>RedBirdly</td></tr>
<tr class="deprecated"><td>haseulite.js</td><td>Loona-related materials with various properties</td><td>Alice</td></tr>
<tr class="deprecated"><td>humans.js</td><td>Humans. Now part of the base game</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
<tr class="deprecated"><td>invertscroll.js</td><td>Inverts the scroll wheel for adjusting brush size (now a setting)</td><td>SquareScreamYT</td></tr>
<tr class="deprecated"><td>mobile_shift.js</td><td>Button for shift on mobile (Now in the base game)</td><td>SquareScreamYT</td></tr>
<tr class="deprecated"><td>nicer_flame.js</td><td>Fire is visually pleasing</td><td>RedBirdly</td></tr>
<tr class="deprecated"><td>nopixellimit.js</td><td>Removes the pixel limit. (now a setting)</td><td>Jayd</td></tr>
<tr class="deprecated"><td>pizzasstuff.js</td><td>New animals, foods, and plants</td><td>_ilikepizza_</td></tr>
<tr class="deprecated"><td>the_ground.js</td><td>Several rock types, worldgen settings, and gemstones</td><td>Alice</td></tr>
<tr class="deprecated"><td>unhide.js</td><td>Unhides all elements except molten ones. (This functionality now exists as a vanilla setting)</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
<tr class="deprecated"><td>wheel_fix.js</td><td>Attempts to fix the brush scaling too much with the mouse wheel for some people. Deprecated</td><td>Nubo318</td></tr>

View File

@ -1,4 +1,4 @@
/*Version 1.2.0 Pseudorandom world generator*/
/*Version 1.2.1 Pseudorandom world generator*/
function pseudorandom(key, num, max = 1){
return (Math.log(key)*(num*Math.log(1625.4986772154357))) % max;
};
@ -14,6 +14,134 @@ let oreChances = {
uranium: 0.805,
aluminum: 1
}
let promptMenus = {};
let keys = ["OK", "Cancel", "Confirm", "Input", "Choices", "Dirs", "Dropdown"];
Object.defineProperty(String.prototype, 'capitalize', {
value: function() {
return this.charAt(0).toUpperCase() + this.slice(1);
},
enumerable: false
});
runAfterLoad(()=>{
let dropDown = document.createElement("select");
dropDown.id = "promptDropdown";
dropDown.style.position = "absolute";
dropDown.style.top = "15%";
dropDown.style.left = "42.5%";
dropDown.style.width = "15%";
dropDown.title = "prompt";
dropDown.style.display = "none";
document.getElementById("promptMenu").appendChild(dropDown);
for(let key of keys){
promptMenus[key] = document.getElementById(`prompt${key}`);
promptMenus[key].style.display = "none";
}
//function prompt
});
function showPromptScreen() {
if (!promptState) return;
closeMenu("prompt");
paused = true;
checkPause();
var promptParent = document.getElementById("promptParent");
var menuTitle = document.querySelector("#promptMenu .menuTitle");
menuTitle.innerText = promptState.title || "Notice";
menuTitle.style.color = promptState.titleColor || "unset";
var promptMenuText = document.getElementById("promptMenuText");
promptMenuText.innerText = promptState.text || "";
if (promptState.html) {
promptMenuText.insertAdjacentHTML("beforeend",promptState.html);
}
let promptOK = document.getElementById("promptOK");
let promptCancel = document.getElementById("promptCancel");
let promptConfirm = document.getElementById("promptConfirm");
let promptInput = document.getElementById("promptInput");
let promptChoices = document.getElementById("promptChoices");
let promptDirs = document.getElementById("promptDirs");
let dropDown = document.getElementById("promptDropdown");
for(let key in promptMenus){
promptMenus[key].style.display = "none";
}
promptConfirm.classList.remove("danger");
if (promptState.type === "text") {
promptOK.style.display = "block";
}
else if (promptState.type === "confirm") {
promptCancel.style.display = "block";
promptConfirm.style.display = "block";
if (promptState.danger) promptConfirm.classList.add("danger");
}
else if (promptState.type === "input") {
promptInput.value = "";
promptInput.style.display = "block";
if (promptState.defaultInput !== undefined) {
promptInput.value = ""+promptState.defaultInput;
}
}
else if (promptState.type === "choose" && promptState.choices) {
promptChoices.innerHTML = "";
for (let i = 0; i < promptState.choices.length; i++) {
const choice = promptState.choices[i];
let span = document.createElement("span");
span.className = "promptChoice";
span.onclick = function(){ handlePrompt(choice) };
span.innerText = choice;
promptChoices.appendChild(span);
}
promptChoices.style.display = "block";
}
else if (promptState.type == "dropdown" && promptState.choices != undefined) {
dropDown.innerHTML = "";
//promptParent.appendChild(promptDropdown);
for(let choice of promptState.choices){
dropDown.innerHTML += `<option value="${choice}">${choice.capitalize()}</option>`;
}
let span = document.createElement("span");
span.className = "promptOK";
span.textContent = "Select";
span.onclick = ()=>{
let c = dropDown.value;
console.log(c);
handlePrompt(c);
document.getElementById("promptMenu").removeChild(span);
};
document.getElementById("promptMenu").appendChild(span);
dropDown.style.display = "block";
}
else if (promptState.type === "dir") {
promptDirs.style.display = "block";
}
promptParent.style.display = "block";
showingMenu = "prompt";
if (promptState.type === "input") {
document.getElementById("promptInput").focus();
document.getElementById("promptInput").select();
}
}
function promptDropdown(title, choices, handler){
let pause = false;
if (promptState) { pause = promptState.wasPaused }
else if (paused) { pause = true }
promptState = {
type: "dropdown",
text: "",
choices: choices,
handler: handler,
title: title || "Choose",
wasPaused: pause
}
showPromptScreen();
}
function makeCurve(pos, w, dir, div = 200){
let prevX = pos[0], prevY = pos[1];
let res = [];
@ -26,6 +154,21 @@ function makeCurve(pos, w, dir, div = 200){
return res;
}
function makePool(pos, w=1, h=1){
let res = [];
for(let i = (w*12*Math.PI); i >= 0; i--){
let y = ((h*35)/3)*Math.sin(i/(12*w));
res.push([i, y]);
}
return res;
}
function drawTriangle(pos, height, elem, replace = null, properties = {}){
for(let i = 0; i < 2*height; i++){
drawLine(elem, pos[0]+i, pos[1], pos[0]+height, pos[1]-(height), replace, properties);
}
}
elements.sandstone = {
category: "solids",
color: ["#a89f67", "#b89c6b", "#bbad68"],
@ -38,14 +181,24 @@ elements.sandstone = {
elements.packed_sand.tempHigh = 300;
elements.packed_sand.stateHigh = "sandstone";
function drawLine(elem,x1,y1,x2,y2, replace = null){
let coords = lineCoords(Math.round(x1),Math.round(y1),Math.round(x2),Math.round(y2));
function drawLine(elem,x1,y1,x2,y2, replace = null, properties = {}){
let coords = lineCoords(Math.round(x1),Math.round(y1),Math.round(x2),Math.round(y2), 1);
for(let pos of coords){
let res = tryCreate(elem, pos[0], pos[1]);
if(res != null){
for(let key in properties){
console.log(properties[key], key)
res[key] = properties[key];
}
}
if(replace != null && res == null){
let pixel = getPixel(pos[0], pos[1]);
if(pixel != null && replace.includes(pixel.element)){
changePixel(pixel, elem);
for(let key in properties){
console.log(properties[key], key)
pixel[key] = properties[key];
}
}
}
}
@ -79,18 +232,53 @@ let structureFuncs = {
if(pseudorandom(232, 4564*(seed/2**32), 1) < 0.25){
let x = pseudorandom(531, 9834*(seed/2**32), width);
let h = pseudorandom(659, 2342*(seed/2**32), 10) + 20;
let hwidth = h*Math.atan(0.78539816);
let num = 0;
for(let i = x - hwidth; i < x + hwidth; i++){
let y = (height-35)-(h);
drawLine("sandstone", i, height-35, x, y, ["sand", "cactus"]);
num++;
if(i == x){
num = 0;
};
let y = (height-35);
drawTriangle([x,y], h, "sandstone", ["sand","cactus"]);
}
},
volcano: (seed)=>{
let x = pseudorandom(531, 9834*(seed/2**32), width);
let h = pseudorandom(659, 2342*(seed/2**32), 10) + 25;
let hwidth = h*Math.tan(0.78539816);
let num = 0;
let y = (height-35);
drawTriangle([x,y], h, "basalt", null, {temp: 850});
let w = Math.round(pseudorandom(2423,34543*(seed/2**32), 2))+1;
let d = Math.round(pseudorandom(1231, 54345*(seed/2**32), 12)-6);
let coords = lineCoords(Math.round(x+(h)+d), height-11, Math.round(x+(h)), Math.round(y-h), w);
for(let pos of coords){
let p = getPixel(pos[0],pos[1]);
if(p != null && p.element == "basalt"){
changePixel(p, "magma", 850);
}
}
},
lava_pool: (seed)=>{
let x = pseudorandom(455, 67854*(seed/2**32), width);
let y;
let vx = pseudorandom(531, 9834*(seed/2**32), width);
let vh = pseudorandom(659, 2342*(seed/2**32), 10) + 20;
if(x > vx-vh && x < vx+vh){
return;
}
for(let i = height; i > 0; i--){
if(getPixel(Math.round(x), i-1) == null && !outOfBounds(Math.round(x), i-1)){
y = i;
break;
}
}
let positions = makePool([x,y], 1+pseudorandom(678, 3453*seed, 1), 1+pseudorandom(232, 8754*seed, 0.75));
for(let pos of positions){
for(let i = y+pos[1]; i > y-10; i--){
let p = getPixel(Math.round(pos[0]), Math.round(i));
if(p != null){
changePixel(p, "magma");
p.temp = 850;
}
}
}
}
};
class biome {
constructor(layersArr, yLevels, properties, afterFunc = false, genStructures = false, sp = false){
@ -106,6 +294,9 @@ class biome {
this.generate = function(seed){
autoResizeCanvas();
// paused = true;
if(seed <= 50000000){
seed = (seed*50000000) % (2**32);
}
let fraction = seed/(2**32);
if(this.sPriority){
if(this.structures != undefined){
@ -161,7 +352,9 @@ class biome {
gen(seed);
}
}
this.generateOreVeins(seed, this.vMulti);
if(!this.noOres){
this.generateOreVeins(seed, this.vMulti);
}
};
}
@ -212,7 +405,7 @@ class biome {
}
let biomes = {
plains: new biome([["rock", "rock", "rock", "gravel"], ["dirt", "dirt", "dirt", "dirt", "mud", "gravel"], ["grass","flower_seed","grass","grass","grass","grass","sapling","grass","grass","grass","grass","grass","grass","grass","grass"]], [25, 38, 40]),
desert: new biome([["rock", "rock", "rock", "gravel"], ["rock", "packed_sand","rock", "packed_sand", "sand"], ["sand"], [null, null, null, null, null, null, null, null, null, "cactus"]], [17, 26, 40, 42], {vMulti: 1.2}, false, structureFuncs.pyramid, true),
desert: new biome([["rock", "rock", "rock", "gravel"], ["rock", "packed_sand","rock", "packed_sand", "sand", "sandstone", "sandstone"], ["sand"], [null, null, null, null, null, null, null, null, null, "cactus"]], [17, 26, 40, 42], {vMulti: 1.2}, false, structureFuncs.pyramid, true),
savanna: new biome([["rock", "rock", "rock", "gravel"], ["dirt", "dirt", "clay_soil", "dirt", "dirt"], ["grass",null,null, null, null, null, "sapling",null,null,null,null]], [25, 38, 40], {lc: ["#6fde26", "#8eed34", "#8cdb42", "#7bd12a", "#96e81c", "#a9e64e", "#a0d94c", "#a9d63e"], wc: ["#bdab7e", "#b09c6a", "#ab996d", "#998a63", "#917959", "#877051"], vMulti: 1.5}),
tundra: new biome([["rock", "rock", "rock", "gravel"], ["dirt", "dirt", "rock", "permafrost"], ["permafrost", "permafrost", "permafrost", "permafrost", "permafrost", "permafrost", "ice", "snow"], [null,null,null,null,null,"pinecone",null,null,null,null,null,null]], [25, 30, 38, 40], {temp: -15, vMulti: 2}),
beach: new biome([["rock", "rock", "rock", "gravel"], ["rock", "gravel", "sand", "sand"], ["sand"]], [7, 13, 35], {vMulti: 0.8}, (seed)=>{
@ -237,6 +430,7 @@ let biomes = {
}
}, false);
}, structureFuncs.ocean),
volcano: new biome([["magma", "magma", "basalt"], ["basalt", "tuff", "magma"], ["basalt"]], [13, 23, 40], {temp: 850, noOres: true}, null, [structureFuncs.volcano, structureFuncs.lava_pool]),
}
let seed = Math.random()*(2**32);
@ -259,16 +453,15 @@ elements.SeedGenerate = {
let arr = [];
let txt = shiftDown;
Object.keys(biomes).forEach(function(b){arr.push(b);});
txt = (arr.length >= 7) ? true : txt;
promptInput("Leave blank to generate new seed or C to keep current seed. Your current seed is: " + seed, function(i){
seed = (i != null && i.toLowerCase() == "c") ? seed : parseFloat(i) || Math.random()*(2**32);
seed = seed % (2**32);
if(!txt){
promptChoose("", arr, (choice)=>{
promptDropdown( "Select a biome to generate: ", arr, (choice)=>{
biomes[choice].generate(seed);
promptText("World generation complete.");
selectElement('dirt');
}, "Select a biome to generate: ");
});
} else {
let str = "";
for(let key in biomes){
@ -294,7 +487,6 @@ elements.RandomGen = {
let arr = [];
let txt = shiftDown;
Object.keys(biomes).forEach(function(b){arr.push(b);});
txt = (arr.length >= 7) ? true : txt;
seed = Math.random()*(2**32);
//seed %= 2**32;
if(txt){
@ -316,17 +508,19 @@ elements.RandomGen = {
}, "Enter Biome Name: ");
} else {
promptChoose("", arr, (choice)=>{
biomes[choice].generate(seed);
selectElement("dirt");
}, "Biome Selection");
promptDropdown( "Select a biome to generate: ", arr, (choice)=>{
biomes[choice].generate(seed);
promptText("World generation complete.");
selectElement('dirt');
});
}
},
}
elements.view_seed = {
category: "edit",
onSelect: function(){
alert(seed);
selectElement("dirt");
promptText(seed, undefined, "Seed");
selectElement(prevElement);
}
}

125
mods/Sulfuric_Dixode.js Normal file
View File

@ -0,0 +1,125 @@
if (typeof elements === "undefined") {
var elements = {};
}
if (typeof behaviors === "undefined") {
var behaviors = {};
}
if (typeof pixelMap === "undefined") {
var pixelMap = [];
}
if (typeof adjacentCoords === "undefined") {
var adjacentCoords = [
{ x: 1, y: 0 },
{ x: -1, y: 0 },
{ x: 0, y: 1 },
{ x: 0, y: -1 },
{ x: 1, y: 1 },
{ x: 1, y: -1 },
{ x: -1, y: 1 },
{ x: -1, y: -1 },
];
}
if (typeof changePixel === "undefined") {
var changePixel = function (pixel, elemName) {
pixel.element = elemName;
};
}
elements.sulfuric_acid = {
name: "Sulfuric Acid",
color: ["#c8e0ff", "#d4e8ff", "#b8d4ff"],
behavior: behaviors.LIQUID,
category: "liquids",
state: "liquid",
density: 1840,
tempHigh: 337,
stateHigh: "sulfuric_acid_gas",
tempLow: 10,
stateLow: "frozen_sulfuric_acid",
conduct: 1,
stain: 0.4,
viscosity: 0.02,
desc: "A highly corrosive, dense mineral acid. Reacts violently with water and metals.",
reactions: {
water: { elem1: "steam", elem2: "sulfuric_acid", chance: 0.6, temp1: 80 },
ice: { elem1: "water", elem2: "sulfuric_acid", chance: 0.7, temp1: 40 },
iron: { elem1: "hydrogen", elem2: "rust", chance: 0.4 },
steel: { elem1: "hydrogen", elem2: "corroded_steel", chance: 0.4 },
aluminum: { elem1: "hydrogen", elem2: "corroded_aluminum", chance: 0.4 },
wood: { elem1: "carbon", elem2: "sulfuric_acid", chance: 0.5 },
plant: { elem1: "carbon", elem2: "sulfuric_acid", chance: 0.5 },
flesh: { elem1: "carbon", elem2: "sulfuric_acid", chance: 0.5 },
},
tick: function (pixel) {
if (Math.random() < 0.05) {
var coord =
adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)];
var x = pixel.x + coord.x;
var y = pixel.y + coord.y;
if (pixelMap[x] && pixelMap[x][y]) {
var other = pixelMap[x][y];
var elemDef = elements[other.element];
if (!elemDef) {
return;
}
if (elemDef.state === "solid" && !elemDef.acid_resistant) {
if (Math.random() < 0.1) {
changePixel(other, "corroded_matter");
}
}
}
}
},
};
elements.sulfuric_acid_gas = {
name: "Sulfuric Acid Gas",
color: ["#e0f0ff", "#d0e4ff"],
behavior: behaviors.GAS,
category: "gases",
state: "gas",
density: 2,
desc: "Vaporized sulfuric acid.",
};
elements.frozen_sulfuric_acid = {
name: "Frozen Sulfuric Acid",
color: ["#9fb8e0", "#8fa8d0"],
behavior: behaviors.WALL,
category: "solids",
state: "solid",
density: 1900,
tempHigh: 10,
stateHigh: "sulfuric_acid",
desc: "Solidified sulfuric acid.",
};
elements.corroded_matter = {
name: "Corroded Matter",
color: ["#3a3a3a", "#2e2e2e", "#444444"],
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
density: 1500,
desc: "Generic material heavily corroded by acid.",
};
elements.corroded_steel = {
name: "Corroded Steel",
color: ["#4b4b4b", "#555555", "#3f3f3f"],
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
density: 7700,
desc: "Steel degraded by sulfuric acid.",
};
elements.corroded_aluminum = {
name: "Corroded Aluminum",
color: ["#6f6f6f", "#7a7a7a", "#656565"],
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
density: 2600,
desc: "Aluminum degraded by sulfuric acid.",
};

View File

@ -44986,7 +44986,6 @@ maxPixels (default 1000): Maximum amount of pixels/changes (if xSpacing and ySpa
function editDistance(s1, s2) {s1 = s1.toLowerCase();s2 = s2.toLowerCase();var costs = new Array();for (var i = 0; i <= s1.length; i++) {var lastValue = i;for (var j = 0; j <= s2.length; j++) {if (i == 0)costs[j] = j;else {if (j > 0) {var newValue = costs[j - 1];if (s1.charAt(i - 1) != s2.charAt(j - 1))newValue = Math.min(Math.min(newValue, lastValue),costs[j]) + 1;costs[j - 1] = lastValue;lastValue = newValue;}}}if (i > 0)costs[s2.length] = lastValue;}return costs[s2.length];}
function similarity(s1, s2) {var longer = s1;var shorter = s2;if (s1.length < s2.length) {longer = s2;shorter = s1;}var longerLength = longer.length;if (longerLength == 0) {return 1.0;}return (longerLength - editDistance(longer, shorter)) / parseFloat(longerLength);}
function mostSimilarElement(s) {
delete elements;
var max = 0;
var maxElement = "";
for (var e in elements) {

21
mods/allthemods.js Normal file
View File

@ -0,0 +1,21 @@
var mods_to_include = ["glow.js", "circuitcore.js", "clone_liquid.js", "colored_lightbulbs.js", "combustion.js", "conveyance.js", "coresbyp.js", "datawire.js", "drill.js", "ExtraMachines.js", "fans.js", "fine_tuned_cloner.js", "flipflop.js", "fueled_generators.js", "gameOfLife.js", "heatshield.js", "human_friendly_design.js", "industry.js", "logicgates.js", "note_block_advanced.js", "note_block.js", "nousersthings.js", "portal.js", "pullers.js", "pushers.js", "sandboxels.js", "schematics.js", "scp.js", "spouts.js", "state_voids.js", "switches.js", "thiquovite.js", "ticking_temp_stuff.js", "video.js", "waterspout.js", "WhisperingTheory.js", "wifi_draw.js", "aircrafts.js", "c_fighter_jet.js", "guided_rocket.js", "icb.js", "life_eater.js", "liquid_void.js", "meat_rockets.js", "more_breaking.js", "rays.js", "rays++.js", "scp.js", "subspace.js", "war_crimes.js", "weapons.js", "aChefsDream_beta.js", "aChefsDream.js", "aChefsDream2.js", "bananas.js", "CherrySoda.js", "community_desserts.js", "devsnacks.js", "GrapeSoda.js", "greenitemsandmore.js", "ketchup_mod.js", "lemonade.js", "morefoodsmod.js", "mossstuff.js", "mustard.js", "potato_chips.js", "sbstuff.js", "soups.js", "weAllScreamFor.js", "apioforms_pre.js", "baby.js", "bacteria_mod.js", "bananas.js", "biology.js", "cat.js", "cells.js", "children.js", "coldblooded.js", "colonies.js", "crimson.js", "dogs.js", "eklegems.js", "fairy_chain.js", "fantastic_creatures.js", "fantasy_elements.js", "fey_and_more.js", "fishin.js", "flowers_and_forests.js", "fwibblen.js", "genetics.js", "human_edit.js", "kopalstuff.js", "lizard_mod.js", "lost_souls.js", "miscible_psoup_and_birthpool.js", "mobs.js", "moretrees.js", "no_blood.js", "nocancer.js", "nocancer2.js", "nograssgrow.js", "ocean.js", "ores.js", "petal_dye.js", "plants.js", "primordial_birthpool.js", "scp.js", "spring.js", "the_ground_og.js", "toothpaste.js", "volcanic_expansion.js", "alcohol.js","alkahest.js","alkali_metal.js","bettermetalscrap.js","boiling_things.js","bouncing_balls.js","chalk.js","chem.js","grav_mudstones.js","halogen.js","liquid_mixing.js","lye.js","metals.js","mixture.js","moreliquids.js", "PRNGworldgenlib.js"
]
var mods_included = mods_to_include.map(mod => enabledMods.includes(mod));
var all_mods_included = mods_included.reduce(function(a,b) { return a && b });
if(!all_mods_included) {
// var mods_needed = mods_to_include.filter(function(modPath) { return !(enabledMods.includes(modPath)) });
mods_needed.forEach(function(modName) {
// enabledMods.splice(enabledMods.indexOf("allthemods"),0,modPath);
dependOn(modPath, ()=>{}, true)
});
// localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
// alert(`The following mods have been inserted: ${mods_needed.join(", ")}
// Reload the page for the mods to take effect.`)
}

277
mods/background_music.js Normal file
View File

@ -0,0 +1,277 @@
/*
function loadJsDelivr(url, callback) {
const script = document.createElement('script');
script.src = url;
script.onload = () => {
console.log('Loaded:', url);
if (callback) callback();
};
script.onerror = () => {
console.error('Failed to load:', url);
};
document.head.appendChild(script);
}
*/
/**
* @type {undefined | HTMLAudioElement}
*/
let currentMusic;
const PLAY = "\u25B6";
const PAUSE = "\u23F8";
/**
*
* @param {string|File} userAudio
*/
function setBackgroundMusic(userAudio) {
let audioSrc;
if (typeof userAudio === "string") {
if (!isValidAudioUrl(userAudio)) {
promptText("Invalid audio URL");
return;
}
audioSrc = new URL(userAudio).href;
} else if (userAudio instanceof File) {
if (!userAudio.type.startsWith("audio/")) {
promptText("Invalid audio file");
return;
}
audioSrc = URL.createObjectURL(userAudio);
} else {
promptText("Invalid audio input");
return;
}
if (currentMusic && currentMusic.src === audioSrc) return;
if (currentMusic) {
currentMusic.pause();
currentMusic.remove();
}
const audio = document.createElement('audio');
audio.src = audioSrc;
audio.loop = true;
audio.volume = 0.5;
audio.id = "bgm";
document.body.appendChild(audio);
currentMusic = audio;
// Only save if it's a URL, not a local file
if (typeof userAudio === "string") {
settings.bgMusic = audioSrc;
saveSettings();
}
logMessage(`Now playing: ${audioSrc}`);
return audio;
}
function isValidAudioUrl(inpurl) {
try {
const url = new URL(inpurl);
if (!['http:', 'https:'].includes(url.protocol)) return false;
return /\.(mp3|wav|ogg)$/i.test(url.pathname);
} catch {
return false;
}
}
let music_setting;
let play;
let playing = false;
dependOn("betterSettings.js", () => {
// @ts-ignore
const settings_tab = new SettingsTab("background_music.js")
// @ts-ignore
music_setting = new Setting("Background Music", "bgm", settingType.TEXT, false)
// @ts-ignore
play = new Setting("Play", "play", settingType.BOOLEAN, false)
settings_tab.registerSettings(undefined, play)
settings_tab.registerSettings(undefined, music_setting)
// @ts-ignore
settingsManager.registerTab(settings_tab)
}, true)
keybinds["KeyK"] = () => {
if (playing) {
document.getElementById('pauseButton').click()
}
}
function addCss() {
const CSS = `
.songControl {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 10px;
flex-wrap: nowrap;
align-items: center;
justify-content: center;
padding: 10px;
height: 20px;
pointer-events: none;
background-color: transparent;
border: 2px solid white;
box-shadow: 0 0 8px rgba(0,0,0,0.8);
}
.pixelArt {
image-rendering: pixelated;
image-rendering: crisp-edges;
width: 15px;
height: auto;
}
`
const style_div = document.createElement("style")
style_div.innerHTML = CSS
document.head.appendChild(style_div)
}
function createPauseButton() {
const pauseImgLink = "https://raw.githubusercontent.com/Cube14yt/assets/main/images/pause.png"
const playImgLink = "https://raw.githubusercontent.com/Cube14yt/assets/main/images/play.png"
const pauseButton = document.createElement("button");
/**
* @this {HTMLButtonElement}
*/
pauseButton.onclick = function () {
if (playing) {
this.replaceChildren()
let img = document.createElement("img")
img.src = playImgLink
img.classList.add("pixelArt")
this.appendChild(img)
playing = !playing
currentMusic?.pause();
} else {
this.replaceChildren()
let img = document.createElement("img")
img.src = pauseImgLink
img.classList.add("pixelArt")
this.appendChild(img)
playing = !playing
const url = music_setting.value;
if (!currentMusic) {
setBackgroundMusic(url);
}
currentMusic?.play()
}
}
pauseButton.replaceChildren()
let img = document.createElement("img")
img.src = playImgLink
img.classList.add("pixelArt")
pauseButton.appendChild(img)
pauseButton.style.pointerEvents = 'auto'
pauseButton.style.border = '2px solid white'
pauseButton.id = 'pauseButton'
return pauseButton
}
function createResetButton() {
const resetButton = document.createElement("button");
/**
* @this {HTMLButtonElement}
*/
resetButton.onclick = function () {
if (currentMusic) currentMusic.currentTime = 0
}
let img = document.createElement("img")
img.src = "https://raw.githubusercontent.com/Cube14yt/assets/main/images/reset.png"
img.classList.add("pixelArt")
resetButton.appendChild(img)
resetButton.style.pointerEvents = "auto"
resetButton.style.border = '2px solid white'
resetButton.id = 'resetButton'
return resetButton
}
function createVolumeButton() {
const volumeButton = document.createElement("button");
/**
* @this {HTMLButtonElement}
*/
volumeButton.onclick = function () {
promptInput("Input the new volume of the current music", (vol) => {
if (!currentMusic) return;
let newVolume = Number(vol)
if (!(newVolume >= 0 && newVolume <= 1)) return
currentMusic.volume = newVolume
})
}
let img = document.createElement("img")
img.src = "https://raw.githubusercontent.com/Cube14yt/assets/main/images/volume.png"
img.classList.add("pixelArt")
volumeButton.appendChild(img)
volumeButton.style.pointerEvents = "auto"
volumeButton.style.border = '2px solid white'
volumeButton.id = "volumeButton"
return volumeButton
}
function createInputButton() {
const inputButton = document.createElement('button')
inputButton.onclick = function () {
promptChoose("How do you want to input your song?", ["URL", "File"], (choice) => {
if (choice === "URL") {
promptInput("Give the url your song should use", (url) => {
music_setting.value = url
}, "Input URL")
} else if (choice === "File") {
const input = document.createElement('input')
input.type = "file"
input.addEventListener('change', (event) => {
// @ts-ignore
const file = event.target.files[0];
if (file) setBackgroundMusic(file)
})
input.click()
}
})
}
inputButton.textContent = "Input Song"
inputButton.style.pointerEvents = "auto"
inputButton.style.border = '2px solid white'
inputButton.id = 'inputButton'
return inputButton
}
function showSongUi() {
let songDiv = document.getElementById("songUiParent");
const canvas_div = document.getElementById("canvasDiv");
if (!canvas_div) {
requestAnimationFrame(showSongUi)
return
};
if (!songDiv) {
songDiv = document.createElement("div");
songDiv.classList.add("songControl");
songDiv.id = "songUiParent";
songDiv.appendChild(createPauseButton())
songDiv.append(createResetButton())
songDiv.append(createVolumeButton())
songDiv.append(createInputButton())
canvas_div.appendChild(songDiv);
}
console.log("UI loaded sucessfully")
}
addCss()
showSongUi()

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
var modName = "mods/boiling_things.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) {
dependOn("code_library.js", function(){
//glass {
@ -533,8 +533,4 @@ if(enabledMods.includes(libraryMod)) {
};
});
} else {
alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`)
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
};
}, true);

View File

@ -32,7 +32,7 @@ elements.change = {
tool: function(pixel) {
changePixel(pixel,changeTo,true);
},
category: "tools",
category: "edit",
desc: "Changes any pixels it is used on to a specified type.<br/>Currently replacing pixels with \"" + changeTo + "\".<br/><span onclick=changeElementPrompt() style=\"color: #ff00ff;\";>Press [;] or click here</span> to open the change prompt.",
};
@ -41,7 +41,7 @@ elements.alt_change = {
tool: function(pixel) {
pixel.element = changeTo;
},
category: "tools",
category: "edit",
desc: "Changes any pixels it is used on to a specified type, but keeping their non-element-based properties.<br/>Currently replacing pixels with \"" + changeTo + "\".<br/><span onclick=changeElementPrompt() style=\"color: #ff00ff;\";>Press [;] or click here</span> to open the change prompt.",
hidden: true,
};
@ -52,7 +52,7 @@ elements.alt_alt_change = {
pixel.element = changeTo;
pixel.color = pixelColorPick(pixel);
},
category: "tools",
category: "edit",
desc: "Changes any pixels it is used on to a specified type, but keeping their non-element-based properties except for color.<br/>Currently replacing pixels with \"" + changeTo + "\".<br/><span onclick=changeElementPrompt() style=\"color: #ff00ff;\";>Press [;] or click here</span> to open the change prompt.",
hidden: true,
};

View File

@ -1,3 +1,6 @@
// This mod has been deprecated as of 2026-01-22.
/*
function reactPixels(pixel1,pixel2) {
var r = elements[pixel1.element].reactions[pixel2.element];
if (r.setting && settings[r.setting]===0) {
@ -71,3 +74,4 @@ function reactPixels(pixel1,pixel2) {
if (r.func) { r.func(pixel1,pixel2); }
return r.elem1!==undefined || r.elem2!==undefined;
}
*/

14968
mods/chem.js

File diff suppressed because it is too large Load Diff

7877
mods/chemLegacy.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1435,7 +1435,7 @@ runAfterLoadList.push(() => {
if (!localStorage.getItem("chessjs-tutorial")) {
// "might break"
// i know damn well it will 100% break on mobile
alert("To start or restart chess board press 'u'. Might break on different resolutions and on mobile.");
promptText("To start or restart chess board press 'u'. Might break on different resolutions and on mobile.");
localStorage.setItem("chessjs-tutorial", true);
}
})

View File

@ -1,7 +1,7 @@
var modName = "mods/colonies.js";
var exoplanetMod = "mods/exoplanet.js";
// var exoplanetMod = "mods/exoplanet.js";
if(enabledMods.includes(exoplanetMod)) {
dependOn("exoplanet.js", function(){
window.addEventListener("load", () => {
document.getElementById("elementButton-base")?.remove()
@ -567,8 +567,4 @@ elements.arriving_rocket = {
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).`)
};
}, true);

View File

@ -1,7 +1,7 @@
var modName = "mods/color_tools.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) {
dependOn("code_library.js", function(){
var colorToolCounter = 0;
saturationAmount = 1;
saturationOp = "add";
@ -290,8 +290,4 @@ if(enabledMods.includes(libraryMod)) {
excludeRandom: true,
desc: "<span style='color:#FF00FF' onClick=colorToolFilterPrompt()>Click here to configure the element filter (applies to all color tools).</span>",
}
} else {
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod)
alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
};
}, true);

View File

@ -12,6 +12,6 @@ elements.delete_all_of_element = {
}
}
},
category: "tools",
category: "edit",
excludeRandom: true,
};

View File

@ -1,54 +1,55 @@
//console.log("doElectricity should be changed");
function doElectricity(pixel) {
if(isNaN(pixel.charge)) {
pixel.charge = 0;
};
if (pixel.charge) {
// Check each adjacent pixel, if that pixel's charge is false, set it to the same charge
for (var i = 0; i < adjacentCoords.length; i++) {
var x = pixel.x+adjacentCoords[i][0];
var y = pixel.y+adjacentCoords[i][1];
if (!isEmpty(x,y,true)) {
var newPixel = pixelMap[x][y];
var con = elements[newPixel.element].conduct;
if (con == undefined) {continue}
if (elements[pixel.element].noConduct?.length && elements[pixel.element].noConduct.includes(newPixel.element)) {continue};
if (Math.random() < con) { // If random number is less than conductivity
if (!newPixel.charge && !newPixel.chargeCD) {
newPixel.charge = isNaN(pixel.charge) ? 0 : pixel.charge; //Actually set it to the same charge
if (elements[newPixel.element].colorOn) {
newPixel.color = pixelColorPick(newPixel);
}
if(elements[newPixel.element].onCharge) {
pixel.charge ??= 0;
if(isNaN(pixel.charge)) { pixel.charge = 0 };
elements[newPixel.element].onCharge(pixel);
};
}
}
else if (elements[newPixel.element].insulate != true && !elements[newPixel.element].noResistance) { // Otherwise heat the pixel (Resistance simulation)
newPixel.temp += isNaN(pixel.charge) ? 0.25 : pixel.charge/4;
pixelTempCheck(newPixel);
}
}
}
pixel.charge -= 0.25;
if (pixel.charge <= 0) {
delete pixel.charge;
//console.log(elements[pixel.element].chargeCD);
var chargeCd = elements[pixel.element].chargeCD ?? 4;
pixel.chargeCD = chargeCd; //Customizable chargeCD
}
}
// Lower charge cooldown
else if (pixel.chargeCD) {
pixel.chargeCD -= 1;
if (pixel.chargeCD <= 0) {
delete pixel.chargeCD;
if (elements[pixel.element].colorOn) {
pixel.color = pixelColorPick(pixel);
}
}
}
}
// [DEPRECATED - BREAKS GAME as of 2026-01]
// function doElectricity(pixel) {
// if(isNaN(pixel.charge)) {
// pixel.charge = 0;
// };
// if (pixel.charge) {
// // Check each adjacent pixel, if that pixel's charge is false, set it to the same charge
// for (var i = 0; i < adjacentCoords.length; i++) {
// var x = pixel.x+adjacentCoords[i][0];
// var y = pixel.y+adjacentCoords[i][1];
// if (!isEmpty(x,y,true)) {
// var newPixel = pixelMap[x][y];
// var con = elements[newPixel.element].conduct;
// if (con == undefined) {continue}
// if (elements[pixel.element].noConduct?.length && elements[pixel.element].noConduct.includes(newPixel.element)) {continue};
// if (Math.random() < con) { // If random number is less than conductivity
// if (!newPixel.charge && !newPixel.chargeCD) {
// newPixel.charge = isNaN(pixel.charge) ? 0 : pixel.charge; //Actually set it to the same charge
// if (elements[newPixel.element].colorOn) {
// newPixel.color = pixelColorPick(newPixel);
// }
// if(elements[newPixel.element].onCharge) {
// pixel.charge ??= 0;
// if(isNaN(pixel.charge)) { pixel.charge = 0 };
// elements[newPixel.element].onCharge(pixel);
// };
// }
// }
// else if (elements[newPixel.element].insulate != true && !elements[newPixel.element].noResistance) { // Otherwise heat the pixel (Resistance simulation)
// newPixel.temp += isNaN(pixel.charge) ? 0.25 : pixel.charge/4;
// pixelTempCheck(newPixel);
// }
// }
// }
// pixel.charge -= 0.25;
// if (pixel.charge <= 0) {
// delete pixel.charge;
// //console.log(elements[pixel.element].chargeCD);
// var chargeCd = elements[pixel.element].chargeCD ?? 4;
// pixel.chargeCD = chargeCd; //Customizable chargeCD
// }
// }
// // Lower charge cooldown
// else if (pixel.chargeCD) {
// pixel.chargeCD -= 1;
// if (pixel.chargeCD <= 0) {
// delete pixel.chargeCD;
// if (elements[pixel.element].colorOn) {
// pixel.color = pixelColorPick(pixel);
// }
// }
// }
// }

View File

@ -65,19 +65,19 @@
// info element
elements.drills_info = {
color: "#000000",
name: "drills.js",
category: "Mods",
behavior: behaviors.SELFDELETE,
maxSize: 1,
tool: function(pixel) {},
onSelect: function(pixel) {
let mod_info = "The drills.js mod adds different kinds of drills to a new 'drills' category.\n\nMod made by: Necrotic_Phantom. \n With help from: voidapex11."
alert(mod_info)
return
},
};
// elements.drills_info = {
// color: "#000000",
// name: "drills.js",
// category: "Mods",
// behavior: behaviors.SELFDELETE,
// maxSize: 1,
// tool: function(pixel) {},
// onSelect: function(pixel) {
// let mod_info = "The drills.js mod adds different kinds of drills to a new 'drills' category.\n\nMod made by: Necrotic_Phantom. \n With help from: voidapex11."
// alert(mod_info)
// return
// },
// };

34
mods/dry_acid.js Normal file
View File

@ -0,0 +1,34 @@
elements.dry_acid = {
name:"Anhydrous acid",
desc:"It's pretty much just acid without water in it.",
color: ["#62e36f", "#a5d9aa", "#b3c9b6"],
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
reactions: {
"water": { elem1:"dry_acid", elem2:"acid", temp2:37.22},
"dirty_water": { elem1:null, elem2:"acid", temp2:37.22}
},
density: 1.522
}
if (elements.acid) {
if (!elements.acid.ignore) {
elements.acid.ignore = [];
}
elements.acid.ignore.push('dry_acid');
}
// Ensure the reactions object exists for the element
if (!elements.acid.reactions) {
elements.acid.reactions = {};
}
// Add the new reaction
elements.acid.reactions["dirty_water"] = {
elem1: "acid", // What this element turns into
elem2: "acid", // What the other element turns into
}
delete elements.acid.reactions.water
delete elements.water.reactions.acid

View File

@ -1152,7 +1152,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod
burnTime: 600,
tempHigh: 200,
stateHigh: ["steam", "ash"],
onTryMoveInto: function(pixel,otherPixel) {
onMoveInto: function(pixel,otherPixel) {
var otherInfo = elements[otherPixel.element]
if(typeof(otherInfo.state) === "string" && otherInfo.state !== "gas") {
pixel.attached = false;

View File

@ -5,13 +5,13 @@ function tempToRGB(temp){
if (temp <= 6500){
return{
r: 255,
g: Math.max(-325.757*Math.pow(0.999581, temp)+272.879, 0),
b: Math.max(-571.403*Math.pow(0.999675, temp)+321.955, 0)
g: Math.trunc(Math.max(-325.757*Math.pow(0.999581, temp)+272.879, 0)),
b: Math.trunc(Math.max(-571.403*Math.pow(0.999675, temp)+321.955, 0))
}
} else {
return {
r: Math.max(604.879*Math.pow(0.999697, temp)+169.618, 0),
g: Math.max(719.488*Math.pow(0.999599, temp)+201.788, 0),
r: Math.trunc(Math.max(604.879*Math.pow(0.999697, temp)+169.618, 0)),
g: Math.trunc(Math.max(719.488*Math.pow(0.999599, temp)+201.788, 0)),
b: 255
}
}
@ -27,7 +27,7 @@ function oldtempToRgb(temp, pixel){
}
if (ctemp <= 0.5){
return{
r: (510*ctemp),
r: Math.trunc(510*ctemp),
g: 0,
b: 0,
opacity: (ctemp/1.3)
@ -35,8 +35,8 @@ function oldtempToRgb(temp, pixel){
} else {
return {
r: 255,
g: ((510*ctemp)-255),
b: ((280*ctemp)-140),
g: Math.trunc((510*ctemp)-255),
b: Math.trunc((280*ctemp)-140),
opacity: (ctemp/1.3)
}
}

View File

@ -2,7 +2,7 @@
// Author: Melecie
runAfterLoad(function() {
if (enabledMods.includes("mods/the_ground.js")) {
if (enabledModNames.includes("mods/the_ground_og.js")) {
let regexRocks = /(granite)|(rhyolite)|(pumice)|(obsidian)|(dacite)|(dacidian)|(andesite)|(diorite)|(scoria)|(andesidian)|(gabbro)|(basalt)|(basalidian)|(peridotite)|(komatiite)|(komatidian)/
let regexType = /(_gravel)|(_sand)|(_sandstone)|(_dust)|(_shard)|(hot_)/
let toHide = ["dry_permafrost", "hot_sand", "hot_dirt", "hot_rock", "hot_rock_wall", "hot_gravel", "hot_limestone", "hot_calcium_carbonate_dust", "sandy_water", "clay_water", "dry_clay_loam"]
@ -33,10 +33,10 @@ runAfterLoad(function() {
//elements.sandstone.color = "#dbbe80";
}
else {
enabledMods.splice(enabledMods.indexOf("mods/hidden_ground.js"), 1);
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert("Hidden Ground: This mod requires The Ground mod. Removing mod and reloading.");
window.location.reload();
}
// else {
// enabledMods.splice(enabledMods.indexOf("mods/hidden_ground.js"), 1);
// localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
// alert("Hidden Ground: This mod requires The Ground mod. Removing mod and reloading.");
// window.location.reload();
// }
})

File diff suppressed because it is too large Load Diff

50
mods/junction.js Normal file
View File

@ -0,0 +1,50 @@
// Junction.js
const connectedPairs = [
[[-1, 0], [1, 0]], // Horizontal
[[0, -1], [0, 1]] // Vertical
];
let isRisingEdge = (current, prev) => current === 2 && prev !== 2;
let isFallingEdge = (current, prev) => current !== 2 && prev === 2;
elements.junction = {
color: "#9db8b5",
category: "logic",
state: "solid",
behavior: behaviors.WALL,
tick: function (pixel) {
if (pixel.start === pixelTicks)
pixel.prevStateMap = {};
for (const pair of connectedPairs) {
let pixelA = pixelMap[pixel.x + pair[0][0]]?.[pixel.y + pair[0][1]];
let pixelB = pixelMap[pixel.x + pair[1][0]]?.[pixel.y + pair[1][1]];
if (!pixelA) continue;
if (!pixelB) continue;
if (pixelA.element !== "logic_wire") continue;
if (pixelB.element !== "logic_wire") continue;
let stateA = pixelA.lstate;
let stateB = pixelB.lstate;
let prevStateA = pixel.prevStateMap[[pixelA.x, pixelA.y]];
let prevStateB = pixel.prevStateMap[[pixelB.x, pixelB.y]];
// console.log("A:", stateA, "->", prevStateA);
// console.log("B:", stateB, "->", prevStateB);
// Set previous lstate to current lstate
pixel.prevStateMap[[pixelA.x, pixelA.y]] = pixelA.lstate;
pixel.prevStateMap[[pixelB.x, pixelB.y]] = pixelB.lstate;
// Rising edge
if (isRisingEdge(stateA, prevStateA)) pixelB.lstate = 2;
if (isRisingEdge(stateB, prevStateB)) pixelA.lstate = 2;
// Falling edge
if (isFallingEdge(stateA, prevStateA)) pixelB.lstate = -2;
if (isFallingEdge(stateB, prevStateB)) pixelA.lstate = -2;
}
}
};

View File

@ -1,11 +1,7 @@
var modName = "mods/life_eater.js";
var fireMod = "mods/fire_mod.js";
if(!enabledMods.includes(fireMod)) {
enabledMods.splice(enabledMods.indexOf(modName),0,fireMod);
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The ${fireMod} mod is required and has been automatically inserted (reload for this to take effect).`);
} else {
dependOn("fire_mod.js", function() {
var lifeEaterCategories = ["life","auto creepers","food","fantastic creatures","fey","auto_fey"];
var lifeEaterBlacklist = ["life_eater_virus","life_eater_slurry","life_eater_infected_dirt"];
@ -166,4 +162,4 @@ if(!enabledMods.includes(fireMod)) {
stateHigh: elements.metal_scrap.stateHigh.concat("life_eater_virus","life_eater_virus","life_eater_virus"),
};
}
}, true);

View File

@ -1,29 +1,27 @@
function whenAvailable(names, callback) {
var interval = 10; // ms
window.setTimeout(function() {
let bool = true;
for(let i = 0; i < names.length; i++)
{
if(!window[names[i]])
{
bool = false;
}
}
if (bool) {
callback();
} else {
whenAvailable(names, callback);
}
}, interval);
}
// function whenAvailable(names, callback) {
// var interval = 10; // ms
// window.setTimeout(function() {
// let bool = true;
// for(let i = 0; i < names.length; i++)
// {
// if(!window[names[i]])
// {
// bool = false;
// }
// }
// if (bool) {
// callback();
// } else {
// whenAvailable(names, callback);
// }
// }, interval);
// }
var modName = "mods/metals.js";
var changeTempMod = "mods/changeTempReactionParameter.js";
var runAfterAutogenMod = "mods/runAfterAutogen2.js";
// var changeTempMod = "mods/changeTempReactionParameter.js";
// var runAfterAutogenMod = "mods/runAfterAutogen2.js";
var libraryMod = "mods/code_library.js";
var onTryMoveIntoMod = "mods/onTryMoveInto.js";
if(enabledMods.includes(changeTempMod) && enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod) && enabledMods.includes(onTryMoveIntoMod)) {
whenAvailable(["runAfterAutogen"], function() {
dependOn("code_library.js", function(){
elements.iron.hardness = 0.74
//https://www.engineeringtoolbox.com/bhn-brinell-hardness-number-d_1365.html
//https://en.wikipedia.org/wiki/Hardnesses_of_the_elements_(data_page)
@ -483,7 +481,7 @@ if(enabledMods.includes(changeTempMod) && enabledMods.includes(runAfterAutogenMo
properties: {
oldColor: null,
},
onTryMoveInto: function(pixel,otherPixel) {
onMoveInto: function(pixel,otherPixel) {
neutronAbsorbency(pixel,otherPixel);
},
tick: function(pixel) {
@ -500,7 +498,7 @@ if(enabledMods.includes(changeTempMod) && enabledMods.includes(runAfterAutogenMo
density: 5803,
tempHigh: 4409,
behavior: behaviors.MOLTEN,
onTryMoveInto: function(pixel,otherPixel) {
onMoveInto: function(pixel,otherPixel) {
neutronAbsorbency(pixel,otherPixel);
},
tick: function(pixel) {
@ -512,7 +510,7 @@ if(enabledMods.includes(changeTempMod) && enabledMods.includes(runAfterAutogenMo
elements.zirconium_gas = {
density: 3, //Unknown/Unmeasured value
behavior: behaviors.GAS,
onTryMoveInto: function(pixel,otherPixel) {
onMoveInto: function(pixel,otherPixel) {
neutronAbsorbency(pixel,otherPixel);
},
tick: function(pixel) {
@ -781,11 +779,4 @@ if(enabledMods.includes(changeTempMod) && enabledMods.includes(runAfterAutogenMo
conduct: 0.35,
hardness: 0.7, //idk lol
};
});
} else {
if(!enabledMods.includes(changeTempMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,changeTempMod) };
if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) };
if(!enabledMods.includes(onTryMoveIntoMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,onTryMoveIntoMod) };
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The "${changeTempMod}", "${runAfterAutogenMod}" and "${onTryMoveIntoMod}" mods are required; any missing mods in this list have been automatically inserted (reload for this to take effect).`);
};
},true)

360
mods/mixtureIII.js Normal file
View File

@ -0,0 +1,360 @@
function getName(elementList)
{
if(elementList.filter(function(item, pos, self) {
return self.indexOf(item) == pos;
}).length == 1)
{
return elementList[0];
}
let name = elementList.join("_") + "_mixture";
if(nameList[name])
{
name = nameList[name];
};
return name;
}
function makeColors(elementList)
{
return elementList.map((c) => elements[c].color instanceof Array ? elements[c].color : [elements[c].color]);
}
function mixture(elementList)
{
elementList.sort();
let name = getName(elementList);
if(!elements[name])
{
elements[name] = true;
let minTempHigh = Infinity;
let stateHigh = null;
let indexStateHigh = -1;
let maxTempLow = -Infinity;
let stateLow = null;
let indexStateLow = -1;
for(let i = 0; i < elementList.length; i++)
{
if(elements[elementList[i]])
{
if(typeof elements[elementList[i]].tempHigh === "number" && elements[elementList[i]].stateHigh)
{
if(elements[elementList[i]].tempHigh < minTempHigh)
{
minTempHigh = elements[elementList[i]].tempHigh;
indexStateHigh = i;
stateHigh = elements[elementList[i]].stateHigh;
}
}
if(typeof elements[elementList[i]].tempLow === "number" && elements[elementList[i]].stateLow)
{
if(elements[elementList[i]].tempLow > maxTempLow)
{
maxTempLow = elements[elementList[i]].tempLow;
indexStateLow = i;
stateLow = elements[elementList[i]].stateLow;
}
}
}
}
let elementList2 = elementList.slice();
let elementHigh = null;
if(indexStateHigh >= 0)
{
if(stateHigh instanceof Array)
{
elementHigh = [];
for(let i = 0; i < stateHigh.length; i++)
{
elementList2[indexStateHigh] = stateHigh[i];
elementHigh.push(mixture(elementList2));
}
}
else
{
elementList2[indexStateHigh] = stateHigh;
elementHigh = mixture(elementList2);
}
}
let elementList3 = elementList.slice();
let elementLow = null;
if(indexStateLow >= 0)
{
if(stateLow instanceof Array)
{
elementLow = [];
for(let i = 0; i < stateLow.length; i++)
{
elementList3[indexStateLow] = stateLow[i];
elementLow.push(mixture(elementList3));
}
}
else
{
elementList3[indexStateLow] = stateLow;
elementLow = mixture(elementList3);
}
}
if(elementHigh instanceof Array && elementHigh.length === 0)
{
minTempHigh = Infinity;
elementHigh = null;
}
if(elementLow instanceof Array && elementLow.length === 0)
{
maxTempLow = -Infinity;
elementLow = null;
}
let colors = makeColors(elementList.slice());
let colors2 = [];
let maxLength = Math.max(...(colors.map((c) => c.length)));
for(let i = 0; i < maxLength; i++)
{
let colors3 = [];
for(let j = 0; j < colors.length; j++)
{
colors3.push(toObject(colors[j][i%colors[j].length]));
}
colors2.push(averageRGB(colors3));
}
let temp = airTemp;
if(maxTempLow < airTemp && minTempHigh > airTemp)
{
}
else if(maxTempLow > -Infinity && minTempHigh < Infinity)
{
temp = (maxTempLow + minTempHigh)/2;
}
else if(maxTempLow > -Infinity)
{
temp = maxTempLow+20;
}
else if(minTempHigh < Infinity)
{
temp = Math.max(minTempHigh-20,absoluteZero);
}
let movable = elementList.some((c) => elements[c].movable || elements[c].movable === undefined);
let density = elementList.map((c) => elements[c].density ? elements[c].density : 0).reduce((a,b)=>a+b)/elementList.length;
let stain = elementList.map((c) => elements[c].stain ? elements[c].stain : 0).reduce((a,b)=>a+b)/elementList.length;
let states = elementList.map((c) => elements[c].state);
if(states.includes("gas"))
{
state = "gas";
density = 0;
}
else if(!movable)
{
state = "solid";
}
else if(states.includes("liquid"))
{
state = "liquid";
}
else
{
state = "solid";
}
addElement(name, {
color: colors2.length == 1 ? colors2[0] : colors2,
colorObject: colors2.length == 1 ? toObject(colors2[0]) :colors2.map((c) => toObject(c)),
tick: function(pixel) {
mixtureBehavior(pixel, elementList);
},
tempHigh: minTempHigh,
stateHigh: elementHigh,
tempLow: maxTempLow,
stateLow: elementLow,
temp: temp,
category: "mixture",
mixture: elementList,
movable: movable,
density: density,
state: state,
stain: stain,
reactions: {},
isGas: state === "gas"
});
for(let i in elements)
{
for(let j = 0; j < elementList.length; j++)
{
if(elements[i].reactions && elements[i].reactions[elementList[j]] !== undefined)
{
if(name === i)
{
continue;
}
elements[i].reactions[name] = {elem2: name, func: function(a,b){mixtureReact(b,a,elementList)}}
}
if(elements[elementList[j]].reactions && elements[elementList[j]].reactions[i] !== undefined)
{
if(name === i)
{
continue;
}
elements[name].reactions[i] = {elem2: i, func: function(a,b){mixtureReact(a,b,elementList)}}
}
}
}
}
return name;
}
function mixtureBehavior(pixel, elementList)
{
let prevCol = pixel.color;
let previous = pixel.element;
let elem = elementList[Math.floor(Math.random()*elementList.length)];
if (elements[elem].tick) { // Run tick function if it exists
elements[elem].tick(pixel);
}
if (pixel.del) {return}
if (elements[elem].behavior) { // Parse behavior if it exists
pixelTick(pixel,elements[elem].behavior);
}
if(pixel.element === previous)
{
pixel.color = prevCol;
}
}
function mixtureReact(pixel, pixel2, elementList)
{
elementList = elementList.slice();
shuffleArray(elementList);
let previous = pixel.element;
let prevCol = pixel.color;
let previous2 = pixel2.element;
let prevCol2 = pixel2.color;
for(let i = 0; i < elementList.length; i++)
{
let elem = elementList[i];
if(pixel.del)
{
return;
}
changePixel(pixel,elem, false);
let rr1 = false;
if (elements[elem].reactions !== undefined && elements[elem].reactions[pixel2.element] !== undefined) {
rr1 = reactPixels(pixel,pixel2);
}
if (!rr1 && elements[pixel2.element].reactions !== undefined && elements[pixel2.element].reactions[elem] !== undefined && !elements[pixel2.element].reactions[elem].oneway) {
reactPixels(pixel2,pixel);
}
if(pixel2.element === previous2)
{
pixel2.color = prevCol2;
}
if(!pixel.del && pixel.element === elem)
{
}
else if(pixel.del)
{
elementList.splice(elementList.indexOf(elem),1);
createPixel(mixture(elementList),pixel.x,pixel.y);
currentPixels[currentPixels.length-1].temp = pixel.temp;
return;
}
else
{
elementList.splice(elementList.indexOf(elem),1)
changePixel(pixel, mixture(elementList.concat([pixel.element])), false);
return;
}
if(pixel2.del)
{
return;
}
}
changePixel(pixel, previous, false);
pixel.color = prevCol;
}
nameList = [];
function toObject(color)
{
color = color.match(/\d+/g);
return {
r: parseInt(color[0]),
g: parseInt(color[1]),
b: parseInt(color[2])
};
}
function averageRGB2(colors)
{
return toObject(averageRGB(colors.map((d) => (toObject(d)))));
}
function averageRGB(rgblist) {
var r = 0;
var g = 0;
var b = 0;
for (var i = 0; i < rgblist.length; i++) {
var rgb = rgblist[i];
r += parseInt(rgb.r);
g += parseInt(rgb.g);
b += parseInt(rgb.b);
}
r = Math.floor(r/rgblist.length);
g = Math.floor(g/rgblist.length);
b = Math.floor(b/rgblist.length);
return "rgb("+r+","+g+","+b+")";
}
function blendColors(colorA, colorB, amount = 0.5) {
const [rA, gA, bA] = colorA.match(/\w\w/g).map((c) => parseInt(c, 16));
const [rB, gB, bB] = colorB.match(/\w\w/g).map((c) => parseInt(c, 16));
const r = Math.round(rA + (rB - rA) * amount).toString(16).padStart(2, '0');
const g = Math.round(gA + (gB - gA) * amount).toString(16).padStart(2, '0');
const b = Math.round(bA + (bB - bA) * amount).toString(16).padStart(2, '0');
return '#' + r + g + b;
}
elements.mixer2 = {
color: "#999999",
ignore: ["mixer2"],
category:"machines",
insulate:true,
hardness: 1,
tick: function(pixel) {
if (!isEmpty(pixel.x-1,pixel.y,true) && !isEmpty(pixel.x+1,pixel.y,true) && isEmpty(pixel.x,pixel.y+1,false))
{
if(elements.mixer2.ignore.includes(pixelMap[pixel.x-1][pixel.y].element) || elements.mixer2.ignore.includes(pixelMap[pixel.x+1][pixel.y].element))
{
return;
}
else
{
createPixel(mixture([pixelMap[pixel.x-1][pixel.y].element,pixelMap[pixel.x+1][pixel.y].element]),pixel.x,pixel.y+1);
deletePixel(pixel.x-1,pixel.y);
deletePixel(pixel.x+1,pixel.y);
}
}
doDefaults(pixel);
},
maxSize: 1
};

View File

@ -1,27 +1,8 @@
function whenAvailable(names, callback) {
var interval = 10; // ms
window.setTimeout(function() {
let bool = true;
for(let i = 0; i < names.length; i++)
{
if(!window[names[i]])
{
bool = false;
}
}
if (bool) {
callback();
} else {
whenAvailable(names, callback);
}
}, interval);
}
var modName = "mods/neutronium_compressor.js";
var runAfterAutogenMod = "mods/runAfterAutogen2.js";
var libraryMod = "mods/code_library.js";
// var runAfterAutogenMod = "mods/runAfterAutogen2.js";
// var libraryMod = "mods/code_library.js";
if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) {
whenAvailable(["urlParams","runAfterAutogen"], function() {
dependOn("code_library.js", function(){
var singularityColorTemplate = ["#202020", "#505050", "#b0b0b0", "#c7c7c7"];
singularityNumber = 10000;
@ -406,11 +387,5 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
};
//Post-generation tasks
});
} else {
if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) };
if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) };
alert(`The "${runAfterAutogenMod}" and "${libraryMod}" mods are required; any missing mods in this list have been automatically inserted (reload for this to take effect).`)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
};
}, true);

View File

@ -1,4 +1,4 @@
elements.grass.tick = null;
delete elements.grass.tick;
elements.grass.behavior = [
["XX", "XX", "XX"],
["XX", "XX", "XX"],

View File

@ -3,7 +3,7 @@ removeMod("pizzasstuff.js");
reload(); */
alert("THIS MOD IS NO LONGER SUPPORTED!\nThe mod 'pizzasstuff.s' and all of its contents have been moved to mossstuff.js.\nPlease install mossstuff.js to continue getting updates.");
// alert("THIS MOD IS NO LONGER SUPPORTED!\nThe mod 'pizzasstuff.s' and all of its contents have been moved to mossstuff.js.\nPlease install mossstuff.js to continue getting updates.");
elements.freeze_ray = {

View File

@ -1,8 +1,8 @@
var modName = "mods/portal.js";
var onTryMoveIntoMod = "mods/onTryMoveInto.js";
// var onTryMoveIntoMod = "mods/onTryMoveInto.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(onTryMoveIntoMod) && enabledMods.includes(libraryMod)) {
dependOn("code_library.js", function(){
//https://stackoverflow.com/a/60922255
if(!enabledMods.includes("mods/mobs.js")) {
headBodyObject = {
@ -17,7 +17,7 @@ if(enabledMods.includes(onTryMoveIntoMod) && enabledMods.includes(libraryMod)) {
_correspondingPortals: null,
},
insulate: true,
onTryMoveInto: function(pixel,otherPixel) {
onMoveInto: function(pixel,otherPixel) {
if(pixel._correspondingPortals == null) {
return;
};
@ -112,9 +112,8 @@ if(enabledMods.includes(onTryMoveIntoMod) && enabledMods.includes(libraryMod)) {
state: "solid",
insulate: true,
}
} else {
if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) };
if(!enabledMods.includes(onTryMoveIntoMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,onTryMoveIntoMod) };
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The "${libraryMod}" and "${onTryMoveIntoMod}" mods are all required; any missing mods in this list have been automatically inserted (reload for this to take effect).`)
};
}, true);
// if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) };
// if(!enabledMods.includes(onTryMoveIntoMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,onTryMoveIntoMod) };
// localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
// alert(`The "${libraryMod}" and "${onTryMoveIntoMod}" mods are all required; any missing mods in this list have been automatically inserted (reload for this to take effect).`)

View File

@ -3,7 +3,7 @@ var variablesMod = "mods/prop and prompt variables.js";
var promptInputNullishes = ["null","none","","n/a"];
var eightSpaces = " ".repeat(8);
if(enabledMods.includes(variablesMod)) {
dependOn("prop and prompt variables.js", function(){
commandHelpObject = {
"set": "Sets properties for every pixel of a given type.\nUsage: set [property] [element] [value] <type>\nDon't include framing characters []<>.\nThe element can be \"all\" to set the property for every pixel.\nNote: Strings can't have spaces because spaces are the separator used in the parsing split().\nArguments in [brackets] are required and ones in <angle brackets> are optional.",
@ -1208,8 +1208,4 @@ Make sure to save your command in a file if you want to add this preset again.`
desc: "<span style='color:#FF00FF;' onClick=funniPrompt()>Click here or press Shift+1 to open the command prompt.</span>",
category:"special",
};
} else {
alert(`The ${variablesMod} mod is required and has been automatically inserted (reload for this to take effect).`)
enabledMods.splice(enabledMods.indexOf(modName),0,variablesMod)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
};
}, true);

View File

@ -1,7 +1,7 @@
var modName = "mods/prop.js";
var variablesMod = "mods/prop and prompt variables.js";
if(enabledMods.includes(variablesMod)) {
dependOn("prop and prompt variables.js", function(){
propProperty = "element";
propValue = "sand";
propType = "string";
@ -212,7 +212,7 @@ if(enabledMods.includes(variablesMod)) {
};
pixelTempCheck(pixel);
},
category: "tools",
category: "edit",
desc: `Sets properties of pixels.<br/>Currently setting ${propProperty} to ${propValue} (${propType}).<br/><span onclick=propPrompt() style=\"color: #ff00ff;\";>Press [,] or click here</span> to open the property tool prompt.`,
};
@ -452,15 +452,11 @@ if(enabledMods.includes(variablesMod)) {
pixelTempCheck(pixel);
};
},
category: "tools",
category: "edit",
desc: `Changes properties of pixels.<br/>Currently ${numberAdjusterVerb} ${numberAdjusterValue} ${numberAdjusterPreposition} ${numberAdjusterProperty}.<br/><span onclick=numberAdjusterPrompt() style=\"color: #ff00ff;\";>Press [Shift+,] or click here</span> to open the adjuster tool prompt.`,
};
function updateNumberAdjusterDescription() {
elements.number_adjuster.desc = numberAdjusterReverseOrder ? `Changes numeric properties of pixels.<br/>Currently ${numberAdjusterVerb} ${numberAdjusterProperty} ${numberAdjusterPreposition} ${numberAdjusterValue}.<br/><span onclick=numberAdjusterPrompt() style=\"color: #ff00ff;\";>Press [Shift+,] or click here</span> to open the adjuster tool prompt.` : `Changes numeric properties of pixels.<br/>Currently ${numberAdjusterVerb} ${numberAdjusterValue} ${numberAdjusterPreposition} ${numberAdjusterProperty}.<br/><span onclick=numberAdjusterPrompt() style=\"color: #ff00ff;\";>Press [Shift+,] or click here</span> to open the adjuster tool prompt.`;
};
} else {
alert(`The ${variablesMod} mod is required and has been automatically inserted (reload for this to take effect).`)
enabledMods.splice(enabledMods.indexOf(modName),0,variablesMod)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
};
}, true);

View File

@ -48,18 +48,18 @@ behaviors.SELFDELETE = [
pullerColour = '#e0adb6'
elements.pullersDesc = {
color: pullerColour,
name: 'pullers.js',
category: "Mods",
behavior: behaviors.SELFDELETE,
tool: function(pixel) {},
onSelect: function(pixel) {
let info1stMod = `pullers.js is a mod made by voidapex11 that adds pullers to sandboxels`
alert(info1stMod)
return
},
};
// elements.pullersDesc = {
// color: pullerColour,
// name: 'pullers.js',
// category: "Mods",
// behavior: behaviors.SELFDELETE,
// tool: function(pixel) {},
// onSelect: function(pixel) {
// let info1stMod = `pullers.js is a mod made by voidapex11 that adds pullers to sandboxels`
// alert(info1stMod)
// return
// },
// };
// for the inator reference: if you know you know
elements.immovable_inator = {

View File

@ -1,7 +1,7 @@
var modName = "mods/random_liquids.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) {
dependOn("code_library.js", function(){
if(urlParams.get('liquidAmount') != null) { //null check
liquidAmount = urlParams.get('liquidAmount')
if(isNaN(liquidAmount) || liquidAmount === "" || liquidAmount === null) { //NaN check
@ -213,8 +213,4 @@ if(enabledMods.includes(libraryMod)) {
if(makeLiquidString == true) {
console.log(`Liquids added to liquidString (length ${liquidString.length})`)
}
} else {
alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`)
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
};
}, true);

View File

@ -1,7 +1,7 @@
var modName = "mods/random_rocks.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) {
dependOn("code_library.js", function(){
if(urlParams.get('rockAmount') != null) { //null check
rockAmount = urlParams.get('rockAmount')
if(isNaN(rockAmount) || rockAmount === "" || rockAmount === null) { //NaN check
@ -157,8 +157,4 @@ if(enabledMods.includes(libraryMod)) {
if(makeRockString == true) {
console.log(`Rocks added to rockString (length ${rockString.length})`)
}
} else {
alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`)
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
};
}, true);

View File

@ -1,7 +1,7 @@
var modName = "mods/randomness.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) {
dependOn("code_library.js", function(){
//i made some stupid things
//TPT reference
@ -723,8 +723,4 @@ if(enabledMods.includes(libraryMod)) {
}
}
});
} else {
if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) };
alert(`The "${libraryMod}" mod is required and has been automatically inserted (reload for this to take effect).`)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
};
}, true);

View File

@ -1,28 +1,27 @@
function whenAvailable(names, callback) {
var interval = 10; // ms
window.setTimeout(function() {
let bool = true;
for(let i = 0; i < names.length; i++)
{
if(!window[names[i]])
{
bool = false;
}
}
if (bool) {
callback();
} else {
whenAvailable(names, callback);
}
}, interval);
}
// function whenAvailable(names, callback) {
// var interval = 10; // ms
// window.setTimeout(function() {
// let bool = true;
// for(let i = 0; i < names.length; i++)
// {
// if(!window[names[i]])
// {
// bool = false;
// }
// }
// if (bool) {
// callback();
// } else {
// whenAvailable(names, callback);
// }
// }, interval);
// }
var modName = "mods/rays.js";
var runAfterAutogenMod = "mods/runAfterAutogen2.js";
var libraryMod = "mods/code_library.js";
// var runAfterAutogenMod = "mods/runAfterAutogen2.js";
// var libraryMod = "mods/code_library.js";
if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) {
whenAvailable(["raaLoaded","libraryLoaded"], function() {
dependOn("code_library.js", function(){
runAfterAutogen(function() {
snowAndIceCache = Object.keys(elements).filter(function(name) {
return name.endsWith("snow") || name.endsWith("ice") || name == "rime"
@ -455,10 +454,4 @@ whenAvailable(["raaLoaded","libraryLoaded"], function() {
}
}
};
});
} else {
if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) };
if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) };
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The "${runAfterAutogenMod}" and "${libraryMod}" mods are required and have been automatically inserted (reload for this to take effect).`);
};
},true);

View File

@ -49,7 +49,7 @@ elements.replace = {
changePixel(pixel,replaceTo,true);
};
},
category: "tools",
category: "edit",
desc: "Changes pixels of a specified type to another specified type.<br/>Currently replacing \"" + replaceFrom + "\" with \"" + replaceTo + "\".<br/><span onclick=replaceElementPrompt() style=\"color: #ff00ff;\";>Press [\"] or click here</span> to open the replace prompt.",
};
@ -60,7 +60,7 @@ elements.alt_replace = {
pixel.element = replaceTo;
};
},
category: "tools",
category: "edit",
desc: "Changes pixels of a specified type to another specified type, but keeping their non-element-based properties.<br/>Currently replacing \"" + replaceFrom + "\" with \"" + replaceTo + "\".<br/><span onclick=replaceElementPrompt() style=\"color: #ff00ff;\";>Press [\"] or click here</span> to open the replace prompt.",
hidden: true,
};
@ -73,7 +73,7 @@ elements.alt_alt_replace = {
pixel.color = pixelColorPick(pixel);
};
},
category: "tools",
category: "edit",
desc: "Changes pixels of a specified type to another specified type, but keeping their non-element-based properties except for color.<br/>Currently replacing \"" + replaceFrom + "\" with \"" + replaceTo + "\".<br/><span onclick=replaceElementPrompt() style=\"color: #ff00ff;\";>Press [\"] or click here</span> to open the replace prompt.",
hidden: true,
};

View File

@ -1,7 +1,7 @@
var modName = "mods/roseyiede.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) {
dependOn("code_library.js", function(){
/*
//arbitrarily picked
binitialArrayL = ["m","n","p","t","ch","k","b","d","j","g","f","th","s","sh","h","l","r","y","w","z"] //:eggTF:
@ -356,8 +356,4 @@ if(enabledMods.includes(libraryMod)) {
density: 956,
temp: 120,
}
} else {
alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`)
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
};
}, true);

View File

@ -1,74 +1,71 @@
var modName = "mods/random_rocks.js";
var onTryMoveIntoMod = "mods/onTryMoveInto.js";
var libraryMod = "mods/code_library.js";
// var onTryMoveIntoMod = "mods/onTryMoveInto.js";
// var libraryMod = "mods/code_library.js";
if(enabledMods.includes(onTryMoveIntoMod) && enabledMods.includes(libraryMod)) {
elements.solid_rock = {
color: ["#808080","#4f4f4f","#949494"],
behavior: behaviors.WALL,
reactions: {
"water": {elem1: "wet_sand", chance: 0.00035},
"salt_water": {elem1: "wet_sand", chance: 0.0005},
"sugar_water": {elem1: "wet_sand", chance: 0.0004},
"seltzer": {elem1: "wet_sand", chance: 0.0004},
"dirty_water": {elem1: "wet_sand", chance: 0.0004},
"soda": {elem1: "wet_sand", chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"grape": {elem2: "juice", chance: 0.1, color2: "#291824"},
"root": {elem1: "sand", chance: 0.0004},
"wheat": {elem2: "flour"},
"primordial_soup": {elem1: "wet_sand", chance: 0.001}
},
onTryMoveInto: function(pixel,otherPixel) {
if(elements[otherPixel.element].category === "corruption") {
if(Math.random() < 0.05) {
changePixel(pixel,"corrupt_solid_rock");
return;
};
} else {
reactionStealer(pixel,otherPixel,"rock");
dependOn("code_library.js", function(){
elements.solid_rock = {
color: ["#808080","#4f4f4f","#949494"],
behavior: behaviors.WALL,
reactions: {
"water": {elem1: "wet_sand", chance: 0.00035},
"salt_water": {elem1: "wet_sand", chance: 0.0005},
"sugar_water": {elem1: "wet_sand", chance: 0.0004},
"seltzer": {elem1: "wet_sand", chance: 0.0004},
"dirty_water": {elem1: "wet_sand", chance: 0.0004},
"soda": {elem1: "wet_sand", chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"grape": {elem2: "juice", chance: 0.1, color2: "#291824"},
"root": {elem1: "sand", chance: 0.0004},
"wheat": {elem2: "flour"},
"primordial_soup": {elem1: "wet_sand", chance: 0.001}
},
onMoveInto: function(pixel,otherPixel) {
if(elements[otherPixel.element].category === "corruption") {
if(Math.random() < 0.05) {
changePixel(pixel,"corrupt_solid_rock");
return;
};
},
tempHigh: 950,
stateHigh: "magma",
category: "land",
state: "solid",
density: 2600,
hardness: 0.55,
breakInto: "rock",
}
} else {
reactionStealer(pixel,otherPixel,"rock");
};
},
tempHigh: 950,
stateHigh: "magma",
category: "land",
state: "solid",
density: 2600,
hardness: 0.55,
breakInto: "rock",
}
if(enabledMods.includes("mods/fey_and_more.js")) {
elements.corrupt_solid_rock = {
color: ["#514c78","#514c78","#2a264d","#2a264d","#514c78","#514c78"],
behavior: behaviors.WALL,
tempHigh: 1200,
category: "corruption",
state: "solid",
density: 1250,
breakInto: "corrupt_rock",
tick: function(pixel) {
var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)];
var rfX = pixel.x+randomNeighborOffset[0];
var rfY = pixel.y+randomNeighborOffset[1];
if(!isEmpty(rfX,rfY,true)) {
var otherPixel = pixelMap[rfX][rfY];
if(otherPixel.element === "solid_rock") {
if(Math.random() < 0.05) {
changePixel(otherPixel,"corrupt_solid_rock")
};
if(enabledMods.includes("mods/fey_and_more.js")) {
elements.corrupt_solid_rock = {
color: ["#514c78","#514c78","#2a264d","#2a264d","#514c78","#514c78"],
behavior: behaviors.WALL,
tempHigh: 1200,
category: "corruption",
state: "solid",
density: 1250,
breakInto: "corrupt_rock",
tick: function(pixel) {
var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)];
var rfX = pixel.x+randomNeighborOffset[0];
var rfY = pixel.y+randomNeighborOffset[1];
if(!isEmpty(rfX,rfY,true)) {
var otherPixel = pixelMap[rfX][rfY];
if(otherPixel.element === "solid_rock") {
if(Math.random() < 0.05) {
changePixel(otherPixel,"corrupt_solid_rock")
};
};
},
};
runAfterLoad(function() {
elements.corrupt_solid_rock.reactions = elements.corrupt_land.reactions;
});
}
} else {
if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) };
if(!enabledMods.includes(onTryMoveIntoMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,onTryMoveIntoMod) };
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The "${libraryMod}" and "${onTryMoveIntoMod}" mods are all required; any missing mods in this list have been automatically inserted (reload for this to take effect).`)
};
};
},
};
runAfterLoad(function() {
elements.corrupt_solid_rock.reactions = elements.corrupt_land.reactions;
});
}
},true);

View File

@ -1,8 +1,10 @@
var modName = "mods/sponge_edit.js";
var onTryMoveIntoMod = "mods/onTryMoveInto.js";
// var onTryMoveIntoMod = "mods/onTryMoveInto.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(onTryMoveIntoMod) && enabledMods.includes(libraryMod)) {
dependOn("code_library.js", function(){
elements.sponge.properties ??= {};
elements.sponge.properties.maxAbsorb = 250;
@ -34,7 +36,7 @@ if(enabledMods.includes(onTryMoveIntoMod) && enabledMods.includes(libraryMod)) {
};
};
elements.sponge.onTryMoveInto = function(pixel,otherPixel) {
elements.sponge.onMoveInto = function(pixel,otherPixel) {
var absorbedElements = Object.keys(pixel.absorbed);
if(absorbedElements.length == 0) {
return false;
@ -68,9 +70,4 @@ if(enabledMods.includes(onTryMoveIntoMod) && enabledMods.includes(libraryMod)) {
};
};
};
} else {
enabledMods.splice(enabledMods.indexOf(modName),0,onTryMoveIntoMod);
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod);
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The ${onTryMoveIntoMod} mod and ${libraryMod} mods are required and have been automatically inserted (reload for this to take effect).`);
};
}, true);

View File

@ -1,7 +1,7 @@
var modName = "mods/color_tools.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) {
dependOn("code_library.js", function(){
stripeFixedDefaultProperties = {
color2: "rgb(0,0,0)",
phase: 0,
@ -103,8 +103,4 @@ if(enabledMods.includes(libraryMod)) {
},
desc: stripePaintDesc
};
} else {
alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`)
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
};
}, true);

View File

@ -1,10 +1,7 @@
var modName = "mods/structure_test.js";
var libraryMod = "mods/code_library.js";
if(!enabledMods.includes(libraryMod)) {
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod);
alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`);
} else {
dependOn("code_library.js", function(){
arrayLoaderVoids = ["air", "null", null];
buildingOneSegmentDoor = ["concrete","wood_plank","concrete","wood_plank","concrete"];
buildingOneSegmentWindows = ["concrete","glass_pane","concrete","glass_pane","concrete"];
@ -752,4 +749,4 @@ if(!enabledMods.includes(libraryMod)) {
worldgentypes.desert.layers.shift();
};
};
};
}, true);

View File

@ -76,13 +76,19 @@ runAfterAutogen(function(){
for (var element in elements) {
if (elements[element].category !== "tools") {
elements[element].hidden = true;
elements[element].category = "inventory";
if (!settings.survival || Object.keys(settings.survival).length < 25) {
elements[element].category = "inventory";
}
}
if (elements[element].onShiftSelect) delete elements[element].onShiftSelect;
}
for (var element in settings.survival) {
if (!elements[element]) { continue; }
if (elements[element].category === "tools") { continue; }
if (!elements[element].colorObject) {
elements[element].color = "#ffffff";
elements[element].colorObject = {"r": 255,"g": 255,"b": 255};
}
createElementButton(element);
document.getElementById("elementButton-"+element).innerHTML += "("+settings.survival[element]+")";
}
@ -120,7 +126,7 @@ elements.cloner.ignore = elements.cloner.ignore.concat(["gold","gold_coin","molt
elements.cloner.desc = "You can only clone one element at a time!"
elements.smash.tool = function(pixel) {
if (elements[pixel.element].seed === true && pixel.element !== "cactus") { return }
if (elements[pixel.element].seed === true) { return }
if (elements[pixel.element].breakInto !== undefined || (elements[pixel.element].seed !== undefined && elements[pixel.element].seed !== true)) {
// times 0.25 if not shiftDown else 1
if (Math.random() < (elements[pixel.element].hardness || 1) * (shiftDown ? 1 : 0.25)) {

View File

@ -1,51 +1,53 @@
var modName = "mods/switches.js";
var formerlyNoConductMod = "mods/doElectricity changes.js";
// var modName = "mods/switches.js";
// var formerlyNoConductMod = "mods/doElectricity changes.js";
if(enabledMods.includes(formerlyNoConductMod)) {
elements.switch_off = {
name: "switch (off)",
color: "#7F3333",
behavior: behaviors.WALL,
noConduct: ["switch_on_control","switch_off_control"],
category: "machines",
};
// if(enabledMods.includes(formerlyNoConductMod)) {
elements.switch_on = {
name: "switch (on)",
color: "#33CC33",
behavior: behaviors.WALL,
conduct: 1,
noConduct: ["switch_on_control","switch_off_control"],
category: "machines",
};
// } else {
// enabledMods.splice(enabledMods.indexOf(modName),0,formerlyNoConductMod)
// alert(`The ${formerlyNoConductMod} mod is required and has been automatically inserted (reload for this to take effect).`)
// localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
// };
elements.switch_off_control = {
color: "#FF3333",
behavior: behaviors.WALL,
behaviorOn: [
"XX|CH:switch_on>switch_off|XX",
"CH:switch_on>switch_off|XX|CH:switch_on>switch_off",
"XX|CH:switch_on>switch_off|XX"
],
conduct: 1,
noConduct: ["switch_on","switch_off"],
category: "machines",
};
elements.switch_on_control = {
color: "#33FF33",
behavior: behaviors.WALL,
behaviorOn: [
"XX|CH:switch_off>switch_on|XX",
"CH:switch_off>switch_on|XX|CH:switch_off>switch_on",
"XX|CH:switch_off>switch_on|XX"
],
conduct: 1,
noConduct: ["switch_on","switch_off"],
category: "machines",
};
} else {
enabledMods.splice(enabledMods.indexOf(modName),0,formerlyNoConductMod)
alert(`The ${formerlyNoConductMod} mod is required and has been automatically inserted (reload for this to take effect).`)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
elements.switch_off = {
name: "switch (off)",
color: "#7F3333",
behavior: behaviors.WALL,
ignoreConduct: ["switch_on_control","switch_off_control"],
category: "machines",
};
elements.switch_on = {
name: "switch (on)",
color: "#33CC33",
behavior: behaviors.WALL,
conduct: 1,
ignoreConduct: ["switch_on_control","switch_off_control"],
category: "machines",
};
elements.switch_off_control = {
color: "#FF3333",
behavior: behaviors.WALL,
behaviorOn: [
"XX|CH:switch_on>switch_off|XX",
"CH:switch_on>switch_off|XX|CH:switch_on>switch_off",
"XX|CH:switch_on>switch_off|XX"
],
conduct: 1,
ignoreConduct: ["switch_on","switch_off"],
category: "machines",
};
elements.switch_on_control = {
color: "#33FF33",
behavior: behaviors.WALL,
behaviorOn: [
"XX|CH:switch_off>switch_on|XX",
"CH:switch_off>switch_on|XX|CH:switch_off>switch_on",
"XX|CH:switch_off>switch_on|XX"
],
conduct: 1,
ignoreConduct: ["switch_on","switch_off"],
category: "machines",
};

View File

@ -2531,7 +2531,7 @@ Proper classification of limestone within these code comments
]
};
elements.plasma.noConduct = ["stellar_plasma","liquid_stellar_plasma","liquid_degenerate_neutronium","gaseous_degenerate_neutronium","neutron_star"]; //I can't suppress the charge overlay and keep the tick color, only effective with noConduct.js but not strictly required
elements.plasma.ignoreConduct = ["stellar_plasma","liquid_stellar_plasma","liquid_degenerate_neutronium","gaseous_degenerate_neutronium","neutron_star"]; //I can't suppress the charge overlay and keep the tick color, only effective with noConduct.js but not strictly required
//Main preset

View File

@ -1,7 +1,7 @@
var modName = "mods/wifi.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) {
dependOn("code_library.js", function(){
//https://stackoverflow.com/a/60922255
elements.wifi = {
color: "#bfff7f",
@ -155,8 +155,4 @@ if(enabledMods.includes(libraryMod)) {
state: "solid",
}
} else {
if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) };
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The "${libraryMod}" mods is required; and has been automatically inserted (reload for this to take effect).`)
};
}, true);

View File

@ -1,7 +1,7 @@
var modName = "mods/wirelike_test.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) {
dependOn("code_library.js", function(){
//The CMYK is symbolic
elements.start_test = {
color: "#dddddd",
@ -674,8 +674,4 @@ if(enabledMods.includes(libraryMod)) {
};
},
};
} else {
alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`)
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
};
}, true)

File diff suppressed because it is too large Load Diff

233
weaponsRewrite.js Normal file
View File

@ -0,0 +1,233 @@
dependOn("betterSettings.js", () => {
const tabweapons = new SettingsTab("weapons.js");
enablestartupprompt = new Setting("Startup prompt", "startup_prompt", settingType.BOOLEAN, false, defaultValue=true, "The prompt requesting you to add velocity.js, (unavailable for steam edition)");
tabweapons.registerSetting(enablestartupprompt);
settingsManager.registerTab(tabweapons);
runAfterLoad(async () => {
window.setTimeout(async () => {
if (!enabledMods.includes("mods/velocity.js") && standaloneType !== "steam" && enablestartupprompt.value === true){
_jaydalert("velocity.js is recommended for weapons.js to function in its intended way.");
}
},)
})
},true)
async function _weaponsjsprompt(message, defaultValue = "") {
return new Promise(resolve => {
promptInput(message, (result) => {
resolve(result);
}, "weapons.js is asking you...", defaultValue);
})
}
async function _jaydalert(message) {
promptText(message, undefined, "Jayd:");
}
async function _weaponsjsdir(message) {
promptDir(message, undefined, "weapons.js is asking you...");
}
elements.tsar_bomba = {
color: "#969696",
tick: (pixel) => {
tryMove(pixel, pixel.x, pixel.y+1)
for (var y = 1; y < 4; y++) {
if (!isEmpty(pixel.x, pixel.y + y, false)) {
explodeAt(pixel.x,pixel.y,150,"plasma")
}
}
},
category: "weapons.js",
state: "solid",
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.missile_left = {
color: "#313131",
category: "weapons.js",
state: "solid",
behavior: [
"EX:20>missile_shrapnel|XX|XX|XX|XX|XX|CR:smoke"
],
ignore: "missile_left",
tick: function(pixel) {
var circlec = circleCoords(pixel.x, pixel.y, 3)
for (var i = 0; i < circlec.length; i++){
var coord = circlec[i]
var x = coord.x
var y = coord.y
if (!(isEmpty(x, y, true) || (x == pixel.x && y == pixel.y) || elements[pixelMap[x][y].element].state == "gas" || pixelMap[x][y].element == "missile_left")){
explodeAt(pixel.x,pixel.y,20,"missile_shrapnel")
}
}
for (var i=0; i<3; i++) {
tryMove(pixel, pixel.x-1, pixel.y)
}
},
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.missile_right = {
color: "#313131",
category: "weapons.js",
state: "solid",
behavior: [
"CR:smoke|XX|XX|XX|XX|XX|EX:20>missile_shrapnel"
],
ignore: "missile_right",
tick: function(pixel) {
var circlec = circleCoords(pixel.x, pixel.y, 3)
for (var i = 0; i < circlec.length; i++){
var coord = circlec[i]
var x = coord.x
var y = coord.y
if (!(isEmpty(x, y, true) || (x == pixel.x && y == pixel.y) || elements[pixelMap[x][y].element].state == "gas")){
explodeAt(pixel.x,pixel.y,20,"missile_shrapnel")
}
}
for (var i=0; i<3; i++) {
tryMove(pixel, pixel.x+1, pixel.y)
}
},
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
}
var target = [,];
var tgt = "head";
elements.tracking_missile = {
color: "#323232",
category: "weapons.js",
behavior: [
"XX","XX","CR:smoke"
],
onSelect: async () => {
var answer1 = await _weaponsjsprompt("Please input the target.",(tgt||undefined));
if (!answer1) {return}
tgt = answer1;
},
tick: (pixel) => {
var circlec = circleCoords(pixel.x, pixel.y, 3)
for (var i = 0; i < circlec.length; i++){
var coord = circlec[i]
var xe = coord.x
var ye = coord.y
if (!(isEmpty(xe, ye, true) || (xe == pixel.x && ye == pixel.y) || elements[pixelMap[xe][ye].element].state == "gas" || pixelMap[xe][ye].element == "tracking_missile")){
explodeAt(pixel.x,pixel.y,20,"missile_shrapnel")
}
}
for (var x = 1; x < width; x++) {
for (var y = 1; y < height; y++) {
if (!isEmpty(x,y)) {
if (pixelMap[x][y].element===tgt) {
target = [pixelMap[x][y].x, pixelMap[x][y].y];
}
}
}
}
if (pixel.x != target[0] || pixel.y != target[1]) {
let {x, y} = pixel;
const empty = checkForEmptyPixels(x, y);
const [tX, tY] = target;
let bestVal = Math.sqrt(Math.pow(tX - x, 2) + Math.pow(tY - y, 2));
let best = null;
for (const pixelPair of empty) {
const [x_, y_] = [x + pixelPair[0], y + pixelPair[1]];
const c = Math.sqrt(Math.pow(tX - x_, 2) + Math.pow(tY - y_, 2));
if (c < bestVal) {
bestVal = c;
best = pixelPair;
}
}
if (best) {
tryMove(pixel, x + best[0]*2, y + best[1]*2, undefined, true);
}
}
}
},
elements.missile_shrapnel = {
color: "#979ea3",
behavior: [
"XX|XX|XX",
"XX|EX:5 %20|XX",
"M2%20|M1%20|M2%20",
],
burn: 90,
burnTime: 100,
density: 2000,
conduct: 1,
state: "solid",
category: "weapons.js"
},
elements.cluster_nuke = {
color: "#323232",
category: "weapons.js",
behavior: behaviors.POWDER,
maxSize: 1,
cooldown: defaultCooldown,
tick: (pixel) => {
for (var y = 1; y < 25; y++) {
if (!isEmpty(pixel.x, pixel.y + y, false)) {
explodeAt(pixel.x,pixel.y,25,["dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","nuke",])
}
}
}
}
// let ammo1 = 1;
// let rdir = 1;
// let ammoLoaded = "";
// elements.railgun = {
// category: "weapons.js",
// behavior: behaviors.WALL,
// onSelect: async (pixel) => {
// var answer1 = await _weaponsjsprompt("Please input the ammo type. \n \n <1 for Armor-Piercing ammo> \n <2 for High-Explosive ammo.>",(ammo1||undefined));
// if (!answer1) {return}
// ammo1 = answer1;
// var answer2 = await _weaponsjsdir("Please input the direction.",(rdir||undefined));
// if (!answer2) {
// console.log(answer2)
// return}
// rdir = answer2;
// },
// tick: async (pixel) => {
// ammoLoaded = "armor_piercing_shell";
// if(ammo1 === 1){
// ammoLoaded = "armor_piercing_shell"
// }
// else if (ammo1 === 2){
// ammoLoaded = "high_explosive_shell"
// }
// if (pixel.charge){
// if(rdir === 1){
// createPixel(ammoLoaded, pixel.x, pixel.y-1);
// }
// if (rdir === 2){
// createPixel(ammoLoaded, pixel.x, pixel.y+1);
// }
// if (rdir === 3){
// createPixel(ammoLoaded, pixel.x-1, pixel.y);
// }
// if (rdir === 4){
// createPixel(ammoLoaded, pixel.x+1, pixel.y);
// }
// }
// doDefaults(pixel);
// },
// color: "#c9c9c9",
// conduct: 1,
// hardness: 8,
// },
// elements.armor_piercing_shell = {
// category: "ammunition",
// color: "#ffc954",
// hardness: 0.9,
// }
// elements.high_explosive_shell = {
// category: "ammunition",
// color: "#ffc954",
// hardness: 0.6,
// }