Merge branch 'R74nCom:main' into main

This commit is contained in:
JustAGenericUsername 2025-02-10 11:17:01 -05:00 committed by GitHub
commit 373ea763ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
34 changed files with 50311 additions and 2153 deletions

View File

@ -23,7 +23,7 @@
"shock":"Šok",
"paint":"Malovat",
"sand":"Písek",
"water":"Voda",
"water":"Voda",
"salt_water":"Slaná_Voda",
"sugar_water":"Sladká_Voda",
"seltzer":"Minerální_Voda",
@ -305,7 +305,7 @@
"crumb":"Drobek",
"baked_batter":"Dort",
"wheat":"Pšenice",
"candy":"Sladkosti",
"candy":"Sladkost",
"coffee_bean":"Kávové_Zrna",
"coffee_ground":"Mletá_Káva",
"nut":"Ořech",
@ -444,7 +444,7 @@
"supernova":"Supernova",
"cook":"Vařit",
"incinerate":"Spálit",
"room_temp":"Teplota_Pokoje",
"room_temp":"Pokojová_Teplota",
"positron":"Pozitron",
"tnt":"TNT",
"c4":"C-4",
@ -541,7 +541,11 @@
"tornado":"Tornádo",
"earthquake":"Zemětřesení",
"tsunami":"Tsunami",
"blaster":"Blaster",
"blaster":"Lazerová_Pistole",
"propane_ice":"Zrmzlý_Propan",
"molten_caustic_potash":"Rozteklý_Potaš"
"molten_caustic_potash":"Rozteklý_Potaš",
"spider": "Pavouk",
"web": "Pavučina",
"rice": "Rýže",
"midas_touch": "Midasův_Dotek"
}

View File

@ -12,6 +12,7 @@ var json = `{
"food": "",
"machines": "",
"special": "",
"states": "",
"other": ""`;
for (var element in elements) {
json += ',\n"'+element+'": ""'

View File

@ -233,7 +233,7 @@
"copper":"réz",
"gold":"arany",
"steel":"acél",
"galvanized_steel":"horganyzott_acél"
"galvanized_steel":"horganyzott_acél",
"nickel":"nikkel",
"zinc":"cink",
"silver":"ezüst",
@ -548,7 +548,7 @@
"tsunami": "cunami",
"blaster": "plazmavető",
"propane_ice": "fagyott_propán",
"molten_caustic_potash": "olvadt_kálium-hidroxid"
"molten_caustic_potash": "olvadt_kálium-hidroxid",
"ectoplasm":"ektoplazma",
"soul":"lélek",
"tombstone":"sírkő",

View File

@ -479,7 +479,7 @@
"prop":"реквизит",
"salt_ice":"солёный лёд",
"sugar_ice":"сладкий лёд",
"seltzer_ice":"селтизерный лёд",
"seltzer_ice":"минеральный лёд",
"dirty_ice":"грязный лёд",
"pool_ice":"лёд в бассейне",
"blood_ice":"кровяной лёд",

View File

@ -63,6 +63,7 @@
"rad_glass": "",
"meat": "",
"rotten_meat": "",
"cured_meat": "",
"cooked_meat": "",
"frozen_meat": "",
"salt": "",
@ -98,10 +99,12 @@
"flea": "",
"termite": "",
"ant": "",
"spider": "",
"web": "",
"fly": "",
"firefly": "",
"hive": "",
"bee": "",
"hive": "",
"stink_bug": "",
"dead_bug": "",
"human": "",
@ -123,12 +126,14 @@
"pipe_wall": "",
"mixer": "",
"grinder": "",
"fuse": "",
"ewall": "",
"torch": "",
"spout": "",
"udder": "",
"bone_marrow": "",
"bone": "",
"ball": "",
"balloon": "",
"antipowder": "",
"antimolten": "",
@ -142,7 +147,6 @@
"light": "",
"liquid_light": "",
"laser": "",
"ball": "",
"pointer": "",
"charcoal": "",
"tinder": "",
@ -153,12 +157,14 @@
"nitrogen": "",
"helium": "",
"anesthesia": "",
"carbon_dioxide": "",
"bubble": "",
"ammonia": "",
"liquid_ammonia": "",
"carbon_dioxide": "",
"oil": "",
"lamp_oil": "",
"propane": "",
"liquid_propane": "",
"methane": "",
"liquid_methane": "",
"stained_glass": "",
@ -190,7 +196,6 @@
"vine": "",
"bamboo_plant": "",
"foam": "",
"bubble": "",
"acid": "",
"neutral_acid": "",
"acid_gas": "",
@ -225,7 +230,6 @@
"wax": "",
"melted_wax": "",
"incense": "",
"fuse": "",
"dioxin": "",
"insulation": "",
"sponge": "",
@ -234,11 +238,12 @@
"copper": "",
"gold": "",
"steel": "",
"nickel": "",
"galvanized_steel": "",
"zinc": "",
"silver": "",
"tin": "",
"lead": "",
"nickel": "",
"aluminum": "",
"tungsten": "",
"molten_tungsten": "",
@ -254,7 +259,9 @@
"electrum": "",
"pyrite": "",
"solder": "",
"amber": "",
"molten_copper": "",
"molten_copper_sulfate": "",
"molten_gold": "",
"molten_silver": "",
"molten_iron": "",
@ -273,6 +280,7 @@
"egg": "",
"yolk": "",
"hard_yolk": "",
"cream": "",
"nut_milk": "",
"dough": "",
"batter": "",
@ -280,7 +288,9 @@
"butter": "",
"cheese": "",
"rotten_cheese": "",
"cheese_powder": "",
"chocolate": "",
"chocolate_powder": "",
"grape": "",
"vinegar": "",
"herb": "",
@ -306,10 +316,12 @@
"crumb": "",
"baked_batter": "",
"wheat": "",
"rice": "",
"candy": "",
"coffee_bean": "",
"coffee_ground": "",
"nut": "",
"nut_oil": "",
"nut_meat": "",
"nut_butter": "",
"jelly": "",
@ -317,7 +329,6 @@
"yogurt": "",
"frozen_yogurt": "",
"ice_cream": "",
"cream": "",
"beans": "",
"dry_ice": "",
"nitrogen_ice": "",
@ -350,11 +361,12 @@
"coffee": "",
"honey": "",
"sap": "",
"amber": "",
"caramel": "",
"molasses": "",
"ketchup": "",
"mayo": "",
"grease": "",
"fat": "",
"melted_chocolate": "",
"liquid_hydrogen": "",
"liquid_oxygen": "",
@ -368,6 +380,11 @@
"limestone": "",
"quicklime": "",
"slaked_lime": "",
"potassium": "",
"molten_potassium": "",
"potassium_gas": "",
"magnesium": "",
"molten_magnesium": "",
"thermite": "",
"molten_thermite": "",
"slag": "",
@ -384,19 +401,24 @@
"cyanide": "",
"cyanide_gas": "",
"ozone": "",
"liquid_ozone": "",
"cloud": "",
"rain_cloud": "",
"snow_cloud": "",
"hail_cloud": "",
"thunder_cloud": "",
"acid_cloud": "",
"sandstorm": "",
"pyrocumulus": "",
"fire_cloud": "",
"rad_cloud": "",
"rad_steam": "",
"color_smoke": "",
"spray_paint": "",
"led_r": "",
"led_g": "",
"led_b": "",
"light_bulb": "",
"sulfur": "",
"molten_sulfur": "",
"sulfur_gas": "",
@ -404,9 +426,8 @@
"snake": "",
"loopy": "",
"warp": "",
"midas_touch": "",
"radiation": "",
"rad_steam": "",
"rad_cloud": "",
"fallout": "",
"neutron": "",
"proton": "",
@ -433,6 +454,7 @@
"borax": "",
"epsom_salt": "",
"potassium_salt": "",
"caustic_potash": "",
"sodium_acetate": "",
"lightning": "",
"bless": "",
@ -463,6 +485,7 @@
"greek_fire": "",
"fireball": "",
"rocket": "",
"antibomb": "",
"cold_bomb": "",
"hot_bomb": "",
"antimatter_bomb": "",
@ -471,9 +494,12 @@
"flash": "",
"smoke_grenade": "",
"landmine": "",
"tornado": "",
"earthquake": "",
"tsunami": "",
"blaster": "",
"armageddon": "",
"tesla_coil": "",
"light_bulb": "",
"shocker": "",
"pressure_plate": "",
"primordial_soup": "",
@ -493,12 +519,13 @@
"slime_ice": "",
"antiice": "",
"ammonia_ice": "",
"liquid_propane": "",
"propane_ice": "",
"methane_ice": "",
"molten_brick": "",
"acid_ice": "",
"soda_ice": "",
"molten_steel": "",
"molten_galvanized_steel": "",
"molten_brass": "",
"molten_bronze": "",
"molten_sterling": "",
@ -521,34 +548,12 @@
"molten_amalgam": "",
"neon_ice": "",
"cyanide_ice": "",
"molten_copper_sulfate": "",
"molten_alga": "",
"molten_metal_scrap": "",
"molten_borax": "",
"molten_epsom_salt": "",
"molten_potassium_salt": "",
"molten_sodium_acetate": "",
"frozen_nitro": "",
"cured_meat": "",
"nut_oil": "",
"grease": "",
"fat": "",
"potassium": "",
"molten_potassium": "",
"magnesium": "",
"molten_magnesium": "",
"sandstorm": "",
"caustic_potash": "",
"antibomb": "",
"tornado": "",
"earthquake": "",
"tsunami": "",
"blaster": "",
"propane_ice": "",
"molten_caustic_potash": "",
"ectoplasm":"",
"soul":"",
"tombstone":"",
"spider":"",
"web":""
}
"molten_sodium_acetate": "",
"frozen_nitro": ""
}

View File

