This commit is contained in:
GGod 2024-05-05 22:06:05 +02:00
commit acb9ccd8db
45 changed files with 13537 additions and 1543 deletions

View File

@ -109,6 +109,12 @@
<p>The original <a href="https://sandboxels.r74n.com/changelog.txt">plain text version</a> of this is still maintained.</p>
</div>
<h2 id="1.9.4.1">[Version 1.9.4.1 - April 8, 2024 - Eclipse Special]</h2>
<ul>
<li>+ Attempting to place Rock Wall on top of Sun begins a solar eclipse</li>
<li>+ Sun can draw over Light pixels</li>
</ul>
<h2 id="1.9.4">[Version 1.9.4 - March 17, 2024 - Natural Disasters]</h2>
<ul>
<li>+ Tornado</li>

View File

@ -7,6 +7,10 @@ See sneak peaks for upcoming updates on the Discord: https://discord.gg/ejUc6YPQ
A fancier version of this changelog can be found here: https://sandboxels.R74n.com/changelog
[Version 1.9.4.1 - April 8, 2024 - Eclipse Special]
+ Attempting to place Rock Wall on top of Sun begins a solar eclipse
+ Sun can draw over Light pixels
[Version 1.9.4 - March 17, 2024 - Natural Disasters]
+ Tornado
+ Earthquake

View File

@ -48,7 +48,7 @@
<meta name="twitter:creator:id" content="1436857621827530753">
<script> // versioning info
currentversion = "1.9.4";
currentversion = "1.9.4.1";
saveVersion = 2;
</script>
<style>
@ -1159,6 +1159,17 @@
"rock_wall": {
color: ["#666666","#363636","#7a7a7a"],
behavior: behaviors.WALL,
tool: function(pixel) {
if (pixel.element === "sun") {
pixel.eclipse = true;
if (Math.random() < 0.1) {
changePixel(pixel,"rock_wall");
pixel.temp = 20;
pixel.color = pixelColorPick(pixel,"#301B16")
}
}
},
canPlace: true,
tempHigh: 950,
stateHigh: "magma",
category: "land",
@ -2177,7 +2188,8 @@
tick: function(pixel) {
// minimum 1726
// maximum 7726
if (pixel.temp < 1500) { pixel.color = pixelColorPick(pixel,"#7a4e43"); var c=0 }
if (pixel.eclipse) { pixel.color = pixelColorPick(pixel,"#FD8C03"); var c=0.01}
else if (pixel.temp < 1500) { pixel.color = pixelColorPick(pixel,"#7a4e43"); var c=0 }
else if (pixel.temp < 3600) { pixel.color = pixelColorPick(pixel,"#ffbdbd"); var c=0.015 }
else if (pixel.temp < 5000) { pixel.color = pixelColorPick(pixel,"#ffd5bd"); var c=0.025 }
else if (pixel.temp < 7000) { pixel.color = pixelColorPick(pixel,"#ffffbd"); var c=0.05 }
@ -2194,16 +2206,25 @@
}
else if (!outOfBounds(x,y)) {
var newPixel = pixelMap[x][y];
if (pixel.temp!==newPixel.temp && elements[newPixel.element].id === elements.sun.id) {
var avg = (pixel.temp + newPixel.temp)/2;
pixel.temp = avg;
newPixel.temp = avg;
pixelTempCheck(pixel);
pixelTempCheck(newPixel);
if (elements[newPixel.element].id === elements.sun.id) {
if (pixel.eclipse) { newPixel.eclipse = true }
if (pixel.temp!==newPixel.temp) {
var avg = (pixel.temp + newPixel.temp)/2;
pixel.temp = avg;
newPixel.temp = avg;
pixelTempCheck(pixel);
pixelTempCheck(newPixel);
}
}
}
}
},
tool: function(pixel) {
if (pixel.element === "light") {
deletePixel(pixel.x,pixel.y);
}
},
canPlace: true,
reactions: {
"hydrogen": { elem2:"helium", temp1:5 },
"helium": { elem2:"carbon_dioxide", temp1:5, tempMax:3600 },
@ -16222,7 +16243,8 @@ Cancer, Landmine, Grenade, Smoke Grenade">?</span> <input type="button" value="O
<option value="zh_cn">简体中文</option>
</optgroup>
</select></p>
<p>Email us at <a href="mailto:contact@R74n.com">contact@R74n.com</a> for advertising, help, or education!</p>
<p>Try our NEW GAME: <a href="https://R74n.com/cook/" target="_blank">Infinite Chef</a></p>
<p>Email us at <a href="mailto:contact@R74n.com?subject=%5BSandboxels%5D">contact@R74n.com</a> for advertising, help, or education!</p>
<div id="newsletterFrame">Be notified when Sandboxels and other R74n projects are updated, along with ramblings from the developer!<br><br>
<form action="https://news.r74n.com/api/v1/free?nojs=true" method="post" class="form _form_1mxvn_6" novalidate="" target="_blank"><input type="hidden" name="first_url" value="https://news.r74n.com/embed"><input type="hidden" name="first_referrer"><input type="hidden" name="current_url" value="https://news.r74n.com/embed"><input type="hidden" name="current_referrer"><input type="hidden" name="referral_code"><input type="hidden" name="source" value="embed"><input type="hidden" name="referring_pub_id"><input type="hidden" name="additional_referring_pub_ids">
<input type="email" placeholder="Type your email..." name="email" style="padding:15px"><input type="submit" value="Subscribe" style="background: rgb(23, 166, 255); padding:15px; border-radius: 20px"></input>
@ -16237,10 +16259,10 @@ Cancer, Landmine, Grenade, Smoke Grenade">?</span> <input type="button" value="O
border: white solid 2px;
}
</style>
<!-- <iframe id="newsletteriframe" width="450" height="250" style="border:1px solid #EEE; background:black; max-width:90%" frameborder="0" scrolling="no"></iframe>
<!-- <iframe id="newsletteriframe" width="450" height="250" style="border:1px solid #EEE; background:black; max-width:90%" frameborder="0" scrolling="no"></iframe> -->
<script>
window.addEventListener('load', function() {
document.getElementById("newsletteriframe").src = "https://news.r74n.com/embed";
// document.getElementById("newsletteriframe").src = "https://news.r74n.com/embed";
var langSelect = document.getElementById("langSelect");
if (langCode) { langSelect.value = langCode }
else if (settings.lang) { langSelect.value = settings.lang }
@ -16249,7 +16271,7 @@ Cancer, Landmine, Grenade, Smoke Grenade">?</span> <input type="button" value="O
document.getElementById("langCredit").style.display = "block";
}
})
</script> -->
</script>
<p>Support development by subscribing on <a href="https://www.patreon.com/R74n" rel="me" target="_blank">our Patreon</a>! Many benefits!!</p>
</div>
@ -16263,7 +16285,7 @@ Cancer, Landmine, Grenade, Smoke Grenade">?</span> <input type="button" value="O
<p>Sandboxels has many <a href="https://sandboxels.R74n.com/education-use"></a>applications in education</a>. With a hands-on experience, it can give students an understanding of emerging phenomena in many fields, such as biology, chemistry, ecology, geology, cooking, and even virology. There are countless aspects to discover.</p>
<p>We have a thriving community on <a href="https://discord.gg/ejUc6YPQuS" target="_blank">Discord</a>! There you can post feedback or share your creations.</p>
<!-- <p>If you'd like to support us, consider donating on <a href="https://www.paypal.com/donate/?hosted_button_id=GCX4VHQ7SZWTN" target="_blank">PayPal</a> or <a href="https://cash.app/$emojiartist" target="_blank" title="$emojiartist">CashApp</a>, or subscribing on Discord.</p> -->
<p>Business inquiries? Education stories? Help needed? Email us at <a href="mailto:contact@r74n.com">contact@R74n.com</a>!</p>
<p>Business inquiries? Education stories? Help needed? Email us at <a href="mailto:contact@R74n.com?subject=%5BSandboxels%5D">contact@R74n.com</a>!</p>
<p>More links: <a href="https://sandboxels.R74n.com/help" rel="help">Help</a><a href="https://sandboxels.R74n.com/tips">Tips</a><a href="https://sandboxels.R74n.com/mod-list">Mods</a><a href="https://sandboxels.R74n.com/mobile-use">Mobile</a><a href="https://sandboxels.R74n.com/offline-use">Offline</a><a href="https://R74n.com/privacy">Privacy</a></p>
<p>Thanks to: Serioustar, ggod, Midi_png, personman, fnl4y, PitsPower, swagg boi, kaeud, WeiChei, Trent, u2ce</p>
<p style="display:none" id="langCredit">Translation by R74n</p>

View File

@ -189,7 +189,7 @@
"bubble":"buborék",
"acid":"sav",
"neutral_acid":"semleges_sav",
"acid_gas":"savgáz",
"acid_gas":"savgőz",
"glue":"ragasztó",
"soda":"szénsavas_üdítőital",
"gray_goo":"szürke_ragacs",
@ -242,7 +242,7 @@
"sterling":"sterling_ezüst",
"gallium":"gallium",
"molten_gallium":"olvadt_gallium",
"gallium_gas":"gallium_gáz",
"gallium_gas":"galliumz",
"rose_gold":"rózsaarany",
"purple_gold":"lila_arany",
"blue_gold":"kék_arany",
@ -259,7 +259,7 @@
"molten_solder":"olvadt_forrasztó_fém",
"juice":"lé",
"juice_ice":"fagyott_lé",
"broth":"leves_leve",
"broth":"leves",
"milk":"tej",
"chocolate_milk":"csokis_tej",
"fruit_milk":"gyümölcsös_tej",
@ -348,7 +348,7 @@
"amber":"borostyán",
"caramel":"karamella",
"molasses":"melasz",
"ketchup":"kechup",
"ketchup":"ketchup",
"mayo":"majonéz",
"melted_chocolate":"olvasztott_csokoládé",
"liquid_hydrogen":"folyékony_hidrogén",
@ -357,7 +357,7 @@
"liquid_helium":"folyékony_hélium",
"sodium":"nátrium",
"molten_sodium":"olvadt_nátrium",
"sodium_gas":"nátrium_gáz",
"sodium_gas":"nátriumz",
"calcium":"kalcium",
"molten_calcium":"olvadt_kalcium",
"limestone":"mészkő",
@ -377,7 +377,7 @@
"fragrance":"illat",
"perfume":"parfüm",
"cyanide":"cián",
"cyanide_gas":"cián_gáz",
"cyanide_gas":"ciángáz",
"ozone":"ózon",
"cloud":"felfő",
"rain_cloud":"esőfelhő",
@ -394,7 +394,7 @@
"led_b":"kék_led",
"sulfur":"kén",
"molten_sulfur":"olvadt_kén",
"sulfur_gas":"kén_gáz",
"sulfur_gas":"kénz",
"copper_sulfate":"rézgálic",
"snake":"kígyó",
"loopy":"kacskaringós",
@ -426,7 +426,7 @@
"bead":"gyöngy",
"color_sand":"színes_homok",
"borax":"bórax",
"epsom_salt":"epsom_só",
"epsom_salt":"keserűsó",
"potassium_salt":"kálium_só",
"sodium_acetate":"nátrium-acetát",
"lightning":"villámcsapás",
@ -475,8 +475,8 @@
"molten_dirt":"olvadt_föld",
"debug":"hibaelhárító",
"prop":"tulajdonság-állító",
"salt_ice":"só_jég",
"sugar_ice":"cukor_jég",
"salt_ice":"sós_jég",
"sugar_ice":"cukros_jég",
"seltzer_ice":"fagyott_szódavíz",
"dirty_ice":"piszkos_jég",
"pool_ice":"fagyott_medencevíz",
@ -501,7 +501,7 @@
"molten_blue_gold":"olvadt_kék_arany",
"molten_electrum":"olvadt_elektrum",
"molten_pyrite":"olvadt_pirit",
"broth_ice":"fagyott_leves_leve",
"broth_ice":"fagyott_leves",
"frozen_vinegar":"fagyott_ecet",
"sauce_ice":"fagyott_szósz",
"alcohol_ice":"fagyott_alkohol",
@ -519,7 +519,7 @@
"molten_alga":"olvadt_alumínium-gallim_ötvözet",
"molten_metal_scrap":"olvadt_fémtörmelék",
"molten_borax":"olvadt_borax",
"molten_epsom_salt":"olvadt_epsom-só",
"molten_epsom_salt":"olvadt_keserűsó",
"molten_potassium_salt":"olvadt_kálium_só",
"molten_sodium_acetate":"olvadt_nátrium-acetát",
"frozen_nitro":"fagyott_nitroglicerin",
@ -531,7 +531,7 @@
"molten_potassium": "olvadt_kálium",
"magnesium": "magnézium",
"molten_magnesium": "olvadt_magnézium",
"sandstorm": "",
"sandstorm": "homokvihar",
"caustic_potash": "kálium-hidroxid",
"antibomb": "antibomba",
"tornado": "tornádó",
@ -539,5 +539,5 @@
"tsunami": "cunami",
"blaster": "plazmavető",
"propane_ice": "fagyott_propán",
"molten_caustic_potash": "Olvadt_kálium-hidroxid"
"molten_caustic_potash": "olvadt_kálium-hidroxid"
}

View File

@ -117,11 +117,12 @@
<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>
<tr><td>betterStats.js</td><td>Separate “real” and “set” TPS, meaning you can see what the TPS actually is, instead of only seeing what its set to</td><td>mollthecoder</td></tr>
<tr><td>buildingreplicator.js</td><td>Scans and replicates builds anywhere on the screen, along with some preset submitted builds</td><td>nousernamefound</td></tr>
<tr><td>change.js</td><td>Adds a tool that only replaces existing pixels</td><td>Alice</td></tr>
<tr><td>color_tools.js</td><td>Adds tools that manipulate colors</td><td>Alice</td></tr>
<tr><td>controllable_pixel_test.js</td><td>Adds a pixel that can be controlled with the keyboard keys. <a href="https://github.com/R74nCom/sandboxels/commit/58dfa9477f2ed7ec9c44b00a35162e7c63bc129c">Read the commit description for more info.</a> [PC ONLY]</td><td>Alice</td></tr>
@ -137,6 +138,7 @@
<tr><td>find.js</td><td>Adds a find mode that highlights a chosen element as pulsating red and yellow <a href="https://github.com/R74nCom/sandboxels/commit/de0dc088ab4d928c77587b9d0e3a7d7663e3f94a">(read commit description)</a></td><td>Alice</td></tr>
<tr><td>insane_random_events.js</td><td>Massively buffs random events</td><td>Alice</td></tr>
<tr><td>invertscroll.js</td><td>Inverts the scroll wheel for adjusting brush size</td><td>SquareScreamYT</td></tr>
<tr><td>mobile_shift.js</td><td>Adds a button for shift on mobile</td><td>SquareScreamYT</td></tr>
<tr><td>moretools.js</td><td>Adds more temperature-modifying tools (±10/tick, ±50/tick, and absolute zero tools)</td><td>Sightnado</td></tr>
<tr><td>move_tools.js</td><td>Adds tools that move pixels</td><td>Alice</td></tr>
<tr><td>noconfirm.js</td><td>Removes all confirmation pop ups</td><td>mollthecoder</td></tr>
@ -155,6 +157,7 @@
<tr><td>alcohol.js</td><td>Adds methanol, (iso-)propanol, and butanol</td><td>Alice</td></tr>
<tr><td>alkahest.js</td><td>Adds the alkahest, a liquid which dissolves anything</td><td>Alice</td></tr>
<tr><td>aScientistsWish.js</td><td>Adds things that related to science, especially radiation</td><td>Carbon Monoxide, CPU</td></tr>
<tr><td>bettermetalscrap.js</td><td>Allows metal scrap to be melted back into its original material</td><td>nousernamefound</td></tr>
<tr><td>bigger_star_spawners.js</td><td>Adds spawners for larger stars</td><td>Alice</td></tr>
<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>
@ -166,6 +169,7 @@
<tr><td>Gemstones.js</td><td>Adds more gemstones</td><td>Schweeny</td></tr>
<tr><td>glenn_gases.js</td><td>Adds most gases from the <a href="https://www.jamieswhiteshirt.com/minecraft/mods/gases/">Glenn's Gases</a> mod into Sandboxels</td><td>Alice</td></tr>
<tr><td>grav_mudstones.js</td><td>Adds various forms of mudstone with different gravities</td><td>Alice</td></tr>
<tr><td>halogen.js</td><td>Adds the missing halogens</td><td>nousernamefound</td></tr>
<tr><td>hidden_ground.js</td><td>Hides most rock variants from the_ground.js excluding the base rocks and walls</td><td>Melecie</td></tr>
<tr><td>iocalfaeus_clones.js</td><td>Adds Iorefrius, Iolucius, and Ioradius gas</td><td>Alice</td></tr>
<tr><td>jaydstuff.js</td><td>Adds various chemicals and compounds</td><td>Jayd</td></tr>
@ -198,6 +202,7 @@
<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>
<tr><td>portal.js</td><td>Adds portals that can teleport pixels</td><td>Alice</td></tr>
<tr><td>pullers.js</td><td>Adds pixels that pull pixels towards them</td><td>voidapex11</td></tr>
<tr><td>pushers.js</td><td>Adds pixels that push elements away from them</td><td>Alice</td></tr>
<tr><td>spouts.js</td><td>Adds spouts for all liquids</td><td>kaeud</td></tr>
<tr><td>state_voids.js</td><td>Adds several elements that each delete a specific state of matter (and combinations thereof)</td><td>Alice</td></tr>
@ -218,8 +223,10 @@
<tr><td>weapons.js</td><td>Adds some extra weapons</td><td>Jayd</td></tr>
<!----><tr><td class="modCat" colspan="3">Food & Cooking</td></tr><!---->
<tr><td>aChefsDream.js</td><td>Adds more foods, animals, tools and many other cooking related items</td><td>SquareScreamYT, RealerRaddler</td></tr>
<tr><td>aChefsDream.js</td><td>Adds more foods, animals, tools and many other cooking related items. Updates can be found in <a href="https://www.youtube.com/watch?v=pQFTtlNPODQ&list=PLWHqGb75vC8o7CLv-pMoVb56JL9BY9F0t">this YouTube Playlist</a></td><td>SquareScreamYT</td></tr>
<tr><td>aChefsDream_beta.js</td><td>Beta testing for aChefsDream. The code can be found <a href="https://www.github.com/SquareScreamYT/aChefsDream.js">on GitHub</a></td><td>SquareScreamYT</td></tr>
<tr><td>bananas.js</td><td>Adds bananas and banana plants</td><td>Alice</td></tr>
<tr><td>community_desserts.js</td><td>Adds various desserts from community suggestions</td><td>Tisquares</td></tr>
<tr><td>greenitemsandmore.js</td><td>Adds various green things, including apples and more food</td><td>zonneschijn7</td>
<tr><td>ketchup_mod.js</td><td>Adds a bunch of ketchup related stuff, plus a few other condiments</td><td>Nubo318 (main dev), Devi, Alice (contributors)</td></tr>
<tr><td>lemonade.js</td><td>Adds lemons and lemonade</td><td>personman / baconthemyth</td></tr>
@ -228,6 +235,8 @@
<tr><td>sbstuff.js</td><td>Adds many foods</td><td>stefanblox</td></tr>
<tr><td>soups.js</td><td>Adds seasoning and soup</td><td>pixelegend4</td></tr>
<tr><td>weAllScreamFor.js</td><td>Adds ice cream toppings</td><td>rottenEgghead</td></tr>
<tr><td>CherrySoda.js</td><td>Adds materials to make Cherry soda. Benzaldehyde + seltzer = Cherrysoda.</td><td>guzzo86</td></tr>
<tr><td>GrapeSoda.js</td><td>Adds materials to make Grape soda. Methylanthranilate + seltzer = Grapesoda.</td><td>guzzo86</td></tr>
<!----><tr><td class="modCat" colspan="3">Life & Nature</td></tr><!---->
<tr><td>advanced_colonies.js</td><td>Adds davlers, creatures with complex colonies</td><td>DaviStudios</td></tr>
@ -263,11 +272,13 @@
<tr><td>volcanic_expansion.js</td><td>Adds Obsidian, Pumice, and Andesite rocks</td><td>Jayd</td></tr>
<!----><tr><td class="modCat" colspan="3">Fun & Games</td></tr><!---->
<tr><td>10kelements.js</td><td>Inserts a customizable amount of randomly generated elements into the game</td><td>nousernamefound</td></tr>
<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>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 Mod (Unreleased)</td><td>As seen on TikTok - Not yet available!</td><td>ggod</td></tr>
<tr><td>elem3.js</td><td>Adds all elements and combinations from Elemental 3 [Very Large]</td><td>Sophie</td></tr>
<tr><td>fools+.js</td><td>improves and makes fools.js EXTREMELY annoying.</td><td>SquareScreamYT</td></tr>
<tr><td>funny elements 2022-11-15.js</td><td>Adds a few curated randomly-generated elements</td><td>Alice</td></tr>
@ -303,6 +314,7 @@
<!----><tr><td class="modCat" colspan="3">Compilations</td></tr><!---->
<tr><td>a_mod_by_alice.js</td><td>A mod combining most of Alices mods, and some other things</td><td>Alice</td></tr>
<tr><td>food_mods.js</td><td>A mod combining most food mods</td><td>stefanblox, moss, Tisquares, SquareScreamYT, Adora, pixelegend4, Alice, Nubo318, Clide4, rottenEgghead</td></tr>
<!----><tr><td class="modCat" colspan="3">Technical Libraries & Tests</td></tr><!---->
<tr><td>a_bundle_of_tests.js</td><td>Several test functions</td><td>Alice</td></tr>

View File

@ -1,11 +1,33 @@
var color = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e","f"]
var states = ["solid", "liquid", "gas"]
var total = 0
var dangerouselements = ["supernova", "n_explosion", "pn_explosion", "armageddon", "nuke", "h_bomb"]
var elementslist = []
for (elementi in elements){
elementslist.push(elementi)
}
elements.change_count = {
color: "#34eb86",
canPlace: false,
behavior: behaviors.SELFDELETE,
onSelect: function() {
var cans = prompt("Please input how many elements you would like to be generared each time.", 10000);
if (!cans) { return }
if (cans == "skin"){settings.randomcount = 10000; settings.skineasteregg = true; saveSettings(); alert("skin"); return}
if (cans > 2000000){alert("You have put too big of a number! This would surely crash your browser or eat up all your RAM! Element count will remain unchanged."); return}
if (cans < 1 && (parseInt(cans) > -1) ){alert("You have either put a decimal or zero. Why? Element count will remain unchanged."); return}
if (isNaN(parseInt(cans))){alert("Apparently your input isnt even a number. Try again. Element count will remain unchanged."); return}
settings.randomcount = parseInt(cans)
settings.skineasteregg = false;
saveSettings()
},
category: "random"
}
var choosebehaviors = behaviors
delete choosebehaviors.KILLPIXEL2
delete choosebehaviors.KILLPIXEL1
if (!settings.randomcount){settings.randomcount = 10000; saveSettings()}
var color = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e","f"]
var states = ["solid", "liquid", "gas"]
var essentialelements = ["molten_gallium", "gallium", "gallium_gas", "change_count"]
var total = 0
var dangerouselements = ["supernova", "n_explosion", "pn_explosion", "armageddon", "nuke", "h_bomb"]
function randomIntFromInterval(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min)
}
@ -13,41 +35,86 @@ var randomProperty = function (obj) {
var keys = Object.keys(obj);
return obj[keys[ keys.length* Math.random() << 0]];
};
for (var i = 1; i <= 10000; i++){
var f = Math.random() < 0.2
var co = Math.random() < 0.2
elements["element_"+i] = {
color: "#" + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)],
category: "random",
behavior: randomProperty(behaviors),
state: states[Math.floor(Math.random()*states.length)],
reactions: {},
density: randomIntFromInterval(1, 10000)
if (Math.abs(settings.randomcount) == settings.randomcount){
if (!settings.skineasteregg){
for (var i = 1; i <= settings.randomcount; i++){
var canHeat = Math.random() < 0.2
var canCold = Math.random() < 0.2
elements["element_"+i] = {
color: "#" + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)],
category: "random",
behavior: randomProperty(choosebehaviors),
state: states[Math.floor(Math.random()*states.length)],
reactions: {},
density: randomIntFromInterval(1, 10000)
}
total = i
if (canHeat){
elements["element_"+i].tempHigh = 20 + randomIntFromInterval(10, 6000)
elements["element_"+i].stateHigh = elementslist[Math.floor(Math.random()*elementslist.length)]
}
if (canCold){
elements["element_"+i].tempLow = 20 - randomIntFromInterval(10, 270)
elements["element_"+i].stateLow = elementslist[Math.floor(Math.random()*elementslist.length)]
}
for (r = 0; r < 10; r++){
elements["element_"+i].reactions[elementslist[Math.floor(Math.random()*elementslist.length)]] = { elem1: elementslist[Math.floor(Math.random()*elementslist.length)], elem2: elementslist[Math.floor(Math.random()*elementslist.length)]}
}
// console.log(i + " is done!")
// console.log(i)
// console.log(elements["element_"+i].behavior)
if (elements["element_" + i].density == i){
console.log(i + "is unique because its density is the same as its id!")
}
total = i
if (f){
elements["element_"+i].tempHigh = 20 + randomIntFromInterval(10, 6000)
elements["element_"+i].stateHigh = elementslist[Math.floor(Math.random()*elementslist.length)]
}
if (co){
elements["element_"+i].tempLow = 20 - randomIntFromInterval(10, 270)
elements["element_"+i].stateLow = elementslist[Math.floor(Math.random()*elementslist.length)]
}
for (r = 0; r < 10; r++){
elements["element_"+i].reactions[elementslist[Math.floor(Math.random()*elementslist.length)]] = { elem1: elementslist[Math.floor(Math.random()*elementslist.length)], elem2: elementslist[Math.floor(Math.random()*elementslist.length)]}
}
// console.log(i + " is done!")
// console.log(i)
// console.log(elements["element_"+i].behavior)
if (elements["element_" + i].density == i){
console.log(i + "is unique because its density is the same as its id!")
}
for (var reaction in elements["element_" + i].reactions){
if (dangerouselements.includes(elements["element_" + i].reactions[reaction].elem1)|| dangerouselements.includes(elements["element_" + i].reactions[reaction].elem2)){
console.log(i + " is scary due to its reaction with " + reaction)
if (!elements["element_"+i].desc){
elements["element_" + i].desc = "This is scary! Don't let it touch " + reaction
}else(elements["element_"+i].desc += (" or " + reaction))
for (var reaction in elements["element_" + i].reactions){
if (dangerouselements.includes(elements["element_" + i].reactions[reaction].elem1)|| dangerouselements.includes(elements["element_" + i].reactions[reaction].elem2)){
console.log(i + " is scary due to its reaction with " + reaction)
if (!elements["element_"+i].desc){
elements["element_" + i].desc = "This is scary! Don't let it touch " + reaction
}else(elements["element_"+i].desc += (" or " + reaction))
}
}
}
} else {
for (var i = 1; i <= settings.randomcount; i++){
elements["skin_" + i] = {
color: elements.skin.color,
category: "skin",
tick: function(pixel){
changePixel(pixel, "skin", false)
},
density: elements.skin.color,
behavior: behaviors.WALL,
state: "solid",
name: "skin"
}
}
}
} else {
window.addEventListener('load', function() {
elementslist = []
for (elementi in elements){
elementslist.push(elementi)
}
var eLen = elementslist.length
const p = document.createElement("p");
p.innerText = `v${currentversion}` +(eLen - Math.abs(settings.randomcount)) +` elements, with 0 hidden`;
document.getElementById("extraInfo").querySelectorAll("small")[1].replaceChildren(p);
if (Math.abs(settings.randomcount) > elementslist.length){
console.log("mode 1")
for (var elementi in elements){
if(!essentialelements.includes(elementi)){
document.getElementById("elementButton-" + elementi)?.remove()
console.log(elementi)
}
}
} else for (var i = 1; i <= Math.abs(settings.randomcount); i++){
var elementi = elementslist[Math.floor(Math.random()*elementslist.length)]
if(!essentialelements.includes(elementi)){
elementslist.splice(elementslist.indexOf(elementi), 1)
document.getElementById("elementButton-" + elementi)?.remove()
console.log(elementi)
}
}
})
}

99
mods/Batteries.js Normal file
View File

@ -0,0 +1,99 @@
elements.charged_battery= {
color: "#9c6c25",
behavior: [
"XX|SH%50|XX", // shocks (adds charge)
"SH%50|CH:low_battery%0.05|SH%50",
"XX|SH%50|XX",
],
colorOn: "#00ff00",
category: "machines",
tempHigh: 1455.5,
stateHigh: ["molten_steel","explosion","acid_gas"],
charge: 0.5,
conduct: 1,
};
elements.low_battery= {
color: "#9c6c25",
behavior: [
"XX|SH%10|XX", // shocks (adds charge)
"SH%10|CH:dead_battery%0.05|SH%10",
"XX|SH%10|XX",
],
behaviorOn: [
"XX|SH%10|XX", // shocks (adds charge)
"SH%10|CH:charged_battery%0.05|SH%10",
"XX|SH%10|XX",
],
colorOn: "#4fb613",
category: "machines",
tempHigh: 1455.5,
stateHigh: ["molten_steel","explosion","acid_gas"],
charge: 0.5,
conduct: 0.75,
};
elements.dead_battery= {
color: "#9c6c25",
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"XX|XX|XX",
],
behaviorOn: [
"XX|XX|XX",
"XX|CH:low_battery%0.05|XX",
"XX|XX|XX",
],
colorOn: "#699e19",
category: "machines",
tempHigh: 1455.5,
stateHigh: ["molten_steel","explosion","acid_gas"],
charge: 0.5,
conduct: 0.5,
};
elements.radio_broadcaster= {
color: "#78784c",
behavior: behaviors.WALL,
behaviorOn: [
"XX|SH AND CR:radio_wave AND CR:radio_wave|XX",
"SH AND CR:radio_wave AND CR:radio_wave|XX|SH AND CR:radio_wave AND CR:radio_wave",
"XX|SH AND CR:radio_wave AND CR:radio_wave|XX",
],
colorOn: "#ffff59",
category: "machines",
tempHigh: 1455.5,
stateHigh: ["molten_steel","explosion","acid_gas"],
conduct: 1
};
elements.radio_receiver= {
color: "#78784c",
behavior: behaviors.WALL,
reactions: {radio_wave: {elem2: "electric", chance: 0.75}},
colorOn: "#ffff59",
category: "machines",
tempHigh: 1455.5,
stateHigh: ["molten_steel","explosion","acid_gas"],
conduct: 1
};
elements.radio_wave= {
color: ["#000000"],
behavior: behaviors.BOUNCY,
behaviorOn: [
["XX","CL","XX"],
["CL","DL%5","CL"],
["XX","CL","XX"]
]
,
colorOn: "#000000",
tick: function(pixel){
if (currentElement == "radio_wave"){
pixel.color = "rgb(15, 15, 15)";
} else {
pixel.color = "rgba(0, 0, 0, -1)";
}
},
category: "energy",
density: 1,
//charge: 0.5,
conduct: 0.01
};

77
mods/CherrySoda.js Normal file
View File

@ -0,0 +1,77 @@
elements.potassiumpermanganate = {
color: ["#800080", "#FF00FF"],
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
density: 2500,
desc: "Potassium permanganate is a dark purple, crystalline solid. It is used as a powerful oxidizing agent.",
tempHigh: 240,
stateHigh: "molten_potassiumpermanganate",
}
elements.molten_potassiumpermanganate = {
color: ["#4B0082", "#800080", "#9932CC", "#8A2BE2", "#6A5ACD", "#FF00FF"],
category: "powders",
state: "solid",
density: 2500,
desc: "Potassium permanganate is a dark purple, crystalline solid. It is used as a powerful oxidizing agent.",
tempLow: 239,
stateLow: "potassiumpermanganate",
}
elements.tolulene = {
color: "#FFFFFF",
behavior: behaviors.LIQUID,
category: "liquids",
state: "liquid",
density: 866,
desc: "Tolulene is used as a paint thinner and also referred to as benezene or methylbeneze",
burn: 37.5,
burnTime: 900,
burnInto: ["steam", "smoke", "fire", "fire",],
reactions: {
"potassiumpermanganate": {elem1: "benzaldehyde", elem2: "benzaldehyde"},
},
tempHigh: 111,
}
elements.benzaldehyde = {
color: "#F5F5F5",
behavior: behaviors.LIQUID,
category: "liquids",
state: "liquid",
density: 1045,
desc: "Benzaldehyde is cherry flavor. It is also clear like tolulene.",
reactions: {
"seltzer": {elem1: "cherrysoda", elem2: "cherrysoda"},
},
}
elements.cherrysoda = {
color: "#D2042D",
behavior: behaviors.LIQUID,
category: "food",
state: "liquid",
density: 1045,
desc: "Cherry soda.",
tempHigh: 150,
stateHigh: "cherrysoda_gas",
}
elements.cherrysoda_gas = {
color: "#D20459",
behavior: behaviors.GAS,
category: "gases",
state: "gas",
density: 1025,
desc: "Cherry soda gas.",
tempLow: 149,
stateLow: "cherrysoda",
temp: 169,
}
elements.cherrysoda_ice = {
color: "BF4F9C",
behavior: behaviors.wALL,
category: "solids",
state: "solid",
density: 1065,
desc: "Cherry soda gas.",
tempHigh: -27,
stateHigh: "cherrysoda",
temp: -47,
}

140
mods/GrapeSoda.js Normal file
View File

@ -0,0 +1,140 @@
elements.anthranilicacid = {
color: "#FFFFFF",
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
tempHigh: 145,
stateHigh: "moltenanthranilicacid",
reactions: {
"methanol": {elem1: "methylanthranilate", elem2: "methylanthranilate"},
},
}
elements.moltenanthranilicacid = {
color: ["#FFFF99", "#FFFF66", "#FFFF00"],
behavior: behaviors.LIQUID,
category: "states",
state: "liquid",
tempLow: 144,
stateLow: "anthranilicacid",
tempHigh: 340,
stateHigh: "anthranilicacidgas",
temp: 155,
viscosity: 10,
}
elements.anthranilicacidgas = {
color: "#FEDEFF",
behavior: behaviors.GAS,
category: "gases",
state: "gas",
tempLow: 339,
stateLow: "moltenanthranilicacid",
temp: 350,
}
elements.methanol = {
color: "#FFE4FF",
behavior: behaviors.LIQUID,
category: "liquids",
state: "liquid",
density: 792,
stateHigh: "methanolgas",
tempHigh: 65,
stateLow: "methanolice",
tempLow: -98,
burn: 100,
burnTime: 100,
burnInto: "carbondioxide"
}
elements.methanolice = {
color: "#FFFFFF",
behavior: behaviors.SOLID,
category: "solids",
state: "solid",
density: 822,
stateHigh: "methanol",
temp: -117,
tempHigh: -97,
}
elements.methanolgas = {
color: "#E1E4FF",
behavior: behaviors.GAS,
category: "gases",
state: "gas",
density: 942,
stateLow: "methanol",
tempLow: 64,
temp: 84,
}
elements.methylanthranilate = {
color: "#FFFBBA",
behavior: behaviors.LIQUID,
category: "liquids",
state: "liquid",
density: 1120,
stateHigh: "methylanthranilategas",
tempHigh: 257,
stateLow: "methylanthranilateice",
tempLow: -20,
reactions: {
"seltzer": {elem1: "grapesoda", elem2: "grapesoda",}
}
}
elements.methylanthranilategas = {
color: "#FFFBBA",
behavior: behaviors.GAS,
category: "gases",
state: "gas",
density: 1120,
stateLow: "methylanthranilate",
tempLow: 256,
temp: 276,
}
elements.methylanthranilateice = {
color: "#FFFBD7",
behavior: behaviors.WALL,
category: "solids",
state: "solid",
density: 1120,
stateHigh: "methulanthranilate",
temphigh: -19,
temp: -39,
}
elements.grapesoda = {
color: "#5B134F",
behavior: behaviors.LIQUID,
category: "food",
state: "liquid",
density: 1120,
stateHigh: "grapesodagas",
tempHigh: 257,
stateLow: "grapesodaice",
tempLow: -20,
}
elements.grapesodagas = {
color: "#B99FEA",
behavior: behaviors.GAS,
category: "gases",
state: "gas",
density: 1100,
stateLow: "grapesoda",
tempLow: 256,
temp: 257,
}
elements.grapesodaice = {
color: "#B99FC2",
behavior: behaviors.WALL,
category: "solids",
state: "solid",
density: 1140,
stateHigh: "grapesoda",
tempHigh: -19,
temp: -20,
}

517
mods/Quicksand_one.js Normal file
View File

@ -0,0 +1,517 @@
elements.peat_bog = {
color: "#483C32",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 55,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1200,
stain: 0.2
};
elements.marsh_muck = {
color: "#6B8E23",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1000,
stain: 0.25
};
elements.quagmire = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1000,
stain: 0.3
};
elements.slime_mold = {
color: "#00FF00",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 30,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1000,
stain: 0.2
};
elements.mangrove_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 55,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1089,
stain: 0.25
};
peat_slurry = {
color: "#556B2F",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1452,
stain: 0.28
};
elements.bog_ooze = {
color: "#2E8B57",
behavior:elements.slime.behavior,
viscosity: 10000,
tempHigh: 100,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1350,
stain: 0.3
};
elements.fen_mud = {
color: "#556B2F",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 100,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1550,
stain: 0.28
};
elements.swamp_sludge = {
color: "#6B8E23",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 52,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1450,
stain: 0.25
};
elements.marsh_slime = {
color: "#00FF00",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 32,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1050,
stain: 0.16
};
elements.peat_paste = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 57,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1600,
stain: 0.1
};
elements.mudflat_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1700,
stain: 0.25
};
elements.swamp_ooze = {
color: "#556B2F",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 54,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1400,
stain: 0.20
};
elements.peat_pudding = {
color: "#8B4513",
behavior: elements.sap.behavior,
viscosity: 10000,
tempHigh: 58,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1600,
stain: 0.21
};
elements.mudflow = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1700,
stain: 0.2
};
elements.marsh_mire = {
color: "#6B8E23",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 55,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1500,
stain: 0.12
};
elements.moor = {
color: "#556B2F",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 57,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1600,
stain: 0.18
};
elements.quicksand_fen = {
color: "#DAA520",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 62,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1550,
stain: 0.15
};
elements.marsh_mudslide = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 58,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1600,
stain: 0.1
};
elements.swamp_slime = {
color: "#00FF00",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 35,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1100,
stain: 0.15
};
elements.mire_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1700,
stain: 0.17
};
elements.peat_quicksand = {
color: "#DAA520",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 65,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1800,
stain: 0.15
};
elements.dense_quicksand = {
color: "#DAA520",
behavior: elements.slime.behavior,
viscosity: 1000,
tempHigh: 65,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1900,
stain: 0.2
};
elements.swamp_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 1000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1700,
stain: 0.25
};
elements.wet_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 1200,
tempHigh: 55,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1600,
stain: 0.3
};
elements.wet_quicksand = {
color: "#DAA520",
behavior: elements.slime.behavior,
viscosity: 700,
tempHigh: 70,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1080,
stain: 0.25
};
elements.slimy_mud = {
color: "#008000",
behavior: elements.slime.behavior,
viscosity: 900,
tempHigh: 55,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1550,
stain: 0.3
};
elements.sticky_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 1100,
tempHigh: 58,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1321,
stain: 0.25
};
elements.sloppy_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 1000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1700,
stain: 0.3
};
elements.thick_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 1300,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1800,
stain: 0.35
};
elements.gloopy_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosit: 1950,
tempHigh: 56,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1000,
stain: 0.28
};
elements.squelchy_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 1050,
tempHigh: 58,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1050,
stain: 0.3
};
elements.mucky_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 950,
tempHigh: 57,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1200,
stain: 0.28
};
elements.soggy_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 1050,
tempHigh: 58,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1090,
stain: 0.3
};
elements.gunky_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 900,
tempHigh: 55,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1550,
stain: 0.28
};
elements.oozy_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 950,
tempHigh: 56,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1000,
stain: 0.3
};
elements.gooey_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 1000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1300,
stain: 0.3
};
elements.goopy_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 1100,
tempHigh: 58,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1080,
stain: 0.3
};
elements.mushy_mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 1000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1200,
stain: 0.3
};
elements.mud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 1050,
tempHigh: 58,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1000,
stain: 0.3
};
elements.quicksand = {
color: "#DAA520",
behavior: elements.slime.behavior,
viscosity: 1750,
tempHigh: 70,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1300,
stain: 0.25
};
elements.sandy_mud = {
color: "#8B4513",
behavior: elements.sap.behavior,
viscosity: 1600,
tempHigh: 60,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1100,
stain: 0.3
};
elements.sticky_quicksand = {
color: "#DAA520",
behavior:elements.sap.behavior,
viscosity: 1700,
tempHigh: 65,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1100,
stain: 0.25
};

1509
mods/Science_mod.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,25 @@
elements.thread = {
color: "#fff3e6",
behavior: behaviors.STURDYPOWDER,
behavior: behaviors.SUPPORTPOWDER,
category: "thread",
state: "solid",
tempHigh: "50",
stateHigh: "ash",
hardness: "0.2",
breakInto: "wool"
breakInto: "wool",
density: " 1314",
burn: "99",
burnTime: "40"
burnTime: "40",
burnInto: "ash",
reactions: {
"weavepowder": { elem1: null, elem2: "rope" },
};
}
}
elements.wool = {
color: "#e2e1d8",
behavior: behaviors.POWDER,
behavior: behaviors.STURDYPOWDER,
category: "thread",
state: "solid",
tempHigh: "40",
@ -25,11 +27,12 @@ elements.wool = {
hardness: "1",
density: " 1314",
burn: "90",
burnTime: "40"
burnTime: "40",
burnInto: "ash",
reactions: {
"weavepowder": { elem1: null, elem2: "thread" },
};
}
}
elements.weavepowder = {
color: "#494736",
behavior: behaviors.POWDER,
@ -40,23 +43,105 @@ elements.weavepowder = {
hardness: "1",
density: " 1314",
burn: "0",
burnTime: "0"
burnTime: "0",
burnInto: "dust",
reactions: {
"wool": { elem1: thread, elem2: "null" },
"thread": { elem1: rope, elem2: "null" },
};
"wool": { elem1: "thread", elem2: null },
"thread": { elem1: "rope", elem2: null },
}
}
elements.rope = {
color: "#ffe6cc",
behavior: behaviors.STURDYPOWDER,
behavior: behaviors.SUPPORT,
category: "thread",
state: "solid",
tempHigh: "60",
stateHigh: "ash",
hardness: "0.4",
breakInto: "thread"
breakInto: "thread",
density: " 1314",
burn: "85",
burnTime: "50"
burnTime: "50",
burnInto: "ash",
}
elements.sheep = {
color: ["#FFFFE8", "#F4FFFF", "#FFF7F2","#796464","#282828"],
behavior: [
"M2%1|M2%1|M2%1",
"M2%3|XX|M2%3",
"XX|M1|XX",
],
reactions: {
"grass": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL },
"dead_plant": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL },
"plant": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL },
"oxygen": { elem2:"carbon_dioxide", chance:0.3 },
"mercury": { elem1:"rotten_meat", chance:0.1 },
"bleach": { elem1:"rotten_meat", chance:0.1 },
"infection": { elem1:"rotten_meat", chance:0.025 },
"uranium": { elem1:"rotten_meat", chance:0.1 },
"cyanide": { elem1:"rotten_meat", chance:0.1 },
"chlorine": { elem1:"meat", chance:0.1 },
"alcohol": { elem1:"meat", chance:0.025 },
"dirty_water": { elem1:"rotten_meat", chance:0.0001 },
"pool_water": { elem1:"rotten_meat", chance:0.005 },
"vinegar": { elem1:"rotten_meat", chance:0.001 },
"body": { elem1:["wool","sheep"], chance:0.1 },
},
egg: "lamb",
foodNeed: 10,
temp: 30,
tempHigh: 100,
stateHigh: "cooked_meat",
tempLow: -18,
stateLow: "frozen_meat",
category:"life",
breakInto: ["meat", "wool"],
burn:15,
burnTime:300,
state: "solid",
density: 1450,
conduct: 0.2
};
elements.lamb = {
color: ["#FFFFE8", "#F4FFFF", "#FFF7F2","#796464","#282828"],
state: "solid",
behavior: [
"M2%1|M2%2|M2%1",
"M2%4|FX%5 AND CH:sheep%0.1|M2%4",
"XX|M1|XX",
],
reactions: {
"grass": { elem2:null, chance:0.05, func:behaviors.FEEDPIXEL },
"dead_plant": { elem2:null, chance:0.05, func:behaviors.FEEDPIXEL },
"plant": { elem2:null, chance:0.05, func:behaviors.FEEDPIXEL },
"oxygen": { elem2:"carbon_dioxide", chance:0.3 },
"mercury": { elem1:"rotten_meat", chance:0.1 },
"bleach": { elem1:"rotten_meat", chance:0.1 },
"infection": { elem1:"rotten_meat", chance:0.025 },
"uranium": { elem1:"rotten_meat", chance:0.1 },
"cyanide": { elem1:"rotten_meat", chance:0.1 },
"chlorine": { elem1:"meat", chance:0.1 },
"alcohol": { elem1:"meat", chance:0.025 },
"dirty_water": { elem1:"rotten_meat", chance:0.0001 },
"pool_water": { elem1:"rotten_meat", chance:0.005 },
"vinegar": { elem1:"rotten_meat", chance:0.001 },
"body": { elem1:["wool","sheep"], chance:0.1 },
},
egg: "lamb",
foodNeed: 20,
temp: 30,
tempHigh: 100,
stateHigh: "cooked_meat",
tempLow: -18,
stateLow: "frozen_meat",
category:"life",
breakInto: ["meat","wool"],
burn:15,
burnTime:300,
state: "solid",
density: 1450,
conduct: 0.2
};

415
mods/UAMM.js Normal file
View File

@ -0,0 +1,415 @@
console.log("Thanks for using UAMM!")
elements.rubidium = {
color: ["#b5b5b5", "#c9c9c9", "#d6cccb"],
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
tempHigh: 39.3,
stateHigh: "liquid_rubidium",
density: 1532,
tick: function (pixel){
var foundelem1 = false
var foundelem2 = false
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x, y, true)){
var otherPixel = pixelMap[x][y]
if (otherPixel.element == "liquid_ammonia"){foundelem1 = true; break}
}
}
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x, y, true)){
var otherPixel = pixelMap[x][y]
if (otherPixel.element == "oxygen"){foundelem2 = true; break}
}
}
if (foundelem1 && foundelem2){changePixel(pixel, "rubidium_peroxide", false)}
},
reactions: {
"water": {elem1: "pop", elem2: "hydrogen", temp2: 400},
"oxygen": {elem1: "rubidium_superoxide", elem2: null, chance: 0.3}
}
};
elements.liquid_rubidium = {
color: ["#cccccc", "#ebe8e8", "#f2e7e6"],
behavior: behaviors.LIQUID,
hidden: true,
state: "liquid",
tempLow: 38,
stateLow: "rubidium",
density: 1475,
reactions: {
"water": {elem1: "pop", elem2: "hydrogen", temp2: 400}
}
}
elements.rubidium_superoxide = {
color: ["#eded00", "#ffff26", "#e3e33d"],
behavior: behaviors.POWDER,
hidden: true,
state: "solid",
tempHigh: 340,
stateHigh: "rubidium_peroxide",
density: 1532,
reactions: {
"water": {elem2: null}
}
};
elements.rubidium_peroxide = {
color: ["#fffed9", "#ffffe8", "#edede4"],
behavior: behaviors.POWDER,
hidden: true,
state: "solid",
density: 1532,
reactions: {
"water": {elem2: null}
}
};
elements.cesium = {
color: ["#e3a814", "#dbab32", "#e8bc4f", "#fabf2d"],
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
fireColor: "#8c21de",
burn: 1,
burnTime: 500,
tempHigh: 29,
stateHigh: "liquid_cesium",
density: 1873,
reactions: {
"water": {func: (pixel1) => {pixel1.burning=true;pixel1.burnStart=pixelTicks},
elem1: "pop", elem2: ["smoke", "fire"], temp2: 22},
"fire": {elem1: ["smoke", "pop"]}
}
};
elements.liquid_cesium = {
color: ["#ebb121", "#edbd42", "#f5cb62", "#fcd26a"],
behavior: behaviors.LIQUID,
hidden: true,
state: "liquid",
tempLow: 28,
stateLow: "cesium",
density: 1842,
reactions: {
"water": {func: (pixel1) => {pixel1.burning=true;pixel1.burnStart=pixelTicks},
elem1: "pop", elem2: ["smoke", "fire"], temp2: 22},
"radiation": {elem1: "liquid_radiocesium", elem2: "smoke", chance: 0.65}
}
};
elements.radiocesium = {
color: ["#c7bda5", "#ada287", "#99958b", "#d1ccc0"],
behavior: [
"XX|CR:radiation%1|XX",
"CR:radiation%1|XX|CR:radiation%1",
"M2|M1|M2",
],
hidden: true,
state: "solid",
fireColor: "#8c21de",
burn: 1,
burnTime: 500,
tempHigh: 29,
stateHigh: "liquid_radiocesium",
density: 1873,
tick: function (pixel) {
if (Math.random()<0.007) {
if (Math.random()<0.5) {
changePixel(pixel, "barium")
}
else {
changePixel(pixel, "radiobarium")
}
}
},
reactions: {
"water": {func: (pixel1) => {pixel1.burning=true;pixel1.burnStart=pixelTicks},
elem1: ["rad_steam", "fallout"], elem2: "explosion"}
}
};
elements.liquid_radiocesium = {
color: ["#e8dcc1", "#d4c6a5", "#bfbaae", "#f5f1e9"],
behavior: behaviors.RADMOLTEN,
hidden: true,
state: "liquid",
tempLow: 28,
stateLow: "radiocesium",
density: 1842,
tick: function (pixel) {
if (Math.random()<0.007) {
if (Math.random()<0.5) {
changePixel(pixel, "barium")
}
else {
changePixel(pixel, "radiobarium")
}
}
},
reactions: {
"water": {func: (pixel1) => {pixel1.burning=true;pixel1.burnStart=pixelTicks},
elem1: ["rad_steam", "fallout"], elem2: "explosion"}
}
};
elements.barium = {
color: ["#1e1e1e", "#353535", "#4e4e4e", "#696969"],
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
tempHigh: 730,
stateHigh: "liquid_barium",
density: 3510,
reactions: {
"water": {elem1: "barium_hydroxide", elem2: "pop"}
}
};
elements.liquid_barium = {
color: ["#1e1e1e", "#353535", "#4e4e4e", "#696969"],
behavior: behaviors.POWDER,
hidden: true,
state: "liquid",
tempLow: 729,
stateLow: "barium",
density: 3338
}
elements.radiobarium = {
color: ["#1e1e1e", "#353535", "#4e4e4e", "#696969"],
behavior: behaviors.POWDER,
hidden: true,
state: "solid",
density: 3510,
tick: function (pixel) {
if (Math.random()<0.007) {
changePixel(pixel, "barium")
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
var rays = 0;
if (isEmpty(x, y)){
createPixel("gamma_ray", x, y)
rays += 1
if (rays == 2) {
break
}
}
}
}
}
};
elements.barium_hydroxide = {
color: ["#f4f4f4", "#ffffff", "#ebebeb", "#e5e5e5"],
behavior: behaviors.POWDER,
hidden: true,
state: "solid",
density: 3510
}
elements.gamma_ray = {
color: "#ffffff",
behavior: [
"XX|XX|XX",
"XX|DL%5|XX",
"XX|XX|XX",
],
hidden: true,
temp: 1000,
state: "gas",
density: 0.00001,
ignoreAir: true,
tick: behaviors.BOUNCY
};
elements.lithium = {
color: ["#e8e8e8", "#f5f5f5", "#c9c9c9", "#d4d4d4"],
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
tempHigh: 180.5,
stateHigh: "liquid_lithium",
density: 534,
tick: function (pixel){
var otherPixel;
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y, true)){
if(Math.random()<0.003) {
changePixel(pixel, "dull_lithium")
}
}
if (!isEmpty(x, y, true)) {
otherPixel = pixelMap[x][y];
if (otherPixel.element != "mineral_oil") {
if (otherPixel.element != "lithium" && otherPixel.element != "dull_lithium" && otherPixel.element != "tarnished_lithium") {
if(Math.random()<0.0007) {
changePixel(pixel, "dull_lithium")
}
}
}
}
}
},
reactions: {
"water": {elem1: "lithium_hydroxide", elem2: "hydrogen", temp2: 400},
"hydrogen": {elem1:"lithium_hydride", elem2: null, chance: 0.5}
}
};
elements.dull_lithium = {
color: ["#d4d4d4", "#e3e3e3", "#b3b3b3", "#bfbfbf"],
behavior: behaviors.POWDER,
hidden: true,
state: "solid",
tempHigh: 180.5,
stateHigh: "liquid_lithium",
density: 534,
tick: function (pixel){
var otherPixel;
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y, true)){
if(Math.random()<0.003) {
changePixel(pixel, "dull_lithium")
}
}
if (!isEmpty(x, y, true)) {
otherPixel = pixelMap[x][y];
if (otherPixel.element != "mineral_oil") {
if (otherPixel.element != "lithium" && otherPixel.element != "dull_lithium" && otherPixel.element != "tarnished_lithium") {
if(Math.random()<0.0007) {
changePixel(pixel, "dull_lithium")
}
}
}
}
}
},
reactions: {
"water": {elem1: "lithium_hydroxide", elem2: "hydrogen", temp2: 400},
"hydrogen": {elem1:"lithium_hydride", elem2: null, chance: 0.5}
}
};
elements.tarnished_lithium = {
color: ["#212121", "#303030", "#0d0d0d", "#404040"],
behavior: behaviors.POWDER,
state: "solid",
hidden: true,
tempHigh: 180.5,
stateHigh: "liquid_lithium"
};
elements.liquid_lithium = {
color: ["#e8e8e8", "#f5f5f5", "#c9c9c9", "#d4d4d4"],
behavior: behaviors.LIQUID,
hidden: true,
state: "liquid",
tempLow: 179.5,
stateLow: "lithium",
density: 511.7
};
elements.lithium_hydroxide = {
color: ["#ffffff", "#f1f1f1", "#e7e7e7", "#ededed"],
behavior: behaviors.POWDER,
hidden: true,
state: "solid",
tempHigh: 180.5,
stateHigh: "liquid_lithium",
density: 1540,
};
elements.lithium_hydride = {
color: ["#8a8a8a", "#b5b5b5", "#bbbbbb"],
behavior: behaviors.POWDER,
hidden: true,
state: "solid",
density: 820,
tick: function (pixel){
var otherPixel;
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y, true)){
var chance = Math.random()
if(Math.random()<0.003) {
if (chance<0.3) {
changePixel(pixel, "lithium_hydroxide")
}
else if (chance>0.3 && chance<0.7) {
changePixel(pixel, "lithium_oxide")
}
else {
changePixel(pixel, "lithium_carbonate")
}
}
}
if (!isEmpty(x, y, true)) {
otherPixel = pixelMap[x][y];
if (otherPixel.element != "mineral_oil") {
if (otherPixel.element != "lithium" && otherPixel.element != "dull_lithium" && otherPixel.element != "tarnished_lithium") {
var chance = Math.random()
if(Math.random()<0.0007) {
if (chance<0.3) {
changePixel(pixel, "lithium_hydroxide")
}
else if (chance>0.3 && chance<0.7) {
changePixel(pixel, "lithium_oxide")
}
else {
changePixel(pixel, "lithium_carbonate")
}
}
}
}
}
}
},
};
elements.lithium_oxide = {
color: ["#ffffff", "#ececec", "#dbdbdb"],
behavior: behaviors.POWDER,
hidden: true,
state: "solid",
density: 2013,
reactions: {
"water": {elem1: "lithium_hydroxide", elem2: "pop", chance: 0.2},
"carbon_dioxide": {elem1: "lithium_carbonate", elem2: null}
}
};
elements.lithium_carbonate = {
color: ["#ffffff", "#e0e0e0", "#c9c8c8"],
behavior: behaviors.POWDER,
hidden: true,
state: "solid",
density: 2110
};
elements.mineral_oil = {
color: ["#cdf6fa", "#e6fdff", "#bff9ff", "#f5feff"],
behavior: behaviors.LIQUID,
state: "liquid",
category: "liquids",
density: 870,
};