@ -135,7 +135,7 @@
<tr><td>velocity.js</td><td>Beta for explosion velocity, and later wind, which may come to the base game in the future</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
<!----><tr><td class="modCat" colspan="3">Tools & Settings</td></tr><!---->
<!-- <tr><td>adjustablepixelsize.js</td><td>Allows you to set the pixelSize with a URL parameter</td><td>Alice</td></tr> -->
<!--<tr><td>adjustablepixelsize.js</td><td>Allows you to set the pixelSize with a URL parameter</td><td>Alice</td></tr>-->
<tr><td>betaworldgen.js</td><td>adds a more advanced world generation to the game</td><td>Adora</td></tr>
<tr><td>betterModManager.js</td><td>Improvements to the Mod Manager</td><td>ggod</td></tr>
<tr><td>betterSettings.js</td><td>Adds additional settings and functionality</td><td>ggod</td></tr>
@ -174,6 +174,7 @@
<tr><td>selective_paint.js</td><td>Adds a tool to paint only selected elements</td><td>SquareScreamYT</td></tr>
<tr><td>stripe_paint.js</td><td>Adds a tool to paint with stripes</td><td>Alice</td></tr>
<tr><td>texturepack.js</td><td>Adds tools that let you create and share custom texture packs</td><td>nousernamefound</td></tr>
<tr><td>text.js</td><td>Adds tools to write text</td><td>RedBirdly</td></tr>
<tr><td>the_ground.js</td><td>Adds several rock types, worldgen settings, and gemstones</td><td>Alice</td></tr>
<!----><tr><td class="modCat" colspan="3">Science & Chemistry</td></tr><!---->
@ -186,10 +187,10 @@
<tr><td>bioooze_and_pyrogens.js</td><td>Adds Bio-Ooze from <a herf="https://frackinuniverse.miraheze.org/wiki/Main_Page">Frackin Universe</a> and several heat-producing materials from various games mods</td><td>Alice</td></tr>
<tr><td>boiling_things.js</td><td>Allows for various elements to be vaporized</td><td>Alice</td></tr>
<tr><td>bouncing_balls.js</td><td>Adds new types of balls that bounce accurately and roll.</td><td>Nekonico</td></tr>
<tr><td>bromine.js</td><td>Adds bromine which emits an orange gas</td><td>Suss</td></tr>
<tr><td>chalcopyrite.js</td><td>Adds the chalcopyrite ore</td><td>Sophie</td></tr>
<tr><td>chem.js</td><td>Adds several chemistry and physics-related elements</td><td>lllllllllwith10ls</td></tr>
<tr><td>clf3.js</td><td>Adds Chlorine Trifluoride</td><td>Alice</td></tr>
<tr><td>debrisable.js</td><td>Expands the number of breakable elements, changes erosion, and adds way to craft certain elements from breaking other elements. </td><td>Nekonico</td></tr>
<tr><td>fire_extinguisher.js</td><td>Adds fire extinguisher blocks and realistic firefighting foam to put out nearly anything</td><td>Dr_Lego</td></tr>
<tr><td>fire_mod.js</td><td>Adds various properties to change fire behavior, & a radioactive version of fire</td><td>Alice</td></tr>
<tr><td>fire_slime.js</td><td>Adds a pyrogenic version of slime</td><td>Alice</td></tr>
@ -203,6 +204,7 @@
<tr><td>laetium.js</td><td>Adds several fictional elements</td><td>Alice</td></tr>
<tr><td>liquid_energy.js</td><td>Adds liquid versions of the elements in the Energy category</td><td>Alice</td></tr>
<tr><td>lye.js</td><td>Adds lye</td><td>BatteRaquette58</td></tr>
<tr><td>mars.js</td><td>Adds some things from Mars with 2 minerals to smelt.</td><td>charcoal_afterlife</td></tr>
<tr><td>metals.js</td><td>Adds several metals</td><td>Alice</td></tr>
<tr><td>mixture.js</td><td>Allows many chemicals to be mixed</td><td>lllllllllwith10ls</td></tr>
<tr><td>more_gold.js</td><td>Adds Green Gold</td><td>pixelegend4</td></tr>
@ -231,6 +233,7 @@
<tr><td>flipflop.js</td><td>Toggleable switches; <a href="https://github.com/R74nCom/sandboxels/pull/134">Explanation</a></td><td>Flix</td></tr>
<tr><td>fueled_generators.js</td><td>Fuel powered generators.</td></tr>
<tr><td>gameOfLife.js</td><td>Conway's Game of Life on a screen</td><td>ggod</td></tr>
<tr><td>heatshield.js</td><td>adds heatshields, makes plasma cooler</td></td><td>Taterbob</td></tr>
<tr><td>logicgates.js</td><td>Adds predictable electricity and logic gates</td><td>nousernamefound</td></tr>
<tr><td>note_block.js</td><td>Adds musical Note Blocks</td><td>Alice</td></tr>
<tr><td>nousersthings.js</td><td>Destroyable machines, pipe variants, filters, and more</td><td>nousernamefound</td></tr>
@ -245,6 +248,7 @@
<tr><td>video.js</td><td>Adds a video player</td><td>ggod</td></tr>
<tr><td>waterspout.js</td><td>Adds back the old Water Spout</td><td>mollthecoder</td></tr>
<tr><td>WhisperingTheory.js</td><td>Adds many more variants of heater and cooler</td><td>kaeud</td></tr>
<tr><td>wifi_draw.js</td><td>Draws connections between WiFi in wifi.js and logicgates.js</td><td>RedBirdly</td></tr>
<!----><tr><td class="modCat" colspan="3">Weapons</td></tr><!---->
<tr><td>aircrafts.js</td><td>Adds aircraft and aircraft part pixels</td><td>Jayd</td></tr>
@ -285,6 +289,7 @@
<tr><td>biology.js</td><td>Adds various elements and functions that let you build your own organism.</td><td>Nekonico</td></tr>
<tr><td>cat.js</td><td>Adds cats and cat food</td><td>SquareScreamYT</td></tr>
<tr><td>cells.js</td><td>Adds several experimental edits of the Cell element</td><td>Alice</td></tr>
<tr><td>children.js</td><td>Adds pesky little gremlins</td><td>Taterbob</td></tr>
<tr><td>colonies.js</td><td>Adds rockets that contain settlers to terraform a planet.</td><td>Nekonico</td></tr>
<tr><td>crimson.js</td><td>Adds elements relating to the Crimson from Terraria</td><td>Alice</td></tr>
<tr><td>dogs.js</td><td>Adds a simple dog and dog food</td><td>hedera-ivy</td></tr>
@ -323,6 +328,7 @@
<tr><td>all_around_fillers.js</td><td>Adds directional Filler variants</td><td>idk73248</td></tr>
<tr><td>allliquids.js</td><td>Made all elements liquids</td><td>Adora</td></tr>
<tr><td>amogus.js</td><td>Adds a small amogus structure</td><td>Alice</td></tr>
<tr><td>bfdi.js</td><td>Adds several references to bfdi</td><td>Taterbob</td></tr>
<tr><td>citybuilding.js</td><td>Adds 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>doom.js</td><td>As seen on TikTok - Select the Doom element to start, WASD</td><td>ggod</td></tr>
@ -355,18 +361,24 @@
<!----><tr><td class="modCat" colspan="3">Visual Effects</td></tr><!---->
<tr><td>acid_and_shapes.js</td><td>Weird visual effects. Enable in Settings</td><td>Alice</td></tr>
<tr><td>customBackground.js</td><td>Set your background to an image link</td><td>Jayd</td></tr>
<tr><td>fast_lightmap.js</td><td>Makes light sources glow, but the fast version</td><td>RedBirdly</td></tr>
<tr><td>fractals.js</td><td>Adds an element and tools to render fractals in game</td><td>nousernamefound</td></tr>
<tr><td>hexagon_test.js</td><td>Makes pixels look like hexagons</td><td>RedBirdly</td></tr>
<tr><td>heatglow.js</td><td>Red glowing effect for hot metals</td><td>nousernamefound</td></tr>
<tr><td>invisible_dye.js</td><td>Adds elements like Dye and Spray Paint that take the color of the background</td><td>Alice</td></tr>
<tr><td>invisible_wall.js</td><td>Adds an element like Wall that takes the color of the background</td><td>Alice</td></tr>
<tr><td>lightmap.js</td><td>Makes light sources glow</td><td>RedBirdly</td></tr>
<tr><td>moreViews.js</td><td>Many new rendering modes</td><td>ggod</td></tr>
<tr><td>nicer_flame.js</td><td>Makes fire visually pleasing</td><td>RedBirdly</td></tr>
<tr><td>occlusion.js</td><td>Adds realistic shadows (similar to Terraria's lighting)</td><td>RedBirdly</td></tr>
<tr><td>onecolor.js</td><td>Makes all placed pixels single-colored</td><td>nousernamefound</td></tr>
<tr><td>paint_event.js</td><td>Adds a random event that randomly paints a circle</td><td>Alice</td></tr>
<tr><td>rainbow_tests.js</td><td>Adds variants of the rainbow element with different maths</td><td>Alice</td></tr>
<tr><td>shader_by_jayd.js</td><td>Adds a glow around light elements</td><td>Jayd</td></tr>
<tr><td>Shroomboxels.js</td><td>A variant of acid_and_shapes.js that uses a different trigonometric function</td><td>Alice</td></tr>
<tr><td>singleColor.js</td><td>Makes all elements pick one color each time they're drawn</td><td>stefanblox</td></tr>
<tr><td>sky.js</td><td>Adds a day-night cycle</td><td>RedBirdly</td></tr>
<tr><td>solidcolor.js</td><td>Makes all placed pixels have a solid color (clone of onecolor.js)</td><td>SquareScreamYT</td></tr>
<tr><td>texture_pack_by_jayd.js</td><td>Adds a cool background</td><td>Jayd</td></tr>
<tr><td>UwUify.js</td><td>Adds an "UwU" background</td><td>Jayd</td></tr>

View File

@ -649,7 +649,8 @@ behavior: behaviors.LIQUID,
category: "life",
state: "liquid",
conduct: 0.019,
viscosity: 100
viscosity: 100,
reactions: {}
};
elements.berry = {
burn: 15,

View File

@ -4,7 +4,7 @@ let channelVar = "0";
// RF Transmitter Element
elements.rf_transmitter = {
color: "#142c47",
category: "Machines",
category: "machines",
behavior: behaviors.WALL,
tempHigh: 250,
stateHigh: "dirt",

View File

@ -8032,11 +8032,13 @@ elements.fruit_slush.stateLowColorMultiplier = 1.2;
elements.juice_ice.stateHighColorMultiplier = 0.83333333333;
elements.juice_ice.stateHigh = "fruit_slush"
elements.juice_ice.tempHigh = -20
elements[iceelem].stateHigh = "fruit_slush"
elements[iceelem].tempHigh = -20
if(elements[iceelem]) {
elements[iceelem].stateHigh = "fruit_slush"
elements[iceelem].tempHigh = -20
}
// fruit milk with milk
elements.fruit_milk.reactions.milk = { chance:1, func: function(pixel1, pixel2){
elements.fruit_milk.reactions ??= {}; elements.fruit_milk.reactions.milk = { chance:1, func: function(pixel1, pixel2){
let newrgb = interpolateRgb(getRGB(pixel1.color), getRGB(pixel2.color), 0.2);
if (((newrgb.r + newrgb.g + newrgb.b) / 3) < 230) {
changePixel(pixel1,"fruit_milk")

File diff suppressed because it is too large Load Diff

View File

@ -1,245 +1 @@
var incrementt = 0;
var interval = setInterval( increment, 500/30);
function increment(){
incrementt = incrementt % (Math.PI*8.8) + (Math.PI/30);
}
shapeModes = ["normal","circles","triangles"];
settings.shapeMode ??= 0;
settings.doAcid ??= false;
function getShapeMode() {
return shapeModes[settings.shapeMode] ?? "normal";
};
function drawPixels(forceTick=false) {
// newCurrentPixels = shuffled currentPixels
var newCurrentPixels = currentPixels.slice();
var pixelsFirst = [];
var pixelsLast = [];
if (!paused || forceTick) {
shuffleArray(newCurrentPixels);
}
/*{newCurrentPixels.sort(function(p) { // shuffle the pixels but keep elements[p.element].isGas last
return 0.5 - Math.random();
})} // shuffle the pixels if not paused*/
for (var i = 0; i < newCurrentPixels.length; i++) {
pixel = newCurrentPixels[i];
//if (pixelMap[pixel.x][pixel.y] == undefined || currentPixels.indexOf(pixel) == -1) {continue}
if (pixel.del) {continue}
if (!paused || forceTick) {
if (elements[pixel.element].tick) { // Run tick function if it exists
elements[pixel.element].tick(pixel);
}
if (pixel.del) {continue}
if (elements[pixel.element].behavior) { // Parse behavior if it exists
pixelTick(pixel);
}
};
if (elements[pixel.element].isGas) {
pixelsLast.push(pixel);
}
else {
pixelsFirst.push(pixel);
}
}
// Draw the current pixels
var canvas = document.getElementById("game");
var ctx = canvas.getContext("2d");
var pixelDrawList = pixelsFirst.concat(pixelsLast);
for (var i = 0; i < pixelDrawList.length; i++) {
pixel = pixelDrawList[i];
if (pixelMap[pixel.x][pixel.y] == undefined) {continue}
if (view===null || view===3) {
ctx.fillStyle = pixel.color;
}
else if (view === 2) { // thermal view
// set the color to pixel.temp, from hottest at 0 hue to coldest 225 hue, with the minimum being -273, max being 6000
var temp = pixel.temp;
if (temp < -273) {temp = -273}
if (temp > 6000) {temp = 6000}
var hue = 225 - (temp/6000)*225;
if (hue < 0) {hue = 0}
if (hue > 225) {hue = 225}
ctx.fillStyle = "hsl("+hue+",100%,50%)";
}
else if (view === 4) { // smooth view, average of surrounding pixels
var colorlist = [];
// check adjacent coords on the pixelMap, add the color to the list if the pixel is not empty and the color indexOf "rgb" is not -1
for (var j = 0; j < biCoords.length; j++) {
var x = pixel.x + biCoords[j][0];
var y = pixel.y + biCoords[j][1];
if (isEmpty(x,y,true) || elements[pixelMap[x][y].element].state !== elements[pixel.element].state) {continue}
var color = pixelMap[x][y].color;
if (color.indexOf("rgb") !== -1) {
colorlist.push(color.match(/\d+/g));
}
}
if (colorlist.length === 0) {
ctx.fillStyle = pixel.color;
}
else {
ctx.fillStyle = averageRGB(colorlist);
}
}
var mode = getShapeMode();
var acidOffset1 = (settings.doAcid ?? false) * (18*Math.sin((pixel.y+incrementt)/4.4));
var acidOffset2 = (settings.doAcid ?? false) * (18*Math.sin((pixel.x+incrementt)/4.4));
if ((view === null || view === 4) && elements[pixel.element].isGas) {
//gas rendering
switch(mode) {
case "circles":
ctx.globalAlpha = 0.66;
ctx.beginPath();
ctx.arc((pixel.x+0.5)*pixelSize+acidOffset1, (pixel.y+0.5)*pixelSize+acidOffset2, pixelSize, 0, 2 * Math.PI, false);
ctx.fill();
ctx.globalAlpha = 1;
break;
case "triangles":
ctx.globalAlpha = 0.66;
ctx.beginPath();
ctx.moveTo((pixel.x-0.75)*pixelSize+acidOffset1,(pixel.y+1.5)*pixelSize+acidOffset2);
ctx.lineTo((pixel.x+0.5)*pixelSize+acidOffset1,(pixel.y-1)*pixelSize+acidOffset2);
ctx.lineTo((pixel.x+1.75)*pixelSize+acidOffset1,(pixel.y+1.5)*pixelSize+acidOffset2);
ctx.fill();
ctx.globalAlpha = 1;
break;
default:
ctx.globalAlpha = 0.5;
ctx.fillRect((pixel.x-1)*pixelSize+acidOffset1, (pixel.y)*pixelSize+acidOffset2, pixelSize*3, pixelSize);
ctx.fillRect((pixel.x)*pixelSize+acidOffset1, (pixel.y-1)*pixelSize+acidOffset2, pixelSize, pixelSize*3);
ctx.globalAlpha = 1;
break;
};
}
else { // draw the pixel (default)
switch(mode) {
case "circles":
ctx.beginPath();
ctx.arc((pixel.x+0.5)*pixelSize+acidOffset1, (pixel.y+0.5)*pixelSize+acidOffset2, pixelSize/2, 0, 2 * Math.PI, false);
ctx.fill();
ctx.globalAlpha = 1;
break;
case "triangles":
ctx.beginPath();
ctx.moveTo(pixel.x*pixelSize+acidOffset1,(pixel.y+1)*pixelSize+acidOffset2);
ctx.lineTo((pixel.x+0.5)*pixelSize+acidOffset1,(pixel.y)*pixelSize+acidOffset2);
ctx.lineTo((pixel.x+1)*pixelSize+acidOffset1,(pixel.y+1)*pixelSize+acidOffset2);
ctx.fill();
ctx.globalAlpha = 1;
break;
default:
ctx.fillRect(pixel.x*pixelSize+acidOffset1, pixel.y*pixelSize+acidOffset2, pixelSize, pixelSize);
break;
};
}
if (pixel.charge && view !== 2) { // Yellow glow on charge
if (!elements[pixel.element].colorOn) {
ctx.fillStyle = "rgba(255,255,0,0.5)";
switch(mode) {
case "circles":
ctx.beginPath();
ctx.arc((pixel.x+0.5)*pixelSize+acidOffset1, (pixel.y+0.5)*pixelSize+acidOffset2, pixelSize/2, 0, 2 * Math.PI, false);
ctx.fill();
ctx.globalAlpha = 1;
break;
case "triangles":
ctx.beginPath();
ctx.moveTo(pixel.x*pixelSize+acidOffset1,(pixel.y+1)*pixelSize+acidOffset2);
ctx.lineTo((pixel.x+0.5)*pixelSize+acidOffset1,(pixel.y)*pixelSize+acidOffset2);
ctx.lineTo((pixel.x+1)*pixelSize+acidOffset1,(pixel.y+1)*pixelSize+acidOffset2);
ctx.fill();
ctx.globalAlpha = 1;
break;
default:
ctx.fillRect(pixel.x*pixelSize+acidOffset1, pixel.y*pixelSize+acidOffset2, pixelSize, pixelSize);
break;
};
}
}
}
if (elements[currentElement].maxSize < mouseSize) {
var mouseOffset = Math.trunc(elements[currentElement].maxSize/2);
}
else {
var mouseOffset = Math.trunc(mouseSize/2);
}
var topLeft = [mousePos.x-mouseOffset,mousePos.y-mouseOffset];
var bottomRight = [mousePos.x+mouseOffset,mousePos.y+mouseOffset];
// Draw a square around the mouse
ctx.strokeStyle = "white";
ctx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize);
// draw one transparent pixel in the center
if (settings.precision) {
ctx.fillStyle = "rgba(255,255,255,0.5)";
ctx.fillRect(mousePos.x*pixelSize,mousePos.y*pixelSize,pixelSize,pixelSize);
}
if ((!paused) || forceTick) {pixelTicks++};
}
runAfterLoad(function() {
//Setting
var settingsMenu = document.getElementById("settingsMenu").getElementsByClassName("menuText")[0];
var settingNodes = [...settingsMenu.childNodes].filter(function(node) { return node.nodeType == 1 });
var lastSetting = settingNodes[settingNodes.length - 1];
//console.log(lastSetting);
//console.log(lastSetting.getAttribute("style"));
lastSetting.removeAttribute("style"); //restore padding for worldgen setting;
//console.log(lastSetting.getAttribute("style"));
//Shape setting
var shapeSettingSpan = document.createElement("span");
shapeSettingSpan.setAttribute("setting","shapeMode");
shapeSettingSpan.setAttribute("class","setting-span");
shapeSettingSpan.textContent = "Pixel Shape (laggy) ";
var settingDropdown = document.createElement("select");
settingDropdown.setAttribute("onchange","settings.shapeMode = parseInt(this.value); saveSettings();");
var options = {
0: "Squares",
1: "Circles",
2: "Triangles"
};
for(value in options) {
var newOption = document.createElement("option");
if(value == "0") {
newOption.setAttribute("selected","");
};
newOption.setAttribute("value",value);
newOption.innerText = options[value];
settingDropdown.appendChild(newOption);
};
shapeSettingSpan.appendChild(settingDropdown);
settingsMenu.appendChild(shapeSettingSpan);
//Acid setting
var acidSettingSpan = document.createElement("span");
acidSettingSpan.setAttribute("setting","doAcid");
acidSettingSpan.setAttribute("class","setting-span");
acidSettingSpan.textContent = "\"Acid\" distortion ";
var settingDropdown = document.createElement("select");
settingDropdown.setAttribute("onchange","settings.doAcid = (this.value === 'true'); saveSettings();");
var options = {
"false": "Disabled",
"true": "Enabled"
};
for(value in options) {
var newOption = document.createElement("option");
if(value == "0") {
newOption.setAttribute("selected","");
};
newOption.setAttribute("value",value);
newOption.innerText = options[value];
settingDropdown.appendChild(newOption);
};
acidSettingSpan.appendChild(settingDropdown);
settingsMenu.appendChild(acidSettingSpan);
settingNodes = [...settingsMenu.childNodes].filter(function(node) { return node.nodeType == 1 });
lastSetting = settingNodes[settingNodes.length - 1];
//console.log(lastSetting);
lastSetting.setAttribute("style","padding-bottom:0"); //remove padding from last setting;
});
logMessage("This mod is deprecated. Please remove it from your mod list.")

View File

@ -1,4 +1,3 @@
//alice's new mini mod
urlParams = new URLSearchParams(window.location.search);
function elementExists(elementName) {
@ -58,15 +57,17 @@ window.addEventListener("load",function() {
};*/
});
function getEmptyVonNeumannNeighbors(pixel) {
function getEmptyVonNeumannNeighbors(pixel,returnOffsets=false) {
var neighbors = [];
var x = pixel.x;
var y = pixel.y;
for(var i = 0; i < adjacentCoords.length; i++) {
var finalX = pixel.x + adjacentCoords[i][0];
var finalY = pixel.y + adjacentCoords[i][1];
var offsetX = adjacentCoords[i][0];
var offsetY = adjacentCoords[i][1];
var finalX = pixel.x + offsetX;
var finalY = pixel.y + offsetY;
if(isEmpty(finalX,finalY,false)) {
neighbors.push([finalX,finalY])
neighbors.push(returnOffsets ? [offsetX,offsetY] : [finalX,finalY])
};
};
return neighbors
@ -93,15 +94,17 @@ function getPixelMooreNeighbors(pixel) {
return neighbors
};
function getEmptyMooreNeighbors(pixel) {
function getEmptyMooreNeighbors(pixel,returnOffsets=false) {
var neighbors = [];
var x = pixel.x;
var y = pixel.y;
for(var i = 0; i < mooreDonutCoords.length; i++) {
var finalX = pixel.x + mooreDonutCoords[i][0];
var finalY = pixel.y + mooreDonutCoords[i][1];
var offsetX = mooreDonutCoords[i][0];
var offsetY = mooreDonutCoords[i][1];
var finalX = pixel.x + offsetX;
var finalY = pixel.y + offsetY;
if(isEmpty(finalX,finalY,false)) {
neighbors.push([finalX,finalY])
neighbors.push(returnOffsets ? [offsetX,offsetY] : [finalX,finalY])
};
};
return neighbors
@ -187,17 +190,17 @@ var argonChance; if(hasArgon == true) { argonChance = ((1.204 * 0.0093) / elemen
var condensationMultiplierScaling = Math.abs(-273.15 - (-190));
function glaciliteBase(pixel,coolingAmount,minimumTemperature,cmsScaling=1.5) {
if(pixel.temp > minimumTemperature) {
if(pixel.temp - coolingAmount <= minimumTemperature) {
pixel.temp = minimumTemperature
function glaciliteBase(pixel,coolingAmount,maximumTemperature,cmsScaling=1.5) {
if(pixel.temp > maximumTemperature) {
if(pixel.temp - coolingAmount <= maximumTemperature) {
pixel.temp = maximumTemperature
} else {
pixel.temp = pixel.temp - coolingAmount;
}
};
var condensationMultiplier = 1;
if(pixel.temp < -190) { //NOT scaled to minimum temperature OR absolute zero
if(pixel.temp < -190) { //NOT scaled to maximum temperature OR absolute zero
var distanceFromNegative190 = Math.abs((-190) - pixel.temp);
condensationMultiplier = Math.max(6,1 + (distanceFromNegative190 / (condensationMultiplierScaling / cmsScaling)));
}
@ -243,7 +246,7 @@ elements.glacilite = {
breakInto: "glacilite_shard",
color: ["#17BBF6","#70A4FE","#6ADCEE","#8EA9FF"],
tempHigh: 1200,
stateHigh: "molten_glacilite",
stateHigh: "liquified_glacilite",
tick: function(pixel) {
glaciliteBase(pixel,5,-190)
}
@ -259,13 +262,13 @@ elements.glacilite_shard = {
temp: -190,
color: ["#17BBF6","#70A4FE","#6ADCEE","#8EA9FF"],
tempHigh: 1200,
stateHigh: "liquid_glacilite",
stateHigh: "liquified_glacilite",
tick: function(pixel) {
glaciliteBase(pixel,5,-190)
}
}
elements.liquid_glacilite = {
elements.liquified_glacilite = {
behavior: behaviors.LIQUID,
state: "liquid",
category: "liquids",
@ -275,21 +278,21 @@ elements.liquid_glacilite = {
hardness: 0.99,
color: ["#01BFE1","#2404C3","#0763DB","#04308F","#3AF0F3"],
tempHigh: 1200,
stateHigh: "molten_glacilite",
stateHigh: "liquified_glacilite",
tick: function(pixel) {
var minimumTemperature = (settings.abszero ?? -273.15);
var maximumTemperature = (settings.abszero ?? -273.15);
var coolingAmount = 14;
var cmsScaling = 3.5;
if(pixel.temp > minimumTemperature) {
if(pixel.temp - coolingAmount <= minimumTemperature) {
pixel.temp = minimumTemperature
if(pixel.temp > maximumTemperature) {
if(pixel.temp - coolingAmount <= maximumTemperature) {
pixel.temp = maximumTemperature
} else {
pixel.temp = pixel.temp - coolingAmount;
}
};
var condensationMultiplier = 1;
if(pixel.temp < -150) { //NOT scaled to minimum temperature OR absolute zero
if(pixel.temp < -150) { //NOT scaled to maximum temperature OR absolute zero
var distanceFromNegative190 = Math.abs((-190) - pixel.temp);
condensationMultiplier = Math.max(6,1 + (distanceFromNegative190 / (condensationMultiplierScaling / cmsScaling)));
};
@ -344,6 +347,159 @@ elements.liquid_glacilite = {
}
}
function igniscidBase(pixel,heatingAmount,minimumTemperature,nerfExponent) {
if(pixel.temp < minimumTemperature) {
if(pixel.temp + heatingAmount >= minimumTemperature) {
pixel.temp = minimumTemperature
} else {
pixel.temp = pixel.temp + heatingAmount;
}
};
var nerfFactor = 1;
if(pixel.temp > minimumTemperature) { nerfFactor = 1 / (Math.log10((pixel.temp - (minimumTemperature - 1))) + 1) ** nerfExponent };
if(Math.random() < (0.04 * nerfFactor)) { pixel.temp += heatingAmount };
var emptyNeighbors = getEmptyVonNeumannNeighbors(pixel,true);
var element = "fire";
var temp = pixel.temp;
if(pixel.temp >= 7000) {
element = "plasma";
temp = Math.max(temp,5000);
} else if(pixel.temp < 100) {
element = "smoke";
pixel.temp += 1.5;
};
for(var i = 0; i < emptyNeighbors.length; i++) {
var coords = emptyNeighbors[i];
var distance = coords.map(x => Math.abs(x)).reduce((a,b) => a + b);
coords = [coords[0]+pixel.x,coords[1]+pixel.y];
var chance = 1/distance;
var newPixel = createPixelReturn(element,...coords);
if(newPixel && (newPixel.temp < pixel.temp)) {
newPixel.temp = temp
}
}
}
elements.igniscid = {
behavior: behaviors.WALL,
state: "solid",
category: "solids",
density: 3300,
hardness: 0.44,
temp: 1200,
breakInto: "igniscid_shard",
color: ["#f68317","#f6b317","#eeea6a","#ffa38e"],
tempHigh: 11000,
stateHigh: "liquified_igniscid",
tick: function(pixel) {
igniscidBase(pixel,4,1200,1.2)
}
}
elements.igniscid_shard = {
behavior: behaviors.POWDER,
state: "solid",
category: "powders",
hidden: true,
density: 3100,
hardness: 0.89,
temp: 1200,
color: ["#f68317","#f6b317","#eeea6a","#ffa38e"],
tempHigh: 11000,
stateHigh: "liquified_igniscid",
tick: function(pixel) {
igniscidBase(pixel,4,1200,1.2)
}
}
elements.liquified_igniscid = {
behavior: behaviors.LIQUID,
state: "liquid",
category: "liquids",
hidden: true,
density: 2790,
temp: 12000,
hardness: 0.99,
color: ["#f77b0f","#e0410b","#db4a07","#f5ac7f","#f3593a"],
tick: function(pixel) {
igniscidBase(pixel,12,100000,0.5)
}
}
elements.frozen_fertilizer = {
color: ["#4d341d","#40301c","#3d2814"],
behavior: [
"CR:stench,stench,methane%0.25|CR:stench,stench,methane%0.5|CR:stench,stench,methane%0.25",
"CR:stench,stench,methane%0.5|XX|CR:stench,stench,methane%0.5",
"CR:stench,stench,methane%0.25|CR:stench,stench,methane%0.5|CR:stench,stench,methane%0.25"
],
behavior: behaviors.WALL,
tempHigh: 0,
stateHigh: "fertilizer",
category: "solids",
hardness: 0.35,
breakInto: "fertilizer",
state: "solid",
density: 1060,
stain: 0.01,
hidden: true,
},
elements.fertilizer = {
color: ["#451f0a","#542b07","#593317"],
behavior: [
"CR:stench,stench,methane%0.25|CR:stench,stench,methane%0.5|CR:stench,stench,methane%0.25",
"M2 AND CR:stench,stench,methane%0.5|XX|M2 AND CR:stench,stench,methane%0.5",
"M1|M1|M1"
],
viscosity: 8000,
tempHigh: 40,
stateHigh: ["poison","stench","methane","dried_fertilizer","dried_fertilizer","dried_fertilizer","dried_fertilizer","dried_fertilizer","dried_fertilizer","dried_fertilizer","dried_fertilizer"],
tempLow: 0,
stateLow: "frozen_fertilizer",
category: "solids",
state: "solid",
density: 1060,
stain: 0.07
},
elements.dried_fertilizer = {
color: ["#4f382b","#66462b","#704a2b"],
behavior: [
"CR:stench,stench,methane%0.15|CR:stench,stench,methane%0.3|CR:stench,stench,methane%0.15",
"CR:stench,stench,methane%0.3|XX|CR:stench,stench,methane%0.3",
"M2|M1|M2"
],
tempHigh: 100,
stateHigh: ["steam","steam","steam","steam","steam","steam","steam","steam","steam","steam","steam","steam","steam","steam","steam","steam","steam","steam","stench","poison","stench","poison","methane","methane","cooked_fertilizer","cooked_fertilizer","cooked_fertilizer","cooked_fertilizer","cooked_fertilizer","cooked_fertilizer","cooked_fertilizer","cooked_fertilizer","cooked_fertilizer","cooked_fertilizer","cooked_fertilizer","cooked_fertilizer",],
category: "solids",
state: "solid",
density: 1100,
stain: 0.045,
hidden: true
},
elements.cooked_fertilizer = {
color: ["#473931","#594636","#4f3621"],
behavior: [
"CR:stench,stench,methane%0.1|CR:stench,stench,methane%0.2|CR:stench,stench,methane%0.1",
"CR:stench,stench,methane%0.2|XX|CR:stench,stench,methane%0.2",
"M2|M1|M2"
],
tempHigh: 550,
stateHigh: ["charcoal","hydrogen","oxygen","nitrogen","sulfur_gas","metal_scrap","calcium","stench","poison_gas","steam","dust"],
category: "solids",
state: "solid",
density: 1240,
burn: 3,
burnTime: 260,
fireElement: ["stench","smoke","carbon_dioxide","poison_gas","fire","fire","fire","fire"],
burnInto: ["charcoal","hydrogen","oxygen","nitrogen","molten_sulfur","metal_scrap","calcium","stench","poison_gas","steam","dust","stench","poison_gas","smoke"],
hidden: true
},
elements.fartium = {
behavior: behaviors.LIQUID,
state: "liquid",
@ -356,7 +512,7 @@ elements.fartium = {
stateHigh: ["fire","explosion","fire","stench","stench"],
burn: 0.8,
burnTime: 150,
burnInto: ["stench","stench","stench","stench","fire","fire","fire","fire","molten_sulfur","explosion"],
burnInto: ["stench","stench","stench","stench","fire","fire","fire","fire","liquified_sulfur","explosion"],
tick: function(pixel) {
var chanceModifier = Math.min(0.22,(pixel.temp - 20) / 750);
if(chanceModifier < 0) { chanceModifier *= 2 };

145
mods/bfdi.js Normal file
View File

@ -0,0 +1,145 @@
elements.abcdefghijklmon = {
color: "#c86b8f",
name: "myblueberryseed",
behavior: behaviors.POWDER,
reactions: {
"porcelain": { elem1: "grower", elem2: "porcelain"},
},
state: "solid",
category: "bfdi",
};
elements.grower = {
color: "#00ff00",
name: "blueberry_plant",
behavior: [
"XX|CL AND CH:shower%10|XX",
"CR:blueberry%1|XX|CR:blueberry%1",
"XX|XX|XX"
],
category: "bfdi",
};
elements.blueberry = {
color: "#5500aa",
behavior: [
"XX|XX|XX",
"XX|EX:20%1|XX",
"XX|XX|XX"
],
category: "bfdi",
};
elements.shower = {
color: "#00aa00",
name: "blueberry_plant",
category: "bfdi"
};
elements.steel.breakInto = "fork"
;
elements.fork = {
color: "#999999",
ignore: "abcd",
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"M2|DL AND M1|M2"
],
state: "solid",
category: "bfdi",
};
elements.abcd = {
state: "gas",
name: "forkrepellent",
category: "bfdi",
stain: 0,
alpha: 0.4,
behavior: [
"XX|M1 AND ST|XX",
"M1 AND ST|XX|M1 AND ST",
"XX|M1 AND ST|XX"
],
};
elements.cheesecake = {
state: "solid",
behavior: behaviors.POWDER,
color: "#ccbb77",
category: "bfdi",
reactions: {
"glass_shard": { elem1: "shardcake", elem2: null }
},
};
elements.baked_batter.reactions = {}
elements.baked_batter.reactions.cheese_powder = { elem1: "cheesecake", elem2: null };
elements.shardcake = {
state: "solid",
name: "cheesecake_with_shards",
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"XX|DL%5 AND M1|XX"
],
color: Array ("#ccbb77","#5e807d"),
category: "bfdi",
};
elements.rocky = {
color: "#777777",
behavior: [
"XX|CR:barf|XX",
"CR:barf|XX|CR:barf",
"XX|CR:barf|XX"
],
category: "bfdi",
reactions: {
"lava_barf": { elem1: null, elem2: "zombie_rocky" }
},
};
elements.barf = {
color: "#008800",
category: "bfdi",
ignore: Array("rocky", "zombie_rocky","cured_rocky"),
state: "liquid",
behavior: [
"XX|XX|XX",
"M2|XX|M2",
"M2|DL%30 AND M1|M2"
],
tempHigh: 800,
stateHigh: "lava_barf",
reactions: {
"lava": { elem1: "lava_barf", elem2: null }
},
};
elements.lava_barf = {
color: "#ffaa00",
glow: 1,
state: "liquid",
ignore: Array("zombie_rocky","rocky","cured_rocky"),
behavior: [
"XX|CH:rocky>zombie_rocky AND CH:barf>lava_barf%5|XX",
"M2 AND CH:rocky>zombie_rocky AND CH:barf>lava_barf%5|XX|M2 AND CH:rocky>zombie_rocky AND CH:barf>lavabarf%5",
"XX|CH:rocky>zombie_rocky AND CH:barf>lava_barf%5 AND M1|XX"
],
category: "bfb",
};
elements.zombie_rocky = {
color: "#005500",
category: "bfdi",
behavior: [
"XX|CH:rocky>zombie_rocky AND CR:lava_barf|XX",
"CH:rocky>zombie_rocky AND CR:lava_barf|XX|CH:rocky>zombie_rocky AND CR:lava_barf",
"XX|CH:rocky>zombie_rocky AND CR:lava_barf|XX"
],
reactions: {
"water": { elem1: null, elem2: "cured_rocky" }
},
};
elements.cured_rocky = {
color: "#777777",
category: "bfdi",
behavior: [
"XX|CR:barf AND CH:zombie_rocky>cured_rocky|XX",
"CR:barf AND CH:zombie_rocky>cured_rocky|XX|CR:barf AND CH:zombie_rocky>cured_rocky",
"XX|CR:barf AND CH:zombie_rocky>cured_rocky|XX"
],
reactions: {
"zombie_rocky": { elem1: "cured_rocky", elem2: "cured_rocky" }
},
};

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
// coded by suss, so the code probably sucks
// lmao it only adds three elements, actually this is my first mod that even ADDS elements
// wait, nobody even reads the mod code, so im essentially talking to myself
// oh well :(
elements.bromine = {
color: "#4e0e00",
behavior: [
"XX|CR:bromine_vapor%5|XX",
"M2|XX|M2",
"XX|M1|XX",
],
category: "liquids",
viscosity: 1.5,
state: "liquid",
density: 3102,
tempLow: -7,
stateLow: "bromine_ice",
};
elements.bromine_ice = {
color: "#350900",
behavior: behaviors.WALL,
category: "states",
state: "solid",
density: 3102,
tempHigh: -7,
stateHigh: "bromine",
temp: -10,
hidden: true,
};
elements.bromine_vapor = {
color: "#d48846",
behavior: behaviors.GAS,
category: "gases",
state: "gas",
density: 7.59,
hidden: true,
}

32
mods/chaos.js Normal file
View File

@ -0,0 +1,32 @@
function getRandomSize(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function randomizeall() {
const elements = document.querySelectorAll('*');
elements.forEach(element => {
const randomFontSize = getRandomSize(1, 150);
element.style.fontSize = `${randomFontSize}px`;
if (element.offsetWidth > 0 && element.offsetHeight > 0) {
const randomWidth = getRandomSize(1, 500);
const randomHeight = getRandomSize(1, 500);
element.style.width = `${randomWidth}px`;
element.style.height = `${randomHeight}px`;
}
if (window.getComputedStyle(element).position === 'absolute' || window.getComputedStyle(element).position === 'relative') {
const randomTop = getRandomSize(1, window.innerHeight - 1);
const randomLeft = getRandomSize(1, window.innerWidth - 1);
element.style.position = 'absolute';
element.style.top = `${randomTop}px`;
element.style.left = `${randomLeft}px`;
}
const randomRotation = getRandomSize(-360, 360);
element.style.transform = `rotate(${randomRotation}deg)`;
});
}
setTimeout(randomizeall, 15000);

494
mods/charsonsmodbeta.js Normal file
View File

@ -0,0 +1,494 @@
//it would be cool to put this on the website :D
//thanks r74n and sandboxels mod devs for the idea for making this and adding so much value to my gaming experience
//if one needs a desc for the mod list on the website it'd be something around "charson's mods compiled such as random foods and random elements asked for by random people, beta"
//thanks!
elements.syrup = {
color: "#a13d08",
behavior: behaviors.LIQUID,
category: "liquids",
viscosity: 100000,
state: "liquid",
density: 720,
isFood: true,
desc: "maple syrup",
reactions: {
"head": { elem1: null, elem2:"head" },
}
};
elements.akshajium = {
color: ["#a8160c", "#fdff94", "#d47d20"],
behavior: behaviors.POWDER,
category: "food",
viscosity: 10000,
state: "solid",
density: 100,
desc: "its pizza",
reactions: {
"head": { elem1: null, elem2:"head" },
}
};
elements.brioche_steam = {
color: "#ab8c60",
behavior: behaviors.GAS,
category: "gases",
state: "gas",
density: 720,
temp: 80,
tempLow: 30,
desc: "how does this make any sense?",
stateLow: ["brioche"],
isFood: true,
};
elements.fancy_dough = {
color: "#d1c0a5",
behavior: behaviors.LIQUID,
category: "liquids",
viscosity: 999999,
state: "liquid",
density: 720,
temp: 30,
tempHigh: 50,
stateHigh: ["steam", "brioche_steam"],
desc: "it can be evaporated",
reactions: {
"head": { elem1: null, elem2:"head" },
}
};
elements.brioche = {
color: ["#c2770e", "#b06227"],
behavior: behaviors.STURDYPOWDER,
category: "food",
temp: 30,
tempHigh: 80,
tempLow: 10,
stateHigh: ["fragrance", "ash"],
stateLow: ["cold_brioche"],
burn: 55,
isFood: true,
breakInto: "fancy_flour",
reactions: {
"head": { elem1: null, elem2:"head" },
}
};
elements.aresium = {
color: "#1017ad",
behavior: behaviors.WALL,
category: "solids",
temp: 19,
tempHigh: 100,
tempLow: -20,
stateHigh: ["skibidi_aresium"],
stateLow: ["magma", "electric"],
desc: "it's a transition metal named after mars",
burn: 0,
conduct: 1,
};
elements.skibidi_aresium = {
color: "#ad1051",
behavior: behaviors.MOLTEN,
category: "states",
temp: 100,
tempHigh: 153,
stateHigh: ["tnt", "molten_iron", "copper", "explosion"],
burn: 0,
conduct: 1,
};
elements.cold_brioche = {
color: "#5f7a8c",
behavior: behaviors.WALL,
category: "states",
temp: 5,
tempHigh: 30,
stateHigh: ["brioche"],
};
elements.fancy_flour = {
color: "#f5e9b5",
behavior: behaviors.POWDER,
category: "powders",
temp: 20,
tempHigh: 70,
burn: 70,
stateHigh: ["fragrance", "smoke"],
};
//thanks to the creator of stickyslime.js for this code
elements.syrup.behavior = [
"XX|ST|XX",
"ST AND M2|XX|ST AND M2",
"XX|ST AND M1|XX",
];
elements.briochify = {
color: ["#c2770e", "#ff0000", "#00ff00", "#0000ff", "#ffdec4"],
tool: function(pixel) {
if (pixel.element == "bread") {
pixel.element = "brioche"
}
if (pixel.element == "flour") {
pixel.element = "fancy_flour"
}
if (pixel.element == "dough") {
pixel.element = "fancy_dough"
}
if (pixel.element == "steam") {
pixel.element = "brioche_steam"
}
if (pixel.element == "kai_cenat") {
pixel.element = "brioche"
}
},
category: "tools",
};
elements.pyrane = {
color: "#fc7c19",
behavior: behaviors.GAS,
category: "gases",
state: "gas",
temp: 50,
desc: "this is a ripoff of nitrogen gas",
tempLow: -20,
stateLow: ["fyrium"],
reactions: {
"ash": { elem1: null, elem2:"pyric_nitrite" },
"dirt": { elem1:"pyrane", elem2:"fire" },
"hydrogen": { elem1:"hydroid", elem2:"hydroid" },
}
};
elements.pyric_nitrite = {
color: "#b3270e",
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
temp: 20,
conduct: 1,
desc: "not to be confused with iron pyrite or anything like that",
reactions: {
"iron": { elem1:"pyric_nitrite", elem2:"pyric_rust" },
"oil": { elem1: null, elem2:"nitrol_fuel" },
"electric": { elem1:["fire", "nitrogen", "stench", "electric", "explosion"], elem2:"fire" },
"shock": { elem1:["fire", "nitrogen", "stench", "electric", "explosion"], elem2:"fire" },
}
};
elements.pyric_rust = {
color: "#913e17",
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
temp: 20,
reactions: {
"steel": { elem1: null, elem2:"tnt" }
}
};
elements.fyrium = {
color: "#ffa930",
behavior: behaviors.WALL,
category: "solids",
state: "solid",
temp: 20,
tempHigh: 137,
stateHigh: ["molten_fyrium"],
breakInto: ["fire"],
};
elements.molten_fyrium = {
color: "#ffffff",
behavior: behaviors.MOLTEN,
category: "states",
temp: 137,
tempLow: -20,
stateLow: ["fyrium"],
reactions: {
"water": { elem1:"fire", elem2:"water" }
}
};
elements.nitrol_fuel = {
color: "#4f180e",
behavior: behaviors.LIQUID,
category: "liquids",
state: "liquid",
temp: 20,
reactions: {
"wood": { elem1: null, elem2:"fueled_wood" },
}
};
elements.fueled_wood = {
color: "#631608",
behavior: behaviors.WALL,
category: "weapons",
state: "solid",
temp: 20,
tempHigh: 30,
stateHigh: ["rocket", "pyrane", "nitrol_fuel", "explosion", "stench"],
reactions: {
"fire": { elem1:["rocket", "pyrane", "nitrol_fuel", "explosion", "stench"], elem2:["rocket", "pyrane", "nitrol_fuel", "explosion", "stench"] },
}
};
elements.hydroid = {
color: "#3a0ca6",
behavior: behaviors.LIQUID,
category: "liquids",
state: "liquid",
temp: 20,
tempHigh: 100,
density: 12,
conduct: 1,
desc: "this is NOT water",
stateHigh: ["pyrane", "steam"],
reactions: {
"fire": { elem1: "hydroid", elem2:"explosion" },
"body": { elem1: "hydroid", elem2:"fyrium" },
"head": { elem1: "hydroid", elem2:"pyrane" },
"water": { elem1: "hydroid", elem2:"hydroid" },
"syrup": { elem1: "hydroid", elem2:"hydroid" },
"magma": { elem1: "hydroid", elem2:"hydroid" },
"oil": { elem1: "hydroid", elem2:"hydroid" },
"juice": { elem1: "hydroid", elem2:"hydroid" },
"syrup": { elem1: "hydroid", elem2:"hydroid" },
}
};
//by someone named spencer
elements.kai_cenat = {
color: "#e00b0b",
behavior: behaviors.STURDYPOWDER,
category: "special",
state: "solid",
desc: "wow",
conduct: 1,
desc: "someone named spencer told me to add this",
};
elements.kai_cenat.behavior = [
["XX","CH:kai_cenat","XX"],
["CH:kai_cenat","XX","CH:kai_cenat"],
["M2","M1 AND CH:kai_cenat","M2"]
];
elements.kai_eraser = {
color: ["e00b0b", "#ff0000", "#00ff00", "#0000ff"],
tool: function(pixel) {
if (pixel.element == "kai_cenat") {
pixel.element = "foam"
}
},
category: "tools",
};
//ok this is the skibididdy mod part
elements.tocopherol = {
color: "#094237",
behavior: behaviors.POWDER,
category: "powders",
viscosity: 10000,
state: "solid",
density: 100,
reactions: {
"sodium_acetate": { elem1:"tocopheryl_acetate", elem2:"sodium" },
}
};
elements.freakium = {
color: "#ff4fed",
behavior: behaviors.DGAS,
category: "gases",
state: "gas",
density: 720,
temp: 80,
tempLow: 30,
reactions: {
"head": { elem1:"baby_oil", elem2:"meat" },
"body": { elem1:"baby_oil", elem2:"meat" },
}
};
elements.tocopheryl_gas = {
color: "#96e3d4",
behavior: behaviors.GAS,
category: "gases",
state: "gas",
density: 720,
temp: 80,
tempLow: 0,
stateLow: ["tocopherol"],
};
elements.tocopheryl_acetate = {
color: "#cffdff",
behavior: behaviors.LIQUID,
category: "liquids",
viscosity: 999999,
state: "liquid",
density: 720,
temp: 30,
tempHigh: 96,
stateHigh: ["tocopheryl_gas"],
reactions: {
"oil": { elem1:"baby_oil", elem2:"baby_oil" },
}
};
elements.diddium = {
color: ["#210742", "#9e20d4"],
behavior: behaviors.STURDYPOWDER,
category: "powders",
temp: 30,
tempHigh: 80,
tempLow: 10,
reactions: {
"diddium": { elem1:"diddium", elem2:"stable_diddium" },
}
};
elements.stable_diddium = {
color: ["#210742", "#9e20d4"],
behavior: behaviors.WALL,
category: "states",
temp: 30,
tempHigh: 80,
tempLow: 10,
reactions: {
"diddium": { elem1:"freakium", elem2:"diddium" },
"stable_diddium": { elem1:"diddium", elem2:"baby_oil" },
}
};
elements.baby_oil = {
color: "#ffeecc",
behavior: behaviors.LIQUID,
category: "liquids",
temp: 30,
tempHigh: 96,
stateHigh: ["tocopheryl_gas"],
reactions: {
"uranium": { elem1: null, elem2:"diddium" },
"diddium": { elem1:"stable_diddium", elem2:"freakium" },
}
};
elements.stupidine = {
color: "#4e4b75",
behavior: behaviors.STURDYPOWDER,
category: "solids",
state: "solid",
temp: 20,
tempHigh: 137,
stateHigh: "liquid_stupidine",
tempLow: -31,
stateLow: "activated_stupidine",
reactions: {
"stupidine": { elem1: "stupidine", elem2:"fragrance" },
}
};
elements.liquid_stupidine = {
color: ["#5328c9", "4089e3"],
behavior: behaviors.AGLIQUID,
category: "liquids",
state: "liquid",
temp: 140,
tempHigh: 500,
stateHigh: "stupidine_gas",
tempLow: 25,
stateLow: "skibidine",
reactions: {
"liquid_stupidine": { elem1:"liquid_stupidine", elem2:"slime" },
}
};
elements.stupidine_gas = {
color: "#802d3a",
behavior: behaviors.GAS,
category: "gases",
state: "gas",
temp: 500,
tempHigh: 1000,
stateHigh: ["nuke", "explosion"],
tempLow: 200,
stateLow: "liquid_stupidine",
reactions: {
"stupidine_gas": { elem1:"stupidine_gas", elem2:"stench" },
}
};
elements.activated_stupidine = {
color: "#3d2f61",
behavior: behaviors.WALL,
category: "solids",
state: "solid",
temp: 20,
reactions: {
"stupidine": { elem1:"explosion", elem2:"explosion" },
}
};
elements.skibidi_soda = {
color: "#3279a8",
behavior: behaviors.LIQUID,
category: "liquids",
state: "liquid",
tempHigh: 100,
stateHigh: ["skibidiness", "skibidine"],
reactions: {
"oxygen": { elem1:"skibidi_soda", elem2:"skibidiness" },
"head": { elem1: "skibidiness", elem2:"head" },
}
};
elements.skibidine = {
color: ["#51649c", "949c51"],
behavior: behaviors.LIQUID,
category: "liquids",
state: "liquid",
reactions: {
"carbon_dioxide": { elem1:"skibidi_soda", elem2:"skibidi_soda" },
"iron": { elem1: "magma", elem2:"stupidine" },
}
};
elements.skibidiness = {
color: "#567de8",
behavior: behaviors.GAS,
category: "gases",
state: "gas",
temp: 20,
reactions: {
"water": { elem1:"skibidiness", elem2:"skibidi_soda"},
}
};
//idk how these work and most of them don't idk why but this is just a beta so...
elements.melted_butter.reactions.bread = { "elem1": null, "elem2":"brioche" },
elements.water.reactions.fancy_flour = { "elem1": null, "elem2":"fancy_dough" },
elements.wood.reactions.nitrol_fuel = { "elem1":"fueled_wood", "elem2": null },
elements.brioche.breakInto = "fancy_flour";
elements.fyrium.breakInto = "fire";
elements.fire.reactions.nitrogen = { "elem1": null, "elem2": "pyrane" },
elements.ash.reactions.pyrane = { "elem1":"pyric_nitrite", "elem2": null },
elements.oil.reactions.pyric_nitrite = { "elem1":"nitrol_fuel", "elem2": null },
elements.hydrogen.reactions.pyrane = { "elem1":"hydroid", "elem2": null },
elements.fire.reactions.fueled_wood = { "elem1": "fire", "elem2": ["rocket", "pyrane", "nitrol_fuel", "explosion", "stench"] };
elements.water.reactions.molten_fyrium = { "elem1": null, "elem2":["fire", "explosion"] },
elements.brioche.breakInto = "fancy_flour";
elements.fyrium.breakInto = "fire";

14
mods/children.js Normal file
View File

@ -0,0 +1,14 @@
elements.child = {
color: "#ffaa55",
behavior: [
"M2|M2|M2",
"M2|XX|M2",
"XX|M1|XX"
],
tempHigh: 100,
stateHigh: "cooked_meat",
category: "life",
reactions: {
"herb": { elem1: "blood", elem2: "explosion"}
},
};

31
mods/cs_expanded.js Normal file
View File

@ -0,0 +1,31 @@
// Made by Kopalecek (also known as davistudios or sylas)
/*
If you would want to use this to make stuff like de_expanded.js, just put "Based off cs_expanded" in a comment at the top. And remove the previous comments in general.
Ryan, if you see this, it would be great if you add ids for stuff like controls, the "Sandboxels Introduction" or menu items in like settings or mods.
*/
const reqCode = 'cs' // Change this to the lang code you want.
const menu = { // Just change the values in this.
pauseButton: 'Pauza',
resetButton: 'Reset',
replaceButton: 'Nahradit',
elemSelectButton: 'VE',
tpsButton: 'TZS',
infoButton: 'Info',
savesButton: 'Uložené',
modsButton: 'Módy',
settingsButton: 'Nastavení',
changelogButton: 'Změny',
}
if (langCode == reqCode) {
Object.keys(menu).forEach(key => {
document.getElementById(key).textContent = menu[key]
})
}

41
mods/dalgonacandy.js Normal file
View File

@ -0,0 +1,41 @@
elements.dalgona = {
desc: "Dalgona candy from Squid Game",
color: "#c49543",
behavior: behaviors.WALL,
category: "food",
state: "solid",
isFood: true,
tempHigh: 400,
stateHigh: "smoke",
tempLow: -20,
stateLow: "salted_caramel",
breakInto: "salted_sugar",
};
elements.salted_caramel = {
color: "#c48537",
behavior: behaviors.POWDER,
category: "food",
state: "solid",
isFood: true,
tempHigh: 400,
temp: -20,
stateHigh: "smoke",
tempLow: -50,
stateLow: "candy",
breakInto: "salted_sugar",
};
elements.salted_sugar = {
color: "#fcfcfc",
behavior: behaviors.POWDER,
category: "food",
state: "solid",
isFood: true,
tempHigh: 170,
temp: -20,
stateHigh: "salted_caramel",
};
elements.sugar.reactions.salt = { elem1:"salted_sugar", elem2: null };
elements.caramel.reactions.salt = { elem1:"salted_caramel", elem2: null };
elements.caramel.reactions.baking_soda = { elem1:"dalgona", elem2: null };

1133
mods/debrisable.js Normal file

File diff suppressed because it is too large Load Diff

70
mods/deneme.js Normal file
View File

@ -0,0 +1,70 @@
elements.carbonite = {
color: "#343634",
behavior: behaviors.WALL,
category: "star wars",
state: "solid",
density: 1000,
tempHigh: 1000,
stateHigh: "carbondioxide",
reactions:{
"acid": {elem1: null, elem2: "slag"},
}
};
elements.light_saber = {
color: "#06d106",
behavior: behaviors.WALL,
category: "star wars",
state: "solid"
}
// look it up:
// https://starwars.fandom.com/wiki/Plastoid
// stormtrooper armor
elements.plastoid = {
color: "#FFAAAA",
behavior: behaviors.WALL,
category: "star wars",
state: "solid",
density: 400,
tempHigh: 300,
stateHigh: "molten_plastic",
hardness: 1,
burn: 0
};
elements.green_milk ={
color: "#95f595",
behavior: behaviors.LIQUID,
category: "star wars",
state: "liquid",
viscosity: 100,
density: 720,
};
elements.laser_blast = {
color: "#ff0000",
behavior: behaviors.BOUNCY,
category: "star wars",
};
elements.tibanna_gas ={
color: "#d99a9a",
behavior: behaviors.GAS,
category: "star wars",
burn: 100,
burnTime: 1,
}
elements.milk_water = {
color: "#e4fade",
behavior: behaviors.LIQUID,
category: "star wars",
hidden: true,
viscosity: 90,
state: "liquid",
density: 1,
};
elements.water.reactions.green_milk = {elem1: null, elem2: "milk_water"}

File diff suppressed because it is too large Load Diff

View File

@ -292,6 +292,7 @@ if (enabledMods.includes("mods/betterMenuScreens.js")) {
}
const changes = Storage.get("changes", []);
for (const change of changes) {
if (!elements[change.element]) continue;
for (const key of Object.keys(change.changes)) {
let c = change.changes[key];
if (key == "behavior" && Object.keys(behaviors).includes(c)) c = behaviors[c];

30
mods/heatshield.js Normal file
View File

@ -0,0 +1,30 @@
elements.ablative_shield = {
color: "#d6999c",
behavior: behaviors.WALL,
category: "solids",
state: "solid",
tempHigh: 2760,
stateHigh: "smoke",
conduct: 0.01,
};
elements.molten_reusable = {
color: "#ff9900",
behavior: behaviors.MOLTEN,
category: "states",
state: "liquid",
hidden: 1,
temp: 1261,
tempLow: 1259,
stateLow: "reusable_shield",
};
elements.reusable_shield = {
color: "#3c3c3c",
behavior: behaviors.WALL,
category: "solids",
state: "solid",
tempHigh: 1260,
stateHigh: "molten_reusable",
conduct: 0.01,
};
elements.plasma.temp = 2800
;

217
mods/mars.js Normal file
View File

@ -0,0 +1,217 @@
elements.mars_gunk = {
color: "#121212",
behavior: behaviors.DGAS,
category: "archived",
state: "gases",
extraInfo: "GUNK",
stain: 0.7
}
elements.mars_dust = {
color: ["#ab2a20","#c53227"],
behavior: behaviors.POWDER,
category: "mars",
state: "solid",
density: 1602,
tempHigh: 500,
hardness: 0.975,
stateHigh: "molten_mars",
tempLow: -170,
stateLow: "mars_rock",
extraInfo: "Dust Samples from mars. Can freeze into Mars Rock."
}
elements.molten_mars = {
color: "#ffc338",
behavior: behaviors.MOLTEN,
category: "mars",
state: "liquid",
hidden: "true",
extraInfo: "The Result of Burnt-up mars stuff. Some turn into this faster more than others.",
temp: 2500
}
elements.mars_rock = {
color: ["#a51002","#bd1102"],
behavior: behaviors.STURDYPOWDER,
category: "mars",
state: "solid",
density: 1605,
tempHigh: 800,
hardness: 0.75,
stateHigh: "molten_mars",
breakInto: "mars_dust",
tempLow: -273,
stateLow: "mars_rock_wall",
extraInfo: "The Freezing of Mars Dust. Can be used for normal land."
}
elements.support_mars_rock = {
color: ["#a51002","#bd1102"],
behavior: behaviors.SUPPORTPOWDER,
category: "mars",
state: "solid",
density: 800,
tempHigh: 150,
hardness: 0.9,
stateHigh: "molten_mars",
breakInto: "mars_rock",
hidden: "true",
extraInfo: "Mars Rock but Support Powder."
}
elements.mars_rock_wall = {
color: ["#591813","#bd1102"],
behavior: behaviors.WALL,
category: "mars",
state: "solid",
density: 20,
tempHigh: 2500,
hardness: 0.35,
stateHigh: "mars_dust",
breakInto: "mars_rock",
extraInfo: "The Freezing of Mars Rock. A wall that keeps the Earthlings Away!"
}
elements.mars_ironheart_ore = {
color: ["#e8e8e8", "#bd1102"],
behavior: behaviors.WALL,
category: "mars",
state: "solid",
density: 2500,
tempHigh: 2500,
hardness: 0.15,
stateHigh: "mars_dust",
breakInto: "mars_ironheart",
extraInfo: "Ore. Very Soft",
stateHigh: "ironheart"
}
elements.mars_ironheart = {
color: ["#e8e8e8", "#bd1102"],
behavior: behaviors.STURDYPOWDER,
category: "mars",
state: "solid",
density: 1500,
tempHigh: 2500,
hardness: 1,
stateHigh: "molten_mars",
extraInfo: "Mars Stuff.",
hidden: "true",
reactions: {
"mars_furnace": { elem1: "ironheart", elem2: "ironheart" },
"nosmoker": { elem1: "ironheart", elem2: "ironheart" }, },
}
elements.mars_furnace = {
color: ["#870002","#870507"],
behavior: [
"XX|CR:mars_gunk%8|XX",
"XX|XX|XX",
"XX|XX|XX",
],
category: "archived",
state: "solid",
hardness: 0.6,
stateHigh: "molten_mars",
extraInfo: "Used to turn Ironheart into Ironheart Solids"
}
elements.nosmoker = {
color: ["#870002", "#870507"],
behavior: behaviors.WALL,
category: "mars",
state: "solid",
extraInfo: "Used to turn Ironheart into Ironheart Solids"
}
elements.ironheart = {
color: "#e9825a",
behavior: [
"SA|XX|SA|",
"XX|XX|XX|",
"M1|M1|M1|",
],
category: "mars",
density: 1450,
state: "solid",
stateHigh: "molten_mars",
extraInfo: "Very Sturdy."
}
elements.antigunk = {
color: "#cecece",
behavior: behaviors.DGAS,
category: "archived",
state: "gas",
extraInfo: "GUNK",
stain: -0.7
}
elements.red_gold_powder = {
color: ["#e27b58", "#bd1102"],
behavior: behaviors.POWDER,
category: "mars",
state: "solid",
tempHigh: 750,
stateHigh: "red_gold",
extraInfo: "Powder Which can turn into Red Gold.",
density: 1602
}
elements.red_gold = {
color: ["#D20103", "#E4080A", "#EFC3CA"],
behavior: behaviors.POWDER,
category: "mars",
state: "solid",
density: 1350,
hardness: 0.7,
breakInto: "mars_dust",
tempHigh: 4500,
stateHigh: "liquid_red_gold",
extraInfo: "Red Gold.",
}
elements.liquid_red_gold = {
color: ["#D201A4", "#E4081B"],
behavior: behaviors.LIQUID,
category: "mars",
state: "liquid",
density: 8,
extraInfo: "Red Gold but a fludid.",
temp: 5500
}
elements.liquid_mars_dust = {
color: "#DB3629",
behavior: behaviors.LIQUID,
category: "archived",
state: "liquid",
extraInfo: "Mars Dust Fluid. Removed 04/02/25."
}
elements.testy = {
color: "#FFFFFF",
behavior: behaviors.WALL,
category: "archived",
state: "solid",
extraInfo: "Don't mind me, just a test. Removed 06/02/25?"
}
elements.legacy_liquid_mars_dust = {
color: "#DB3629",
behavior: behaviors.SUPERFLUID,
category: "archived",
state: "liquid",
extraInfo: "Mars Dust Superfluid. Changed at the start."
}
elements.o2_tank = {
color: "#98F5F9",
behavior: [
"CR:oxygen%3|XX|XX",
"XX|XX|XX",
"XX|XX|XX",
],
category: "mars",
state: "solid",
}
// 1.4.7
// most elements done :D
// iron heart ore
// iron heart
// GUNK
// furnace
//anti gunk
// new mars and gunk catagory
// made things sink
//changes
// ryan pushed it thx ryan
// removing mars_furnace so yeah
// no anti gunk or gunk anymore
// im putting in the archive
// lil changes
// inroducing oxygen tanks!

View File

@ -784,9 +784,8 @@ if(enabledMods.includes(changeTempMod) && enabledMods.includes(runAfterAutogenMo
});
} else {
if(!enabledMods.includes(changeTempMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,changeTempMod) };
if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) };
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}", "${libraryMod}", and "${onTryMoveIntoMod}" mods are required; any missing mods in this list have been automatically inserted (reload for this to take effect).`);
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).`);
};

View File

@ -95,13 +95,3 @@ elements.note_block = {
};
},
};
runAfterLoad(function() {
elements.note_block.movable = false;
});
if(runAfterAutogen) {
runAfterAutogen(function() {
elements.note_block.movable = false;
});
};

View File

@ -662,17 +662,12 @@ if(enabledMods.includes(libraryMod)) {
minecraftModEnabled = true
}
//maxColorOffset will only be applied if maxColorOffset.js is enabled
elements.silk_velvet = {
color: ["#edece8", "#ede7e4"],
maxColorOffset: 7,
category: "land",
grain: 0.5,
category: "solids",
state: "solid",
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"XX|M1|XX",
],
behavior: behaviors.STURDYPOWDER,
burnInto: "ash",
burn:72,
burnTime:25,
@ -681,15 +676,11 @@ if(enabledMods.includes(libraryMod)) {
elements.red_velvet = {
color: ["#a80508", "#b30b0e"],
maxColorOffset: 7,
category: "land",
grain: 0.5,
category: "solids",
state: "solid",
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"XX|M1|XX",
],
tick: function() { //alias for velvet that is red
behavior: behaviors.STURDYPOWDER,
tick: function(pixel) { //alias for velvet that is red
pixel.element = "silk_velvet";
},
burnInto: "ash",

25
mods/ru_expanded.js Normal file
View File

@ -0,0 +1,25 @@
// Based off cs_expanded
// Made by Kopalecek (also known as davistudios or sylas) and Bufka2011
const reqCode = 'ru' // Change this to the lang code you want.
const menu = { // Just change the values in this.
pauseButton: 'Пауза',
resetButton: 'Сброс',
replaceButton: 'Замена',
elemSelectButton: 'Э',
tpsButton: 'TPS',
infoButton: 'Инфо',
savesButton: 'Сохранения',
modsButton: 'Моды',
settingsButton: 'Настройки',
changelogButton: 'Чейнджлог',
}
if (langCode == reqCode) {
Object.keys(menu).forEach(key => {
document.getElementById(key).textContent = menu[key]
})
}

View File

@ -1,900 +1 @@
function runAfterAutogen(func) {
runAfterAutogenList.push(func);
};
function runAfterButtons(func) {
runAfterButtonsList.push(func);
};
runAfterAutogenList = [];
runAfterButtonsList = [];
function behaviorStringsToArrays() {
for (var behavior in behaviors) {
if (typeof behaviors[behavior][0] === "string") {
var newbehavior = [];
for (var i = 0; i < behaviors[behavior].length; i++) {
newbehavior.push(behaviors[behavior][i].split("|"));
}
behaviors[behavior] = newbehavior;
}
}
}
function tripletsToRgbAndGenerateColorObjects() {
for (var key in elements) {
if (elements.hasOwnProperty(key)) {
// if the element has no color, skip it
if (elements[key].color === undefined) {
continue;
}
// if the color is an array, loop over each one
if (elements[key].color instanceof Array) {
var rgbs = [];
var rgbos = [];
for (var i = 0; i < elements[key].color.length; i++) {
var c = elements[key].color[i];
if (c.startsWith("#")) {
var rgb = hexToRGB(c);
rgbs.push("rgb("+rgb.r+","+rgb.g+","+rgb.b+")");
rgbos.push(rgb);
}
else {
rgbs.push(c);
}
}
elements[key].color = rgbs;
elements[key].colorObject = rgbos;
} else {
// if elements[key].color starts with #
if (elements[key].color.startsWith("#")) {
var rgb = hexToRGB(elements[key].color);
elements[key].color = "rgb("+rgb.r+","+rgb.g+","+rgb.b+")";
elements[key].colorObject = rgb;
}
}
}
}
}
// Automatic molten element generation
// Moved above the exposed autoGenAllElements for ReferenceError purposes
function autoGen(newname,element,autoType) {
var autoInfo = autoElements[autoType];
var newcolor = elements[element].colorObject;
var colorList = [];
var colorObjectList = [];
// if newcolor is not an array, put it in an array
if (!(newcolor instanceof Array)) { newcolor = [newcolor]; }
// for every color in the newcolor array, add a new color with the same value, but with the r and g values increased
for (var i = 0; i < newcolor.length; i++) {
var c = newcolor[i];
for (var j = 0; j < autoInfo.rgb.length; j++) {
var newc = autoInfo.rgb[j];
r = Math.floor(c.r * newc[0]);
g = Math.floor(c.g * newc[1]);
b = Math.floor(c.b * newc[2]);
if (r > 255) {r = 255;} if (g > 255) {g = 255;}
colorList.push("rgb("+r+","+g+","+b+")");
colorObjectList.push({r:r,g:g,b:b});
}
}
var newelem = {
//"name": newname.replaceAll("_"," "),
behavior: autoInfo.behavior,
hidden: autoInfo.hidden || false,
state: autoInfo.state || "solid",
category: autoInfo.category || "states",
}
if (colorList.length <= 1) { colorList = colorList[0]; }
if (colorObjectList.length <= 1) { colorObjectList = colorObjectList[0]; }
newelem.color = colorList;
newelem.colorObject = colorObjectList;
var multiplier = 1.1;
if (autoInfo.type === "high") {
if (!elements[element].stateHigh) {elements[element].stateHigh = newname;}
newelem.temp = elements[element].tempHigh;
newelem.tempLow = elements[element].tempHigh+(autoInfo.tempDiff || 0);
newelem.stateLow = element;
// Change density by *0.9
if (elements[element].density) { newelem.density = Math.round(elements[element].density * 0.9 * 10) / 10; }
}
else if (autoInfo.type === "low") {
if (!elements[element].stateLow) {elements[element].stateLow = newname;}
newelem.temp = elements[element].tempLow;
newelem.tempHigh = elements[element].tempLow+(autoInfo.tempDiff || 0);
newelem.stateHigh = element;
multiplier = 0.5;
// Change density by *1.1
if (elements[element].density) { newelem.density = Math.round(elements[element].density * 1.1 * 10) / 10; }
}
if (!elements[element].ignore) { elements[element].ignore = [] }
elements[element].ignore.push(newname);
if (elements[element].viscosity || autoInfo.viscosity) {
newelem.viscosity = elements[element].viscosity || autoInfo.viscosity;
}
// Change by *multiplier
if (elements[element].conduct) { newelem.conduct = Math.round(elements[element].conduct * multiplier * 10) / 10; }
if (elements[element].burn) { newelem.burn = Math.round(elements[element].burn * multiplier * 10) / 10; }
if (elements[element].burnTime) { newelem.burnTime = Math.round(elements[element].burnTime * multiplier * 10) / 10; }
if (elements[element].burnInto) { newelem.burnInto = elements[element].burnInto; }
if (elements[element].fireColor) { newelem.fireColor = elements[element].fireColor; }
// If the new element doesn't exist, add it
if (!elements[newname]) { elements[newname] = newelem; }
else {
// Loop through newelem's keys and values, copy them to the new element if they are not already defined
for (var key in newelem) {
if (elements[newname][key] == undefined) { elements[newname][key] = newelem[key]; }
}
}
if (autoType === "molten" && (elements.molten_slag && elements.molten_slag.ignore && elements.molten_slag.ignore.indexOf(element) === -1)) { // Slag reactions
if (newname !== "molten_slag") {
if (!elements[newname].reactions) { elements[newname].reactions = {}; }
elements[newname].reactions.ash = { "elem1":null, "elem2":"molten_slag" };
elements[newname].reactions.dust = { "elem1":null, "elem2":"molten_slag" };
elements[newname].reactions.magma = { "elem1":null, "elem2":"molten_slag" }
};
}
}
function autoGenAllElements() {
for (element in elements) {
if (elements[element].tempHigh!==undefined && (elements[element].stateHigh===undefined||elements[element].forceAutoGen)) {
var newname = elements[element].stateHighName;
if ((elements[element].state==="solid" || !elements[element].state)) { // Melting
if (!newname) { newname = "molten_"+element }
autoGen(newname,element,"molten");
}
else if (elements[element].state==="liquid") { // Evaporating
if (!newname) {
newname = element;
if (newname.startsWith("liquid_")) { newname = newname.substring(7); }
if (newname.startsWith("molten_")) { newname = newname.substring(7); }
newname += "_gas";
}
autoGen(newname,element,"evaporate");
}
}
if (elements[element].tempLow!==undefined && (elements[element].stateLow===undefined||elements[element].forceAutoGen)) {
var newname = elements[element].stateLowName;
if (elements[element].state==="liquid") { // Freezing
if (!newname) {
newname = element;
if (newname.startsWith("liquid_")) { newname = newname.substring(7); }
if (newname.endsWith("_water")) { newname = newname.substring(0,newname.length-6); }
newname += "_ice";
}
autoGen(newname,element,"frozen");
}
else if (elements[element].state==="gas") { // Condensing
if (!newname) {
newname = element;
if (newname.endsWith("_gas")) { newname = newname.substring(0,newname.length-4); }
newname = "liquid_"+newname;
}
autoGen(newname,element,"condense");
}
}
if (elements[element].behavior && typeof elements[element].behavior[0] === "string") {
var newbehavior = [];
for (var i = 0; i < elements[element].behavior.length; i++) {
newbehavior.push(elements[element].behavior[i].split("|"));
}
elements[element].behavior = newbehavior;
}
if (elements[element].behaviorOn && typeof elements[element].behaviorOn[0] === "string") {
var newbehavior = [];
for (var i = 0; i < elements[element].behaviorOn.length; i++) {
newbehavior.push(elements[element].behaviorOn[i].split("|"));
}
elements[element].behaviorOn = newbehavior;
}
}
}
function doFinalChecks() {
nextid = 1;
for (key in elements) {
elements[key].id = nextid;
nextid++;
// If the element has no behavior, set it to behaviors.WALL
if (!elements[key].behavior && !elements[key].tick) {
elements[key].tick = function(pixel) {};
}
// If the behavior is a function, delete it and set tick to it instead
if (typeof elements[key].behavior === "function") {
if (elements[key].tick) {
elements[key].tick1 = elements[key].tick;
elements[key].tick2 = elements[key].behavior;
elements[key].tick = function(pixel) {
if (pixel.start === pixelTicks) {return}
var id = elements[pixel.element].id;
elements[pixel.element].tick1(pixel);
if (!pixel.del && id === elements[pixel.element].id) {
elements[pixel.element].tick2(pixel);
}
}
}
else {
elements[key].tick = elements[key].behavior;
}
delete elements[key].behavior;
}
// If the element has no color, set it to white
if (elements[key].color === undefined) {
elements[key].color = "rgb(255,255,255)";
elements[key].colorObject = {r:255,g:255,b:255};
}
// If the element's behavior is an array and contains M1 or M2, set its movable to true
if (elements[key].behavior && typeof elements[key].behavior[0] === "object") {
var bstring = JSON.stringify(elements[key].behavior);
if (bstring.indexOf("M1")!==-1 || bstring.indexOf("M2")!==-1) { elements[key].movable = true; }
}
if (elements[key].tick) { elements[key].movable = true; }
if (elements[key].behavior) {
// If the element's behavior[1][1] includes "FX", set it's flippableX to true
if (elements[key].behavior[1][1].indexOf("FX") !== -1) {
elements[key].flippableX = true;
}
// If the element's behavior[1][1] includes "FY", set it's flippableY to true
if (elements[key].behavior[1][1].indexOf("FY") !== -1) {
elements[key].flippableY = true;
}
// If the element's behavior stringified includes "BO", loop through the behavior
if (elements[key].behavior.toString().indexOf("BO") !== -1 && !elements[key].rotatable) {
for (var i = 0; i < elements[key].behavior.length; i++) {
// Loop through each array in the behavior
for (var j = 0; j < elements[key].behavior[i].length; j++) {
// If the behavior includes "BO", set the behaviorOn to the behavior
if (elements[key].behavior[i][j].indexOf("BO") !== -1) {
if ((i==0 && j==0) || (i==0 && j==2) || (i==2 && j==0) && (i==2 && j==2)) {
elements[key].flippableX = true;
elements[key].flippableY = true;
}
else if (i==0 || i==2) {
elements[key].flippableY = true;
}
else if (j==0 || j==2) {
elements[key].flippableX = true;
}
}
}
}
}
// If the element's behavior[1][1] includes "RT", set it's rotatable to "true"
if (elements[key].behavior[1][1].indexOf("RT") !== -1) {
elements[key].rotatable = true;
}
}
// If the element's state is "gas", isGas = true
if (elements[key].state === "gas") {
elements[key].isGas = true;
}
// Else if the state is not "solid" or "liquid", delete it
else if (elements[key].state !== "solid" && elements[key].state !== "liquid") {
delete elements[key].state;
}
// If the element has reactions, loop through each one (it is an object), if the value for elem1 or elem2 is not an element and is not null, remove that key
if (elements[key].reactions) {
for (var reaction in elements[key].reactions) {
// If elem1 exists
if (elements[key].reactions[reaction].elem1) {
// If elem1 is an array, loop through each element, else check once. Don't delete if it === null
if (Array.isArray(elements[key].reactions[reaction].elem1)) {
for (var i = 0; i < elements[key].reactions[reaction].elem1.length; i++) {
if (elements[key].reactions[reaction].elem1[i] && !elements[elements[key].reactions[reaction].elem1[i]]) {
elements[key].reactions[reaction].elem1.splice(i,1);
}
}
}
else if (elements[key].reactions[reaction].elem1 && !elements[elements[key].reactions[reaction].elem1]) {
delete elements[key].reactions[reaction].elem1;
}
}
// If elem2 exists
if (elements[key].reactions[reaction].elem2) {
// If elem2 is an array, loop through each element, else check once. Don't delete if it === null
if (Array.isArray(elements[key].reactions[reaction].elem2)) {
for (var i = 0; i < elements[key].reactions[reaction].elem2.length; i++) {
if (elements[key].reactions[reaction].elem2[i] && !elements[elements[key].reactions[reaction].elem2[i]]) {
elements[key].reactions[reaction].elem2.splice(i,1);
}
}
}
else if (elements[key].reactions[reaction].elem2 && !elements[elements[key].reactions[reaction].elem2]) {
delete elements[key].reactions[reaction].elem2;
}
}
}
}
// If the element's stateHigh or stateLow is not an element, remove it and tempHigh/Low
if (elements[key].stateHigh) {
// If it's an array, do it for each item, otherwise, just do it once
if (Array.isArray(elements[key].stateHigh)) {
for (var i = 0; i < elements[key].stateHigh.length; i++) {
if (!elements[elements[key].stateHigh[i]] && elements[key].stateHigh[i] !== null) {
elements[key].stateHigh.splice(i,1);
}
}
if (elements[key].stateHigh.length == 0) {
delete elements[key].stateHigh;
delete elements[key].tempHigh;
}
}
else {
if (!elements[elements[key].stateHigh] && elements[key].stateHigh !== null) {
delete elements[key].stateHigh;
delete elements[key].tempHigh;
}
}
}
if (elements[key].stateLow) {
if (Array.isArray(elements[key].stateLow)) {
for (var i = 0; i < elements[key].stateLow.length; i++) {
if (!elements[elements[key].stateLow[i]] && elements[key].stateLow[i] !== null) {
elements[key].stateLow.splice(i,1);
}
}
if (elements[key].stateLow.length == 0) {
delete elements[key].stateLow;
delete elements[key].tempLow;
}
}
else {
if (!elements[elements[key].stateLow] && elements[key].stateLow !== null) {
delete elements[key].stateLow;
delete elements[key].tempLow;
}
}
}
// same for burnInto
if (elements[key].burnInto) {
if (Array.isArray(elements[key].burnInto)) {
for (var i = 0; i < elements[key].burnInto.length; i++) {
if (!elements[elements[key].burnInto[i]]) {
delete elements[key].burnInto[i];
}
}
if (elements[key].burnInto.length == 0) {
delete elements[key].burnInto;
}
}
else {
if (!elements[elements[key].burnInto]) {
delete elements[key].burnInto;
}
}
}
// same for breakInto
if (elements[key].breakInto) {
if (Array.isArray(elements[key].breakInto)) {
for (var i = 0; i < elements[key].breakInto.length; i++) {
if (elements[key].breakInto[i]!==null && !elements[elements[key].breakInto[i]]) { delete elements[key].breakInto[i]; }
}
if (elements[key].breakInto.length == 0) { delete elements[key].breakInto; }
}
else {
if (elements[key].breakInto[i]!==null && !elements[elements[key].breakInto]) { delete elements[key].breakInto; }
}
}
if (elements[key].colorPattern) {
if (!elements[key].colorKey) {
delete elements[key].colorPattern;
}
else {
var newPattern = [];
for (var i = 0; i < elements[key].colorPattern.length; i++) {
newPattern.push([]);
var line = elements[key].colorPattern[i];
// loop through each character in the line
for (var j = 0; j < line.length; j++) {
var char = line[j];
if (elements[key].colorKey[char]) {
if (elements[key].colorKey[char].startsWith("#")) {
var rgb = hexToRGB(elements[key].colorKey[char]);
elements[key].colorKey[char] = "rgb("+rgb.r+","+rgb.g+","+rgb.b+")";
}
newPattern[i].push(elements[key].colorKey[char]);
}
else {
newPattern[i].push("rgb(255,255,255)");
}
}
}
elements[key].colorPattern = newPattern;
delete elements[key].colorKey;
}
}
}
};
function createWorldGenOptions() {
for (var key in worldgentypes) {
document.getElementById("worldgenselect").innerHTML += "<option value='" + key + "'>" + key.replace(/_/g, " ").replace(/\b\w/g, l => l.toUpperCase()) + "</option>";
}
};
function validateWorldGenSelection() {
if (settings["worldgen"] && !worldgentypes[settings["worldgen"]]) {
settings["worldgen"] = "off";
}
};
function validateRandomEventChoices() {
for (var key in randomEventChoices) {
for (var i = 0; i < randomEventChoices[key].length; i++) {
if (!elements[randomEventChoices[key][i]]) {
randomEventChoices[key].splice(i,1);
}
}
}
};
function setEqualReactions(fromElement,toElement) {
if (elements[fromElement] && elements[toElement]) {
if (elements[fromElement].reactions) {
elements[toElement].reactions = elements[fromElement].reactions;
return true;
};
};
return false;
};
function loadSettings() {
var settingSpans = document.getElementsByClassName("setting-span");
for (var i = 0; i < settingSpans.length; i++) {
var setting = settingSpans[i].getAttribute("setting");
if (setting in settings) {
var settingValue = settings[setting];
var settingElements = settingSpans[i].getElementsByTagName("select") || settingSpans[i].getElementsByTagName("input");
if (settingElements.length > 0) {
settingElements[0].value = settingValue;
}
}
}
};
function setCanvasWidthAndHeight(ctx) {
var newWidth = Math.ceil(window.innerWidth*0.9 / pixelSize) * pixelSize;
var newHeight = Math.ceil(window.innerHeight*0.675 / pixelSize) * pixelSize;
// If the new width is greater than 800, set it to 800
if (newWidth > 1000) { newWidth = 1000; }
// If we are on a desktop and the new height is greater than 600, set it to 600
if (window.innerWidth > 1000 && newHeight > 500) { newHeight = 500; }
ctx.canvas.width = newWidth;
ctx.canvas.height = newHeight;
document.getElementById("gameDiv").style.width = newWidth + "px";
document.getElementById("loadingP").style.display = "none";
document.getElementById("canvasDiv").style.display = "block";
width = Math.round(newWidth/pixelSize)-1;
height = Math.round(newHeight/pixelSize)-1;
};
function definePixelMap() {
if (settings["worldgen"]) {
clearAll();
}
else {
// Object with width arrays of pixels starting at 0
pixelMap = [];
for (var i = 0; i < width; i++) {
pixelMap[i] = [];
}
}
};
function setRandomChoices() {
randomChoices = Object.keys(elements).filter(function(e) {
return elements[e].excludeRandom != true && elements[e].category != "tools" && !elements[e].tool;
});
};
function addCanvasAndWindowListeners(gameCanvas) {
gameCanvas.addEventListener("mousedown", mouseClick);
gameCanvas.addEventListener("touchstart", mouseClick, { passive: false });
window.addEventListener("mouseup", mouseUp);
window.addEventListener("touchend", mouseUp, { passive: false });
window.addEventListener("mousemove", mouseMove);
gameCanvas.addEventListener("touchmove", mouseMove, { passive: false });
gameCanvas.addEventListener("wheel", wheelHandle);
};
function generateModManagerList() {
if (enabledMods.length > 0) {
modManagerList = document.getElementById("modManagerList");
for (var i = 0; i < enabledMods.length; i++) {
var mod = enabledMods[i];
// modName is the last part of the mod's path
var modName = mod.split("/").pop();
modManagerList.innerHTML += "<li><a href='" + mod + "' target='_blank'>" + modName + "</a> <span class='removeModX' onclick='removeMod(\"" + mod + "\")'>X</span></li>";
}
}
else {
document.getElementById("noMods").style.display = "block";
}
};
//this part defines basically all of the keybinds
function addKeyboardListeners() {
document.addEventListener("keydown", function(e) {
if (e.ctrlKey || e.metaKey) {
return
}
// else if tab, set document.body.class to "usingTab"
else if (e.keyCode == 9) {
document.body.classList.add("usingTab");
}
// F1 = hide #underDiv, #infoParent, #modParent, #pagetitle, #colorSelector if they aren't hidden, otherwise show them
if (e.keyCode == 112) {
e.preventDefault();
if (document.getElementById("underDiv").style.display == "none") {
document.getElementById("underDiv").style.display = "block";
document.getElementById("pagetitle").style.display = "block";
document.getElementById("colorSelector").style.display = "block";
document.getElementById("bottomInfoBox").style.display = "block";
} else {
document.getElementById("underDiv").style.display = "none";
if (showingMenu) {
closeMenu()
};
document.getElementById("pagetitle").style.display = "none";
document.getElementById("colorSelector").style.display = "none";
document.getElementById("bottomInfoBox").style.display = "none";
}
}
if (showingMenu) {
// esc or / or tab / or \ (while in settings) to close
if (e.keyCode == 27 || (e.keyCode == 191 && showingMenu=="info") || e.keyCode == 9 || (e.keyCode == 220 && showingMenu=="settings")) {
e.preventDefault();
closeMenu();
}
// enter to clear infoSearch
else if (e.keyCode == 13 && showingMenu == "info") {
var infoSearch = document.getElementById("infoSearch");
infoSearch.value = "";
showInfo();
}
return;
}
if (e.keyCode == 219 || e.keyCode == 189) {
if (shiftDown) {mouseSize = 1}
else {
mouseSize -= 2;
if (mouseSize < 1) { mouseSize = 1; }
}
}
// If the user presses ] or =, increase the mouse size by 2
if (e.keyCode == 221 || e.keyCode == 187) {
if (shiftDown) {mouseSize = (mouseSize+15)-((mouseSize+15) % 15)}
else {mouseSize += 2;}
// if height>width and mouseSize>height, set mouseSize to height, if width>height and mouseSize>width, set mouseSize to width
if (mouseSize > (height > width ? height : width)) { mouseSize = (height > width ? height : width); }
}
// User presses shift
else if (e.keyCode == 16) {
if (event.location === KeyboardEvent.DOM_KEY_LOCATION_LEFT) {
shiftDown = 1;
} else if (event.location === KeyboardEvent.DOM_KEY_LOCATION_RIGHT) {
shiftDown = 3;
}
}
// User presses alt
else if (e.keyCode == 18) {
if (event.location === KeyboardEvent.DOM_KEY_LOCATION_LEFT) {
shiftDown = 2;
} else if (event.location === KeyboardEvent.DOM_KEY_LOCATION_RIGHT) {
shiftDown = 4;
}
}
// p or spacebar or ` or k = pause
if (e.keyCode == 80 || e.keyCode == 32 || e.keyCode == 192 || e.keyCode == 75) {
e.preventDefault();
togglePause();
}
// e = chooseElementPrompt()
else if (e.keyCode == 69) {
e.preventDefault();
chooseElementPrompt();
}
// . = doFrame()
else if (e.keyCode == 190) {
e.preventDefault();
doFrame();
}
// / or i = showInfo()
else if (e.keyCode == 191 || e.keyCode == 73) {
e.preventDefault();
showInfo();
}
// f = full screen
else if (e.keyCode == 70) {
e.preventDefault();
if (document.fullscreenElement) {
document.exitFullscreen(document.body);
} else {
requestFullScreen(document.body);
}
}
// 0-9 = setView(the number)
else if (e.keyCode >= 48 && e.keyCode <= 57) {
// if not command or control down, set view to the number
e.preventDefault();
setView(e.keyCode-48);
}
// right arrow = switch the category to the one after the current category
else if (e.keyCode == 39) {
e.preventDefault();
// in categoryControls, find the button with the class categoryButton and the attribute current="true"
var currentButton = document.querySelector(".categoryButton[current='true']");
var currentCategory = currentButton.getAttribute("category");
// get the categoryButton that is after the current one in the div
var nextButton = currentButton.nextElementSibling;
// if there is no next button, go to the first one
if (nextButton == null) {
nextButton = document.querySelector(".categoryButton");
}
var nextCategory = nextButton.getAttribute("category");
selectCategory(nextCategory);
// focus on categoryControls
document.getElementById("categoryControls").focus();
}
// left arrow = switch the category to the one before the current category
else if (e.keyCode == 37) {
e.preventDefault();
// in categoryControls, find the button with the class categoryButton and the attribute current="true"
var currentButton = document.querySelector(".categoryButton[current='true']");
var currentCategory = currentButton.getAttribute("category");
// get the categoryButton that is before the current one in the div
var prevButton = currentButton.previousElementSibling;
// if there is no previous button, go to the last one
if (prevButton == null) {
prevButton = document.querySelector(".categoryButton:last-child");
}
var prevCategory = prevButton.getAttribute("category");
selectCategory(prevCategory);
}
// m = closeMenu() and showModManager()
else if (e.keyCode == 77) {
e.preventDefault();
closeMenu();
showModManager();
}
// \ = closeMenu() and showSettings()
else if (e.keyCode == 220) {
e.preventDefault();
closeMenu();
showSettings();
}
// c or F2 = screenshot
else if (e.keyCode == 67 || e.keyCode == 113) {
e.preventDefault();
var link = document.createElement('a');
link.setAttribute('download', 'sandboxels-screenshot.png');
link.setAttribute('href', document.getElementById("game").toDataURL("image/png").replace("image/png", "image/octet-stream"));
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
// x = explodeAt()
/*else if (e.keyCode == 88) {
e.preventDefault();
explodeAt(mousePos.x, mousePos.y, Math.round(mouseSize/2));
}*/
});
};
function addUnshiftListeners() {
document.addEventListener("keyup", function(e) {
if (e.keyCode == 16 || e.keyCode == 18) {
shiftDown = 0;
if (shaping) {
shaping = 0;
shapeStart = null;
}
}
});
};
function createButtonsAndCountElements() {
elementCount = 0;
hiddenCount = 0;
categoryList = [];
for (var element in elements) {
elementCount++;
if (settings.cheerful && elements[element].nocheer) {
elements[element].hidden = true;
hiddenCount++;
continue;
}
var category = elements[element].category;
if (category==null) {category="other"}
if (categoryList.indexOf(category) === -1) {
categoryList.push(category);
}
if (elements[element].hidden && (!settings["unhide"] || ( settings["unhide"]===2 && !settings.unlocked[element] ))) { hiddenCount++; continue; }
var categoryDiv = document.getElementById("category-"+category);
if (categoryDiv == null) {
createCategoryDiv(category);
categoryDiv = document.getElementById("category-"+category);
}
createElementButton(element);
}
// Set the first button in categoryControls div to be the current category
document.getElementById("categoryControls").children[0].click()
document.getElementById("extraInfo").innerHTML += "<small><p>There are " + elementCount + " elements, including " + hiddenCount + " hidden ones.</p><p>©2021-" + new Date().getFullYear() + ". All Rights Reserved. <a href='https://r74n.com'>R74n</a></p></small>";
selectElement(currentElement);
focusGame();
};
window.onload = function() {
// If the browser is Firefox, set #categoryControls padding-bottom:11px;
if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
document.getElementById("categoryControls").style.paddingBottom = "11px";
}
// Loop through runAfterLoadList and run each function
for (var i = 0; i < runAfterLoadList.length; i++) {
runAfterLoadList[i]();
}
// Loop through behaviors and each behavior, if it is a string, split the items and replace the value with the array
behaviorStringsToArrays();
// convert every color in the elements object to rgb
tripletsToRgbAndGenerateColorObjects()
autoElements = {
"molten": { // Solid -> Liquid
rgb: [ [2,1.25,0.5], [2,1,0.5], [2,0.75,0] ],
behavior: behaviors.MOLTEN,
type: "high",
viscosity: 10000,
hidden: true,
state: "liquid",
tempDiff: -100,
},
"frozen": { // Liquid -> Solid
rgb: [ [1.2,1.2,1.3] ],
behavior: behaviors.WALL,
type: "low",
hidden: true,
state: "solid",
},
"condense": { // Gas -> Liquid
rgb: [ [0.5,0.5,0.5] ],
behavior: behaviors.LIQUID,
type: "low",
hidden: true,
state: "liquid",
},
"evaporate": { // Liquid -> Gas
rgb: [ [1.5,1.5,1.5] ],
behavior: behaviors.GAS,
type: "high",
hidden: true,
state: "gas",
}
}
// Loop through each element. If it has a tempHigh, but not a stateHigh, create a new molten element
autoGenAllElements();
// Loop through runAfterAutogenList and run each function
for (var i = 0; i < runAfterAutogenList.length; i++) {
runAfterAutogenList[i]();
};
// Loop through each element, final checks
doFinalChecks();
// Generate worldgen options
// Loop through the worldgentypes object, add the key to the #worldgenselect select as an option with the value of the key and the name of the key capitalized and underscores replaced with spaces
createWorldGenOptions();
validateWorldGenSelection();
// Loop through randomEventChoices, and loop through the array of each. If the element doesn't exist, remove it from the array.
validateRandomEventChoices();
// Poison == poison gas reactions
setEqualReactions("poison","poison_gas");
// Load settings
// Loop through all the elements with setting-span class.
// If the span's setting attribute is in settings, set the first select or input to the value of the setting.
loadSettings();
//scared to touch this because ctx is pretty important
var gameCanvas = document.getElementById("game");
// Get context
var ctx = gameCanvas.getContext("2d");
setCanvasWidthAndHeight(ctx);
mousePos = {x:width/2,y:height/2};
definePixelMap();
// randomChoices = the keys of "elements" with any element with the category "tools" or the property excludeRandom set to true removed
setRandomChoices();
addCanvasAndWindowListeners(gameCanvas);
gameCanvas.ontouchstart = function(e) {
if (e.touches) e = e.touches[0];
return false;
}
window.onbeforeunload = function(){ // Confirm leaving page if there are pixels on-screen
if (currentPixels.length > 0){
return 'Are you sure you want to leave?';
}
};
// If enabledMods has items, add an li to modManagerList for each item with the href to the item, target blank, and the item's name, with "<span class="removeModX" onclick='removeMod('>X</span>" after the link
generateModManagerList();
document.getElementById("game").oncontextmenu = function(e) { e.preventDefault(); return false; }
// If the user presses [ or -, decrease the mouse size by 2
addKeyboardListeners();
// If the user releases either shift
addUnshiftListeners();
// Create buttons for elements
// For each element type in elements, create a button in controls that sets the current element to that type
// Alphabetically sort and loop through dictionary named "elements"
createButtonsAndCountElements();
for (var i = 0; i < runAfterButtonsList.length; i++) {
runAfterButtonsList[i]();
};
selectElement(currentElement);
focusGame();
// For every button element, onkeyup="event.preventDefault()"
var buttonElements = document.getElementsByTagName("button");
for (var i = 0; i < buttonElements.length; i++) {
buttonElements[i].onkeyup = function(e) {
e.preventDefault();
}
}
if (window.self !== window.top && !location.ancestorOrigins[0].includes("itch.io")) {
// Open a message that tells the user they aren't on the real website
var menuParent = document.createElement("div");
menuParent.className = "menuParent";
menuParent.style.display = "block";
menuParent.innerHTML = `<div class="menuScreen">
<button class="XButton" onclick="closeMenu();">-</button>
<span class="menuTitle">Sandboxels</span>
<div class="menuText" style="padding-top:1em">
You may be on a website that has embedded our game involuntarily.
<br><br>
The real game is at this URL: <a href="https://sandboxels.r74n.com" target="_blank">sandboxels.R74n.com</a>.
<br><br>
Please use the main website to support us instead.
<br><br>
You can also join our <a href="https://discord.gg/ejUc6YPQuS" target="_blank">Discord</a> if that isn't possible.
</div>
<br><br><br><br>
</div>`
document.body.appendChild(menuParent);
showingMenu = "alert";
}
//get the first .elementButton in the first .category, and selectElement(button.element)
var firstDiv = document.getElementsByClassName("category")[0];
var firstElementButton = firstDiv.getElementsByClassName("elementButton")[0];
selectElement(firstElementButton.getAttribute("element"));
};
logMessage("This mod is deprecated. Please remove it from your mod list, along with any mods that depend on it.")

89
mods/sky.js Normal file
View File

@ -0,0 +1,89 @@
if (!enabledMods.includes("mods/betterSettings.js")) { enabledMods.unshift("mods/betterSettings.js"); localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); window.location.reload() };
var sky_settingsTab = new SettingsTab("Sky");
var realtime_setting = new Setting("Use real life time for sky", "real_time", settingType.BOOLEAN, false, defaultValue=true);
var initial_hour_setting = new Setting("Initial hour", "initial_hour", settingType.NUMBER, false, defaultValue=8);
var ticks_per_hour_setting = new Setting("Ticks per hour", "ticks_per_hour", settingType.NUMBER, false, defaultValue=150);
sky_settingsTab.registerSettings("Real time", realtime_setting);
sky_settingsTab.registerSettings("Initial hour", initial_hour_setting);
sky_settingsTab.registerSettings("Ticks per hour", ticks_per_hour_setting);
settingsManager.registerTab(sky_settingsTab);
var hour = initial_hour_setting.value;
function lerpColor(start, end, t) {
return start.map((s, i) => Math.round(s + (end[i] - s) * t));
}
function getSkyColors(hour) {
const SKY_COLOR_PAIRS = [
[[0, 0, 15], [0, 0, 30]], // midnight
[[10, 10, 40], [20, 20, 60]],
[[255, 100, 50], [255, 150, 100]],
[[135, 206, 235], [180, 230, 255]],
[[135, 206, 250], [135, 206, 255]],
[[135, 206, 250], [120, 190, 240]],
[[255, 150, 100], [120, 70, 70]],
[[30, 15, 60], [20, 10, 40]],
[[0, 0, 15], [0, 0, 30]], // midnight
];
// Determine the interval (each interval is 3 hours)
const index = Math.floor(hour / 3);
const t = (hour % 3) / 3;
const [bottomStart, topStart] = SKY_COLOR_PAIRS[index];
const [bottomEnd, topEnd] = SKY_COLOR_PAIRS[index + 1];
return {
skyTop: `rgb(${lerpColor(topStart, topEnd, t).join(", ")})`,
skyBottom: `rgb(${lerpColor(bottomStart, bottomEnd, t).join(", ")})`,
};
}
function renderSky(ctx) {
const { skyTop, skyBottom } = getSkyColors(hour);
const gradient = ctx.createLinearGradient(0, 0, 0, height * pixelSize);
gradient.addColorStop(0, skyTop);
gradient.addColorStop(1, skyBottom);
ctx.fillStyle = gradient;
ctx.fillRect(0, 0, width * pixelSize, height * pixelSize);
}
function updateDayTime() {
if (realtime_setting.value) {
const now = new Date();
hour = now.getHours() + now.getMinutes() / 60;
} else {
hour = (hour + (1 / ticks_per_hour_setting.value)) % 24; // Keep within 0-23
}
}
// Make sure the sky gets VIP treatment in the render list
function prioritizeRenderSky() {
const idx = renderPrePixelList.indexOf(renderSky);
if (idx !== -1) {
const [skyFn] = renderPrePixelList.splice(idx, 1);
renderPrePixelList.unshift(skyFn);
}
}
// Resetting canvas also resets time
function initializeCanvas() {
const resizeCanvas = autoResizeCanvas;
autoResizeCanvas = (clear) => {
resizeCanvas(clear);
hour = initial_hour_setting.value;
};
}
// Hooks
setTimeout(initializeCanvas, 500);
runAfterLoad(prioritizeRenderSky);
runEveryTick(updateDayTime);
renderPrePixel(renderSky);

146
mods/solidcolor.js Normal file
View File

@ -0,0 +1,146 @@
// all credits to nousernamefound for onecolor.js
window.addEventListener('load', function() {
console.log("attempted override");
pixelColorPick = function(pixel, customColor = null) {
var element = pixel.element;
var elementInfo = elements[element];
if (pixel.charge && elementInfo.colorOn) {
customColor = elementInfo.colorOn;
}
if (customColor != null) {
if (Array.isArray(customColor)) {
customColor = customColor[Math.floor(Math.random() * customColor.length)];
}
if (customColor.startsWith("#")) {
customColor = hexToRGB(customColor);
}
var rgb = customColor;
} else {
var rgb = elements[element].colorObject;
if (Array.isArray(rgb)) {
rgb = rgb[Math.floor(Math.random() * rgb.length)];
}
}
var coloroffset = Math.floor(Math.random() * (Math.random() > 0.5 ? -1 : 1) * Math.random() * 15);
var r = rgb.r + 0;
var g = rgb.g + 0;
var b = rgb.b + 0;
r = Math.max(0, Math.min(255, r));
g = Math.max(0, Math.min(255, g));
b = Math.max(0, Math.min(255, b));
var color = "rgb(" + r + "," + g + "," + b + ")";
return color;
}
pixelTempCheck = function(pixel) {
if (pixel.del) { return }
var elementInfo = elements[pixel.element];
if (pixel.temp < absoluteZero) {
pixel.temp = absoluteZero;
}
if (pixel.temp >= elementInfo.tempHigh) {
var result = elementInfo.stateHigh;
if (elementInfo.extraTempHigh) {
for (var extraTemp in elementInfo.extraTempHigh) {
if (pixel.temp >= extraTemp) {
result = elementInfo.extraTempHigh[extraTemp];
}
}
}
if (Array.isArray(result)) {
result = result[Math.floor(Math.random() * result.length)];
}
if (result === null) {
deletePixel(pixel.x, pixel.y);
return false;
} else {
if (elements[result].customColor) {
changePixel(pixel, result, false);
pixel.color = color;
} else if (elementInfo.stateHighColor) {
changePixel(pixel, result, false);
pixel.color = pixelColorPick(pixel, elementInfo.stateHighColor);
} else if (elementInfo.stateHighColorMultiplier) {
var color = pixel.color;
changePixel(pixel, result, false);
var rgb = color.match(/\d+/g);
var m = elementInfo.stateHighColorMultiplier;
if (Array.isArray(m)) {
m = m[0];
}
var r = Math.floor(rgb[0] * m);
var g = Math.floor(rgb[1] * m);
var b = Math.floor(rgb[2] * m);
r = Math.max(0, Math.min(255, r));
g = Math.max(0, Math.min(255, g));
b = Math.max(0, Math.min(255, b));
pixel.color = "rgb(" + r + "," + g + "," + b + ")";
} else {
changePixel(pixel, result, false);
}
if (elementInfo.fireColor && result === "fire") {
pixel.color = pixelColorPick(pixel, elementInfo.fireColor);
}
}
}
else if (pixel.temp <= elementInfo.tempLow) {
var result = elementInfo.stateLow;
if (elementInfo.extraTempLow) {
for (var extraTemp in elementInfo.extraTempLow) {
if (pixel.temp <= extraTemp) {
result = elementInfo.extraTempLow[extraTemp];
}
}
}
if (Array.isArray(result)) {
result = result[Math.floor(Math.random() * result.length)];
}
if (result === null) {
deletePixel(pixel.x, pixel.y);
return false;
} else {
if (elements[result].customColor) {
changePixel(pixel, result, false);
pixel.color = color;
} else if (elementInfo.stateLowColor) {
changePixel(pixel, result, false);
pixel.color = pixelColorPick(pixel, elementInfo.stateLowColor);
} else if (elementInfo.stateLowColorMultiplier) {
var color = pixel.color;
changePixel(pixel, result, false);
var rgb = color.match(/\d+/g);
var m = elementInfo.stateLowColorMultiplier;
if (Array.isArray(m)) {
m = m[0];
}
var r = Math.floor(rgb[0] * m);
var g = Math.floor(rgb[1] * m);
var b = Math.floor(rgb[2] * m);
r = Math.max(0, Math.min(255, r));
g = Math.max(0, Math.min(255, g));
b = Math.max(0, Math.min(255, b));
pixel.color = "rgb(" + r + "," + g + "," + b + ")";
} else {
changePixel(pixel, result, false);
}
}
}
return true;
}
});

500
mods/survivalhack.js Normal file
View File

@ -0,0 +1,500 @@
if (!settings.survival) {
settings.survival = {
"wall": 999,
"dirt": 999,
"sapling": 1,
"seeds": 5,
"ice": 25,
"cloner": 5,
"goldcoin":1000,
"diamond":10000,
}
}
settings.survival.cloner = 1;
settings.unhide = 0;
// settings.survivalClone=null; settings.survival = null; saveSettings();
survivalTimeout = null;
function survivalSave() {
if (survivalTimeout) { clearTimeout(survivalTimeout); }
survivalTimeout = setTimeout(function(){
saveSettings();
},1000);
}
function survivalAdd(element,amount,skipSave) {
if (elements[element].category === "tools") { return }
if (settings.survival[element]) {
settings.survival[element] += amount;
}
else {
settings.survival[element] = amount;
}
survivalUpdate(element);
if (!skipSave) {survivalSave()}
}
function survivalRemove(element,amount,skipSave) {
if (elements[element].category === "tools") { return }
if (settings.survival[element]) {
settings.survival[element] -= amount;
survivalUpdate(element);
}
if (settings.survival[element] <= 0) {
delete settings.survival[element];
var btn = document.getElementById("elementButton-"+element);
if (btn) { btn.remove(); }
selectElement("unknown");
}
if (!skipSave) {survivalSave()}
}
function survivalCount(element) {
return settings.survival[element] || 0;
}
function survivalUpdate(element) {
if (element === "gold_coin") {
// if it is not an integer, round it to 0.1
if (settings.survival.gold_coin % 1 !== 0) {
settings.survival.gold_coin = Math.round(settings.survival.gold_coin*10)/10;
}
document.getElementById("coinCount").innerHTML = settings.survival.gold_coin||0;
}
var btn = document.getElementById("elementButton-"+element);
if (elements[element] && elements[element].category === "tools") { return }
if (btn) {
btn.innerHTML = btn.innerHTML.split("(")[0]+"("+settings.survival[element]+")";
}
else if (elements[element]) {
createElementButton(element);
document.getElementById("elementButton-"+element).innerHTML += "("+settings.survival[element]+")";
}
}
runAfterAutogen(function(){
elements.erase.name = "pick_up";
delete elements.paint.category;
delete elements.lookup.category;
delete elements.pick;
delete elements.prop;
elements.radiation.category = "tools";
for (var element in elements) {
if (elements[element].category !== "tools") {
elements[element].hidden = true;
elements[element].category = "inventory";
}
}
for (var element in settings.survival) {
if (!elements[element]) { continue; }
if (elements[element].category === "tools") { continue; }
createElementButton(element);
document.getElementById("elementButton-"+element).innerHTML += "("+settings.survival[element]+")";
}
});
delete elements.cloner.behavior;
elements.cloner.tick = function(pixel) {
if (settings.survivalClone) {
if (Math.random() < 0.025) {
// 1 or -1
var x = pixel.x + (Math.random() < 0.5 ? 1 : -1);
var y = pixel.y + (Math.random() < 0.5 ? 1 : -1);
if (isEmpty(x,y)) {
createPixel(settings.survivalClone,x,y);
}
}
}
else {
for (var i = 0; i < adjacentCoords.length; i++) {
var coords = adjacentCoords[i];
var x = pixel.x + coords[0];
var y = pixel.y + coords[1];
if (!isEmpty(x,y,true)) {
if (pixelMap[x][y].clone) { pixel.clone = pixelMap[x][y].clone; break }
var element = pixelMap[x][y].element;
if (element === pixel.element || elements[pixel.element].ignore.indexOf(element) !== -1) { continue }
settings.survivalClone = element;
survivalSave();
break;
}
}
}
};
elements.cloner.ignore = elements.cloner.ignore.concat(["gold","gold_coin","molten_gold","sun","supernova","diamond"]);
elements.cloner.desc = "You can only clone one element at a time!"
elements.smash.tool = function(pixel) {
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)) {
var breakInto = elements[pixel.element].breakInto;
if (elements[pixel.element].seed && (!breakInto || Math.random() < 0.5)) {
if (Math.random() < 0.2) {
breakInto = elements[pixel.element].seed;
}
else {
breakInto = null;
}
}
// if breakInto is an array, pick one
if (Array.isArray(breakInto)) {
breakInto = breakInto[Math.floor(Math.random() * breakInto.length)];
}
if (breakInto === null) {
deletePixel(pixel.x,pixel.y);
return;
}
var oldelement = pixel.element;
changePixel(pixel,breakInto);
pixelTempCheck(pixel);
if (elements[oldelement].breakIntoColor) {
pixel.color = pixelColorPick(pixel, elements[oldelement].breakIntoColor);
}
}
}
};
elementWorth = {
"gold_coin": 1,
"diamond": 10000,
"ketchup": 15,
"jelly": 10,
"soda": 10,
"toast": 10,
"oil": 10,
"bread": 3,
"glass": 5,
"rad_glass": 6,
"glass_shard": 2,
"rad_shard": 3,
"paper": 5,
"broth": 5,
"honey": 5,
"caramel": 5,
"sap": 4,
"candy": 5,
"popcorn": 2,
"flour": 2,
"lettuce": 2,
"sauce": 2,
"wood": 0.2,
"tree_branch": 0.1,
"plant": 0.1,
"mushroom_cap": 0.1,
"mushroom_gill": 0.3,
"vine": 0.1,
"cactus": 0.1,
"cloner": 0,
"wall": 0,
"fire": 0,
"smoke": 0,
"plasma": 0,
"light": 0,
"laser": 0,
"liquid_light": 0.1,
"flash": 0,
"radiation": 0,
"petal": -1,
"cell": -1,
"cancer": -1,
"foam": -1,
}
elements.sell = {
color: ["#fff0b5","#ffe680","#c48821","#986a1a","#eca832","#f0bb62"],
tool: function(pixel) {
if (elementWorth[pixel.element] === 0) { return; }
deletePixel(pixel.x,pixel.y);
if (elementWorth[pixel.element] === -1) { return; }
survivalAdd("gold_coin",elementWorth[pixel.element]||1);
},
toolHoverStat: function(pixel) {
return "$"+(elementWorth[pixel.element]||1);
},
category: "tools",
desc: "Exchanges pixels for their market value in Gold Coins"
}
elements.seeds.name = "seed";
/*
~Cloner
~Sell
Shop
Cloner Reset
~Ammonia
~Dirt
~Water
~Seeds
~Sapling
~Pinecone
~Primordial Soup
~Worm
~Bee
~Human
~TNT
Seller (Runs Sell tool on pixels that touch it)
Buyer (Cloner but uses store price every time, prompt to select item on select)
Prices tab
*/
survivalShop = {
"dirt*25": 25,
"water*25": 250,
"ammonia*25": 500,
"seeds*1": 500,
"sapling*1": 500,
"pinecone*1": 500,
"tnt*25": 1000,
"worm*1": 1000,
"bee*1": 5000,
"primordial_soup*5": 10000,
"human*1": 50000,
"sun*1": 500000,
}
function survivalBuy(element) {
var price = survivalShop[element];
if (!price) { alert("The shop isn't selling "+element+"!"); return }
if (!settings.survival.gold_coin || settings.survival.gold_coin < price) { alert("You can't afford that!"); return }
survivalRemove("gold_coin",price);
var amount = 1;
if (element.indexOf("*") !== -1) { amount = parseInt(element.split("*")[1]); element = element.split("*")[0]; }
survivalAdd(element,amount);
selectElement(element);
}
function survivalResetCloner() {
if (!settings.survival.gold_coin || settings.survival.gold_coin < 1000) { alert("You can't afford that!"); return }
survivalRemove("gold_coin",1000);
settings.survivalClone = null;
survivalSave();
}
worldgentypes = {}
window.addEventListener("load",function(){
// move to start of tools
var erase = document.getElementById("elementButton-erase");
var sell = document.getElementById("elementButton-sell");
var parent = erase.parentElement;
parent.removeChild(sell);
parent.insertBefore(sell,parent.firstChild);
parent.removeChild(erase);
parent.insertBefore(erase,parent.firstChild);
document.getElementById("replaceButton").remove();
document.getElementById("savesButton").remove();
document.getElementById("elemSelectButton").remove();
doRandomEvents = function() {}
worldGen = function() {}
worldgentypes = {}
loadSave = function() {}
showSaves = function() {}
placeImage = function() {}
chooseElementPrompt = function() {}
document.getElementById("toolControls").insertAdjacentHTML("beforeend",`<button class="controlButton" title="Erases all survival.js data" onclick="if (confirm('THIS WILL ERASE ALL survival.js DATA!!! ARE YOU SURE?')) {settings.survivalClone=null; settings.survival = null; saveSettings(); location.reload()}">StartOver</button>`);
createCategoryDiv("shop");
var shopDiv = document.getElementById("category-shop");
shopDiv.style.display = "none";
shopDiv.insertAdjacentHTML("beforeend",`<p>You have $<span id="coinCount">${settings.survival.gold_coin||0}</span></p>`);
for (var element in survivalShop) {
var price = survivalShop[element];
var button = document.createElement("button");
var name = element;
var amount = 1;
if (element.indexOf("*") !== -1) { amount = parseInt(element.split("*")[1]); name = element.split("*")[0]; }
var elemname = name;
name = (elements[elemname].name||name).replace(/_/g, " ").replace("."," ").replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}).replace(" ",".").replace(/ /g, "");
button.classList.add("elementButton");
button.setAttribute("element",element);
button.setAttribute("category","shop");
button.setAttribute("title",amount+" "+name+" for $"+price);
button.innerHTML = name+"<span style='font-family:Arial;font-size:1.15em'> ("+amount+" for $"+price+")</span>";
if (elements[elemname]) {
if (elements[elemname].color instanceof Array) {
button.style.backgroundImage = "linear-gradient(to bottom right, "+elements[elemname].color.join(", ")+")";
// choose the middlemost item in array
var colorObject = elements[elemname].colorObject[Math.floor(elements[elemname].colorObject.length/2)];
if (elements[elemname].darkText !== false && (elements[elemname].darkText || (colorObject.r+colorObject.g+colorObject.b)/3 > 200)) {
button.className += " bright"
}
}
else {
button.style.background = elements[elemname].color;
var colorObject = elements[elemname].colorObject;
if (elements[elemname].darkText !== false && (elements[elemname].darkText || (colorObject.r+colorObject.g+colorObject.b)/3 > 200)) {
button.className += " bright"
}
}
}
button.addEventListener("click",function(){
survivalBuy(this.getAttribute("element"));
});
shopDiv.appendChild(button);
}
shopDiv.insertAdjacentHTML("beforeend",`<p><button style="background-color:#dddd00" class="elementButton bright" title="Resets the cloner" onclick="survivalResetCloner()">ResetCloner<span style='font-family:Arial;font-size:1.15em'> ($1000)</span></button></p>`);
createCategoryDiv("prices");
var pricesDiv = document.getElementById("category-prices");
pricesDiv.style.display = "none";
for (var element in elementWorth) {
if (elementWorth[element] <= 0) { continue }
var name = (elements[element].name||element).replace(/_/g, " ").replace("."," ").replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}).replace(" ",".");
// create text with the name of the element and its worth, separated by •
var text = name+"="+elementWorth[element] + " • ";
pricesDiv.insertAdjacentHTML("beforeend",`${text}`);
}
pricesDiv.innerHTML = pricesDiv.innerHTML.slice(0,-2);
pricesDiv.innerHTML = "<p style='font-family:Arial'>"+pricesDiv.innerHTML+"</p>";
});
runAfterLoad(function(){
checkUnlock = function(element) {
return;
}
oldClearAll = clearAll;
clearAll = function() {
if (currentPixels && currentPixels.length > 0) {
for (var i = 0; i < currentPixels.length; i++) {
var pixel = currentPixels[i];
if (pixel && pixel.element) {
survivalAdd(pixel.element,1);
}
}
}
oldClearAll();
}
mouseAction = function(e,mouseX,mouseY,startPos) {
if (mouseType == "left") {
mouse1Action(e,mouseX,mouseY,startPos);
}
else if (mouseType == "right") { mouse2Action(e,mouseX,mouseY,startPos); }
else if (mouseType == "middle") { mouseMiddleAction(e,mouseX,mouseY); }
}
mouse1Action = function(e,mouseX=undefined,mouseY=undefined,startPos) {
if (currentElement === "erase") { mouse2Action(e,mouseX,mouseY); return; }
else if (currentElement === "pick") { mouseMiddleAction(e,mouseX,mouseY); return; }
// If x and y are undefined, get the mouse position
if (mouseX == undefined && mouseY == undefined) {
// var canvas = document.getElementById("game");
// var ctx = canvas.getContext("2d");
lastPos = mousePos;
mousePos = getMousePos(canvas, e);
var mouseX = mousePos.x;
var mouseY = mousePos.y;
}
var cooldowned = false;
if ((mouseSize===1 || elements[currentElement].maxSize===1) && elements[currentElement].cooldown) {
if (pixelTicks-lastPlace < elements[currentElement].cooldown) {
return;
}
cooldowned = true;
}
lastPlace = pixelTicks;
startPos = startPos || lastPos
if (!(isMobile || (cooldowned && startPos.x===lastPos.x && startPos.y===lastPos.y) || elements[currentElement].tool || elements[currentElement].category==="tools")) {
var coords = lineCoords(startPos.x,startPos.y,mouseX,mouseY);
}
else { var coords = mouseRange(mouseX,mouseY); }
var element = elements[currentElement];
var mixList = [];
// For each x,y in coords
for (var i = 0; i < coords.length; i++) {
var x = coords[i][0];
var y = coords[i][1];
if (currentElement === "mix") {
if (!isEmpty(x,y,true)) {
var pixel = pixelMap[x][y];
if (!(elements[pixel.element].movable !== true || elements[pixel.element].noMix === true) || shiftDown) {
mixList.push(pixel);
}
}
}
else if (elements[currentElement].tool && !(elements[currentElement].canPlace && isEmpty(x,y))) {
// run the tool function on the pixel
if (!isEmpty(x,y,true)) {
var pixel = pixelMap[x][y];
// if the current element has an ignore property and the pixel's element is in the ignore property, don't do anything
if (elements[currentElement].ignore && elements[currentElement].ignore.indexOf(pixel.element) != -1) {
continue;
}
elements[currentElement].tool(pixel);
}
}
else if (isEmpty(x, y)) {
if (survivalCount(currentElement) < 1 && elements[currentElement].category !== "tools") {
return;
}
createPixel(currentElement,x,y);
if (elements[currentElement].customColor || elements[currentElement].singleColor) {
pixelMap[x][y].color = pixelColorPick(currentElement,currentColor);
}
if (elements[currentElement].category !== "tools") { survivalRemove(currentElement,1); }
}
}
if (currentElement == "mix") {
for (var i = 0; i < mixList.length; i++) {
var pixel1 = mixList[Math.floor(Math.random()*mixList.length)];
var pixel2 = mixList[Math.floor(Math.random()*mixList.length)];
swapPixels(pixel1,pixel2);
mixList.splice(mixList.indexOf(pixel1),1);
mixList.splice(mixList.indexOf(pixel2),1);
if (elements[pixel1.element].onMix) {
elements[pixel1.element].onMix(pixel1,pixel2);
}
if (elements[pixel2.element].onMix) {
elements[pixel2.element].onMix(pixel2,pixel1);
}
}
}
}
mouse2Action = function(e,mouseX=undefined,mouseY=undefined,startPos) {
// Erase pixel at mouse position
if (mouseX == undefined && mouseY == undefined) {
// var canvas = document.getElementById("game");
// var ctx = canvas.getContext("2d");
lastPos = mousePos;
mousePos = getMousePos(canvas, e);
var mouseX = mousePos.x;
var mouseY = mousePos.y;
}
if (dragStart) {
dragStart = 0;
for (var i = 0; i < draggingPixels.length; i++) {
var pixel = draggingPixels[i];
delete pixel.drag;
}
draggingPixels = null;
}
// If the current element is "pick" or "lookup", coords = [mouseX,mouseY]
if (currentElement == "pick" || currentElement == "lookup") {
var coords = [[mouseX,mouseY]];
}
else if (!isMobile) {
startPos = startPos || lastPos
var coords = lineCoords(startPos.x,startPos.y,mouseX,mouseY);
}
else {
var coords = mouseRange(mouseX,mouseY);
}
// For each x,y in coords
for (var i = 0; i < coords.length; i++) {
var x = coords[i][0];
var y = coords[i][1];
if (!isEmpty(x, y)) {
if (outOfBounds(x,y)) {
continue
}
var pixel = pixelMap[x][y];
survivalAdd(pixel.element,1);
delete pixelMap[x][y];
// Remove pixel from currentPixels
for (var j = 0; j < currentPixels.length; j++) {
if (currentPixels[j].x == x && currentPixels[j].y == y) {
currentPixels.splice(j, 1);
break;
}
}
}
}
}
})
window.addEventListener("beforeunload",function(){
clearAll();
saveSettings();
});