File diff suppressed because it is too large Load Diff

12
mods/aChefsDream_beta.js Normal file
View File

@ -0,0 +1,12 @@
// created by SquareScreamYT
// please visit the repo to see the code
fetch('https://raw.githubusercontent.com/SquareScreamYT/aChefsDream.js/main/aChefsDream.js')
.then(response => response.text())
.then(code => {
eval(code);
})
.catch(error => {
console.error('Error fetching or executing code:', error);
alert("There was an error loading aChefsDream beta. Please reload or check your internet. If not, please try again or use the stable one at aChefsDream.js.")
});

View File

@ -15,6 +15,7 @@ elements.carbon_monoxide = {
tempLow: -192,
stateLow: "liquid_carbon_monoxide",
burntime: 5,
darkText: true,
fireColor: "#ebba34",
reactions: {
"head": { elem1:"rotten_meat", chance:0.5 },
@ -28,9 +29,11 @@ elements.liquid_carbon_monoxide = {
category: "liquids",
state: "liquid",
density: 1.14,
darkText: true,
tempHigh: -190,
temp: -192,
tempLow: -199,
hidden: true,
stateLow: "ice_carbon_monoxide",
stateHigh: "carbon_monoxide",
};
@ -42,6 +45,7 @@ elements.ice_carbon_monoxide = {
temp: -199,
density: 1.14,
tempHigh: -192,
darkText: true,
stateHigh: "liquid_carbon_monoxide",
};
elements.carbon_monoxide_detector = {
@ -187,6 +191,8 @@ elements.fallout_drum = {
state: "solid",
density: 9000,
color: "#e3cc34",
tempHigh: 2500,
stateHigh: ["aluminum","radiated_water","radiated_water","fallout"],
breakInto: ["fallout","fallout"],
reactions: {
"water": { elem1:"fallout_drum", elem2:"radiated_water" },
@ -200,13 +206,17 @@ elements.radiated_water = {
density :1300,
color: ["#23d959","#29d65d"],
hidden: true,
tempHigh: 140,
stateHigh: "polluted_air",
tempLow: -6,
stateLow: "rad_ice",
reactions: {
"human": { elem2:"rotten_meat" },
"body": { elem2:"rotten_meat" },
"head": { elem2:"ash" },
"bird": { elem2:"rotten_meat"},
"cell": { elem2:"cancer"},
}
"cell": { elem2:"cancer"},
}
};
elements.polluted_air = {
@ -220,8 +230,13 @@ elements.polluted_air = {
"head": { elem2:"rotten_meat" },
"human": { elem2:"rotten_meat" },
"bird": { elem2:"rotten_meat" },
"cell": { elem2:"cancer"},
}
"cell": { elem2:"cancer" },
"water": { elem1: null, elem2: "radiated_water" },
"worm": { elem2: ["ash","cancer"] },
"flea": { elem2: "ash" },
"seed": {elem2: "dead_plant" },
"plant": {elem1: null, chance:0.5, elem2: "dead_plant", chance:0.5 },
},
};
elements.siren = {
@ -236,4 +251,89 @@ elements.siren = {
"radiated_water": {"charge1":1},
"polluted_air": {"charge1":1},
}
};
elements.radiated_metal = {
behavior: behaviors.WALL,
category: "radiated",
state:"solid",
density :2045,
color: ["#5e705a","#83ab7b","#474747"],
tempHigh: 1440,
stateHigh: ["molten_nickel","molten_iron","molten_tin","fallout"],
reactions: {
"water": { elem2:"radiated_water", chance:0.7 },
"foam": { elem1:["tin","nickel","iron"] },
}
};
elements.rad_ice = {
behavior: behaviors.WALL,
category: "radiated",
state:"solid",
density: 1905,
color: ["#81d79c","#68b899","#68abb8"],
hidden: true,
temp: -6,
tempHigh: 5,
stateHigh: ["radiated_water","water"],
reactions: {
"snow": { elem2:"dirty_water" },
"water": { elem2:"radiated_water" },
}
}
elements.rad_snow = {
behavior: behaviors.POWDER,
category: "radiated",
state:"powder",
density: 1500,
color: ["#9effe4","#b5fffd","#d4fff1"],
temp: -2,
tempHigh: 21,
stateHigh: "radiated_water",
};
elements.rad_rock = {
behavior: behaviors.POWDER,
category: "land",
state: "powder",
density: 2790,
color: ["#34382d","#3f4633","#595a4d"],
tempHigh: 1200,
stateHigh: ["magma","fallout"],
reactions: {
"water": { elem2:"dirty_water" },
"salt_water": { elem2:"dirty_water" },
"sugar_water": { elem2:"dirty_water" },
"seltzer": { elem2:"dirty_water" },
"bleach": {elem2: "rock", chance:0.1 },
"rad_cleaner": { elem1:"rock" },
"foam": { elem1:"rock" },
"juice": { elem2: null },
"blood": { elem2:"infection" },
"grass": { elem2:"dead_plant" },
"plant": { elem2:"dead_plant" },
"cell": { elem2:"cancer" },
"worm": { elem2:"ash" },
"glass": { elem2:"rad_glass"},
"glass_shard": { elem2:"rad_shard" },
}
};
elements.rad_cleaner = {
behavior: behaviors.WALL,
category: "machines",
state: "solid",
density: 2500,
color: ["#383838","#212220"],
desc: "clean radiated elements",
tempHigh: 1250,
stateHigh: ["fallout","molten_plastic","steam"],
reactions: {
"radiated_water": {elem2:"water" },
"polluted_air": {elem2: "oxygen"},
"rad_snow": {elem2: "snow"},
"rad_rock": {elem2: "rock"},
}
}

37
mods/bettermetalscrap.js Normal file
View File

@ -0,0 +1,37 @@
if (!elements.aluminum.properties){elements.aluminum.properties = {}}
elements.aluminum.properties.scrapType = "aluminum"
if (!elements.tin.properties){elements.tin.properties = {}}
elements.tin.properties.scrapType = "tin"
if (!elements.brass.properties){elements.brass.properties = {}}
elements.brass.properties.scrapType = "brass"
if (!elements.grenade.properties){elements.grenade.properties = {}}
elements.grenade.properties.scrapType = "steel"
if (!elements.smoke_grenade.properties){elements.smoke_grenade.properties = {}}
elements.smoke_grenade.properties.scrapType = "steel"
if (!elements.flashbang.properties){elements.flashbang.properties = {}}
elements.flashbang.properties.scrapType = "steel"
var randomScrap = ["aluminum", "steel", "iron"]
delete elements.metal_scrap.tempHigh
delete elements.metal_scrap.stateHigh
if (!elements.metal_scrap.tick){
elements.metal_scrap.tick = function(pixel){
if (!pixel.scrapType){
pixel.scrapType = randomScrap[Math.floor(Math.random()*randomScrap.length)]
}
if (pixel.temp >= elements[pixel.scrapType].tempHigh){
changePixel(pixel, pixel.scrapType, false)
}
}
}
else {
const prefunc = elements.metal_scrap.tick;
elements.metal_scrap.tick = function(pixel){
prefunc(pixel);
if (!pixel.scrapType){
pixel.scrapType = randomScrap[Math.floor(Math.random()*randomScrap.length)]
}
if (pixel.temp >= elements[pixel.scrapType].tempHigh){
changePixel(pixel, pixel.scrapType, false)
}
}
}

210
mods/buildingreplicator.js Normal file
View File

@ -0,0 +1,210 @@
function playSound(soundFile) {
var audio = new Audio("https://JustAGenericUsername.github.io/" + soundFile);
audio.play();
}
function reverseObject(obj) {
const reversedObj = {};
for (const key in obj) {
const value = obj[key];
reversedObj[value] = key;
}
return reversedObj;
}
let blueprint = [
["0","0","0","0","0","G","G","G","G","G","0","0","0","0","0"],
["0","0","0","G","G","S","W","W","W","S","G","G","0","0","0"],
["0","0","G","W","W","S","W","W","W","S","W","W","G","0","0"],
["0","G","W","W","W","S","0","0","0","S","W","W","W","G","0"],
["0","G","W","W","0","0","0","0","0","0","0","W","W","G","0"],
["G","S","S","S","0","0","0","0","0","0","0","S","S","S","G"],
["G","W","W","0","0","0","0","0","0","0","0","0","W","W","G"],
["G","W","W","0","0","0","0","0","0","0","0","0","W","W","G"],
["G","W","W","0","0","0","0","0","0","0","0","0","W","W","G"],
["G","S","S","S","0","0","0","0","0","0","0","S","S","S","G"],
["0","G","W","W","0","0","0","0","0","0","0","W","W","G","0"],
["0","G","W","W","W","S","0","0","0","S","W","W","W","G","0"],
["0","0","G","W","W","S","W","W","W","S","W","W","G","0","0"],
["0","0","0","G","G","S","W","W","W","S","G","G","0","0","0"],
["0","0","0","0","0","G","G","G","G","G","0","0","0","0","0"]
]
let decaybp = [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0],
[0,2,2,2,2,0,2,2,2,2,2,2,2,3,1,3,0,4,0],
[5,2,2,6,6,7,6,6,6,6,6,6,6,8,8,8,8,8,0],
[5,2,9,6,6,0,6,0,6,0,6,0,6,9,0,0,0,10,0],
[8,2,11,6,6,0,6,0,6,0,6,0,6,8,8,8,8,8,0],
[5,2,9,6,6,6,0,0,0,0,0,0,6,9,2,2,0,10,0],
[5,2,2,2,9,6,9,9,6,9,9,6,9,9,2,2,0,10,0],
[0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,10,0],
[0,0,9,9,0,9,9,0,9,0,9,9,0,9,9,2,2,2,2]]
function getRandomPixelCoordinates(pixel, offsetx, offsety, bp, keyobject) {
let x, y, r;
let attempts = 0;
const maxAttempts = 1000;
do {
x = Math.floor(Math.random() * bp[0].length);
y = Math.floor(Math.random() * bp.length);
r = bp[y][x];
r = keyobject[r];
if (r !== undefined) {
attempts++;
}
if (attempts >= maxAttempts) {
return "terminated";
}
} while (r === undefined || r === 0 || r === "0" || !isEmpty(pixel.x + x - offsetx, pixel.y + y - offsety, true));
return { x, y, r };
}
elements.turn_into = {
color: "#000000",
behavior: behaviors.WALL,
state: "gas",
hidden: true,
properties: {
timer: 8,
},
category: "special",
tick: function(pixel){
if (!pixel.turninto){deletePixel(pixel.x, pixel.y); return}
if (pixel.timer == 8){pixel.color = pixelColorPick({element: pixel.turninto})}
//console.log(elements[pixel.turninto].color)
pixel.timer --
if (pixel.timer <= 0){
deletePixel(pixel.x, pixel.y);
createPixel(pixel.turninto, pixel.x, pixel.y);
}
}
}
elements.submitted_blueprint_1_creator = {
color: "#64abfd",
behavior: behaviors.WALL,
state: "solid",
category: "special",
tick: function(pixel){
if(!pixel.done){
if (pixelTicks % 3 == 0){
let randomcoord = getRandomPixelCoordinates(pixel, 7, 7, blueprint, {G: "glass", S: "steel", W: "silver"});
if (randomcoord == "terminated"){pixel.done = true; return;}
let rx = pixel.x + randomcoord.x-7;
let ry = pixel.y + randomcoord.y-7;
playSound("synth.wav")
try {
createPixel("turn_into", rx, ry);
pixelMap[rx][ry].turninto = randomcoord.r;
pixelMap[rx][ry].timer = 8;
} catch (error) {
console.error("Error occurred at coordinates:", rx, ",", ry);
console.error("Error message:", error);
}
}
if(pixelTicks == pixel.start){
// playSound("nocmusic.mp3")
}
}
}
}
elements.submitted_blueprint_2_creator = {
color: "#64abfd",
behavior: behaviors.WALL,
state: "solid",
category: "special",
tick: function(pixel){
if(!pixel.done){
if (pixelTicks % 3 == 0){
let randomcoord = getRandomPixelCoordinates(pixel, -1, -1, decaybp, {1: "led_r", 2:"porcelain", 3: "glass", 4: "tungsten", 5: "zinc", 6: "aluminum", 7: "copper", 8: "copper", 9: "steel", 10: "bronze", 11: "sterling"});
if (randomcoord == "terminated"){pixel.done = true; return;}
let rx = pixel.x + randomcoord.x+1;
let ry = pixel.y + randomcoord.y+1;
playSound("synth.wav")
try {
createPixel("turn_into", rx, ry);
pixelMap[rx][ry].turninto = randomcoord.r;
pixelMap[rx][ry].timer = 8;
} catch (error) {
console.error("Error occurred at coordinates:", rx, ",", ry);
console.error("Error message:", error);
}
}
if(pixelTicks == pixel.start){
// playSound("nocmusic.mp3")
}
}
}
}
elements.custom_bp_spawner = {
color: "#64abfd",
behavior: behaviors.WALL,
state: "solid",
category: "special",
tick: function(pixel){
if(!pixel.done){
if (pixelTicks % 3 == 0){
let randomcoord = getRandomPixelCoordinates(pixel, -1, -1, customBP, customBPKey);
if (randomcoord == "terminated"){pixel.done = true; return;}
let rx = pixel.x + randomcoord.x+1;
let ry = pixel.y + randomcoord.y+1;
playSound("synth.wav")
try {
createPixel("turn_into", rx, ry);
pixelMap[rx][ry].turninto = randomcoord.r;
pixelMap[rx][ry].timer = 8;
} catch (error) {
console.error("Error occurred at coordinates:", rx, ",", ry);
console.error("Error message:", error);
}
}
if(pixelTicks == pixel.start){
// playSound("nocmusic.mp3")
}
}
}
}
var customBP = []
var customBPKey = {}
let bpsizeH = 15;
let bpsizeW = 15;
let generatedBP = [];
let seenElements = {};
elements.bp_scanner = {
color: "#64abfd",
behavior: behaviors.SOLID,
state: "solid",
category: "special",
onSelect: function(pixel){
bpsizeH = prompt("Enter the height of the blueprint. It will be scanned from the TOP LEFT corner.", 15);
bpsizeW = prompt("Enter the width of the blueprint", 15);
},
tick: function(pixel){
if(pixelTicks == pixel.start){
generatedBP = [];
for (let y = 1; y <= bpsizeH; y++){
generatedBP.push([]);
}
let elementCounter = 1;
seenElements = {};
for (let y = 0; y < bpsizeH; y++){
for (let x = 0; x < bpsizeW; x++){
if (!isEmpty(pixel.x + x + 1, pixel.y + y + 1, true)){
var opElement = pixelMap[pixel.x + x+1][pixel.y + y+1].element;
if (!seenElements[opElement]){
generatedBP[y].push(elementCounter);
seenElements[opElement] = elementCounter;
elementCounter++;
} else {
generatedBP[y].push(seenElements[opElement]);
}
} else {
generatedBP[y].push(0);
}
}
}
console.log(generatedBP);
console.log(seenElements);
deletePixel(pixel.x, pixel.y);
customBP = generatedBP;
customBPKey = reverseObject(seenElements);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -4,125 +4,185 @@
* Don't see your favorite dessert? Let me know!
*
* Got questions? Contact tisqbisque on Discord!
*
* This version: 1.1
*/
// Dulce de leche items - BASE COMPLETE
// Dulce de leche items
elements.dulce_de_leche = {
alias: "manjar",
color: ["#c56600","#f7a204","#ca6400","#893604"],
category: "Community",
behavior: behaviors.STURDYPOWDER,
state: "liquid",
behavior: behaviors.LIQUID,
reactions: {
"cream_cheese": { elem1:"dulce_de_leche", elem2:null, color1:["#DFAB73","#fbcc75","#e2aa73","#be9075"], oneway:true }, // for recipe accuracy :3
},
tempLow: -20,
stateLow: "candy",
tempHigh: 250,
stateHigh: ["fragrance","smoke","smoke"],
viscosity: 500,
stain: 0.02,
density: 1284.93,
hidden: true,
desc: "Added in the first version of the mod. From undexconocidox_26419.\n"
isFood: true,
desc: "Added in the first version of the mod.\nMade by heating Sweetened Condensed Milk at 175°C+.\nFrom undexconocidox_26419.\n"
}
elements.sweetened_condensed_milk = {
color: ["#ffe9ba","#fbd396","#fde2a9"],
category: "Community",
state: "liquid",
behavior: behaviors.LIQUID,
tempLow: 0,
stateLow: ["ice_cream","sugar"],
tempHigh: 175,
stateHigh: "dulce_de_leche",
viscosity: 5,
stain: 0.015,
density: 1050.83,
hidden: true,
desc: "Added in the first version of the mod. Made by mixing Milk and Sugar at 85°C+.\n",
isFood: true,
desc: "Added in the first version of the mod.\nMade by mixing Milk and Sugar at 85°C+.\n",
}
// Chocotorta items - BASE COMPLETE
// Chocotorta items
elements.cream_cheese = {
color: ["#ebe9ea","#e4dfdd","#eeeeee"],
category: "Community",
behavior: behaviors.SUPPORTPOWDER,
state: "solid",
behavior: behaviors.STURDYPOWDER,
//reactions: {
// For future use
//},
tempHigh: 65,
stateHigh: "melted_cheese",
stateHighColor: ["#fbffff","#f6f6f6"],
hardness: 0.01,
density: 980.61,
hidden: true,
desc: "Added in the first version of the mod. Made by mixing Acid with Milk or Cream.\n",
isFood: true,
desc: "Added in the first version of the mod.\nMade by mixing Acid with Milk or Cream.\n",
}
elements.cocoa_bean = {
color: ["#e16f51","#e28e67","#e18550","#84574d"],
category: "Community",
behavior: behaviors.STURDYPOWDER,
state: "solid",
behavior: behaviors.POWDER,
// Has no reactions
breakInto: "cocoa_powder",
density: 593,
tempHigh: 179.4,
stateHigh: "dead_plant",
tempLow: -2,
stateLow: "frozen_plant",
// not hidden by default
// not food don't eat it
desc: "Added in the first version of the mod.\n",
}
elements.cocoa_powder = {
color: ["#855344","#6d4c41","#40271d"],
category: "Community",
state: "solid",
behavior: behaviors.POWDER,
onMix: function(powder, doughcheck) {
if (doughcheck.name == "dough" && shiftDown && Math.random() < 0.01) {
changePixel(powder,"chocolate_biscuit_dough");
if (elements[doughcheck.element].id == elements.dough.id && shiftDown && Math.random() < 0.25) {
deletePixel(powder.x,powder.y);
changePixel(doughcheck,"chocolate_biscuit_dough");
}
},
reactions: {
"dough": { elem1:null, elem2:"chocolate_biscuit_dough" },
},
category: "Community",
density: 363.5,
tempHigh: 50,
stateHigh: "smoke",
hidden: true,
desc: "Added in the first version of the mod. Made by Smashing Cocoa Bean.\n",
isFood: true,
desc: "Added in the first version of the mod.\nMade by Smashing Cocoa Bean.\n",
}
elements.chocolate_biscuit_dough = {
name: "choco_Biscuit_Dough",
color: "#623727",
category: "Community",
state: "solid",
behavior: behaviors.STURDYPOWDER,
tempHigh: 94,
stateHigh: "chocolate_biscuit",
burn: 40,
burnTime: 25,
burnInto: "ash",
state: "solid",
density: 526.9,
isFood: true,
hidden: true,
desc: "Added in the first version of the mod. Made by mixing Cocoa Powder with Dough.\n",
desc: "Added in the first version of the mod.\nMade by hard mixing Cocoa Powder with Dough.\n",
}
elements.chocolate_biscuit = {
name: "choco_Biscuit",
color: "#864B36",
behavior: behaviors.STURDYPOWDER,
tempHigh: 550,
stateHigh: ["smoke","smoke","smoke","ash"],
breakInto: "crumb",
category: "Community",
state: "solid",
behavior: behaviors.STURDYPOWDER,
breakInto: "crumb",
breakIntoColor: ["#af8264","#b28461","#aa7852","#a8744b"],
tempHigh: 232.2,
stateHigh: ["smoke","smoke","smoke","ash"],
density: 233.96,
isFood: true,
category: "Community",
hidden: true,
desc: "Added in the first version of the mod. Made by cooking Choco Biscuit Dough at 94°C+. Can be layered with other items to make chocotorta, from undexconocidox_26419.\n",
desc: "Added in the first version of the mod.\nMade by cooking Choco Biscuit Dough at 94°C+.\nCan be layered with other items to make chocotorta, from undexconocidox_26419.\n",
}
// Haupia items - BASE COMPLETE
// Haupia items
elements.coconut = {
color: ["#793b1e","#995c31","#5f3015"],
category: "Community",
state: "solid",
behavior: behaviors.POWDER,
breakInto: ["coconut_milk","tinder"],
category: "Community",
tempHigh: 225,
stateHigh: ["steam","ash","smoke"],
density: 822,
desc: "Added in the first version of the mod.\n",
}
elements.coconut_milk = {
color: ["#f3f3f3","#e4ddcb","#f8f8f8"],
behavior: behaviors.LIQUID,
category: "Community",
state: "liquid",
behavior: behaviors.LIQUID,
reactions: {
"sugar": { elem1:null, elem2:"haupia_mix", tempMin:90 },
},
tempHigh: 102,
stateHigh: "steam",
tempLow: -0.5,
stateLowName: "coconut_ice",
viscosity: 1.8,
density: 1031.33,
hidden: true,
desc: "Added in the first version of the mod. Made by smashing Coconut.\n",
isFood: true,
desc: "Added in the first version of the mod.\nMade by smashing Coconut.\n",
}
elements.haupia_mix = {
color: ["#f3f3f3","#e4ddcb","#f8f8f8"],
behavior: behaviors.LIQUID,
tempLow: 3,
category: "Community",
state: "liquid",
behavior: behaviors.LIQUID,
tempHigh: 105,
stateHigh: "steam",
tempLow: 3,
stateLow: "haupia",
viscosity: 2.3,
density: 1242.67,
hidden: true,
desc: "Added in the first version of the mod. Made by mixing Coconut Milk and Sugar at 90°C+.\n",
desc: "Added in the first version of the mod.\nMade by mixing Coconut Milk and Sugar at 90°C+.\n",
}
elements.haupia = {
color: ["#ffffff","#f8f8f8","#f7f9f8"],
behavior: behaviors.SUPPORT,
density: 1300,
category: "Community",
state: "solid",
behavior: behaviors.SUPPORT,
tempHigh: 105,
stateHigh: ["steam","fragrance"],
density: 1300,
hidden: true,
desc: "Added in the first version of the mod. Made by cooling Haupia Mix at 3°C-. From tisqbisque.\n"
isFood: true,
desc: "Added in the first version of the mod.\nMade by cooling Haupia Mix at 3°C-.\nFrom tisqbisque.\n"
}
// Adjusting existing elements here

9
mods/copy_canvas.js Normal file
View File

@ -0,0 +1,9 @@
document.addEventListener("keydown", function(e) {
if (e.keyCode == 83) {
document.getElementById("game").toBlob(function(blob) {
const item = new ClipboardItem({ "image/png": blob });
navigator.clipboard.write([item]);
});
alert("Canvas copied!");
}
})

917
mods/easysurvival.js Normal file
View File

@ -0,0 +1,917 @@
behaviors = {
POWDER_OLD: [
"XX|XX|XX",
"XX|XX|XX",
"M2|M1|M2",
],
POWDER: function(pixel) {
if (pixel.start === pixelTicks) {return}
if (pixel.charge && elements[pixel.element].behaviorOn) {
pixelTick(pixel)
}
if (!tryMove(pixel, pixel.x, pixel.y+1)) {
if (Math.random() < 0.5) {
if (!tryMove(pixel, pixel.x+1, pixel.y+1)) {
tryMove(pixel, pixel.x-1, pixel.y+1);
}
} else {
if (!tryMove(pixel, pixel.x-1, pixel.y+1)) {
tryMove(pixel, pixel.x+1, pixel.y+1);
}
}
}
doDefaults(pixel);
},
AGPOWDER: [
"M2|M1|M2",
"XX|XX|XX",
"XX|XX|XX",
],
LIQUID_OLD: [
"XX|XX|XX",
"M2|XX|M2",
"M1|M1|M1",
],
LIQUID: function(pixel) {
if (pixel.start === pixelTicks) {return}
if (pixel.charge && elements[pixel.element].behaviorOn) {
pixelTick(pixel)
}
if (elements[pixel.element].viscosity && (!((Math.random()*100) < 100 / Math.pow(elements[pixel.element].viscosity, 0.25)))) {
var move1Spots = [
[pixel.x, pixel.y+1]
]
}
else {
var move1Spots = [
[pixel.x+1, pixel.y+1],
[pixel.x, pixel.y+1],
[pixel.x-1, pixel.y+1],
]
}
var moved = false;
for (var i = 0; i < move1Spots.length; i++) {
var coords = move1Spots[Math.floor(Math.random()*move1Spots.length)];
if (tryMove(pixel, coords[0], coords[1])) { moved = true; break; }
else { move1Spots.splice(move1Spots.indexOf(coords), 1); }
}
if (!moved) {
if (elements[pixel.element].viscosity===undefined || !(!((Math.random()*100) < 100 / Math.pow(elements[pixel.element].viscosity, 0.25)))) {
if (Math.random() < 0.5) {
if (!tryMove(pixel, pixel.x+1, pixel.y)) {
tryMove(pixel, pixel.x-1, pixel.y);
}
} else {
if (!tryMove(pixel, pixel.x-1, pixel.y)) {
tryMove(pixel, pixel.x+1, pixel.y);
}
}
}
}
doDefaults(pixel);
},
SUPERFLUID_OLD: [
"XX|XX|XX",
"XX|XX|M2 AND BO",
"XX|M1|M2",
],
SUPERFLUID: function(pixel) {
if (pixel.start === pixelTicks) {return}
if (pixel.charge && elements[pixel.element].behaviorOn) {
pixelTick(pixel)
}
if (!tryMove(pixel, pixel.x, pixel.y+1)) {
// go either left or right depending on pixel.flipX
var newx = pixel.flipX ? pixel.x-1 : pixel.x+1;
if (Math.random() < 0.5) {
if (!tryMove(pixel, newx, pixel.y)) {
pixel.flipX = !pixel.flipX;
tryMove(pixel, newx, pixel.y+1);
}
}
else {
if (!tryMove(pixel, newx, pixel.y+1)) {
if (!tryMove(pixel, newx, pixel.y)) { pixel.flipX = !pixel.flipX; }
}
}
}
doDefaults(pixel);
},
LIGHTWEIGHT: [
"XX|XX|XX",
"XX|FX%0.25|XX",
"M2%10|M1%10|M1%10",
],
SLIDE: [
"XX|XX|XX",
"XX|XX|M2 AND BO",
"XX|M1|M1",
],
AGLIQUID: [
"M1|M1|M1",
"M2|XX|M2",
"XX|XX|XX",
],
WALL: [
"XX|XX|XX",
"XX|XX|XX",
"XX|XX|XX",
],
UL_UR: [
"M1|M1|M1",
"M2|XX|M2",
"XX|M2|XX",
],
UL_UR_OPTIMIZED: function(pixel) {
if (pixel.start === pixelTicks) {return}
if (pixel.charge && elements[pixel.element].behaviorOn) {
pixelTick(pixel)
}
var move1Spots = [
[pixel.x, pixel.y-1],
[pixel.x+1, pixel.y-1],
[pixel.x-1, pixel.y-1],
]
var moved = false;
for (var i = 0; i < move1Spots.length; i++) {
var coords = move1Spots[Math.floor(Math.random()*move1Spots.length)];
if (tryMove(pixel, coords[0], coords[1])) { moved = true; break; }
else { move1Spots.splice(move1Spots.indexOf(coords), 1);}
}
if (!moved && !pixel.del) {
var move2Spots = [
[pixel.x, pixel.y+1],
[pixel.x+1, pixel.y],
[pixel.x-1, pixel.y],
]
for (var i = 0; i < move2Spots.length; i++) {
var coords = move2Spots[Math.floor(Math.random()*move2Spots.length)];
if (tryMove(pixel, coords[0], coords[1])) { break; }
else { move2Spots.splice(move2Spots.indexOf(coords), 1); }
}
}
if (!pixel.del) { doDefaults(pixel); }
},
GAS_OLD: [
"M2|M1|M2",
"M1|XX|M1",
"M2|M1|M2",
],
GAS: function(pixel) {
if (pixel.start === pixelTicks) {return}
if (pixel.charge && elements[pixel.element].behaviorOn) {
pixelTick(pixel)
}
var move1Spots = [
[pixel.x, pixel.y+1],
[pixel.x, pixel.y-1],
[pixel.x+1, pixel.y],
[pixel.x-1, pixel.y],
]
var moved = false;
for (var i = 0; i < move1Spots.length; i++) {
var coords = move1Spots[Math.floor(Math.random()*move1Spots.length)];
if (tryMove(pixel, coords[0], coords[1])) { moved = true; break; }
else { move1Spots.splice(move1Spots.indexOf(coords), 1);}
}
if (!moved) {
var move2Spots = [
[pixel.x+1, pixel.y+1],
[pixel.x-1, pixel.y+1],
[pixel.x+1, pixel.y-1],
[pixel.x-1, pixel.y-1],
]
for (var i = 0; i < move2Spots.length; i++) {
var coords = move2Spots[Math.floor(Math.random()*move2Spots.length)];
if (tryMove(pixel, coords[0], coords[1])) { break; }
else { move2Spots.splice(move2Spots.indexOf(coords), 1); }
}
}
doDefaults(pixel);
},
DGAS: [
"M2|M1|M2",
"M1|DL%5|M1",
"M2|M1|M2",
],
SUPPORT: [
"XX|XX|XX",
"SP|XX|SP",
"XX|M1|XX",
],
SUPPORTPOWDER: [
"XX|XX|XX",
"SP|XX|SP",
"M2|M1|M2",
],
DELETE: [
"XX|DL|XX",
"DL|XX|DL",
"XX|DL|XX",
],
FILL: [
"XX|CL|XX",
"CL|XX|CL",
"XX|CL|XX",
],
CLONER: [
"XX|CF|XX",
"CF|XX|CF",
"XX|CF|XX",
],
SUPERCLONER: [
"CF|CF|CF",
"CF|CF|CF",
"CF|CF|CF",
],
STURDYPOWDER: [
"XX|XX|XX",
"XX|XX|XX",
"XX|M1|XX",
],
SELFDELETE: [
"XX|XX|XX",
"XX|DL|XX",
"XX|XX|XX",
],
FOAM: [
"XX|XX|XX",
"XX|DL%5|XX",
"M2%25|M1%25|M2%25",
],
BUBBLE: [
"XX|XX|XX",
"XX|DL%0.25 AND FX%1|M1%5",
"XX|M1%1|M1%2",
],
STICKY: [
"XX|ST|XX",
"ST|XX|ST",
"XX|ST AND M1|XX",
],
MOLTEN: [
"XX|CR:fire%2.5|XX",
"M2|XX|M2",
"M1|M1|M1",
],
RADPOWDER: [
"XX|CR:radiation%1|XX",
"CR:radiation%1|XX|CR:radiation%1",
"M2|M1|M2",
],
RADMOLTEN: [
"XX|CR:fire,fire,fire,radiation%4.5|XX",
"M2 AND CR:radiation%1|XX|M2 AND CR:radiation%1",
"M1|M1|M1",
],
RADLIQUID: [
"XX|CR:radiation%2|XX",
"M2 AND CR:radiation%2|XX|M2 AND CR:radiation%2",
"M1|M1|M1",
],
BOUNCY: function(pixel) {
if (pixel.bx===undefined) {
// choose 1, 0, or -1
pixel.bx = Math.random() < 0.5 ? 1 : Math.random() < 0.5 ? 0 : -1;
pixel.by = Math.random() < 0.5 ? 1 : Math.random() < 0.5 ? 0 : -1;
// if both are 0, make one of them 1 or -1
if (pixel.bx===0 && pixel.by===0) {
if (Math.random() < 0.5) { pixel.bx = Math.random() < 0.5 ? 1 : -1; }
else { pixel.by = Math.random() < 0.5 ? 1 : -1; }
}
}
// move and invert direction if hit
if (!pixel.del && pixel.bx && !tryMove(pixel, pixel.x+pixel.bx, pixel.y)) { pixel.bx = -pixel.bx; }
if (!pixel.del && pixel.by && !tryMove(pixel, pixel.x, pixel.y+pixel.by)) { pixel.by = -pixel.by; }
},
FEEDPIXEL: function(pixel) {
if (!pixel.food) { pixel.food = 1 }
else { pixel.food ++ }
if (pixel.food > (elements[pixel.element].foodNeed||30)) {
// loop through adjacentCoords and check each pixel to lay an egg
for (var i = 0; i < adjacentCoords.length; i++) {
var x = pixel.x+adjacentCoords[i][0];
var y = pixel.y+adjacentCoords[i][1];
if (isEmpty(x, y)) {
if (elements[pixel.element].egg) {
createPixel(elements[pixel.element].egg,x,y)
}
else {
createPixel("egg",x,y)
pixelMap[x][y].animal = elements[pixel.element].baby || pixel.element;
if (elements[pixel.element].eggColor) {
pixelMap[x][y].color = pixelColorPick(pixelMap[x][y],elements[pixel.element].eggColor)
}
}
pixel.food = 0;
break;
}
}
}
},
KILLPIXEL1: function(pixel) {
pixel.dead = true;
},
KILLPIXEL2: function(pixel1,pixel2) {
pixel2.dead = true;
},
FLY: function(pixel, onHit) {
var nx = pixel.flipX ? -1 : 1;
var ny = Math.random() < 0.5 ? -1 : 1;
var hit = false;
if (!tryMove(pixel, pixel.x+nx, pixel.y+ny)) {
if (!tryMove(pixel, pixel.x+nx, pixel.y-ny)) {
if (!tryMove(pixel, pixel.x, pixel.y+ny)) {
if (!tryMove(pixel, pixel.x, pixel.y-ny)) {hit=[pixel.x, pixel.y-ny]}
}else {hit=[pixel.x, pixel.y+ny]}
}else {hit=[pixel.x+nx, pixel.y-ny]}
}else {hit=[pixel.x+nx, pixel.y+ny]}
if (hit && onHit) {
if (!isEmpty(hit[0], hit[1], true)) {
onHit(pixel, pixelMap[hit[0]][hit[1]]);
}
else {onHit(pixel);}
}
if (pixel.del) {return}
if (!isEmpty(pixel.x+nx,pixel.y) || Math.random() < 0.02) {
pixel.flipX = !pixel.flipX;
}
if (pixel.charge && elements[pixel.element].behaviorOn) {
pixelTick(pixel)
}
doDefaults(pixel);
},
CRAWLER: function(pixel) {
if (Math.random() < 0.08) { // flip
pixel.flipX = !pixel.flipX;
}
var dir = pixel.flipX ? -1 : 1;
var dirY = pixel.flipY ? -1 : 1;
if (!tryMove(pixel,pixel.x,pixel.y+dirY)) { // fall or climb
if (!tryMove(pixel,pixel.x+dir,pixel.y)) { // hits wall
if (!pixel.hilled && !isEmpty(pixel.x+dir,pixel.y,true) && pixelMap[pixel.x+dir][pixel.y].element === "ant_wall") {
pixel.hilled = true;
}
tryMove(pixel,pixel.x+dir,pixel.y + (Math.random() < 0.25 ? 1 : -1));
}
if (Math.random() < 0.01 && !isEmpty(pixel.x+dir,pixel.y+1,true) && eLists.CRAWLTHRU.indexOf(pixelMap[pixel.x+dir][pixel.y+1].element) !== -1) {
if (!pixel.hilled || !isEmpty(pixel.x+dir,pixel.y,true) && pixelMap[pixel.x+dir][pixel.y].element === "ant_wall") {
var wallCoords = [
[-1,-1],[1,-1],
[-1,0],[1,0],
[0,1]
];
if (!isEmpty(pixel.x,pixel.y-2)) {
wallCoords.push([0,-1])
}
if (Math.random() < 0.15) { wallCoords.push([-1,1]) }
if (Math.random() < 0.15) { wallCoords.push([1,1]) }
// loop through wallCoords, change pixel to ant_wall if in crawlthru
for (var i = 0; i < wallCoords.length; i++) {
var x = pixel.x+dir+wallCoords[i][0];
var y = pixel.y+1+wallCoords[i][1];
if (!isEmpty(x,y,true) && eLists.CRAWLTHRU.indexOf(pixelMap[x][y].element) !== -1) {
changePixel(pixelMap[x][y],"ant_wall");
}
}
deletePixel(pixel.x+dir,pixel.y+1);
tryMove(pixel,pixel.x+dir,pixel.y+1);
}
}
else if (Math.random() < 0.08 && !isEmpty(pixel.x+dir,pixel.y-1,true) && eLists.CRAWLTHRU.indexOf(pixelMap[pixel.x+dir][pixel.y-1].element) !== -1) {
swapPixels(pixel,pixelMap[pixel.x+dir][pixel.y-1]);
}
}
doDefaults(pixel);
}
}
elements.supercloner = {
color: "#dddd00",
behavior: behaviors.SUPERCLONER,
ignore: ["ecloner","slow_cloner","clone_powder","floating_cloner","wall","ewall", "cloner"],
category:"inventory",
insulate:true,
hardness: 1,
darkText: true,
}
if (!settings.survival) {
settings.survival = {
"wall": 9999,
"dirt": 9999,
"sapling": 10,
"seeds": 50,
"ice": 250,
"cloner": 10,
"supercloner": 10
}
}
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(["sun","supernova"]);
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": 1000^21,
"ketchup": 150,
"jelly": 120,
"soda": 104,
"toast": 120,
"oil": 1023423,
"bread": 32,
"glass": 54,
"rad_glass": 64,
"glass_shard": 42,
"rad_shard": 312412,
"paper": 512312,
"broth": 512312,
"honey": 125,
"caramel": 53,
"sap": 34,
"candy": 325,
"popcorn": 232,
"flour": 322,
"lettuce": 2232,
"sauce": 2232,
"wood": 999,
"tree_branch": 100000,
"plant": 1,
"mushroom_cap": 1,
"mushroom_gill": 3,
"vine": 1,
"cactus": 1,
"cloner": 2,
"wall": 1000^22,
"fire": 100000^232,
"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*10[pixel.element]||1);
},
category: "tools",
desc: "Exchanges pixels for their market value in Gold Coins x 10"
}
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,
"milk": -200^2,
}
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 (currentElement === "shock") {
if (!isEmpty(x,y,true)) {
// One loop that repeats 5 times if shiftDown else 1 time
for (var j = 0; j < (shiftDown ? 5 : 1); j++) {
var pixel = pixelMap[x][y];
var con = elements[pixel.element].conduct;
if (con == undefined) {continue}
if (Math.random() < con) { // If random number is less than conductivity
if (!pixel.charge && !pixel.chargeCD) {
pixel.charge = 1;
if (elements[pixel.element].colorOn) {
pixel.color = pixelColorPick(pixel);
}
}
}
else if (elements[pixel.element].insulate != true) { // Otherwise heat the pixel (Resistance simulation)
pixel.temp += 0.25;
pixelTempCheck(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;
}
currentPixels.push(new Pixel(x, y, currentElement));
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();
});

View File

@ -68,7 +68,7 @@ runAfterLoad(function() {
});
// Run if another mod is active
if (enabledMods.includes("test.js")) {
if (enabledMods.includes("mods/test.js")) {
runAfterLoad(function() {
// Your code here
console.log("Hello World!");

15
mods/food_mods.js Normal file
View File

@ -0,0 +1,15 @@
var mods_to_include = ["mods/sbstuff.js","mods/ketchup_mod.js","mods/morefoodsmod.js","mods/weAllScreamFor.js","mods/soups.js","mods/pizzasstuff.js","mods/community_desserts.js","mods/plants.js","mods/aChefsDream.js"]
var mods_included = mods_to_include.map(mod => enabledMods.includes(mod));
var all_mods_included = mods_included.reduce(function(a,b) { return a && b });
if(!all_mods_included) {
var mods_needed = mods_to_include.filter(function(modPath) { return !(enabledMods.includes(modPath)) });
mods_needed.forEach(function(modPath) {
enabledMods.splice(enabledMods.indexOf("mods/food_mods"),0,modPath);
});
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The following mods have been inserted: ${mods_needed.join(", ")}
Reload the page for the mods to take effect. Happy cooking!`)
}

382
mods/halogen.js Normal file
View File

@ -0,0 +1,382 @@
var metalstocorrode = ["iron", "copper", "gold", "brass","steel","nickel","zinc","silver","aluminum","bronze","tin","lead", "rose_gold", "blue_gold", "gallium", "electrum", "purple_gold"]
var biologicaltocorrode = []
var alkalimetals = ["lithium", "sodium", "potassium", "rubidium", "cesium", "radiocesium", "caesium", "caesium_137", "francium", "molten_caesium", "molten_caesium_137", "liquid_cesium", "liquid_radiocesium"]
for (let elementi in elements){
if (elements[elementi].category == "life" || elements[elementi].category == "food"){
biologicaltocorrode.push(elementi)
}
}
biologicaltocorrode.splice(biologicaltocorrode.indexOf("salt"), 1)
biologicaltocorrode.splice(biologicaltocorrode.indexOf("sugar"), 1)
biologicaltocorrode.push("wood")
if (enabledMods.includes("mods/bettermetalscrap.js")){
for (let metal in metalstocorrode){
if (!elements[metalstocorrode[metal]].properties){elements[metalstocorrode[metal]].properties = {}}
elements[metalstocorrode[metal]].properties.scrapType = metalstocorrode[metal]
}
}
function basicHalogen(pixel){
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x, y, true)){
var otherPixel = pixelMap[x][y]
if (metalstocorrode.includes(otherPixel.element) && Math.random() < 0.01){
otherPixel.element = "metal_scrap"
if (Math.random()<0.5){
deletePixel(pixel.x, pixel.y)
}
}
if (biologicaltocorrode.includes(otherPixel.element) && Math.random() < 0.1){
changePixel(otherPixel, "ash", false)
if (Math.random()<0.5){
deletePixel(pixel.x, pixel.y)
}
}
if (alkalimetals.includes(otherPixel.element) && Math.random() < 0.1){
changePixel(otherPixel, "salt", false)
deletePixel(pixel.x, pixel.y)
otherPixel.temp += 100
}
}
}
}
elements.fluorine = {
color: ["#c4d067", "#ced87e", "#d8e094", "#e2e9aa", "#ecf1c0"],
behavior: behaviors.GAS,
state: "gas",
category: "gases",
tempLow: -188,
stateLow: "liquid_fluorine",
density: 1.696,
tick: function(pixel){
basicHalogen(pixel)
}
}
elements.liquid_fluorine = {
color: ["#aed067", "#b8d87e", "#c3e194", "#cee9aa", "#daf1c0"],
behavior: behaviors.LIQUID,
state: "liquid",
tempLow: -220,
stateLow: "fluorine_ice",
category: "states",
tempHigh: -186,
stateHigh: "fluorine",
hidden: true,
density: 1509,
tick: function(pixel){
basicHalogen(pixel)
},
}
elements.fluorine_ice = {
color: ["#b3c97c", "#b9ce8c", "#bfd39c", "#c5d8ac", "#cdddbb"],
behavior: behaviors.WALL,
state: "solid",
tempHigh: -218,
stateHigh: "liquid_fluorine",
category: "states",
hidden: true,
density: 1520
}
elements.bromine = {
color: ["#901100", "#7f1702", "#6e1a05", "#5e1b07", "#4e1b0a"],
behavior: behaviors.LIQUID,
state: "liquid",
tempLow: -7,
stateLow: "bromine_ice",
tempHigh: 59,
stateHigh: "bromine_gas",
category: "liquids",
density: 3120,
tick: function(pixel){
basicHalogen(pixel);
if (pixel.isVapor){
deletePixel(pixel.x, pixel.y)
return;
}
if (pixel.temp > 16 && Math.random() < 0.01){
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y)){
createPixel("bromine_gas", x, y)
pixelMap[x][y].isVapor = true
break;
}
}
}
}
}
elements.bromine_gas = {
color: ["#8f0000", "#7e0205", "#6e0508", "#5d080a", "#4d0a0a"],
behavior: behaviors.GAS,
state: "gas",
tempLow: 57,
stateLow: "bromine",
category: "states",
hidden: true,
density: 6,
tick: function(pixel){
basicHalogen(pixel)
if (pixel.isVapor && Math.random() < 0.07){
deletePixel(pixel.x, pixel.y)
}
}
}
elements.bromine_ice = {
color: ["#8f002b", "#7e0522", "#6d091a", "#5d0a13", "#4d0a0a"],
behavior: behaviors.WALL,
state: "solid",
tempHigh: -5,
stateHigh: "bromine",
category: "states",
hidden: true,
density: 3119,
tick: function(pixel){
basicHalogen(pixel)
if (pixel.isVapor){
deletePixel(pixel.x, pixel.y)
return;
}
}
}
elements.iodine = {
color: ["#323131", "#3a3737", "#423d3f", "#494347", "#504950"],
behavior: behaviors.WALL,
state: "solid",
tempHigh: 114,
stateHigh: "liquid_iodine",
category: "solids",
density: 4940,
tick: function(pixel){
basicHalogen(pixel)
}
}
elements.liquid_iodine = {
color: ["#7d2d84", "#71267b", "#651f71", "#591868", "#4e115f"],
behavior: behaviors.LIQUID,
state: "liquid",
tempLow: 112,
stateLow: "iodine",
tempHigh: 184,
stateHigh: "iodine_gas",
category: "states",
hidden: true,
density: 3960,
tick: function(pixel){
basicHalogen(pixel)
}
}
elements.iodine_gas = {
color: ["#923a89", "#84337d", "#762c71", "#692666", "#5c1f5a"],
behavior: behaviors.GAS,
state: "gas",
tempLow: 182,
stateLow: "liquid_iodine",
category: "states",
hidden: true,
density: 7,
tick: function(pixel){
basicHalogen(pixel)
}
}
elements.astatine = {
color: ["#303130", "#333633", "#373a37", "#3a3f3a", "#3e443e"],
behavior: behaviors.RADSOLID,
state: "solid",
tempHigh: 302,
stateHigh: "molten_astatine",
category: "solids",
density: 6400,
tick: function(pixel){
basicHalogen(pixel)
}
}
elements.molten_astatine = {
color: ["#cdaf42", "#d09a2c", "#d38419", "#d66b10", "#d84e13"],
behavior: behaviors.RADMOLTEN,
state: "solid",
tempHigh: 337,
stateHigh: "astatine_gas",
stateLow: "astatine",
tempLow: 300,
category: "states",
hidden: true,
density: 6400,
tick: function(pixel){
basicHalogen(pixel)
}
}
elements.astatine_gas = {
color: ["#cdaf42", "#d09a2c", "#d38419", "#d66b10", "#d84e13"],
behavior: behaviors.GAS,
state: "gas",
tempLow: 335,
stateLow: "molten_astatine",
category: "states",
hidden: true,
density: 7,
tick: function(pixel){
basicHalogen(pixel)
}
}
elements.tennessine = {
color: ["#675151", "#5b4845", "#4f3f3b", "#433630", "#382d27"],
behavior: behaviors.RADSOLID,
state: "solid",
category: "solids",
density: 7000,
tick: function(pixel){
basicHalogen(pixel)
}
}
window.addEventListener('load', function() {
if (elements.polonium){
elements.astatine.tick = function(pixel){
basicHalogen(pixel)
if (Math.random()<0.005){
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y)){
createPixel("positron", x, y)
pixelMap[x][y].temp += 270
break;
}
}
changePixel(pixel, "polonium", false)
pixel.temp += 270
}
}
let oldgas = elements.astatine_gas.tick
let oldmolten = elements.molten_astatine.tick
elements.molten_astatine.tick = function(pixel){
oldmolten(pixel)
if (Math.random()<0.005){
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y)){
createPixel("positron", x, y)
pixelMap[x][y].temp += 270
break;
}
}
changePixel(pixel, "polonium", false)
pixel.temp += 270
}
}
elements.astatine_gas.tick = function(pixel){
oldgas(pixel)
if (Math.random()<0.005){
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y)){
createPixel("positron", x, y)
pixelMap[x][y].temp += 270
break;
}
}
changePixel(pixel, "polonium", false)
pixel.temp += 270
}
}
}
else {
elements.astatine.tick = function(pixel){
basicHalogen(pixel)
if (Math.random()<0.005){
changePixel(pixel, "positron", false)
pixel.temp += 270
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x, y, true)){
pixelMap[x][y].temp += 100
}
}
}
}
let oldgas = elements.astatine_gas.tick
let oldmolten = elements.molten_astatine.tick
elements.molten_astatine.tick = function(pixel){
oldmolten(pixel)
if (Math.random()<0.005){
changePixel(pixel, "positron", false)
pixel.temp += 270
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x, y, true)){
pixelMap[x][y].temp += 100
}
}
}
}
elements.astatine_gas.tick = function(pixel){
oldgas(pixel)
if (Math.random()<0.005){
changePixel(pixel, "positron", false)
pixel.temp += 270
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x, y, true)){
pixelMap[x][y].temp += 100
}
}
}
}
}
if (elements.moscovium){
elements.tennessine.tick = function(pixel){
basicHalogen(pixel)
if (Math.random()<0.04){
changePixel(pixel, "moscovium", false)
pixel.temp += 450
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y)){
createPixel("helium", x, y)
break;
}
}
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x, y, true)){
pixelMap[x][y].temp += 200
}
}
}
}
} else {
elements.tennessine.tick = function(pixel){
basicHalogen(pixel)
if (Math.random()<0.04){
changePixel(pixel, "helium", false)
pixel.temp += 450
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x, y, true)){
pixelMap[x][y].temp += 200
}
}
}
}
}
})

View File

@ -2,32 +2,41 @@ function weightedAverage(num1, num2, weight){
return ((weight * num1)+((1-weight)*num2))
}
const heatfunc = function(pixel){
if (pixel.ogR == null || pixel.ogG == null || pixel.ogB == null || !(pixel.element == pixel.ogElement)){
if (pixel.element != "metal_scrap" || eLists.metals.includes(pixel.scrapType) || !pixel.scrapType){{
if (pixel.ogR == null || pixel.ogG == null || pixel.ogB == null || (pixel.element != pixel.ogElement && pixel.element == "metal_scrap") || (pixel.element != "metal_scrap" && pixel.ogElement == "metal_scrap") || (pixel.element == "oxidized_copper" && pixel.ogElement == "copper")){
pixel.ogR = parseInt(pixel.color.slice(4, pixel.color.indexOf(',')), 10)
pixel.ogG = parseInt(pixel.color.slice(pixel.color.indexOf(',') + 1, pixel.color.lastIndexOf(',')), 10)
pixel.ogB = parseInt(pixel.color.slice(pixel.color.lastIndexOf(',') + 1, -1), 10)
pixel.ogElement = pixel.element
}else{
var gethigh = (elements[pixel.element].tempHigh)
}
var gethigh = 1000
var ctemp = 0
var ogR = 0
var ogG = 0
var ogB = 0
if (elements[pixel.element].tempHigh){
gethigh = elements[pixel.element].tempHigh
} else if (pixel.scrapType) {
gethigh = elements[pixel.scrapType].tempHigh
}
var halftemp = ((20+gethigh)/2)
if (pixel.temp <= (gethigh) - halftemp){
var ctemp = 0;
ctemp = 0;
} else if (pixel.temp > (gethigh)-halftemp && pixel.temp <= gethigh){
var ctemp = ((1/halftemp)*pixel.temp)-(((gethigh)-halftemp)/halftemp)
ctemp = ((1/halftemp)*pixel.temp)-(((gethigh)-halftemp)/halftemp)
}
if (ctemp <= 0.5){
var newR = (((510-(2*pixel.ogR))*ctemp)+pixel.ogR);
var newG = ((0-((2*pixel.ogG)*ctemp))+pixel.ogG);
var newB = ((0-((2*pixel.ogB)*ctemp))+pixel.ogB);
newR = (((510-(2*pixel.ogR))*ctemp)+pixel.ogR);
newG = ((0-((2*pixel.ogG)*ctemp))+pixel.ogG);
newB = ((0-((2*pixel.ogB)*ctemp))+pixel.ogB);
}else if (ctemp > 0.5){
var newR = 255;
var newG = ((510*ctemp)-255);
var newB= ((280*ctemp)-140);
newR = 255;
newG = ((510*ctemp)-255);
newB= ((280*ctemp)-140);
}
let weight = (1-(ctemp/1.3))
pixel.color = "rgb(" + weightedAverage(pixel.ogR, newR, weight) + "," + weightedAverage(pixel.ogG, newG, weight) + "," + weightedAverage(pixel.ogB, newB, weight) + ")";
}
};
}}};
if (!eLists.metals) { eLists.metals = [] }
eLists.metals = eLists.metals.concat(["iron", "glass", "copper", "gold", "brass","steel","nickel","zinc","silver","aluminum","bronze","metal_scrap","oxidized_copper","tin","lead", "rose_gold"])
eLists.metals.forEach(metal => {
@ -36,8 +45,8 @@ eLists.metals.forEach(metal => {
elements[metal].tick = heatfunc;
}else{
const modfunc = function(pixel){
prefunc(pixel);
heatfunc(pixel);
prefunc(pixel);
};
elements[metal].tick = modfunc;
}

91
mods/lizard_mod.js Normal file
View File

@ -0,0 +1,91 @@
// lizard_mod.js by @RedBirdly
function blendColors(color1, color2, ratio = 0.5) {
// Convert the colors to RGB
const rgb1 = parseColor(color1);
const rgb2 = parseColor(color2);
// Calculate the blended color
const blendedColor = [
Math.round(rgb1[0] * (1 - ratio) + rgb2[0] * ratio), // Red
Math.round(rgb1[1] * (1 - ratio) + rgb2[1] * ratio), // Green
Math.round(rgb1[2] * (1 - ratio) + rgb2[2] * ratio) // Blue
];
// Convert the blended color back to a CSS color string
return `rgb(${blendedColor[0]}, ${blendedColor[1]}, ${blendedColor[2]})`;
}
function parseColor(color) {
// Create a temporary div to parse the color
const div = document.createElement('div');
div.style.color = color;
document.body.appendChild(div);
// Get the computed color
const computedColor = getComputedStyle(div).color;
// Remove the temporary div
document.body.removeChild(div);
// Parse the computed color into RGB values
const match = computedColor.match(/\d+/g);
return match.map(Number);
}
// dark red, dark green, brown, dark gray, light gray, lime
let lizard_colors = ["#4d2f2a", "#356641", "#85754d", "#3c3c3c", "#A1A1A1", "#98fb98"];
// camouflage function for lizards
function camo(pixel) {
if (!paused) {
// set camouflage color to random color
if (Math.random() < 0.002) {
let n = Math.floor(Math.random() * lizard_colors.length);
pixel.color = lizard_colors[n];
}
// set camouflage color to random color but make it slightly gray because camouflage isn't perfect
if (Math.random() < 0.1) {
for (let i = 0; i < currentPixels.length; i++) {
let x = currentPixels[i].x;
let y = currentPixels[i].y;
let dx = Math.abs(x - pixel.x);
let dy = Math.abs(y - pixel.y);
if (dx <= 1 && dy <= 1 && currentPixels[i].element != "lizard") {
pixel.color = blendColors(blendColors(currentPixels[i].color, "#887766", 0.4), pixel.color);
break;
}
}
}
}
}
// define element
elements.lizard = {
color: lizard_colors,
behavior: [
"ST%98|M1%6|ST%98",
"XX|XX|M2%20 AND BO",
"XX|M1%80|M2",
],
tick: camo,
tempHigh: 100,
stateHigh: "ash",
tempLow: 0,
stateLow: "dead_bug",
breakInto: "dead_bug",
category: "life",
burn: 95,
burnTime: 25,
state: "solid",
density: 500,
conduct: 0.15,
reactions: {
"bird": { elem2: null, chance: 0.1, func: behaviors.FEEDPIXEL },
"plant": { elem2: null, chance: 0.05, func: behaviors.FEEDPIXEL },
"tomato": { elem2: null, chance: 0.05, func: behaviors.FEEDPIXEL },
"fly": { elem2: null, chance: 0.15, func: behaviors.FEEDPIXEL },
"ant": { elem2: null, chance: 0.1, func: behaviors.FEEDPIXEL },
}
};

View File

@ -20,7 +20,6 @@ function whenAvailable(names, callback) {
}
}, interval);
}
var runAfterAutogenMod = "mods/runAfterAutogen2.js";
function getName(elementList)
{
@ -274,11 +273,14 @@ function mixture(elementList)
reactions: {},
};
elementCount++;
elements[name].hidden = true;
hiddenCount++;
elements[name].id = nextid++;
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>"; //update extra info counts (and the copyright year, due to the method used)
if(typeof elementCount !== 'undefined')
{
elementCount++;
elements[name].hidden = true;
hiddenCount++;
elements[name].id = nextid++;
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>"; //update extra info counts (and the copyright year, due to the method used)
}
}
else if(!elements[name].mixture)
{
@ -498,15 +500,11 @@ function isValidMixture(elementList)
return true;
}
if(enabledMods.includes(runAfterAutogenMod)){
whenAvailable(["runAfterAutogen"], function() {
runAfterAutogen(function() {
mixture2(["water","blood"]);
mixture2(["water","cough_drugs","cellulose_gum","carbon_dioxide","sugar","milk"]);
});
runAfterAutogen(function() {
mixture2(["water","blood"]);
mixture2(["water","cough_drugs","cellulose_gum","carbon_dioxide","sugar","milk"]);
});
}
predefinedColors = [

440
mods/mixtureII.js Normal file
View File

@ -0,0 +1,440 @@
function getName(elementList)
{
if(elementList.filter(function(item, pos, self) {
return self.indexOf(item) == pos;
}).length == 1)
{
return elementList[0];
}
let name = elementList.join("_") + "_mixture";
if(nameList[name])
{
name = nameList[name];
};
return name;
}
function makeColors(elementList)
{
return elementList.map((c) => elements[c].color instanceof Array ? elements[c].color : [elements[c].color]);
}
function mixture(elementList)
{
elementList.sort();
let name = getName(elementList);
if(!elements[name])
{
elements[name] = true;
let minTempHigh = Infinity;
let stateHigh = null;
let indexStateHigh = -1;
let maxTempLow = -Infinity;
let stateLow = null;
let indexStateLow = -1;
for(let i = 0; i < elementList.length; i++)
{
if(elements[elementList[i]])
{
if(typeof elements[elementList[i]].tempHigh === "number" && elements[elementList[i]].stateHigh)
{
if(elements[elementList[i]].tempHigh < minTempHigh)
{
minTempHigh = elements[elementList[i]].tempHigh;
indexStateHigh = i;
stateHigh = elements[elementList[i]].stateHigh;
}
}
if(typeof elements[elementList[i]].tempLow === "number" && elements[elementList[i]].stateLow)
{
if(elements[elementList[i]].tempLow > maxTempLow)
{
maxTempLow = elements[elementList[i]].tempLow;
indexStateLow = i;
stateLow = elements[elementList[i]].stateLow;
}
}
}
}
let elementList2 = elementList.slice();
let elementHigh = null;
if(indexStateHigh >= 0)
{
if(stateHigh instanceof Array)
{
elementHigh = [];
for(let i = 0; i < stateHigh.length; i++)
{
elementList2[indexStateHigh] = stateHigh[i];
elementHigh.push(mixture(elementList2));
}
}
else
{
elementList2[indexStateHigh] = stateHigh;
elementHigh = mixture(elementList2);
}
}
let elementList3 = elementList.slice();
let elementLow = null;
if(indexStateLow >= 0)
{
if(stateLow instanceof Array)
{
elementLow = [];
for(let i = 0; i < stateLow.length; i++)
{
elementList3[indexStateLow] = stateLow[i];
elementLow.push(mixture(elementList3));
}
}
else
{
elementList3[indexStateLow] = stateLow;
elementLow = mixture(elementList3);
}
}
if(elementHigh instanceof Array && elementHigh.length === 0)
{
minTempHigh = Infinity;
elementHigh = null;
}
if(elementLow instanceof Array && elementLow.length === 0)
{
maxTempLow = -Infinity;
elementLow = null;
}
let colors = makeColors(elementList.slice());
let colors2 = [];
let maxLength = Math.max(...(colors.map((c) => c.length)));
for(let i = 0; i < maxLength; i++)
{
let colors3 = [];
for(let j = 0; j < colors.length; j++)
{
colors3.push(toObject(colors[j][i%colors[j].length]));
}
colors2.push(averageRGB(colors3));
}
let temp = airTemp;
if(maxTempLow < airTemp && minTempHigh > airTemp)
{
}
else if(maxTempLow > -Infinity && minTempHigh < Infinity)
{
temp = (maxTempLow + minTempHigh)/2;
}
else if(maxTempLow > -Infinity)
{
temp = maxTempLow+20;
}
else if(minTempHigh < Infinity)
{
temp = Math.max(minTempHigh-20,absoluteZero);
}
let movable = elementList.some((c) => elements[c].movable || elements[c].movable === undefined);
let density = elementList.map((c) => elements[c].density ? elements[c].density : 0).reduce((a,b)=>a+b)/elementList.length;
let stain = elementList.map((c) => elements[c].stain ? elements[c].stain : 0).reduce((a,b)=>a+b)/elementList.length;
let states = elementList.map((c) => elements[c].state);
if(states.includes("gas"))
{
state = "gas";
density = 0;
}
else if(!movable)
{
state = "solid";
}
else if(states.includes("liquid"))
{
state = "liquid";
}
else
{
state = "solid";
}
elements[name] = {
color: colors2.length == 1 ? colors2[0] : colors2,
colorObject: colors2.length == 1 ? toObject(colors2[0]) :colors2.map((c) => toObject(c)),
tick: function(pixel) {
mixtureBehavior(pixel, elementList);
},
tempHigh: minTempHigh,
stateHigh: elementHigh,
tempLow: maxTempLow,
stateLow: elementLow,
temp: temp,
category: "mixture",
mixture: elementList,
movable: movable,
density: density,
state: state,
stain: stain,
reactions: {},
isGas: state === "gas"
};
for(let i in elements)
{
for(let j = 0; j < elementList.length; j++)
{
if(elements[i].reactions && elements[i].reactions[elementList[j]] !== undefined)
{
if(name === i)
{
continue;
}
elements[i].reactions[name] = {elem2: name, func: function(a,b){mixtureReact(b,a,elementList)}}
}
if(elements[elementList[j]].reactions && elements[elementList[j]].reactions[i] !== undefined)
{
if(name === i)
{
continue;
}
elements[name].reactions[i] = {elem2: i, func: function(a,b){mixtureReact(a,b,elementList)}}
}
}
}
if(typeof elementCount !== 'undefined')
{
elementCount++;
elements[name].hidden = true;
elements[name].id = nextid++;
if (elements[name].hidden && (!settings["unhide"] || ( settings["unhide"]===2 && !settings.unlocked[name] ))) { hiddenCount++; }
else
{
var categoryDiv = document.getElementById("category-mixture");
if (categoryDiv == null) {
createCategoryDiv("mixture");
}
createElementButton(name);
}
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>"; //update extra info counts (and the copyright year, due to the method used)
}
}
return name;
}
function mixtureBehavior(pixel, elementList)
{
let prevCol = pixel.color;
let previous = pixel.element;
let elem = elementList[Math.floor(Math.random()*elementList.length)];
if (elements[elem].tick) { // Run tick function if it exists
elements[elem].tick(pixel);
}
if (pixel.del) {return}
if (elements[elem].behavior) { // Parse behavior if it exists
pixelTick(pixel,elements[elem].behavior);
}
if(pixel.element === previous)
{
pixel.color = prevCol;
}
}
function mixtureReact(pixel, pixel2, elementList)
{
elementList = elementList.slice();
shuffleArray(elementList);
let previous = pixel.element;
let prevCol = pixel.color;
let previous2 = pixel2.element;
let prevCol2 = pixel2.color;
for(let i = 0; i < elementList.length; i++)
{
let elem = elementList[i];
if(pixel.del)
{
return;
}
changePixel(pixel,elem, false);
let rr1 = false;
if (elements[elem].reactions !== undefined && elements[elem].reactions[pixel2.element] !== undefined) {
rr1 = reactPixels(pixel,pixel2);
}
if (!rr1 && elements[pixel2.element].reactions !== undefined && elements[pixel2.element].reactions[elem] !== undefined && !elements[pixel2.element].reactions[elem].oneway) {
reactPixels(pixel2,pixel);
}
if(pixel2.element === previous2)
{
pixel2.color = prevCol2;
}
if(!pixel.del && pixel.element === elem)
{
}
else if(pixel.del)
{
elementList.splice(elementList.indexOf(elem),1);
createPixel(mixture(elementList),pixel.x,pixel.y);
currentPixels[currentPixels.length-1].temp = pixel.temp;
return;
}
else
{
elementList.splice(elementList.indexOf(elem),1)
changePixel(pixel, mixture(elementList.concat([pixel.element])), false);
return;
}
if(pixel2.del)
{
return;
}
}
changePixel(pixel, previous, false);
pixel.color = prevCol;
}
nameList = [];
function toObject(color)
{
color = color.match(/\d+/g);
return {
r: parseInt(color[0]),
g: parseInt(color[1]),
b: parseInt(color[2])
};
}
function averageRGB2(colors)
{
return toObject(averageRGB(colors.map((d) => (toObject(d)))));
}
function averageRGB(rgblist) {
var r = 0;
var g = 0;
var b = 0;
for (var i = 0; i < rgblist.length; i++) {
var rgb = rgblist[i];
r += parseInt(rgb.r);
g += parseInt(rgb.g);
b += parseInt(rgb.b);
}
r = Math.floor(r/rgblist.length);
g = Math.floor(g/rgblist.length);
b = Math.floor(b/rgblist.length);
return "rgb("+r+","+g+","+b+")";
}
function blendColors(colorA, colorB, amount = 0.5) {
const [rA, gA, bA] = colorA.match(/\w\w/g).map((c) => parseInt(c, 16));
const [rB, gB, bB] = colorB.match(/\w\w/g).map((c) => parseInt(c, 16));
const r = Math.round(rA + (rB - rA) * amount).toString(16).padStart(2, '0');
const g = Math.round(gA + (gB - gA) * amount).toString(16).padStart(2, '0');
const b = Math.round(bA + (bB - bA) * amount).toString(16).padStart(2, '0');
return '#' + r + g + b;
}
changePixel = function (pixel,element,changetemp=true) {
if (!elements[element]) {
pixel.invalidElement = element;
element = "unknown"
}
if(pixel.element !== element)
{
pixel.element = element;
pixel.color = pixelColorPick(pixel);
}
pixel.start = pixelTicks;
var elementInfo = elements[element];
if (elementInfo.burning == true) {
pixel.burning = true;
pixel.burnStart = pixelTicks;
}
else if (pixel.burning && !elementInfo.burn) {
delete pixel.burning;
delete pixel.burnStart;
}
delete pixel.origColor; // remove stain
if (pixel.r && !elementInfo.rotatable) {
delete pixel.r;
}
if (pixel.flipX && !elementInfo.flippableX) {
delete pixel.flipX;
}
if (pixel.flipY && !elementInfo.flippableY) {
delete pixel.flipY;
}
// If elementInfo.flippableX, set it to true or false randomly
if (elementInfo.flipX !== undefined) { pixel.flipX = elementInfo.flipX }
else if (elementInfo.flippableX) {
pixel.flipX = Math.random() >= 0.5;
}
// If elementInfo.flippableY, set it to true or false randomly
if (elementInfo.flipY !== undefined) { pixel.flipY = elementInfo.flipY }
else if (elementInfo.flippableY) {
pixel.flipY = Math.random() >= 0.5;
}
if (elementInfo.temp !== undefined && changetemp) {
pixel.temp = elementInfo.temp;
pixelTempCheck(pixel)
}
if (pixel.con && !elementInfo.canContain) {
delete pixel.con;
}
// If elementInfo.properties, set each key to its value
if (elementInfo.properties !== undefined) {
for (var key in elementInfo.properties) {
// If it is an array or object, make a copy of it
if (typeof elementInfo.properties[key] == "object") {
pixel[key] = JSON.parse(JSON.stringify(elementInfo.properties[key]));
}
else {
pixel[key] = elementInfo.properties[key];
}
}
}
checkUnlock(element);
}
elements.mixer = {
color: "#999999",
ignore: ["mixer"],
category:"machines",
insulate:true,
hardness: 1,
tick: function(pixel) {
if (!isEmpty(pixel.x-1,pixel.y,true) && !isEmpty(pixel.x+1,pixel.y,true) && isEmpty(pixel.x,pixel.y+1,false))
{
if(elements.mixer.ignore.includes(pixelMap[pixel.x-1][pixel.y].element) || elements.mixer.ignore.includes(pixelMap[pixel.x+1][pixel.y].element))
{
return;
}
else
{
createPixel(mixture([pixelMap[pixel.x-1][pixel.y].element,pixelMap[pixel.x+1][pixel.y].element]),pixel.x,pixel.y+1);
deletePixel(pixel.x-1,pixel.y);
deletePixel(pixel.x+1,pixel.y);
}
}
doDefaults(pixel);
},
maxSize: 1
};

336
mods/mobile_shift.js Normal file
View File

@ -0,0 +1,336 @@
mobileshift = null;
mobileShiftButton = document.createElement("button");
mobileShiftButton.onclick = function() {
if (mobileshift == "shift") {
mobileshift = null;this.setAttribute("on","false");
onShiftDown(1);
} else {
mobileshift = "shift";
this.setAttribute("on","true");
onShiftDown(0);
};
focusGame();
on="false"
};
mobileShiftButton.textContent = "Shift";
window.addEventListener("load",function(){
document.getElementById("toolControls").appendChild(mobileShiftButton);
});
elements.heat.tool = function(pixel) {
if (mobileshift == "shift" || shiftDown) {pixel.temp += elements.heat.temp+(Math.random()*elements.heat.temp*1.5)*20;}
else {pixel.temp += elements.heat.temp+(Math.random()*elements.heat.temp*1.5);}
pixelTempCheck(pixel);
}
elements.cool.tool = function(pixel) {
if (shiftDown) {pixel.temp += elements.cool.temp+(Math.random()*elements.cool.temp*1.5)*20;}
else {pixel.temp += elements.cool.temp+(Math.random()*elements.cool.temp*1.5);}
pixelTempCheck(pixel);
}
elements.drag.tool = function(pixel) {
if (!dragStart) {
dragStart = pixelTicks;
draggingPixels = [];
}
if (pixelTicks === dragStart && !pixel.drag && (elements[pixel.element].movable || shiftDown || mobileshift == "shift")) {
pixel.drag = true;
draggingPixels.push(pixel);
}
}
elements.paint.tool = function(pixel) {
if (!shiftDown && mobileshift != "shift") {
pixel.color = pixelColorPick(pixel,currentColor)
}
else {
// convert the hex of currentColor to rgb and set it as a string
var rgb = currentColor.replace("#","").match(/.{1,2}/g);
for (var i = 0; i < rgb.length; i++) {
rgb[i] = parseInt(rgb[i],16);
}
pixel.color = "rgb(" + rgb.join(",") + ")"
}
delete pixel.origColor;
}
elements.milk.onMix = function(milk1, milk2) {
if (shiftDown && Math.random() < 0.01 || mobileshift == "shift" && Math.random() < 0.01) {
changePixel(milk1,"butter")
}
}
elements.cream.onMix = function(milk1, milk2) {
if ((shiftDown && Math.random() < 0.01 || mobileshift == "shift" && Math.random() < 0.01) || (elements[milk2.element].id === elements.milk.id && Math.random() < 0.00025)) {
changePixel(milk1,"butter")
}
}
elements.batter.onMix = function(batter,ingredient) {
if (elements[ingredient.element].isFood && elements[ingredient.element].id !== elements.batter.id && elements[ingredient.element].id !== elements.flour.id && elements[ingredient.element].id !== elements.yolk.id && elements[ingredient.element].id !== elements.dough.id && elements[ingredient.element].id !== elements.baked_batter.id) {
var rgb1 = batter.color.match(/\d+/g);
var rgb2 = ingredient.color.match(/\d+/g);
// average the colors
var rgb = [
Math.round((parseInt(rgb1[0])*10+parseInt(rgb2[0]))/11),
Math.round((parseInt(rgb1[1])*10+parseInt(rgb2[1]))/11),
Math.round((parseInt(rgb1[2])*10+parseInt(rgb2[2]))/11)
];
// convert rgb to hex
var hex = RGBToHex(rgb);
batter.color = pixelColorPick(batter, hex);
if ((elements[ingredient.element].density > elements.batter.density || shiftDown || mobileshift == "shift") && Math.random() < 0.05) {
// 50% change to delete ingredient
if (Math.random() < 0.5) { deletePixel(ingredient.x, ingredient.y); }
else {
ingredient.color = pixelColorPick(ingredient, hex);
}
}
}
}
elements.cook.tool = function(pixel) {
if (!shiftDown && mobileshift != "shift") {
pixel.temp += 0.5;
pixelTempCheck(pixel);
}
else {
pixel.temp += 1;
pixelTempCheck(pixel);
}
}
elements.debug.tool = function(pixel) {
mouseIsDown = false;
shiftDown = false;
mobileshift = null;
var output = pixel.element.toUpperCase()+" at x"+pixel.x+", y"+pixel.y+", tick"+pixelTicks+"\n";
for (var i in pixel) {
if (i !== "x" && i !== "y" && i !== "element") {
output += " " + i + ": " + pixel[i] + "\n";
}
}
console.log(output);
console.log(JSON.stringify(pixel));
alert(output);
lastDebug = pixelTicks;
}
function mouseClick(e) {
if (showingMenu && currentElement != "lookup") {
closeMenu();
return false;
}
mouseIsDown = true;
lastPlace = -100;
if (e.button === 0) {
mouseType = "left";
}
else if (e.button === 2) {
mouseType = "right";
}
else if (e.button === 1) {
mouseType = "middle";
}
else {
mouseType = "left";
}
if ((e.button === 0 || e.touches) && placingImage) {
if (e.touches) { mouseMove(e); }
placeImage();
return false;
}
else if (mobileshift == "shift" && e.button !== 1 && !((elements[currentElement].tool || elements[currentElement].category==="tools") && mouseType==="left")|| shiftDown && e.button !== 1 && !((elements[currentElement].tool || elements[currentElement].category==="tools") && mouseType==="left")) {
shaping = 1;
shapeStart = mousePos;
}
if (elements[currentElement].singleColor) {
// choose random item from .color
if (Array.isArray(elements[currentElement].color)) {
currentColor = elements[currentElement].color[Math.floor(Math.random() * elements[currentElement].color.length)];
}
else { currentColor = elements[currentElement].color;}
// convert from rgb(r,g,b) to #rrggbb
// RGBToHex takes an array of integers
if (currentColor.indexOf("rgb") !== -1) {
var rgb = currentColor.match(/\d+/g);
currentColor = RGBToHex([parseInt(rgb[0]),parseInt(rgb[1]),parseInt(rgb[2])]);
}
}
mouseMove(e);
return false;
}
function placeImage(placementX,placementY,scale) {
if (!scale) { scale = mouseSize }
// downscale the <img to mouseSize x mouseSize and draw it
var canvas = document.createElement("canvas");
// set width or height proportional to mouseSize
if (placingImage.width > placingImage.height) {
canvas.width = mouseSize;
canvas.height = Math.round(placingImage.height/placingImage.width*mouseSize);
}
else {
canvas.height = mouseSize;
canvas.width = Math.round(placingImage.width/placingImage.height*mouseSize);
}
var newWidth = canvas.width;
var newHeight = canvas.height;
var ctx = canvas.getContext("2d");
if (settings.imagesmooth === 0) {
ctx.webkitImageSmoothingEnabled = false;
ctx.mozImageSmoothingEnabled = false;
ctx.imageSmoothingEnabled = false;
}
ctx.drawImage(placingImage,0,0,newWidth,newHeight);
var newImage = ctx.getImageData(0,0,newWidth,newHeight);
var elem = (settings.imageelem || "wood");
if (!elements[elem] || elements[elem].tool || elements[elem].canPlace===false) { elem = "wood";}
// loop through each pixel in the ImageData
for (var x = 0; x < newWidth; x++) {
for (var y = 0; y < newHeight; y++) {
var i = (y*newWidth+x)*4;
var r = newImage.data[i];
var g = newImage.data[i+1];
var b = newImage.data[i+2];
var a = newImage.data[i+3];
if (a > 0.33) {
// mousePos is the center of the image
var pixelX = (placementX||mousePos.x) - Math.round(newWidth/2) + x+1;
var pixelY = (placementY||mousePos.y) - Math.round(newHeight/2) + y+1;
if (isEmpty(pixelX,pixelY)) {
createPixel(elem,pixelX,pixelY);
pixelMap[pixelX][pixelY].color = pixelColorPick(pixelMap[pixelX][pixelY], RGBToHex([r,g,b]));
}
else if (!outOfBounds(pixelX,pixelY) && (mobileshift == "shift" || shiftDown || mode === "replace")) {
changePixel(pixelMap[pixelX][pixelY],elem);
pixelMap[pixelX][pixelY].color = pixelColorPick(pixelMap[pixelX][pixelY], RGBToHex([r,g,b]));
}
}
}
}
}
function mouse1Action(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 || mobileshift == "shift") {
mixList.push(pixel);
}
}
}
else if (currentElement === "shock") {
if (!isEmpty(x,y,true)) {
// One loop that repeats 5 times if shiftDown else 1 time
for (var j = 0; j < (shiftDown ? 5 : 1); j++) {
var pixel = pixelMap[x][y];
var con = elements[pixel.element].conduct;
if (con == undefined) {continue}
if (Math.random() < con) { // If random number is less than conductivity
if (!pixel.charge && !pixel.chargeCD) {
pixel.charge = 1;
if (elements[pixel.element].colorOn) {
pixel.color = pixelColorPick(pixel);
}
}
}
else if (elements[pixel.element].insulate != true) { // Otherwise heat the pixel (Resistance simulation)
pixel.temp += 0.25;
pixelTempCheck(pixel);
}
}
}
}
else if (currentElement === "random" && isEmpty(x, y)) {
// create pixel with random element from "randomChoices" array
currentPixels.push(new Pixel(x, y, randomChoices[Math.floor(Math.random() * randomChoices.length)]));
}
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 (mode === "replace") {
if (outOfBounds(x,y)) {
continue;
}
// Remove pixel at position from currentPixels
var index = currentPixels.indexOf(pixelMap[x][y]);
if (index > -1) {
currentPixels.splice(index, 1);
}
if (currentElement == "random") {
currentPixels.push(new Pixel(x, y, randomChoices[Math.floor(Math.random() * randomChoices.length)]));
}
else {
currentPixels.push(new Pixel(x, y, currentElement));
}
if (elements[currentElement].customColor || elements[currentElement].singleColor) {
pixelMap[x][y].color = pixelColorPick(currentElement,currentColor);
}
if (currentElementProp) {
for (var key in currentElementProp) {
pixelMap[x][y][key] = currentElementProp[key]
}
}
}
else if (isEmpty(x, y)) {
currentPixels.push(new Pixel(x, y, currentElement));
if (elements[currentElement].customColor || elements[currentElement].singleColor) {
pixelMap[x][y].color = pixelColorPick(currentElement,currentColor);
}
if (currentElementProp) {
for (var key in currentElementProp) {
pixelMap[x][y][key] = currentElementProp[key]
}
}
}
}
if (currentElement == "mix") {
// 1. repeat for each pixel in mixList
// 2. choose 2 random pixels and swap their x and y
// 3. remove pixel from mixList
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);
}
}
}
}

209
mods/morepowders.js Normal file
View File

@ -0,0 +1,209 @@
elements.template = {
color: "#ffffff",
category: "more_powders",
state: "solid",
hidden: true,
behavior: behaviors.POWDER
}
elements.powder = {
color: ["#c17d17", "#f2a32e"],
behavior: behaviors.POWDER,
category: "more_powders",
state: "solid",
reactions: {
"glue": { elem1: "smoke", elem2: "sticky_powder" },
"foam": { elem1: "foam_powder", elem2: "foam_powder" },
"electric": { elem1: null, elem2: "electric_powder" },
"dust": { elem1: null, elem2: "void_powder" },
},
stateHigh: "smoke",
tempHigh: 200,
tempLow: -200,
stateLow: "cold_powder",
stateHigh: "hot_powder",
}
elements.gas_powder = {
color: "#b98ffc",
behavior: behaviors.POWDER,
category: "more_powders",
state: "gas",
stateHigh: "smoke",
tempHigh: 2000,
reactions: {
"up_powder": { elem1: null, elem2: "up_gas_powder" },
},
tempLow: -200,
stateLow: "powder",
}
elements.up_powder = {
color: "#8ffcb9",
behavior: behaviors.AGPOWDER,
category: "more_powders",
state: "solid",
tempLow: -200,
stateLow: "powder",
},
elements.up_gas_powder = {
color: ["#a2c5da", "#a0a7d8"],
behavior: behaviors.AGPOWDER,
category: "more_powders",
state: "gas",
stateHigh: "gas_powder",
tempHigh: 1000,
hidden: true,
tempLow: -200,
stateLow: "powder",
}
elements.slow_powder = {
color: "#c9445c",
behavior:[
"XX|XX|XX",
"XX|XX|XX",
"M2%20|M1%20|M2%20",
],
category: "more_powders",
state: "solid",
stateHigh: "smoke",
tempHigh: 2000,
reactions: {
"gas_powder": { elem1: null, elem2: "slow_gas_powder" },
"up_powder": { elem1: null, elem2: "slow_up_powder" },
},
tempLow: -200,
stateLow: "powder",
}
elements.slow_gas_powder = {
color: "#c069aa",
behavior:[
"XX|XX|XX",
"XX|XX|XX",
"M2%20|M1%20|M2%20",
],
category: "more_powders",
state: "gas",
stateHigh: "gas_powder",
tempHigh: 1000,
hidden: true,
tempLow: -200,
stateLow: "powder",
}
elements.slow_up_powder = {
color:["#aba18a", "#a4aa8a"],
behavior:[
"M2%20|M1%20|M2%20",
"XX|XX|XX",
"XX|XX|XX",
],
category: "more_powders",
state: "solid",
stateHigh: "up_powder",
tempHigh: 1000,
hidden: true,
reactions: {
"slow_powder": { elem1: null, elem2: "slower_up_powder" },
},
tempLow: -200,
stateLow: "powder",
}
elements.slower_up_powder = {
color: ["#b5827b", "#b59e7b"],
behavior:[
"M2%10|M1%10|M2%10",
"XX|XX|XX",
"XX|XX|XX",
],
category: "more_powders",
state: "solid",
stateHigh: "up_powder",
tempHigh: 1000,
hidden: true,
tempLow: -200,
stateLow: "powder",
}
elements.sticky_powder = {
color: ["#badd96", "#96dd96"],
behavior:[
"ST|ST|ST",
"ST|XX|ST",
"ST AND M2|ST AND M1|ST AND M2",
],
category: "more_powders",
state: "solid",
hidden: true,
tempLow: -200,
stateLow: "powder",
}
elements.foam_powder = {
color: ["#e0be8b", "#ffffff"],
behavior: behaviors.FOAM,
category: "more_powders",
state: "gas",
tempLow: -200,
stateLow: "frozen_foam_powder",
hidden: true
}
elements.frozen_foam_powder = {
color: ["#c0eded", "#a7cfba"],
behavior: behaviors.POWDER,
category: "more_powders",
state: "gas",
tempHigh: 1000,
stateHigh: "foam_powder",
hidden: true
}
elements.electric_powder = {
color: ["#eae463", "#f9fc45"],
behavior: [
"SH|SH|SH",
"SH|XX|SH",
"SH AND M2|SH AND M1|SH AND M2",
],
category: "more_powders",
state: "solid",
reactions: {
},
stateHigh: "smoke",
tempHigh: 500,
tempLow: -1000,
stateLow: "powder",
hidden: true
}
elements.hot_powder = {
color: ["#8a3b87", "#d43a3a", "#d43a3a"],
behavior:[
"HT|HT|HT",
"HT|XX|HT",
"HT AND M2|HT AND M1|HT AND M2",
],
category: "more_powders",
state: "solid",
tempLow: -200,
stateLow: "cold_powder",
temp: 200,
hidden: true
}
elements.cold_powder = {
color: ["#8a3b87", "#3f3cd4", "#3f3cd4"],
behavior:[
"CO|CO|CO",
"CO|XX|CO",
"CO AND M2|CO AND M1|CO AND M2",
],
category: "more_powders",
state: "solid",
tempHigh: 400,
stateHigh: "hot_powder",
temp: -200,
hidden: true
}
elements.void_powder = {
color: "#303031",
category: "more_powders",
state: "solid",
hidden: true,
behavior: [
"DL|DL|DL",
"DL|XX|DL",
"DL AND M2|DL AND M1|DL AND M2",
]
}

48
mods/nettysaddon.js Normal file
View File

@ -0,0 +1,48 @@
elements.ultra_uranium = {
color: ["#50C878" , "#4F7942"],
behavior: [
"XX|XX|XX",
"XX|DL%5|XX",
"M2%25|M1%25|M2%25",
],
category: "weapons",
state: "solid",
temp: 9999999999999999,
hardness: 1,
};
elements.mega_beam = {
color: ["#DFFF00" , "#00FFFF"],
tick: function(pixel) {
var x = pixel.x;
for (var y = pixel.y; y < height; y++) {
if (outOfBounds(x, y)) {
break;
}
if (isEmpty(x, y)) {
if (Math.random() > 0.05) { continue }
createPixel("flash", x, y);
pixelMap[x][y].color = "#DFFF00";
pixelMap[x][y].temp = 9800;
}
else {
if (elements[pixelMap[x][y].element].isGas) { continue }
if (elements[pixelMap[x][y].element].id === elements.mega_beam.id) { break }
pixelMap[x][y].temp += 9800;
pixelTempCheck(pixelMap[x][y]);
break;
}
}
deletePixel(pixel.x-1, pixel.y-1);
deletePixel(pixel.x+1, pixel.y+1);
if ( pixelTicks - pixel.start > 1) {
deletePixel(pixel.x, pixel.y)
}
doHeat(pixel);
},
temp: 9800,
category: "weapons",
state: "gas",
density: 1,
excludeRandom: true,
noMix: true
}

View File

@ -82,6 +82,7 @@ class Type {
this.breakInto = undefined;
this.properties = undefined;
this.maxSize = undefined;
this.tool = undefined;
}
setColor(color) {
@ -238,16 +239,16 @@ function createOther() {
Fw.stateHigh = "plasma";
Fw.breakInto = "fire";
Fw.reactions = {
"water": { elem1: "wall", chance: 0.2 },
"steam": { elem1: "wall", chance: 0.2 },
"carbon_dioxide": { elem1: "wall", chance: 0.2 },
"foam": { elem1: "wall", chance: 0.2 },
"dirty_water": { elem1: "wall", chance: 0.2 },
"salt_water": { elem1: "wall", chance: 0.2 },
"sugar_water": { elem1: "wall", chance: 0.2 },
"seltzer": { elem1: "wall", chance: 0.2 },
"pool_water": { elem1: "wall", chance: 0.2 },
},
"water": { elem1: "wall", chance: 0.2 },
"steam": { elem1: "wall", chance: 0.2 },
"carbon_dioxide": { elem1: "wall", chance: 0.2 },
"foam": { elem1: "wall", chance: 0.2 },
"dirty_water": { elem1: "wall", chance: 0.2 },
"salt_water": { elem1: "wall", chance: 0.2 },
"sugar_water": { elem1: "wall", chance: 0.2 },
"seltzer": { elem1: "wall", chance: 0.2 },
"pool_water": { elem1: "wall", chance: 0.2 },
},
Fw.Add();
const Nz = new Type("nirmizer");
@ -267,6 +268,29 @@ function createOther() {
Nz.Add();
}
function createTools() {
const Fr = new Type("freeze");
Fr.setColor(["#7fcef0", "#b2daeb"]);
Fr.behavior = [
"CO:100|CO:100|CO:100",
"CO:100|CO:100|CO:100",
"CO:100|CO:100|CO:100",
],
Fr.tool = function(pixel) {
let value = Math.max(30, pixel.temp / 5);
if (shiftDown) value *= 2;
pixel.temp -= value;
pixelTempCheck(pixel);
}
Fr.temp = -273;
Fr.category = cat.ENERGY;
Fr.insulate = true;
Fr.canPlace = false;
Fr.desc = "Use on pixels to heavily decrease temperature."
Fr.Add();
}
createNirmics();
createMinerals();
createOther();
createOther();
createTools();

View File

@ -102,4 +102,128 @@ elements.frozen_xenon = {
stateHigh: "liquid_xenon",
density: 3410,
conduct: 0.8
}
elements.radon = {
color: elements.neon.color,
behavior: behaviors.GAS,
colorOn: ["#d33d7c","#f73273","#c03190"],
category: "gases",
state: "gas",
conduct: 0.8,
tempLow: -61,
stateLow: "liquid_radon",
density: 9.73,
tick: function(pixel){
if(elements.polonium){
if(Math.random()<0.00038){
for (var i = 0; i < adjacentCoords.length; i++){
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y) && Math.random()<0.01){
createPixel(x, y, "helium")
pixelMap[x][y].temp += 75
break;
}
}
changePixel(pixel, "polonium", false)
pixel.temp += 100
}
}else{
if(Math.random()<0.00038){
for (var i = 0; i < adjacentCoords.length; i++){
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x, y, true) && Math.random()<0.01){
pixel.temp += 50
}
}
changePixel(pixel, "helium", false)
pixel.temp += 100
}
}
for (var i = 0; i < adjacentCoords.length; i++){
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y) && Math.random() < 0.001){
createPixel("radiation", x, y);
}
}
}
}
elements.liquid_radon = {
color: elements.neon.color,
behavior: behaviors.LIQUID,
colorOn: ["#d33d7c","#f73273","#c03190"],
category: "states",
state: "liquid",
tempHigh: -58,
stateHigh: "radon",
density: 13,
tempLow: -71,
stateLow: "frozen_radon",
conduct: 0.8,
tick: elements.radon.tick
}
elements.frozen_radon = {
color: elements.neon.color,
behavior: behaviors.WALL,
colorOn: ["#d33d7c","#f73273","#c03190"],
category: "states",
state: "solid",
tempHigh: -68,
stateHigh: "liquid_radon",
density: 16,
conduct: 0.8,
tick: elements.radon.tick
}
elements.oganesson = {
color: elements.neon.color,
behavior: behaviors.GAS,
colorOn: ["#5bdce6","#56a9f7","#56b0e4"],
category: "gases",
state: "gas",
conduct: 0.8,
density: 9.73,
tick: function(pixel){
if(elements.livermorium){
if(Math.random()<0.038){
for (var i = 0; i < adjacentCoords.length; i++){
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y) && Math.random()<0.01){
createPixel(x, y, "helium")
pixelMap[x][y].temp += 250
break;
}
}
changePixel(pixel, "livermorium", false)
pixel.temp += 100
}
}else{
if(Math.random()<0.038){
for (var i = 0; i < adjacentCoords.length; i++){
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x, y, true) && Math.random()<0.01){
pixel.temp += 100
}
}
changePixel(pixel, "helium", false)
pixel.temp += 250
}
}
for (var i = 0; i < adjacentCoords.length; i++){
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y) && Math.random() < 0.01){
createPixel("radiation", x, y);
}
}
}
}

View File

@ -1,4 +1,9 @@
// Gallium is the best element
behaviors.RADSOLID = [
"XX|CR:radiation%1|XX",
"CR:radiation%1|XX|CR:radiation%1",
"XX|CR:radiation%1|XX"
]
elements.caesium = {
color: ["#917921", "#ebcb59", "#a48b2d", "#d6b84c"],
behavior: behaviors.WALL,
@ -24,9 +29,10 @@ elements.molten_caesium = {
state: "liquid",
tempLow: 27.44,
stateLow: "caesium",
hidden: true,
tempHigh: 671,
stateHigh: "caesium_vapor",
density: 1843,
density: 1842,
temp: 29,
conduct: 0.90,
reactions: {
@ -44,10 +50,165 @@ elements.caesium_vapor = {
category: "states",
state: "gas",
tempLow: 660,
hidden: true,
stateLow: "molten_caesium",
density: 1.7,
temp: 700
}
elements.caesium_137 = {
color: ["#917921", "#ebcb59", "#a48b2d", "#d6b84c"],
behavior: behaviors.RADSOLID,
category: "solids",
state: "solid",
tempHigh: 28.44,
stateHigh: "molten_caesium_137",
density: 1873,
conduct: 0.90,
reactions: {
"water": { "elem1":"pop", "elem2":"hydrogen" },
"sugar_water": { "elem1":"pop", "elem2":"hydrogen" },
"dirty_water": { "elem1":"pop", "elem2":"hydrogen" },
"pool_water": { "elem1":"pop", "elem2":"hydrogen" },
"salt_water": { "elem1":"pop", "elem2":"hydrogen" },
"seltzer": { "elem1":"pop", "elem2":"hydrogen" },
},
tick: function(pixel){
if (Math.random()<0.0002){
changePixel(pixel, "barium", false)
if (Math.random() >= 0.946){
pixelMap[pixel.x][pixel.y].excited = true
}
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y)){
createPixel("electric", x, y)
break;
}
}
}
}
},
elements.molten_caesium_137 = {
color: ["#735c0a", "#a68e37", "#7e6715", "#9b832e"],
behavior: behaviors.RADLIQUID,
category: "states",
state: "liquid",
tempLow: 27.44,
stateLow: "caesium_137",
tempHigh: 671,
hidden: true,
stateHigh: "caesium_vapor_137",
density: 1842,
temp: 29,
conduct: 0.90,
reactions: {
"water": { "elem1":"pop", "elem2":"hydrogen" },
"sugar_water": { "elem1":"pop", "elem2":"hydrogen" },
"dirty_water": { "elem1":"pop", "elem2":"hydrogen" },
"pool_water": { "elem1":"pop", "elem2":"hydrogen" },
"salt_water": { "elem1":"pop", "elem2":"hydrogen" },
"seltzer": { "elem1":"pop", "elem2":"hydrogen" },
},
tick: function(pixel){
if (Math.random()<0.0002){
changePixel(pixel, "barium", false)
if (Math.random() >= 0.946){
pixelMap[pixel.x][pixel.y].excited = true
}
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y)){
createPixel("electric", x, y)
break;
}
}
}
}
},
elements.caesium_137_vapor = {
color: ["#d89e77", "#cd9064", "#af6f34", "#a26320"],
behavior: behaviors.RADSOLID,
category: "states",
state: "gas",
tempLow: 660,
stateLow: "molten_caesium_137",
density: 1.7,
temp: 700,
hidden: true,
tick: function(pixel){
behaviors.GAS(pixel)
if (Math.random()<0.0002){
changePixel(pixel, "barium", false)
if (Math.random() >= 0.946){
pixelMap[pixel.x][pixel.y].excited = true
}
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y)){
createPixel("electric", x, y)
break;
}
}
}
}
}
elements.barium = {
color: ["#191f19", "#2c332c", "#3f483f", "#545e54", "#6a756a"],
behavior: behaviors.STURDYPOWDER,
reactions: elements.caesium.reactions,
category: "powders",
state: "solid",
tempHigh: 730,
stateHigh: "molten_barium",
density: 3594,
tick: function(pixel){
if(pixel.excited && Math.random() < 0.005){
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y)){
createPixel("laser", x, y)
pixelMap[x][y].temp = pixel.temp + 120
delete pixel.excited
break;
}
}
}
}
}
elements.molten_barium = {
color: ["#c26d24", "#cf8225", "#da9727", "#e4ad2b", "#ecc432"],
behavior: behaviors.MOLTEN,
reactions: elements.caesium.reactions,
category: "states",
state: "liquid",
tempLow: 728,
hidden: true,
stateLow: "barium",
density: 3338,
tick: function(pixel){
if(pixel.excited && Math.random() < 0.005){
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y)){
createPixel("laser", x, y)
pixelMap[x][y].temp = pixel.temp + 120
delete pixel.excited
break;
}
}
}
}
}
elements.subzero_grass_seed = {
color: ["#022c14", "#032911", "#032205", "#021f00"],
behavior: [
@ -97,7 +258,7 @@ elements.acid_gas.ignore.push("ruthenium"),
elements.acid_gas.ignore.push("molten_ruthenium")
elements.technetium = {
color: ["#e7d9bb", "#bab195", "#8f8a70", "#66654e"],
behavior: behaviors.WALL,
behavior: behaviors.RADSOLID,
tick: function(pixel){
if(Math.random() < 0.0007){
for (var i = 0; i < squareCoords.length; i++) {
@ -121,7 +282,7 @@ elements.technetium = {
},
elements.molten_technetium = {
color: ["#d16b42", "#da904c", "#dfb360", "#e2d57f"],
behavior: behaviors.MOLTEN,
behavior: behaviors.RADMOLTEN,
tick: function(pixel){
if(Math.random() < 0.0007){
for (var i = 0; i < squareCoords.length; i++) {
@ -1444,19 +1605,49 @@ elements.blackhole_storage = {
conduct: 1,
},
elements.plutonium = {
color: ["#616161", "#4b4949", "#353232", "#211c1c"],
color: ["#212121", "#2b1c1c", "#371616", "#430e0e", "#510606", "#212121", "#1e1e1e", "#1b1b1b", "#171717", "#141414", "#212121", "#1e1e1e", "#1b1b1b", "#171717", "#141414"],
behavior: behaviors.STURDYPOWDER,
category: "powders",
tempHigh: 640,
stateHigh: "molten_plutonium",
state: "solid",
tick: function(pixel){
if (Math.random() < 0.0007) {
changePixel(pixel, "neutron", false);
} else if (Math.random() < 0.0007) {
changePixel(pixel, "uranium", false);
}
},
if(Math.random() < 0.0007){
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y)){
createPixel("helium", x, y)
pixelMap[x][y].temp = pixel.temp + 200
break;
}
}
if(Math.random() < 0.5){
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y)){
createPixel("neutron", x, y)
pixelMap[x][y].temp = pixel.temp + 200
break;
}
}
}
changePixel(pixel, "uranium", false);
pixelMap[x][y].temp += 200
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x, y, true)){
pixelMap[x][y].temp += 175
}
}
}
behaviors.RADSOLID
},
reactions: {
"neutron": { elem1:"pn_explosion", tempMin:400, chance:0.1 },
},
@ -1464,25 +1655,54 @@ elements.plutonium = {
}
elements.molten_plutonium = {
color: ["#6b5133", "#743f26", "#7c2727"],
behavior: behaviors.LIQUID,
behavior: behaviors.RADMOLTEN,
category: "states",
state: "liquid",
tempLow: 620,
stateLow: "plutonium",
tick: function(pixel){
if (Math.random() < 0.0007) {
changePixel(pixel, "neutron", false);
} else if (Math.random() < 0.0007) {
changePixel(pixel, "uranium", false);
}
},
if(Math.random() < 0.0007){
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y)){
createPixel("helium", x, y)
pixelMap[x][y].temp = pixel.temp + 200
break;
}
}
if(Math.random() < 0.5){
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (isEmpty(x, y)){
createPixel("neutron", x, y)
pixelMap[x][y].temp = pixel.temp + 200
break;
}
}
}
changePixel(pixel, "uranium", false);
pixelMap[x][y].temp += 200
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x, y, true)){
pixelMap[x][y].temp += 175
}
}
}
},
reactions: {
"neutron": { elem1:"pn_explosion", tempMin:400, chance:0.1 },
},
density: 16629,
},
elements.neutron.reactions.plutonium = { temp2:100 };
elements.neutron.reactions.molten_plutonium = { temp2:100 }
elements.neutron.reactions.plutonium = { temp2:200 };
elements.neutron.reactions.molten_plutonium = { temp2:200 }
elements.pn_explosion = {
color: ["#ffb48f","#ffd991","#ffad91"],
behavior: [
@ -1578,6 +1798,7 @@ elements.invisiblewall = {
category: "solids",
movable: false,
noMix: true,
hardness: 1,
},
elements.bismuth = {
color: ["#818181","#989898","#b0b0b0","#c9c9c9"],
@ -1662,7 +1883,7 @@ elements.molten_bismuth = {
}
}
changePixel(pixel, "bismuth")
var rgbResult = HSVtoRGB(pixel.tHue + 0.08, 0.5, 0.9);
var rgbResult = HSVtoRGB(pixel.tHue + 0.02, 0.5, 0.9);
const hexR = rgbResult.r.toString(16).padStart(2, '0');
const hexG = rgbResult.g.toString(16).padStart(2, '0');
const hexB = rgbResult.b.toString(16).padStart(2, '0');
@ -2387,6 +2608,9 @@ elements.scuffed_circle_brush = {
createPixel(circleElem, thisx, thisy)
}
}
function randomIntFromInterval(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min)
}
elements.spacedust_cola = {
color: ["#090033", "#0a0027", "#0a001b", "#0b000f"],
behavior: elements.soda.behavior,
@ -2431,4 +2655,45 @@ elements.grid_brush = {
deletePixel(pixel.x, pixel.y)
}
}
}
elements.healing_serum = {
color: ["#79d2c5", "#77d8c0", "#78ddb9", "#7de1b0", "#85e6a6", "#91e99a", "#9fec8e"],
behavior: behaviors.LIQUID,
category: "liquids",
state: "liquid",
properties: {
wait: 15,
waitReduce: false,
},
tick: function(pixel){
if (pixel.waitReduce){pixel.wait -= 1}
if (pixel.wait == 0){
pixel.elementsSeen = {}
}
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x,y, true)){
if (!pixel.waitReduce){
pixel.waitReduce = true
}
if (pixel.wait == 0){
if (!pixel.elementsSeen[pixelMap[x][y].element] && pixelMap[x][y].element != "healing_serum"){
pixel.elementsSeen[pixelMap[x][y].element] = 1
} else if (pixelMap[x][y].element != "healing_serum") {
pixel.elementsSeen[pixelMap[x][y].element] += 1
}
}
}
if (pixel.wait == 0){
if (Object.keys(pixel.elementsSeen).length == 0){
deletePixel(pixel.x, pixel.y)
return;
} else{
changePixel(pixel, Object.keys(pixel.elementsSeen).reduce((a, b) => pixel.elementsSeen[a] > pixel.elementsSeen[b] ? a : b))
}
}
}
}
}

44
mods/potato_chips.js Normal file
View File

@ -0,0 +1,44 @@
elements.potato_chip = {
behavior: behaviors.STURDYPOWDER,
state: "solid",
density: 1350,
color: ["#F7DD93", "#D8A44B"],
category: "food",
desc: "Potato chip. Turns potato next to it into potato chip if temp is >= 104.",
tick: function(pixel) {
if(pixelTicks - pixel.start >= 15) {
if (!isEmpty(pixel.x, pixel.y - 1, true)) {
if (pixel.temp >= 104 && pixelMap[pixel.x][pixel.y - 1].element === "potato") {
changePixel(pixelMap[pixel.x][pixel.y - 1], "potato_chip");
}
}
if (!isEmpty(pixel.x, pixel.y + 1, true)) {
if (pixel.temp >= 104 && pixelMap[pixel.x][pixel.y + 1].element === "potato") {
changePixel(pixelMap[pixel.x][pixel.y + 1], "potato_chip");
}
}
if (!isEmpty(pixel.x - 1, pixel.y, true)) {
if (pixel.temp >= 104 && pixelMap[pixel.x - 1][pixel.y].element === "potato") {
changePixel(pixelMap[pixel.x - 1][pixel.y], "potato_chip");
}
}
if (!isEmpty(pixel.x + 1,pixel.y, true)) {
if (pixel.temp >= 104 && pixelMap[pixel.x + 1][pixel.y].element === "potato") {
changePixel(pixelMap[pixel.x + 1][pixel.y], "potato_chip");
}
}
}
}
}
elements.sunflower_oil = {
behavior: behaviors.LIQUID,
color: ["#FFFFCC", "#FFFF99", "#FFFF66", "#FFFF33", "#FFFF00", "#FFCC00"],
viscosity: 63,
category: "food",
state: "liquid",
reactions: {
"potato": {elem2: "potato_chip", tempMin: 140},
}
}

View File

@ -231,6 +231,23 @@ drawPixels = function(forceTick=false) {
if (ctx.globalAlpha < 1) {
ctx.globalAlpha = 1;
}
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++};
}

View File

@ -2,19 +2,28 @@
// a sandboxels mod that adds pullers
/*
==CHANGELOG==
Version 1.1.1#
Version 1.2.1
@voidapex11
~initial comit
~fixed error
+e pullers
Version 1.1.2
@voidapex11
~fixed spelling mistake's
Version 1.1.1
@voidapex11
~initial commit
+pullersDesc
+imovable_inator& movable_inator
+imovable wall, steel & insulation
+L, R, U & D pullers
+void light&dark
~don't comit without permision as you may disrupt other dev's hard work
~don't commit without permission as you may disrupt other dev's hard work
~update changelog with newer updates first
~Version format is:
rewrites.major updates.paches&minor feechers
put a '#' at end of version format if it has not been pushed to the github
rewrites.major updates.paches&minor features
put a '#' at the end of the version format if it has not been pushed to the github
~for change-log
'~' means notes/changes '+' means aditions and '-' is removals
*/
@ -41,10 +50,10 @@ elements.pullersDesc = {
};
// for the inator reference: if you know you know
elements.imovable_inator = {
elements.immovable_inator = {
color: "#525252",
tool: function(pixel) {
pixel.imovable = true
pixel.immovable = true
},
category: "tools",
}
@ -52,14 +61,14 @@ elements.imovable_inator = {
elements.movable_inator = {
color: "#a8a8a8",
tool: function(pixel) {
pixel.imovable = false
pixel.immovable = false
},
category: 'tools',
}
elements.imovable_wall = {
elements.immovable_wall = {
color: "#808080",
behavior: behaviors.WALL,
category: "solids",
@ -67,11 +76,11 @@ elements.imovable_wall = {
hardness: 1,
noMix: true,
properties: {
imovable: true
immovable: true
}
}
elements.imovable_steel = {
elements.immovable_steel = {
color: "#71797e",
behavior: behaviors.WALL,
reactions: {
@ -92,11 +101,11 @@ elements.imovable_steel = {
conduct: 0.42,
hardness: 0.8,
properties: {
imovable: true
immovable: true
}
}
elements.imovable_insulation = {
elements.immovable_insulation = {
color: "#b8aea5",
behavior: behaviors.WALL,
category: "solids",
@ -104,7 +113,7 @@ elements.imovable_insulation = {
state: "solid",
noMix: true,
properties: {
imovable: true
immovable: true
}
}
@ -123,7 +132,7 @@ elements.left_puller = {
for (i = 1; i <= pixel.range; i++) {
if (!isEmpty(pixel.x + i, pixel.y, true)) {
if (pixelMap[pixel.x+i][pixel.y]['imovable']) {break}
if (pixelMap[pixel.x+i][pixel.y]['immovable']) {break}
else {
tryMove(pixelMap[pixel.x + i][pixel.y], pixel.x + i - 1, pixel.y);
}
@ -157,7 +166,7 @@ elements.right_puller = {
for(h = pixel.pushStrength; h >= pixel.pushStrength; h--) {
for (i = 1; i <= pixel.range; i++) {
if (!isEmpty(pixel.x - i, pixel.y, true)) {
if (pixelMap[pixel.x-i][pixel.y]['imovable']) {break}
if (pixelMap[pixel.x-i][pixel.y]['immovable']) {break}
else {
tryMove(pixelMap[pixel.x - i][pixel.y], pixel.x - i + 1, pixel.y);
}
@ -190,7 +199,7 @@ elements.down_puller = {
for (i = 1; i <= pixel.range; i++) {
if (!isEmpty(pixel.x, pixel.y - i, true)) {
if (pixelMap[pixel.x][pixel.y - i]['imovable']) {break}
if (pixelMap[pixel.x][pixel.y - i]['immovable']) {break}
else {
tryMove(pixelMap[pixel.x][pixel.y - i], pixel.x, pixel.y - i + 1);
}
@ -223,7 +232,7 @@ elements.up_puller = {
for (i = 1; i <= pixel.range; i++) {
if (!isEmpty(pixel.x, pixel.y + i, true)) {
if (pixelMap[pixel.x][pixel.y + i]['imovable']){
if (pixelMap[pixel.x][pixel.y + i]['immovable']){
break
}
else {
@ -246,5 +255,99 @@ elements.up_puller = {
}
if (enabledMods.includes("pushers.js")) {
console.info('compatibility with pushers.js and imovable objects coming in a later update of the pullers.js')
console.log('compatibility with pushers.js and imovable objects coming in a later update of the pullers.js\neventualy...')
}
e_pullerColour='#c3a5d6'
elements.left_e_puller = {
color: e_pullerColour,
properties: {
range: 10,
pushStrength: 1,
},
tick: function(pixel) {
if (pixel.charge) {
elements.left_puller.tick(pixel)
}
doDefaults(pixel);
},
category: "machines",
breakInto: ["metal_scrap", "steel", "iron", "glass", "uranium", "tin"],
tempHigh: 2400,
stateHigh: ["molten_aluminum", "molten_steel", "molten_iron", "molten_glass", "molten_uranium", "molten_tin"],
density: 10000,
hardness: 0.85,
conduct: 1,
state: "solid",
}
elements.right_e_puller = {
color: e_pullerColour,
properties: {
range: 10,
pushStrength: 1,
},
tick: function(pixel) {
if (pixel.charge) {
elements.right_puller.tick(pixel)
}
doDefaults(pixel);
},
category: "machines",
breakInto: ["metal_scrap", "steel", "iron", "glass", "uranium", "tin"],
tempHigh: 2400,
stateHigh: ["molten_aluminum", "molten_steel", "molten_iron", "molten_glass", "molten_uranium", "molten_tin"],
density: 10000,
hardness: 0.85,
conduct: 1,
state: "solid",
}
elements.down_e_puller = {
color: e_pullerColour,
properties: {
range: 10,
pushStrength: 1,
},
tick: function(pixel) {
if (pixel.charge) {
elements.down_puller.tick(pixel)
}
doDefaults(pixel);
},
category: "machines",
breakInto: ["metal_scrap", "steel", "iron", "glass", "uranium", "tin"],
tempHigh: 2400,
stateHigh: ["molten_aluminum", "molten_steel", "molten_iron", "molten_glass", "molten_uranium", "molten_tin"],
density: 10000,
hardness: 0.85,
conduct: 1,
state: "solid",
}
elements.up_e_puller = {
color: e_pullerColour,
properties: {
range: 10,
pushStrength: 1,
},
tick: function(pixel) {
if (pixel.charge) {
elements.up_puller.tick(pixel)
}
doDefaults(pixel);
},
category: "machines",
breakInto: ["metal_scrap", "steel", "iron", "glass", "uranium", "tin"],
tempHigh: 2400,
stateHigh: ["molten_aluminum", "molten_steel", "molten_iron", "molten_glass", "molten_uranium", "molten_tin"],
density: 10000,
hardness: 0.85,
conduct: 1,
state: "solid",
}

View File

@ -591,7 +591,7 @@ elements.r_gullibullium_gas = {
elements.boba_pearls = {
color: "#3b0a57",
behavior: behaviors.POWDER,
category: "Purple Guy's Boba",
category: "Boba",
state: "solid",
density: 54678900,
hardness:0.95
@ -600,7 +600,7 @@ elements.boba_pearls = {
elements.vanilla_boba = {
color: "#fff0dd",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -609,7 +609,7 @@ elements.vanilla_boba = {
elements.mango_boba = {
color: "#ffc77d",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -618,7 +618,7 @@ elements.mango_boba = {
elements.matcha_boba = {
color: "#58d168",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -627,7 +627,7 @@ elements.matcha_boba = {
elements.banana_boba = {
color: "#ffe1a1",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -636,7 +636,7 @@ elements.banana_boba = {
elements.banana_cream_boba = {
color: "#ffffc1",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -645,7 +645,7 @@ elements.banana_cream_boba = {
elements.satans_boba = {
color: "#852d2d",
behavior: behaviors.MOLTEN,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25,
@ -655,7 +655,7 @@ elements.satans_boba = {
elements.peach_boba = {
color: "#ffbe73",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -664,7 +664,7 @@ elements.peach_boba = {
elements.strawberry_boba = {
color: "#e27c7c",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -673,7 +673,7 @@ elements.strawberry_boba = {
elements.mint_boba = {
color: "#8cff9b",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -682,7 +682,7 @@ elements.mint_boba = {
elements.mint_vanilla_boba = {
color: "#c8ffcf",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -691,7 +691,7 @@ elements.mint_vanilla_boba = {
elements.classic_boba = {
color: "#ffffff",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -700,7 +700,7 @@ elements.classic_boba = {
elements.taro_boba = {
color: "#f1c8ff",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -709,7 +709,7 @@ elements.taro_boba = {
elements.thai_tea_boba = {
color: "#ffc98c",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -718,7 +718,7 @@ elements.thai_tea_boba = {
elements.jasmine_green_tea_boba = {
color: "#d8ffc7",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -727,7 +727,7 @@ elements.jasmine_green_tea_boba = {
elements.honeydew_boba = {
color: "#9eff98",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -736,7 +736,7 @@ elements.honeydew_boba = {
elements.rose_boba = {
color: "#ffe6e6",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -745,7 +745,7 @@ elements.rose_boba = {
elements.lavender_boba = {
color: "#efbfff",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -754,7 +754,7 @@ elements.lavender_boba = {
elements.lychee_boba = {
color: "#fff1bf",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -763,7 +763,7 @@ elements.lychee_boba = {
elements.passion_fruit_boba = {
color: "#ffb942",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -772,7 +772,7 @@ elements.passion_fruit_boba = {
elements.pineapple_boba = {
color: "#ffe742",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -781,7 +781,7 @@ elements.pineapple_boba = {
elements.blueberry_boba = {
color: "#272a98",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -790,7 +790,7 @@ elements.blueberry_boba = {
elements.raspberry_boba = {
color: "#ff3333",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -799,7 +799,7 @@ elements.raspberry_boba = {
elements.coconut_boba = {
color: "#f1f1f1",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -808,7 +808,7 @@ elements.coconut_boba = {
elements.almond_boba = {
color: "#e4daa9",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -817,7 +817,7 @@ elements.almond_boba = {
elements.hazelnut_boba = {
color: "#fbf4d4",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -826,7 +826,7 @@ elements.hazelnut_boba = {
elements.caramel_boba = {
color: "#e4ab32",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -835,7 +835,7 @@ elements.caramel_boba = {
elements.chocolate_boba = {
color: "#6f4b00",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -844,7 +844,7 @@ elements.chocolate_boba = {
elements.coffee_boba = {
color: "#866625",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -853,7 +853,7 @@ elements.coffee_boba = {
elements.guava_boba = {
color: "#ff390a",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -862,7 +862,7 @@ elements.guava_boba = {
elements.kiwi_boba = {
color: "#09de0f",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -871,7 +871,7 @@ elements.kiwi_boba = {
elements.papaya_boba = {
color: "#c4ce37",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -880,7 +880,7 @@ elements.papaya_boba = {
elements.black_sesame_boba = {
color: "#6e89a9",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -889,7 +889,7 @@ elements.black_sesame_boba = {
elements.pandan_boba = {
color: "#33d460",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -898,7 +898,7 @@ elements.pandan_boba = {
elements.pomegranate_boba = {
color: "#ca0000",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -907,7 +907,7 @@ elements.pomegranate_boba = {
elements.watermelon_boba = {
color: "#f26565",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -916,7 +916,7 @@ elements.watermelon_boba = {
elements.grapefruit_boba = {
color: "#f1962f",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -925,7 +925,7 @@ elements.grapefruit_boba = {
elements.plum_boba = {
color: "#dacfd9",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -934,7 +934,7 @@ elements.plum_boba = {
elements.jackfruit_boba = {
color: "#daa128",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -943,7 +943,7 @@ elements.jackfruit_boba = {
elements.soursop_boba = {
color: "#ded3bb",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -952,7 +952,7 @@ elements.soursop_boba = {
elements.cranberry_boba = {
color: "#f81e1e",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -961,7 +961,7 @@ elements.cranberry_boba = {
elements.blood_orange_boba = {
color: "#ed2115",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -970,7 +970,7 @@ elements.blood_orange_boba = {
elements.lemonade_boba = {
color: "#ffe151",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -979,7 +979,7 @@ elements.lemonade_boba = {
elements.guanabana_boba = {
color: "#f5f5f5",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -988,7 +988,7 @@ elements.guanabana_boba = {
elements.cherry_blossom_boba = {
color: "#f598e8",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -997,7 +997,7 @@ elements.cherry_blossom_boba = {
elements.cardamom_boba = {
color: "#dac370",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -1006,7 +1006,7 @@ elements.cardamom_boba = {
elements.saffron_boba = {
color: "#ffe323",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -1015,7 +1015,7 @@ elements.saffron_boba = {
elements.pistachio_boba = {
color: "#9cff90",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -1024,7 +1024,7 @@ elements.pistachio_boba = {
elements.blue_raspberry_boba = {
color: "#29c9f1",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -1033,7 +1033,7 @@ elements.blue_raspberry_boba = {
elements.cotton_candy_boba = {
color: "#f1cfde",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -1042,7 +1042,7 @@ elements.cotton_candy_boba = {
elements.bubblegum_boba = {
color: "#ff97bc",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -1051,7 +1051,7 @@ elements.bubblegum_boba = {
elements.peppermint_boba = {
color: ["#ffeff5", "#ff0000"],
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -1060,7 +1060,7 @@ elements.peppermint_boba = {
elements.spearmint_boba = {
color: ["#ffeff5", "#00ff00"],
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -1085,7 +1085,61 @@ elements.strawberry_kiwi_boba = {
"k": "#09de0f"
},
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
}
elements.lychee_rose_boba = {
color: "#e04b8c",
behavior: behaviors.LIQUID,
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
}
elements.raspberry_lemonade_boba = {
color: "#e0604a",
behavior: behaviors.LIQUID,
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
}
elements.blackberry_boba = {
color: "#232048",
behavior: behaviors.LIQUID,
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
}
elements.elderflower_boba = {
color: "#ef9d5c",
behavior: behaviors.LIQUID,
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
}
elements.hibiscus_boba = {
color: "#e8a1cd",
behavior: behaviors.LIQUID,
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
}
elements.dragon_fruit_boba = {
color: "#cd4747",
behavior: behaviors.LIQUID,
category: "Boba",
state: "liquid",
density: 1300,
hardness:0.25
@ -1098,7 +1152,7 @@ elements.wasters_personal_boba = {
"M2|M1|M2",
"M2|XX|M2"
],
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1500,
hardness:0.25
@ -1111,7 +1165,7 @@ elements.when_yous_personal_boba = {
"M2|M1|M2",
"M2|XX|M2"
],
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 1600,
hardness:0.25
@ -1120,16 +1174,16 @@ elements.when_yous_personal_boba = {
elements.nousernamefounds_gallium_boba = {
color: ["#b1b1b1", "#bfbfbf", "#9e9e9e"],
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 5100,
hardness:0.25
}
elements.bartender_twix_hartwell_whites_bday_cake_boba = {
elements.bart_ender_twixs_birthday_cake_boba = {
color: "#e6dbe4",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 2000,
hardness:0.25
@ -1138,7 +1192,7 @@ elements.bartender_twix_hartwell_whites_bday_cake_boba = {
elements.sb_boba = {
color: ["#000000", "#ffff00", "#3a3a3a", "#ff0000"],
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 2000,
hardness:0.25
@ -1147,7 +1201,7 @@ elements.sb_boba = {
elements.sethies_red_boba = {
color: "#ff8282",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 2000,
hardness:0.25
@ -1156,7 +1210,7 @@ elements.sethies_red_boba = {
elements.sethies_blue_boba = {
color: "#82c0ff",
behavior: behaviors.LIQUID,
category: "Purple Guy's Boba",
category: "Boba",
state: "liquid",
density: 2010,
hardness:0.25
@ -1516,8 +1570,8 @@ elements.water_but_it_stays_liquid = {
elements.blue_uranium = {
color: ["#4ba5ff","#71a8de","#b4c7da","#3e6892","#6da4da","#9dc1e6"],
behavior: [
"XX|CR:radiation%20|XX",
"CR:radiation%1|CH:lead%0.001|CR:radiation%20",
"XX|CR:radiation%15|XX",
"CR:radiation%1|CH:lead%0.001|CR:radiation%15",
"M2|M1|M2",
],
reactions: {
@ -3298,6 +3352,186 @@ elements.turtle_egg = {
breakInto: "crushed_shell"
}
elements.radium = {
color: ["#d9d9d9", "#d0d0d0", "#b3b3b3"],
behavior: [
"XX|CR:radiation%1000000|XX",
"CR:radiation%1000000|CH:lead%0.001|CR:radiation%1000000",
"M2|M1|M2",
],
reactions: {
"neutron": { elem1:"n_explosion", tempMin:700, chance:0.1 }
},
tempHigh: 1132.2,
category: "powders",
state: "solid",
density: 5500,
hardness: 0.45,
conduct: 0.235,
excludeRandom: true
}
elements.unbreakable_battery = {
color: "#9d8725",
behavior: [
"XX|SH|XX",
"SH|XX|SH",
"XX|SH|XX",
],
category: "machines",
hardness: 1
}
elements.diamond_wall = {
color: ["#03fcec","#03c6fc","#b3eeff","#8ab0e6"],
behavior: behaviors.WALL,
category: "solids",
tempHigh: 900,
stateHigh: "carbon_dioxide",
state: "solid",
density: 3515,
hardness: 0.99,
breakInto: "diamond"
}
elements.osmium = {
color: ["#bddee4","#a7c3c8","#98b3b7"],
behavior: behaviors.WALL,
category: "solids",
tempHigh: 3033,
state: "solid",
density: 3515,
hardness: 0.7,
breakInto: "osmium_shard"
}
elements.osmium_shard = {
color: ["#bddee4","#a7c3c8","#98b3b7"],
behavior: behaviors.POWDER,
category: "powders",
tempHigh: 3033,
state: "solid",
density: 3515,
hardness: 0.7,
}
elements.copper_scrap = {
color: ["#a95232","#be4322","#c76035"],
behavior: behaviors.POWDER,
reactions: {
"blood": { elem1:"oxidized_copper_scrap", chance:0.003 },
"infection": { elem1:"oxidized_copper_scrap", chance:0.003 },
"antibody": { elem1:"oxidized_copper_scrap", chance:0.003 },
"fire": { elem1:"oxidized_copper_scrap", chance:0.0025 },
},
category: "powders",
tempHigh: 1085,
density: 8960,
conduct: 0.95,
hardness: 0.3,
fireColor: ["#07BA4F","#00BC5B","#00C2A9","#11B7E7","#C6F2EC"]
}
elements.oxidized_copper_scrap = {
color: ["#406555","#42564a","#517364"],
behavior: behaviors.POWDER,
reactions: {
"hydrogen": {tempMin:900, elem1:"copper_scrap", elem2:"steam"}
},
category: "powders",
hidden: true,
tempHigh: 1085,
stateHigh: "molten_copper",
density: 8960,
conduct: 0.85,
hardness: 0.2,
alias: "copper carbonate"
}
elements.cleaning_solution = {
color: "#5894e9",
behavior: behaviors.LIQUID,
reactions: {
"milk": { elem1: null, elem2: "cheese" },
"pilk": { elem1: null, elem2: "cheese", color2:"#c48a25" },
"fruit_milk": { elem1: null, elem2: "cheese", color2:"#c2864e" },
"chocolate_milk": { elem1: null, elem2: "cheese", color2:"#6b4000" },
"eggnog": { elem1: null, elem2: "cheese", color2:"#ffdb63" },
"nut_milk": { elem1: null, elem2: "cheese", color2:"#ded0ad" },
"yogurt": { elem1: null, elem2: "cheese" },
"baking_soda": { elem1: "sodium_acetate", elem2: "carbon_dioxide", attr1:{"foam":20} },
"limestone": { elem1: "sodium_acetate", elem2: "carbon_dioxide", attr1:{"foam":5} },
"rust": { elem2:"iron", chance:0.05 },
"oxidized_copper": { elem2:"copper", chance:0.05 },
"egg": { elem2:"yolk", chance:0.0005 },
"yolk": { elem1:"mayo", elem2:"mayo", chance:0.1 },
"mushroom_spore": { elem2:null, chance:0.05 },
"mushroom_gill": { elem2:null, chance:0.05 },
"mushroom_cap": { elem2:null, chance:0.05 },
"pollen": { elem2:null, chance:0.05 },
"salt": { elem1: null, elem2: "sodium_acetate", chance:0.05 },
"lettuce": { elem2:"pickle", chance:0.01 },
"egg": { elem2:"pickle", color2:"#e0e0ab", chance:0.01 },
"tomato": { elem2:"pickle", color2:"#fa6e11", chance:0.01 },
"grape": { elem2:"pickle", color2:"#b86a4b", chance:0.01 },
"pumpkin": { elem2:"pickle", color2:"#ffa42e", chance:0.01 },
"dirt": { elem1: null, elem2: "mud" },
"sand": { elem1: null, elem2: "wet_sand" },
"clay_soil": { elem1: null, elem2: "clay" },
},
viscosity: 12,
tempHigh: 100.6,
stateHigh: ["steam","carbon_dioxide","methane"],
tempLow: -2.22,
stateLowName: "frozen_cleaning_solution",
category: "liquids",
state: "liquid",
density: 1006,
stain: -1.05
}
elements.abs_zero = {
color: "#a2ddff",
tool: function(pixel) {
pixel.temp = absoluteZero
pixelTempCheck(pixel);
},
category: "tools",
excludeRandom: true
}
elements.firedoesntwork = {
color: "#c44f45",
tick: function(pixel) {
if ((pixel.temp > absoluteZero || pixel.charge) && !pixel.burning) {
pixel.burning = true;
pixel.burnStart = pixelTicks;
}
if (pixel.burning) {
if (!tryMove(pixel, pixel.x, pixel.y-1)) {
// tryMove again to the top left or top right
tryMove(pixel, pixel.x+(Math.random() < 0.5 ? -1 : 1), pixel.y-1);
}
if (pixelTicks-pixel.burnStart > 50 && Math.random() < 0.1) {
explodeAt(pixel.x, pixel.y, 10, "fw_ember");
}
}
else {
if (!tryMove(pixel, pixel.x, pixel.y+1)) {
// tryMove again to the bottom left or bottom right
tryMove(pixel, pixel.x+(Math.random() < 0.5 ? -1 : 1), pixel.y+1);
}
}
doDefaults(pixel);
},
burn: 90,
burnTime: 100,
density: 2000,
conduct: 1,
state: "solid",
category: "weapons"
}
if (!elements.sand.reactions) { elements.sand.reactions = {} }
elements.sand.reactions.dirt = { elem1:"dirty_sand", elem2:"dirty_sand" }
@ -3374,6 +3608,9 @@ elements.when_iium.reactions.when_i_particles = { elem1:"when_i_particles", elem
if (!elements.ash.reactions) { elements.ash.reactions = {} }
elements.ash.reactions.dust = { elem1:"dusty_ash", elem2:"dusty_ash" }
if (!elements.vinegar.reactions) { elements.vinegar.reactions = {} }
elements.vinegar.reactions.alchohol = { elem1:"cleaning_solution", elem2:"cleaning_solution" }
elements.steel.hardness = 0.85
elements.uncharge.category = "tools"
@ -3384,5 +3621,15 @@ elements.room_temp.category = "tools"
elements.heat_ray.category = "rays"
elements.battery.breakInto = "explosion"
elements.oxidized_copper.category = "solids"
elements.oxidized_copper.behavior = behaviors.SOLID
elements.oxidized_copper.breakInto = "oxidized_copper_scrap"
elements.body.color = ["#069469","#047e99","#7f5fb0", "#e85858", "#e8ac58", "#e8cc47", "#48e84e", "#48e7e8", "#488be8", "#9312e8", "#e8136e", "#8e492d"]
// important colors: ["#000000", "#edff00", "#3a3a3a", "#ff0000"], ["#82c0ff", "#ff8282"], ["#cca77c","#ad8b63","#b59d81","#c7a073","#c9b297"],

200
mods/randomelements.js Normal file
View File

@ -0,0 +1,200 @@
const adjectives = ["shiny", "glowing", "dark", "bright", "heavy", "light", "hot", "cold", "hard", "soft", "smooth", "rough", "round", "sharp", "sweet", "sour", "bitter", "salty", "savory"];
const nouns = ["metal", "crystal", "stone", "powder", "liquid", "gas", "plasma", "slime", "sand", "dust", "rock", "lava", "ice", "vapor", "ash", "soot", "sludge"];
const elementNames = [];
while (elementNames.length < 300) {
const adjective = adjectives[Math.floor(Math.random() * adjectives.length)];
const noun = nouns[Math.floor(Math.random() * nouns.length)];
const name = `${adjective}_${noun}`;
if (!elementNames.includes(name)) {
elementNames.push(name);
}
}
const nounTemperatures = {
metal: {tempLow: 1000, tempHigh: 1800},
crystal: {tempLow: 500, tempHigh: 1000},
stone: {tempLow: 600, tempHigh: 1200},
powder: {tempLow: 100, tempHigh: 500},
liquid: {tempLow: -100, tempHigh: 100},
gas: {tempLow: -200, tempHigh: -100},
plasma: {tempLow: 8000, tempHigh: 20000},
slime: {tempLow: -10, tempHigh: 30},
sand: {tempLow: 100, tempHigh: 500},
dust: {tempLow: 50, tempHigh: 200},
rock: {tempLow: 500, tempHigh: 1000},
lava: {tempLow: 700, tempHigh: 1200},
ice: {tempLow: -50, tempHigh: 0},
vapor: {tempLow: -50, tempHigh: 100},
ash: {tempLow: 200, tempHigh: 500},
soot: {tempLow: 200, tempHigh: 500},
sludge: {tempLow: -10, tempHigh: 100}
}
const nounColors = {
metal: ["#999999", "#bbbbbb", "#cccccc", "#dddddd", "#eeeeee"],
crystal: ["#77ffff", "#88eeff", "#99ddff", "#aaccff", "#bbbbff"],
stone: ["#888888", "#999999", "#aaaaaa", "#bbbbbb", "#cccccc"],
powder: ["#eeeeee", "#ffffff", "#dddddd", "#cccccc", "#bbbbbb"],
liquid: ["#336699", "#4477aa", "#5588bb", "#6699cc", "#77aadd"],
gas: ["#ffffff", "#eeeeee", "#dddddd", "#cccccc", "#bbbbbb"],
plasma: ["#ff9966", "#ffaa77", "#ffbb88", "#ffcc99", "#ffddaa"],
slime: ["#88cc88", "#99dd99", "#aaddaa", "#bbeebb", "#ccffcc"],
sand: ["#D2B48C", "#E8D5A9", "#F0E3C4", "#DCD0BF", "#EBE4D6"],
dust: ["#aaaaaa", "#bbbbbb", "#cccccc", "#dddddd", "#eeeeee"],
rock: ["#777777", "#888888", "#999999", "#aaaaaa", "#bbbbbb"],
lava: ["#ff4400", "#ff5511", "#ff6622", "#ff7733", "#ff8844"],
ice: ["#66cccc", "#77dddd", "#88eeee", "#99ffff", "#aaffff"],
vapor: ["#ffffff", "#eeeeee", "#dddddd", "#cccccc", "#bbbbbb"],
ash: ["#cccccc", "#dddddd", "#eeeeee", "#ffffff", "#eeeeee"],
soot: ["#333333", "#444444", "#555555", "#666666", "#777777"],
sludge: ["#886633", "#997733", "#a98844", "#bb9944", "#ccaa55"]
};
const nounStates = {
metal: "solid",
crystal: "solid",
stone: "solid",
powder: "liquid",
liquid: "liquid",
gas: "gas",
plasma: "gas",
slime: "liquid",
sand: "liquid",
dust: "liquid",
rock: "solid",
lava: "liquid",
ice: "solid",
vapor: "gas",
ash: "liquid",
soot: "liquid",
sludge: "liquid"
};
// Map noun to behavior
const nounBehaviors = {
metal: behaviors.WALL,
crystal: behaviors.WALL,
stone: behaviors.WALL,
powder: behaviors.POWDER,
liquid: behaviors.LIQUID,
gas: behaviors.GAS,
plasma: behaviors.GAS,
slime: behaviors.LIQUID,
sand: behaviors.POWDER,
dust: behaviors.POWDER,
rock: behaviors.WALL,
lava: behaviors.LIQUID,
ice: behaviors.WALL,
vapor: behaviors.GAS,
ash: behaviors.POWDER,
soot: behaviors.POWDER,
sludge: behaviors.LIQUID
};
const adjectiveBreakInto = {
sweet: "sugar",
salty: "salt",
};
const nounBreakInto = {
crystal: "glass_shard",
ice: "snow",
rock: ["sand", "gravel"],
};
const adjectiveColorModifiers = {
dark: 0.8, // darker
shiny: 1.2, // brighter
glowing: 1.5 // brightest
};
// Generate elements
for (const name of elementNames) {
const [adjective, noun] = name.split("_");
let baseColor = nounColors[noun];
const {tempLow, tempHigh} = nounTemperatures[noun];
let temp = Math.random() * (tempHigh - tempLow) + tempLow;
if (adjective === "hot") {
temp *= 1.5;
} else if (adjective === "cold") {
temp /= 2;
}
if (adjective in adjectiveColorModifiers) {
const modifier = adjectiveColorModifiers[adjective];
baseColor = modifyColor(baseColor, modifier);
}
elements[name] = {
color: baseColor,
behavior: nounBehaviors[noun],
category: "random elements",
state: nounStates[noun],
temp: temp,
breakInto: adjectiveBreakInto[adjective] || nounBreakInto[noun],
density: Math.random() * 100,
viscosity: Math.random() * 100
};
function modifyColor(color, modifier) {
if (color[0] === '#') {
color = color.slice(1);
}
color = String(color);
// Check for '#'
const match = color.match(/^#?(.*)$/);
if (match) {
color = match[1];
}
// Convert to RGB
let [r, g, b] = color.match(/.{1,2}/g).map(x => parseInt(x, 16));
// Apply modifier
r = Math.round(r * modifier);
g = Math.round(g * modifier);
b = Math.round(b * modifier);
// Constrain RGB values to 0-255
r = Math.max(0, Math.min(255, r));
g = Math.max(0, Math.min(255, g));
b = Math.max(0, Math.min(255, b));
// Convert back to hex
return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
}
}
/*
changelog only count importtant stuff and not the small details
0.1
added the mod
0.2
elements have breakInto's
elements with the adjectives "dark, shiny and glowing" are darker or brighter
elements with the nouns "crystal, ice, rock" can break into other elements like "glass_shard, snow, sand"
fixed some elements having wrong states
todo:
elements have reactions
gases dont have breakintos
what a silly little changelog! i made it literally right here!!
*/

View File

@ -1,7 +1,5 @@
elements.cooked_rice = {
viscosity: 1000,
tempMin: 20,
stateMin: "rice",
tempHigh: 500,
stateHigh: "charcoal",
density: 699,
@ -1452,7 +1450,7 @@ elements.silver_coin = {
state: "solid",
};
elements.uraniumaniumaniumaniumanium_popcornicecream_plutoniumeptunium_238239 = {
elements.lololol_this_crashes_ur_game_lololol_why_would_you_want_to_use_this_lololol_it_crashes = {
color: "#238fe8",
behavior: [
"XX|XX|XX",
@ -1501,104 +1499,6 @@ elements.oreo = {
state: "liquid"
};
elements.uranium_238 = {
tempHigh: 1200,
stateHigh: "molten_uranium",
color: ["#0f400b", "#30522d", "#4d6b4a", "#6f8f6d"],
behavior: [
"XX|CR:radiation%1|XX",
"CR:radiation%1|CH:lead%0.001|CR:radiation%1",
"M2|M1|M2",
],
category: "powders",
state: "liquid",
density: 19100,
hardness: 0.6,
conduct: 0.235,
excludeRandom: true,
reactions: {
"neutron": {elem1: "uranium_239",},
}
};
elements.uranium_239 = {
tempHigh: 1300,
stateHigh: "molten_uranium",
color: ["#153816", "#135e14", "#379138", "#567556", "#7bb37b"],
behavior: [
"XX|CR:radiation%2|XX",
"CR:radiation%2|CH:lead%0.002|CR:radiation%2",
"M2|M1|M2",
],
category: "powders",
state: "liquid",
hidden: true,
density: 19100,
hardness: 0.6,
conduct: 0.235,
excludeRandom: true,
reactions: {
"electron": {elem1: "neptunium_239"}
}
};
elements.neptunium_239 = {
tempHigh: 1500,
stateHigh: "molten_uranium",
color: ["#082e19", "#173b27", "#354a3f", "#4c635a", "#344a41"],
behavior: [
"XX|CR:radiation%3|XX",
"CR:radiation%3|CH:lead%0.003|CR:radiation%3",
"M2|M1|M2",
],
category: "powders",
state: "liquid",
hidden: true,
density: 20000,
hardness: 0.7,
conduct: 0.3,
excludeRandom: true,
reactions: {
"electron": {elem1: "plutonium"},
"neutron": { elem1:"n_explosion", tempMin:500, chance:0.1 }
}
};
elements.plutonium = {
tempHigh: 2000,
stateHigh: "molten_uranium",
color: ["#0a4a17", "#194d23", "#263b2a", "#475449"],
behavior: [
"XX|CR:radiation%4|XX",
"CR:radiation%4|CH:lead%0.004|CR:radiation%4",
"M2|M1|M2",
],
category: "powders",
state: "liquid",
hidden: true,
density: 22000,
hardness: 0.8,
conduct: 0.4,
excludeRandom: true,
reactions: {
"neutron": { elem1:"n_explosion", tempMin:500, chance:0.2 },
"electron": { elem1:"n_explosion", tempMin:500, chance:0.00000000000000000000001 }
}
};
elements.electron = {
color: "#c99d16",
behavior: behaviors.BOUNCY,
reactions: {
"uranium": { temp2:100 },
},
temp: 35,
category: "energy",
state: "gas",
density: 0.00002,
ignoreAir: true
};
elements.sned = {
desc: "slowly expanding...",
color: "#dfe0d9",
@ -1757,15 +1657,7 @@ elements.thermal_paste = {
state: "liquid",
};
elements.sam = {
name: "sam's sperm i think",
viscosity: 10000,
color: "#0e0e0e",
behavior: behaviors.LIQUID,
category: "joke",
state: "liquid",
desc: "begs the question; did he censor himself?"
};
// die
elements.glitch = {
color: ["#ff0000", "#c300ff", "#bbff00", "#1100ff", "#00ffaa"],
@ -1803,11 +1695,20 @@ elements.sound = {
}
file.click();
},
onUnselect: function() {},
tool: function() {},
category: "special",
};
elements.vomit = {
viscosity: 170,
tempHigh: 100,
stateHigh: ["dirty_water", "stench"],
behavior: behaviors.LIQUID,
category: "liquids",
state: "liquid",
stain: 0.1
};
elements.incinerate.category = "tools",
elements.cook.category = "tools",
elements.room_temp.category = "tools",
@ -1863,3 +1764,102 @@ if (!elements.coffee.reactions) elements.coffee.reactions = {};
elements.coffee.reactions.milk = {elem1: null, elem2: "coffee_milk",}
elements.silver.breakInto = "silver_coin"
// sb is an idiot and he has alzheimer so here is a property list
/*
== METADATA ==
name
alias
category
desc
extraInfo
related
hidden
darkText
canPlace
nocheer
forceAutoGen
== COLOR ==
color
innerColor (dead property)
colorOn
customColor
forceSaveColor
colorPattern
colorKey
== BEHAVIOR ==
behavior
behaviorOn
tool (func)
onMouseUp (func)
onSelect (func)
onUnselect (func)
onMix (func)
tick (func)
perTick (func)
reactions
== TEMP ==
temp
tempLow
stateLow
stateLowName
stateLowColor
stateLowColorMultiplier
tempHigh
stateHigh
stateHighName
stateHighColor
stateHighColorMultiplier
extraTempLow
extraTempHigh
heatCapacity (dead property)
== PROPERTIES ==
state
density
insulate
viscosity
conduct
stain
stainSelf
charge
movable
hardness
foodNeed
properties
maxSize
baby
egg
eggColor
seed
noMix
ignoreAir
excludeRandom
cooldown
isFood
ignore
canContain
== BURN ==
burn
burning
burnTime
burnInto
extinguish
fireColor
fireElement
== FLIP ==
rotatable
flipX
flippableX
flipY
flippableY
== BREAK ==
breakInto
breakIntoColor
*/

1232
mods/scp.js Normal file

File diff suppressed because it is too large Load Diff

198
mods/shipstuff.js Normal file
View File

@ -0,0 +1,198 @@
// Shipstuff, made by netty
// Ship materials
elements.ship_steel = {
color: ["#2B7D15", "#2B7D15", "#34E504"],
behavior: behaviors.WALL,
hardness: 1,
tempHigh: 9500,
stateHigh: "magma",
density: 1e+20,
};
// Bombers
elements.bomberLeft = {
color: "#555757",
conduct: 1,
behavior: behaviors.WALL,
behaviorOn: [
"XX|XX|XX",
"CR:ship_missileL|XX|XX",
"XX|XX|XX",
],
};
elements.bomberRight = {
color: "#555757",
behavior: behaviors.WALL,
conduct: 1,
behaviorOn: [
"XX|XX|XX",
"XX|XX|CR:ship_missileR",
"XX|XX|XX",
],
};
// Missiles
elements.ship_missileR = {
color: "#FFFFFF",
hidden: true,
behavior: [
"XX|XX|XX",
"CR:fw_ember|XX|M1",
"XX|XX|XX",
],
tick: function(pixel) {
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x4 = pixel.x+coord[0];
var y4 = pixel.y+coord[1];
if (isEmpty(x4, y4, true) && !isEmpty(x, y)) {
explodeAt(pixel.x, pixel.y, 25, "plasma");
}
}
},
};
elements.ship_missileL = {
color: "#FFFFFF",
hidden: true,
behavior: [
"XX|XX|XX",
"M1|XX|CR:fw_ember",
"XX|XX|XX",
],
tick: function(pixel) {
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x5 = pixel.x+coord[0];
var y5 = pixel.y+coord[1];
if (isEmpty(x5, y5, true) && !isEmpty(x, y)) {
explodeAt(pixel.x, pixel.y, 25, "plasma");
}
}
},
};
elements.ship_missile = {
color: ["#F5F6F5", "#E1DFDF"],
category: "weapons",
behavior: [
"XX|M1|XX",
"XX|XX|XX",
"XX|CR:flash|XX",
],
tick: function(pixel) {
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x6 = pixel.x+coord[0];
var y6 = pixel.y+coord[1];
if (isEmpty(x6, y6, true) && !isEmpty(x, y)) {
explodeAt(pixel.x, pixel.y, 30, "plasma, fire, fw_ember");
}
}
},
};
elements.ship_flare = {
color: ["#FFBD00", "#FF4200", "#7C00FF"],
category: "weapons",
behavior: [
"XX|M1|XX",
"XX|XX|XX",
"XX|CR:smoke|XX",
],
tick: function(pixel) {
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x7 = pixel.x+coord[0];
var y7 = pixel.y+coord[1];
if (isEmpty(x7, y7, true) && !isEmpty(x, y)) {
explodeAt(pixel.x, pixel.y, 20, "fw_ember, smoke");
}
}
},
};
// Bombs / Nukes
elements.stationary_nuke = {
color: ["#E7E71B", "#CCCC31", "#048904"],
burn: 25,
burnInto: "n_explosion",
burnTime: 200,
behavior: WALL,
};
elements.naval_mine = {
color: ["#0C32A0", "#09267A"],
behavior: behaviors.POWDER,
reactions: {
"water": { elem1: "explosion", elem2: "water" },
"salt_water": { elem1: "explosion", elem2: "salt" },
},
hardness: 0.45,
density: 500,
};
// Other ship materials
elements.tempered_glass = {
color: "#A1A1A1",
behavior: behaviors.WALL,
colorPattern: textures.GLASS,
colorKey: {
"g": "#5e807d",
"s": "#638f8b",
"S": "#679e99"},
hardnesss: 0.85,
tempHigh: 2500,
stateHigh: "rad_glass",
density: 5700,
};
elements.bulletproof_glass= {
color: "#5E5F5E",
behavior: behaviors.WALL,
colorPattern: textures.GLASS,
colorKey: {
"g": "#5e807d",
"s": "#638f8b",
"S": "#679e99"},
hardnesss: 0.94,
tempHigh: 3500,
stateHigh: "rad_glass",
density: 6000,
};
elements.asphalt = {
color: "#313131",
behavior: behaviors.WALL,
hardness: 0.35,
density: 145,
tempHigh: 2500,
stateHigh: "molten_asphalt",
};
elements.molten_asphalt = {
color: "#313131",
behavior: behaviors.LIQUID,
hardness: 0.30,
density: 125,
temp: 3000,
burnTime: 50
};
// Technologies
elements.flare_shooter = {
color: ["#000000", "#FFBD00"],
conduct: 1,
behavior: behaviors.WALL,
behaviorOn: [
"XX|CR:ship_flare|XX",
"XX|XX|XX",
"XX|XX|XX",
],
hardness: 0.20,
tempHigh: 2000,
stateHigh: "molten_glass",
density: 900,
};
elements.flying_nuker ={
color: ["#0BD10B", "#034603"],
behavior: [
"XX|XX|XX",
"XX|XX|M1 AND BO",
"XX|CR:nuke|XX",
],
hardness: 0.55,
density: 300
};
// End of mod

138
mods/spaceship.js Normal file
View File

@ -0,0 +1,138 @@
elements.power_core = {
color: ["#10F7F3", "#5AEDEB", "#BDFCFB"],
behavior: behaviors.WALL,
temp: 250,
category: "special",
stateHigh: "n_explosion",
tempHigh: 9500,
state: "solid",
desc: "The power core for your spaceship! Make sure it doesnt reach 9500 degrees!" ,
tick: function(pixel) {
const elementToCheck = "core_casing";
let isValid = true;
for (let i = pixel.x - 4; i < pixel.x + 4; i++) {
for (let j = pixel.y - 4; j < pixel.y + 4; j++) {
if (Math.abs(pixel.x - i) === 4 || Math.abs(pixel.y - j) === 4) {isValid &= pixelMap[i][j]?.element === elementToCheck;}
else if (i !== pixel.x && j !== pixel.y) isValid &= isEmpty(i, j);
}
}
// if (!pixel.alerted) {
// if (isValid) { alert("Power Core succesfully stored") }
// else { alert("Invalid core! Make sure its a 9x9 hollow box with the pixel in the middle!"); }
// pixel.alerted = true;
// } Not finished Yet
if (pixel.temp === 5000) { pixel.color = pixelColorPick(pixel,"#F92810");}
else if ( pixel.temp < 2000) { pixel.color = pixelColorPick(pixel,"#F9B610");}
else { pixel.color = pixelColorPick(pixel,"#5AEDEB");}
if (isValid) { if (pixelMap[pixel.x][pixel.y-4].element === "core_casing")
{createPixel("core_energizer", pixel.x, pixel.y-5);}}
else {{createPixel("core_energizer", pixel.x, pixel.y-4);}
}
},
};
elements.thrusters = {
color: ["#8D8D8C", "#666666"],
behavior: behaviors.WALL,
category: "special",
behaviorOn: [
"XX|XX|XX",
"XX|XX|CR:fire",
"XX|XX|XX",
],
state: "solid",
desc: "Use this to drive your ship! (Cosmetic)",
conduct:1,
};
elements.core_wall = {
color: ["#6EB5F1", "#708494"],
behavior: behaviors.WALL,
hardness: 1,
density: 90000000,
desc: "Harder than anything in the world!",
category: "special",
};
elements.space_blaster = {
color: ["#10F7F3", "#5AEDEB", "#BDFCFB"],
tick: function(pixel) {
for (var i = 0; i < 3; i++) {
var skip = false;
if (!isEmpty(pixel.x,pixel.y-1,true)) {
var p = pixelMap[pixel.x][pixel.y-1];
if (p.element === "space_blaster") { skip = true; }
if (Math.random() < 0.9 && elements[p.element].hardness !== 1) {
deletePixel(p.x,p.y);
}
}
if (!tryMove(pixel,pixel.x-1,pixel.y,["flash","heat_ray","electric"]) && !skip) {
explodeAt(pixel.x,pixel.y,30,"plasma");
var coords = circleCoords(pixel.x,pixel.y,15);
coords.forEach(function(coord) {
var x = coord.x;
var y = coord.y;
if (!isEmpty(x,y,true)) {
pixelMap[x][y].temp += 10000;
pixelTempCheck(pixelMap[x][y]);
}
})
deletePixel(pixel.x,pixel.y);
return;
}
}
},
category: "energy",
state: "solid",
density: 100000000,
temp: 10000,
hardness: 1,
maxSize: 3,
cooldown: defaultCooldown,
excludeRandom: true,
desc: "A energized blaster pixel",
};
elements.space_gunner_LEFT = {
color: ["#708494", "#5A6873"],
behavior: behaviors.WALL,
category: "special",
behaviorOn: [
"XX|XX|XX",
"CR:space_blaster|XX|XX",
"XX|XX|XX",
],
state: "solid",
desc: "Use this to shoot your enemies! (Shoots Left)",
conduct:1,
};
elements.space_gunner_RIGHT = {
color: ["#708494", "#5A6873"],
behavior: behaviors.WALL,
category: "special",
behaviorOn: [
"XX|XX|XX",
"XX|XX|CR:space_blaster",
"XX|XX|XX",
],
state: "solid",
desc: "Use this to shoot your enemies! (Shoots Right)",
conduct:1,
};
elements.core_energizer = {
color: "#FFFB00",
hidden: true,
behavior: behaviors.WALL,
state: "solid",
tick: function(pixel) {
createPixel("radiation", pixel.x, pixel.y+1)
},
};
elements.core_casing = {
color: ["#4A7375","#C1D875","#8BFCF3"],
reactions: {
"radiation": { elem2:"electric", temp1:200 }
},
behavior: behaviors.WALL,
category: "special",
density: 2710,
conduct: 0.73,
hardness: 1,
desc: "Casing for the inner core!",
};

View File

@ -76,6 +76,9 @@ elements.left_missile = {
"M2|EX:10|XX",
],
category:"ammunition",
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.right_missile = {
color: "#4c4e42",
@ -85,6 +88,9 @@ elements.right_missile = {
"XX|EX:10|M2",
],
category:"ammunition",
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.up_missile = {
color: "#4c4e42",
@ -94,7 +100,9 @@ elements.up_missile = {
"XX|EX:10|XX",
],
category:"ammunition",
alias: "the element that some guy try to add to my mod without my permission but when doing so fucked the behavior grid up",
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.cluster_munition = {
color: "#444444",
@ -160,6 +168,9 @@ elements.left_bullet = {
"M2|XX|XX",
],
category:"ammunition",
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.right_bullet = {
color: "#4c4e42",
@ -169,6 +180,9 @@ elements.left_bullet = {
"XX|XX|M2",
],
category:"ammunition",
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.e_gun_left = {
color: "#C0C0C0",
@ -226,6 +240,9 @@ elements.left_rocket = {
"XX|XX|XX",
],
category:"ammunition",
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.right_rocket = {
color: "#4c4e42",
@ -235,6 +252,9 @@ elements.left_rocket = {
"XX|XX|XX",
],
category:"ammunition",
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.e_rocket_launcher_left = {
color: "#C0C0C0",
@ -529,6 +549,9 @@ elements.bombs_for_throwing_at_you_left = {
"XX|XX|XX",
"M1|M1%10 AND EX:10>bomb|XX",
],
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
}
elements.machine_for_throwing_bombs_at_right = {
color: "#524c41",
@ -549,6 +572,9 @@ elements.bombs_for_throwing_at_you_right = {
"XX|XX|XX",
"XX|M1%10 AND EX:10>bomb|M1",
],
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.energized_orb_left = {
color: ["#e0e000","#f3f300"],
@ -592,4 +618,120 @@ elements.fast_bomb = {
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.liquid_bomb = {
color: "#524c41",
tick: function(pixel) {
if (pixel.start === pixelTicks) {return}
if (pixel.charge && elements[pixel.element].behaviorOn) {
pixelTick(pixel)
}
if (elements[pixel.element].viscosity && (!((Math.random()*100) < 100 / Math.pow(elements[pixel.element].viscosity, 0.25)))) {
var move1Spots = [
[pixel.x, pixel.y+1]
]
}
else {
var move1Spots = [
[pixel.x+1, pixel.y+1],
[pixel.x, pixel.y+1],
[pixel.x-1, pixel.y+1],
]
}
var moved = false;
for (var i = 0; i < move1Spots.length; i++) {
var coords = move1Spots[Math.floor(Math.random()*move1Spots.length)];
if (tryMove(pixel, coords[0], coords[1])) { moved = true; break; }
else { move1Spots.splice(move1Spots.indexOf(coords), 1); }
}
if (!moved) {
if (elements[pixel.element].viscosity===undefined || !(!((Math.random()*100) < 100 / Math.pow(elements[pixel.element].viscosity, 0.25)))) {
if (Math.random() < 0.5) {
if (!tryMove(pixel, pixel.x+1, pixel.y)) {
tryMove(pixel, pixel.x-1, pixel.y);
}
} else {
if (!tryMove(pixel, pixel.x-1, pixel.y)) {
tryMove(pixel, pixel.x+1, pixel.y);
}
}
}
}
doDefaults(pixel);
},
category: "weapons",
state: "liquid",
behavior: [
"XX|EX:10>explosion|XX",
"XX|XX|XX",
"XX|EX:10>explosion|XX",
],
density: 1300,
excludeRandom: true,
ignore: "gas_bomb",
cooldown: defaultCooldown
},
elements.gas_bomb = {
color: "#524c41",
tick: function(pixel) {
if (pixel.start === pixelTicks) {return}
if (pixel.charge && elements[pixel.element].behaviorOn) {
pixelTick(pixel)
}
var move1Spots = [
[pixel.x, pixel.y+1],
[pixel.x, pixel.y-1],
[pixel.x+1, pixel.y],
[pixel.x-1, pixel.y],
]
var moved = false;
for (var i = 0; i < move1Spots.length; i++) {
var coords = move1Spots[Math.floor(Math.random()*move1Spots.length)];
if (tryMove(pixel, coords[0], coords[1])) { moved = true; break; }
else { move1Spots.splice(move1Spots.indexOf(coords), 1);}
}
if (!moved) {
var move2Spots = [
[pixel.x+1, pixel.y+1],
[pixel.x-1, pixel.y+1],
[pixel.x+1, pixel.y-1],
[pixel.x-1, pixel.y-1],
]
for (var i = 0; i < move2Spots.length; i++) {
var coords = move2Spots[Math.floor(Math.random()*move2Spots.length)];
if (tryMove(pixel, coords[0], coords[1])) { break; }
else { move2Spots.splice(move2Spots.indexOf(coords), 1); }
}
}
doDefaults(pixel);
},
category: "weapons",
state: "gas",
behavior: [
"XX|EX:10>explosion|XX",
"XX|XX|XX",
"XX|EX:10>explosion|XX",
],
density: 1300,
excludeRandom: true,
ignore: "liquid_bomb",
cooldown: defaultCooldown
}
elements.tank_left = {
color: "#bcc6cc",
category: "vehicles",
behavior: [
"M2 AND CR:fast_bullet_left|XX|XX",
"M1|XX|XX",
"M1|M1|XX",
],
},
elements.tank_right = {
color: "#bcc6cc",
category: "vehicles",
behavior: [
"XX|XX|M2 AND CR:fast_bullet_right",
"XX|XX|M1",
"XX|M1|M1",
],
}