diff --git a/mod-list.html b/mod-list.html index 3d610c21..e1b5416e 100644 --- a/mod-list.html +++ b/mod-list.html @@ -126,6 +126,7 @@ buildingreplicator.jsScans and replicates builds anywhere on the screen, along with some preset submitted buildsnousernamefound change.jsAdds a tool that only replaces existing pixelsAlice color_tools.jsAdds tools that manipulate colorsAlice +controllable_pixel.jsAdds a pixel controlled using WASD (keyboard required)Jayd controllable_pixel_test.jsAdds a pixel that can be controlled with the keyboard keys. Read the commit description for more info. [PC ONLY]Alice cpt_alt.jsAdds a more destructive variant of the controllable pixelAlice debugRework.jsRevamps the Debug toolFioushemastor @@ -219,6 +220,7 @@ Weapons aircrafts.jsAdds aircraft and aircraft part pixelsJayd +c_fighter_jet.jsAdds a controllable fighter jet, wasd to move, q+wasd to shoot, gvbn for missiles.Jayd icb.jsAdds various levels of nested cluster bombsAlice life_eater.jsAdds Warhammer 40,000’s Life-Eater Virus and Virus BombsAlice liquid_void.jsAdds a liquid variant of VoidAlice @@ -298,6 +300,7 @@ minecraft.jsAdds several things from MinecraftStellarX20 minesweeper.jsA subpar implementation of MinesweeperAlice musicalfruit.jsHumans get gas from eating Beansmollthecoder +prideflags.jsAdds some pride flags to the game.Adora random_elems.jsCurated randomly generated elementsAlice random_liquids.jsRandomly generates liquids on game loadAlice sbmixup.jsAdds silly elements from a Mix-Up! gamestefanblox @@ -391,4 +394,4 @@ - \ No newline at end of file + diff --git a/mods/Batteries.js b/mods/Batteries.js index 424a79a7..e0d668c1 100644 --- a/mods/Batteries.js +++ b/mods/Batteries.js @@ -22,7 +22,7 @@ elements.low_battery= { ], behaviorOn: [ "XX|SH%10|XX", // shocks (adds charge) - "SH%10|CH:charged_battery%0.05|SH%10", + "SH%10|CH:charged_battery%0.045|SH%10", "XX|SH%10|XX", ], colorOn: "#4fb613", @@ -41,7 +41,7 @@ elements.dead_battery= { ], behaviorOn: [ "XX|XX|XX", - "XX|CH:low_battery%0.05|XX", + "XX|CH:low_battery%0.045|XX", "XX|XX|XX", ], colorOn: "#699e19", @@ -93,7 +93,196 @@ elements.radio_wave= { } }, category: "energy", + reactions: {electric: {elem1: null, elem2: null, chance: 0.5}}, density: 1, //charge: 0.5, - conduct: 0.01 + conduct: 0.01, + ignore: ["radio_wave"], }; + +elements.e_nuke = { + desc: "Works like a nuke but needs power to explode", + color: elements.nuke.color, + hardness: 0.5, + state: "solid", + behavior: behaviors.POWDER, + conduct: 1, + category: "weapons", + behaviorOn: [ + "XX|XX|XX", + "XX|XX|XX", + "M2|M1 AND EX:60>plasma,plasma,plasma,plasma,radiation,rad_steam|M2", + ], + name: "E-Nuke", +}; +elements.drill = { + color: ["#a7ab81","#a3a685", "#9ba252"], + 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 === "drill") { skip = true; } + if (Math.random() < 0.9 && elements[p.element].hardness !== 1) { + deletePixel(p.x,p.y); + } + } + if (!tryMove(pixel,pixel.x,pixel.y+1,["flash","smoke"]) && !skip) { + explodeAt(pixel.x,pixel.y,5,"flash"); + var coords = circleCoords(pixel.x,pixel.y,2); + coords.forEach(function(coord){ + var x = coord.x; + var y = coord.y; + if (!isEmpty(x,y,true)) { + pixelMap[x][y].temp += 55; + pixelTempCheck(pixelMap[x][y]); + } + }) + deletePixel(pixel.x,pixel.y); + return; + } + } + }, + category: "weapons", + state: "solid", + density: 100000000, + temp: 55, + hardness: 1, + maxSize: 3, + cooldown: defaultCooldown, + excludeRandom: true, +}; +elements.holy_hand_grenade = { + color: elements.gold.color, + behavior: [ + "XX|EX:6>god_ray,bless,bless,bless%1|XX", + "XX|XX|XX", + "M2|M1 AND EX:6>god_ray,bless,bless,bless%1|M2", + ], + behaviorOn: [ + "XX|XX|XX", + "XX|EX:6>god_ray,bless,bless,bless%1|XX", + "XX|XX|XX", + ], + category: "weapons", + state: "solid", + density: 1300, + tempHigh: 1455.5, + stateHigh: ["molten_steel", "god_ray"], + excludeRandom: true, + conduct: 1, + cooldown: defaultCooldown, +}; +//Fioushemastor (Aparently needlessly complicated. IDK) +elements.timer_input = { + color: "#4d0a03", + behavior: behaviors.WALL, + category: "machines", + insulate: true, + conduct: 1, + noMix: true + } + + let TimerDelay = 100 + elements.Timer = { + color: "#838cc2", + behavior: behaviors.WALL, + tick: function(pixel){ + if (pixelTicks == pixel.start) { + pixel.delay = TimerDelay + } + //ceck all surroundings + for (let offset of adjacentCoords) { + if (isEmpty(pixel.x+offset[0], pixel.y+offset[1])) continue; + if (pixelMap[pixel.x+offset[0]][pixel.y+offset[1]].charge && pixelMap[pixel.x+offset[0]][pixel.y+offset[1]].element == "timer_input") { + let oppositeCoords = {x: pixel.x-offset[0], y: pixel.y-offset[1]} + pixel.timers.push({start: pixelTicks, coords: oppositeCoords, delay: pixel.delay}) + } + } + //go through all timers + for (let index in pixel.timers) { + let timer = pixel.timers[index] + if (timer.start == pixelTicks-pixel.delay) { + if (isEmpty(timer.coords.x, timer.coords.y, true)) continue; + pixelMap[timer.coords.x][timer.coords.y].charge = 1 + pixel.timers.splice(index, 1) + } + } + + }, + onSelect: () => { + TimerDelay = prompt("what shall the delay be? (in ticks)", 100) + }, + colorOn: "#ffff59", + category: "machines", + tempHigh: 1455.5, + stateHigh: "molten_steel", + conduct: 0, + properties: { + timers: [], + delay: 100 + } + }; + +//ExtraMachines +elements.titanium = { + desc: "Another metal that does not erode nor conduct electricity", + conduct: 0, + color: ["#a1ada5","#ebf5ee","#bac2bc","#848a86","#505251"], + tempHigh:3000, + stateHigh: "molten_titanium", + category: "solids", + state: "soild", + hardness: 1, + density: 792, + behavior: behaviors.WALL, +}; + +elements.molten_titanium = { + desc: "Melted version of titanium", + temp : 3000, + conduct: 0, + color: ["#d16e04","#FFCC99","#FF6600","#FF7F50","#DC143C","#800020"], + tempLow:2999, + stateLow: "titanium", + category: "states", + state: "soild", + density: 792, + behavior: behaviors.MOLTEN, +}; +textures.Reniforced_Titanuim = { + REINFORCEDTITANIUM: [ + "GiGgggGiGGg", + "gggGGGGgggg", + "iiiiiiiiiii", + "GgGGggggGGg", + "GggGGgggGGg", + "igGGGgggggi", + "GggggggGGGG", + "GggGGgggggg", + "Ggggggggggg", + "ggggggGGggg", + "Ggggggggggg", + "iiiiiiiiiii",], + + +}; + +elements.Reniforced_Titanuim = { + color: "#787878", + colorPattern: textures.Reniforced_Titanuim.REINFORCEDTITANIUM, + colorKey: { + "g": "#787878", + "G": "#606060", + "i": "#332f2f"}, + behavior: behaviors.WALL, + + tempHigh: 4000, + stateHigh : "molten_titanium", + category: "solids", + state: "solid", + density: 5000, + hardness:1, + noMix: true +}; + diff --git a/mods/IreThings.js b/mods/IreThings.js new file mode 100644 index 00000000..bb754dc3 --- /dev/null +++ b/mods/IreThings.js @@ -0,0 +1,169 @@ + +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.045|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.045|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", + reactions: {electric: {elem1: null, elem2: null, chance: 0.5}}, + density: 1, + //charge: 0.5, + conduct: 0.01 +}; +elements.e_nuke = { + desc: "Works like the nuke but needs power to explode", + color: "#534636", + hardness: elements.nuke.hardness, + state: "solid", + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "M2|M1|M2", + ], + conduct: 1, + category: "weapons", + behaviorOn:[ + "XX|XX|XX", + "XX|XX|XX", + "M2|M1 AND EX:60>plasma,plasma,plasma,plasma,radiation,rad_steam|M2", + ], +}; +elements.10_timer= { + color: ["#000000"], + behavior: behaviors.WALL, + colorOn: "#000000", + conduct: 0, + category: "machines", + 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)) + } + } + } + } +} +elements.gasoline_engine = { + color: "#6d5f5d", + behavior: behaviors.WALL, + state: "solid", + density: 1000, + category: "testing", + properties: { + timer: 10 + }, diff --git a/mods/Science_mod.js b/mods/Science_mod.js index c2ad9e2c..7f75597b 100644 --- a/mods/Science_mod.js +++ b/mods/Science_mod.js @@ -1,11 +1,15 @@ // Science mod for Sandboxels // (Inspired by survival.js) -// Build 21 +// Build 26 (version alpha 0.0.26) +console.log("version alpha 0.0.26") +console.log("build 26") // If there is anything you want to suggest or there's a bug then just dm me on discord (@a_british_proto) +// I've decided to start doing this project on my schools computer's (because they don't crash all the time) so there will be long delays in updates, sorry! // Todo: // - Make new substances that you can get after mixing different elements -// - Make a way to get the different substances by mixing different elements and different substances +// - Make a way to get the different substances by mixing different elements and different substances (basically the same as the one above) // - Create different proporties for the substances (doing now) +// - Actually update all the properties and make them have effects // How much of the elements you're gonna have when you start: @@ -1247,6 +1251,7 @@ substance.Silver_Vandium_Trioxide = { } // Why is this fun? How is this not torture? This is line 1247! (at the time I am making this comment) +// Not changing this ever lol ^^^^ // I think there's two silver iodides I'm just not so sure (and I ain't editing this after) // Nvm it's only one , I got silver iodide and silver iodate mixed up :skull: @@ -1507,3 +1512,28 @@ substance.Aluminum_Chloride_Hydrate = { state: "solid", hidden:true } + +// NULL/null just means unknown +substance.Aluminum_Chloride_Hexahydrate = { + behavior: behaviors.NULL, + color: "000000", + category: "null", + state: "null", + hidden:true +} + +substance.Aluminum_Perchlorate_Nonahydrate = { + behavior: behaviors.NULL, + color: "000000", + category: "null", + state: "null", + hidden:true +} + +substance.Aluminum_Chlorate_Nonahydrate= { + behavior: behaviors.NULL, + color: "000000", + category: "null", + state: "null", + hidden:true +} diff --git a/mods/Thread.js b/mods/Thread.js index 03c22ff4..7ba6cc8a 100644 --- a/mods/Thread.js +++ b/mods/Thread.js @@ -145,3 +145,36 @@ elements.lamb = { density: 1450, conduct: 0.2 }; +converter1Var = 0; +converter2Var = 0; +elements.loom = { + color: "#296127", + behavior: behaviors.WALL, + category: "machines", + tick: function(pixel) { + if (pixel.start === pixelTicks){ + pixel.contype = converter2Var; + pixel.specialturn = converter1Var; + } + 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 == pixel.specialturn || pixel.specialturn == "all") && !elements.converter.ignore.includes(otherPixel.element)){ + changePixel(otherPixel, pixel.contype) + } + } + } + }, + onSelect: function() { + var answer5 = prompt("Please input what type of element should be converted. Write \"all\" to include everything.",(converter1Var||undefined)); + if (!answer5) { return } + converter1Var = answer5; + var answer6 = prompt("Please input what it should turn into.",(converter2Var||undefined)); + if (!answer6) { return } + converter2Var = answer6; + }, + movable: false, +}, diff --git a/mods/alchem.js b/mods/alchem.js new file mode 100644 index 00000000..b6e2e8b9 --- /dev/null +++ b/mods/alchem.js @@ -0,0 +1,367 @@ +initialElements = ["water","dirt","fire","oxygen"]; +function findReachable(elems) { + let redo = true; + for(let i = 0; i < elems.length; i++) + { + if(redo) + { + i = 0; + } + redo = false; + let e1 = elems[i]; + if(e1 === "mushroom_gill") { + redo = redo || addElement(elems, "mushroom_cap"); + } + + + if(e1 === "thorium" && elems.includes("neutron")) { + redo = redo || addElement(elems, "radium"); + } + + if(elements[e1].burnInto) { + redo = redo || addElement(elems, elements[e1].burnInto); + } + if(elements[e1].stateHigh) { + redo = redo || addElement(elems, elements[e1].stateHigh); + } + + if(elements[e1].stateLow) { + redo = redo || addElement(elems, elements[e1].stateLow); + } + if(elements[e1].breakInto) { + redo = redo || addElement(elems, elements[e1].breakInto); + } + + if(elements[e1].extraTempLow) { + for(let i in elements[e1].extraTempLow) { + redo = redo || addElement(elems, elements[e1].extraTempLow[i]); + } + } + + + if(elements[e1].behavior && elements[e1].behavior instanceof Array) { + let behavior = elements[e1].behavior; + for(let i = 0; i < behavior.length; i++) + { + for(let j = 0; j < behavior[i].length; j++) + { + let b0 = behavior[i][j].split(" AND "); + for (var k = 0; k < b0.length; k++) { + var b = b0[k]; + // remove everything after % + b = b.split("%")[0]; + if (b.indexOf(":") != -1) { + var arg = b.split(":")[1]; + } + else { var arg = undefined } + var b = b.split(":")[0]; + if (b == "CR" || b == "CH" || b == "LB" || b == "L1" || b == "L2" || b == "C2") { + if (!arg) { arg = "[???]" } + else if (arg.indexOf(">") != -1) { arg = arg.split(">")[1]; } + redo = redo || addElement(elems, arg.split(",")); + } + } + } + } + } + + for(let j in elements[e1].reactions) + { + if(elems.includes(j)) { + if(elements[e1].reactions[j].elem1) { + redo = redo || addElement(elems, elements[e1].reactions[j].elem1); + } + if(elements[e1].reactions[j].elem2) { + redo = redo || addElement(elems, elements[e1].reactions[j].elem2); + } + } + } + } + return elems; +} + +function addElement(list, elem) { + if(elem instanceof Array) + { + let result = false; + for(let i = 0; i < elem.length; i++) + { + result = result || addElement(list,elem[i]); + } + return result; + } + if(elem && !list.includes(elem)) { + list.push(elem); + return true; + } +} + + + +let chemMod = document.querySelector("[src=\"mods/chem.js\"]"); +// unhide oxygen (air), dirt (earth), fire, and water +function loadAlchem() { + + if(!elements.hematite) { + elements.hematite = { + color: ["#e0472f","#bf2a2a","#913920"], + behavior: behaviors.POWDER, + category: "alchemy mod", + density: 5250, + state: "solid", + tempHigh: 1539, + hidden: true + }; + elements.molten_hematite = { + reactions: { + "charcoal": { elem1: ["molten_iron","molten_iron","molten_iron","molten_iron","molten_nickel"], elem2: "carbon_dioxide"}, + }, + }; + elements.molten_slag.ignore.push("hematite"); + } + + elements.molten_pyrite = { + reactions: { + "oxygen": { elem1: "iron", elem2: "sulfur_dioxide"}, + }, + }; + elements.molten_slag.ignore.push("pyrite"); + + + if(!elements.chalcopyrite) { + elements.chalcopyrite = { + color: ["#e8d7cb","#cdc0af","#726153","#8f775e","#bfaea0",], + behavior: behaviors.WALL, + category: "alchemy mod", + density: 4200, + state: "solid", + tempHigh: 950, + hidden: true + }; + elements.molten_chalcopyrite = { + reactions: { + "charcoal": { elem1: "molten_copper", elem2: ["molten_slag","molten_slag","sulfur_dioxide","sulfur_dioxide","sulfur_dioxide","molten_iron"]}, + }, + }; + elements.molten_slag.ignore.push("chalcopyrite"); + } + + if(!elements.sphalerite) { + elements.sphalerite = { + color: ["#7a7a7a","#5c5c5c","#3d3d3d","#363636","#e0e0e0",], + behavior: behaviors.WALL, + category: "alchemy mod", + density: 4090, + state: "solid", + tempHigh: 1850, + hidden: true + }; + elements.molten_sphalerite = { + reactions: { + "charcoal": { elem1: "molten_zinc", elem2: ["sulfur_dioxide","sulfur_dioxide","sulfur_dioxide","sulfur_dioxide","sulfur_dioxide","gallium_gas"]}, + }, + }; + elements.molten_slag.ignore.push("sphalerite"); + } + + + if(!elements.cassiterite) { + elements.cassiterite = { + color: ["#5e5b5b","#705a4d","#826f6f","#333030","#e3d8d1"], + behavior: behaviors.WALL, + category: "alchemy mod", + density: 6950, + state: "solid", + tempHigh: 1630, + hidden: true + }; + elements.molten_cassiterite = { + reactions: { + "charcoal": { elem1: "molten_tin", elem2: "carbon_dioxide"}, + }, + }; + elements.molten_slag.ignore.push("cassiterite"); + } + + if(!elements.galena) { + elements.galena = { + color: ["#e6e6e6","#bdbdbd","#7a7a7a","#737373"], + behavior: behaviors.WALL, + category: "alchemy mod", + density: 7600, + state: "solid", + tempHigh: 1113, + hidden: true + }; + elements.molten_galena = { + reactions: { + "charcoal": { elem1: "molten_lead", elem2: "sulfur_dioxide"}, + }, + }; + elements.molten_slag.ignore.push("galena"); + } + + let ores = Array(5).fill("molten_hematite") + .concat(Array(5).fill("molten_pyrite")) + .concat(Array(5).fill("molten_chalcopyrite")) + .concat(Array(3).fill("molten_cassiterite")) + .concat(Array(5).fill("molten_sphalerite")) + .concat(Array(3).fill("molten_galena")) + .concat(Array(2).fill("molten_rutile")) + .concat(Array(5).fill("molten_bauxite")) + .concat(Array(2).fill("molten_silver")) + .concat(Array(1).fill("molten_gold")) + .concat(Array(3).fill("molten_fluorite")) + .concat(Array(3).fill("molten_uraninite")) + + elements.molten_slag.ignore.push("rutile"); + elements.molten_slag.ignore.push("bauxite"); + elements.molten_slag.ignore.push("silver"); + elements.molten_slag.ignore.push("gold"); + + elements.seltzer.reactions["electric"] = + { elem1: "water", elem2:"methane"}; + elements.carbon_dioxide.reactions["electric"] = + { elem1:"methane"}; + elements.magma.reactions["magma"] = + { elem2:ores, tempMin:2500, tempMax:3000, chance:0.0001}; + +if (!settings.alchemyUnlocked) { + settings.alchemyUnlocked = { + "oxygen": true, + "dirt": true, + "fire": true, + "water": true, + }; +} +if (settings.unlocked.alchemymod) { + for (var element in settings.unlocked) { + if (settings.unlocked[element]) { + settings.alchemyUnlocked[element] = true + } + } +} + +// loop through the elements object +if (elements.explosion) { + elements.explosion.category = "tools"; +} +if (elements.room_temp) { + elements.room_temp.category = "tools"; +} +if (elements.cook) { + elements.cook.category = "tools"; +} +if (elements.incinerate) { + elements.incinerate.category = "tools"; +} +for (var element in elements) { + if (elements[element].category === "tools") { + settings.alchemyUnlocked[element] = true; + } + if (settings.alchemyUnlocked[element]) { + elements[element].hidden = false; + if (elements[element].category !== "tools") { elements[element].category = "alchemy mod"; } + } + else if (elements[element].category !== "tools") { + // give the element the hidden attribute true + elements[element].hidden = true; + // set its category to "alchemy mod" + elements[element].category = "alchemy mod"; + } +} + +// set the unhide setting to Unlock as Discovered (2) +settings.unhide = 2; + +runAfterLoad(function(){ + checkUnlock = function(element) { + if (elements[element] && elements[element].hidden && !settings.alchemyUnlocked[element]) { + settings.alchemyUnlocked[element] = true; + if (settings.unhide === 2) { + createElementButton(element) + var categoryButton = document.querySelector(".categoryButton[current='true']"); + var currentCategory = categoryButton.getAttribute("category"); + if (currentCategory !== elements[element].category) { + document.getElementById("categoryButton-"+elements[element].category).classList.add("notify"); + } + // add notify to the elementButton of the element + document.getElementById("elementButton-"+element).classList.add("notify"); + } + saveSettings(); + } + } +}) +runAfterAutogen(function(){ + for (var element in elements) { + if (elements[element].category === "states") { + elements[element].category = "alchemy mod" + } + } +}) +window.addEventListener("load",function(){ + for (var element in elements) { + if (elements[element].hidden && document.getElementById("elementButton-"+element)) { + document.getElementById("elementButton-"+element).remove() + } + } +}) + + /*runAfterAutogen(function(){ + let reachable = findReachable(initialElements); + console.log(reachable.join(",")); + let string = ""; + for(let i in elements) + { + if(!reachable.includes(i)) + { + if(string === "") + { + string = i; + } + else + { + string += "," + i; + } + } + } + console.log(string); + string = ""; + for(let i = 0; i < reachable.length; i++) + { + if(!settings.alchemyUnlocked[reachable[i]]) + { + if(string === "") + { + string = reachable[i]; + } + else + { + string += "," + reachable[i]; + } + } + } + console.log(string); + string = ""; + for(let i in settings.alchemyUnlocked) + { + if(!reachable.includes(i) && settings.alchemyUnlocked[i] && elements[i].category !== "tools") + { + if(string === "") + { + string = i; + } + else + { + string += "," + i; + } + } + } + console.log(string); + });*/ +} +if(chemMod) { + chemMod.addEventListener("load",loadAlchem); +} else { + loadAlchem(); +} \ No newline at end of file diff --git a/mods/barf_mod.js b/mods/barf_mod.js new file mode 100644 index 00000000..b5ba91ed --- /dev/null +++ b/mods/barf_mod.js @@ -0,0 +1,42 @@ +elements.barf = { + color: "#9ACD32", + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "M1|M1|M1" + ], + category: "liquids", + density: 1020, + state: "liquid", + viscosity: 5, + reactions: { + "milk": { "elem1": "cheese", "chance": 1.0 } + }, + tempHigh: 300, + stateHigh: "stench", + tempLow: 0, + stateLow: "frozen_barf", + flammable: true, + burn: 20, + burnInto: "smoke" +}; + +elements.frozen_barf = { + color: "#B0E0E6", + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "XX|XX|XX" + ], + category: "solids", + density: 1030, + state: "solid", + tempHigh: 0, + stateHigh: "barf" +}; + +elements.slime.reactions = elements.slime.reactions || {}; +elements.slime.reactions.blood = { "elem1": "barf", "chance": 1.0 }; + +elements.blood.reactions = elements.blood.reactions || {}; +elements.blood.reactions.slime = { "elem1": "barf", "chance": 1.0 }; diff --git a/mods/c_fighter_jet.js b/mods/c_fighter_jet.js new file mode 100644 index 00000000..8ba67c73 --- /dev/null +++ b/mods/c_fighter_jet.js @@ -0,0 +1,449 @@ +document.onkeydown = function(ki)/*keyboard_input*/ { + //a + if (ki.keyCode == 65) { + KA = true; + } + //d + if (ki.keyCode == 68) { + KD = true; + } + //w + if (ki.keyCode == 87) { + KW = true; + } + //s + if (ki.keyCode == 83) { + KS = true; + } + if (ki.keyCode == 86) { + KJ = true; + } + if (ki.keyCode == 78) { + KL = true; + } + if (ki.keyCode == 71) { + KI = true; + } + if (ki.keyCode == 66) { + KK = true; + } + if (ki.keyCode == 81) { + KQ = true; + } + if (ki.keyCode == 90) { + ammo = 300; + missile = 20; + } +} +document.onkeyup = function(i2)/*input 2*/ { + //a + if (i2.keyCode == 65) { + KA = false; + ul = false; + dl = false; + } + //d + if (i2.keyCode == 68) { + KD = false; + ur = false; + dr = false; + } + //w + if (i2.keyCode == 87) { + KW = false; + ul = false; + ur = false; + } + //s + if (i2.keyCode == 83) { + KS = false; + dl = false; + dr = false; + } + if (i2.keyCode == 86) { + KJ = false; + } + if (i2.keyCode == 78) { + KL = false; + } + if (i2.keyCode == 71) { + KI = false; + } + if (i2.keyCode == 66) { + KK = false; + } + if (i2.keyCode == 81) { + KQ = false; + } +} +var KA = false; +var KD = false; +var KW = false; +var KS = false; +var KJ = false; +var KL = false; +var KI = false; +var KK = false; +var KQ = false; +var vX = 2; +var vY = 2; +var ul = false; +var ur = false; +var dl = false; +var dr = false; +var ammo = 300; +var missile = 20; +elements.cfj = { + name: "c_fighter_jet", + tick: function(pixel) { + logMessage("|"); + logMessage("|[Callsign: Box 1]"); + logMessage("|[Codename: 'Player]'"); + logMessage("|"); + logMessage("|[Operation: 'Sandbox']"); + logMessage("|['Box Squadron']"); + logMessage("|"); + logMessage("|[Ammo:" + ammo +"]"); + logMessage("|[Missiles:" + missile +"]"); + logMessage("|"); + if (KA === true) { + tryMove (pixel,pixel.x-vX,pixel.y) + } + if (KD === true) { + tryMove (pixel,pixel.x+vX,pixel.y) + } + if (KW === true) { + tryMove (pixel,pixel.x,pixel.y-vY) + } + if (KS === true) { + tryMove (pixel,pixel.x,pixel.y+vY) + } + if (KJ === true && missile > 0) { + createPixel("cfj_missile_left",pixel.x-1,pixel.y); + missile--; + } + if (KL === true && missile > 0) { + createPixel("cfj_missile_right",pixel.x+1,pixel.y); + missile--; + } + if (KI === true && missile > 0) { + createPixel("cfj_missile_up",pixel.x,pixel.y-1); + missile--; + } + if (KK === true && missile > 0) { + createPixel("cfj_missile_down",pixel.x,pixel.y+1); + missile--; + } + if (KQ === true) { + if (KA === true && dl === false && ul === false && ammo > 0) { + createPixel("cfj_b_l",pixel.x-4,pixel.y); + ammo--; + } + if (KD === true && dr === false && ur === false && ammo > 0) { + createPixel("cfj_b_r",pixel.x+4,pixel.y); + ammo--; + } + if (KW === true && ul === false && ur === false && ammo > 0) { + createPixel("cfj_b_u",pixel.x,pixel.y-4); + ammo--; + } + if (KS === true && dl === false && dr === false && ammo > 0) { + createPixel("cfj_b_d",pixel.x,pixel.y+4); + ammo--; + } + if (KA === true && KW === true && ammo > 0) { + createPixel("cfj_b_ul",pixel.x-4,pixel.y-4); + ul = true; + ammo--; + } + if (KD === true && KW === true && ammo > 0) { + createPixel("cfj_b_ur",pixel.x+4,pixel.y-4); + ur = true; + ammo--; + } + if (KA === true && KS === true && ammo > 0) { + createPixel("cfj_b_dl",pixel.x-4,pixel.y-4); + dl = true; + ammo--; + } + if (KD === true && KS === true && ammo > 0) { + createPixel("cfj_b_dr",pixel.x+4,pixel.y+4); + dr = true; + ammo--; + } + } + }, + category: "cfj", + states:"solid", + color:"#FFFFFF", +}, +elements.cfj_missile_left = { + color: "#524c41", + category: "cfj", + state: "solid", + behavior: [ + "XX|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|M2 AND EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|M1|XX|EX:20>missile_shrapnel|CR:smoke AND EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|M2 AND EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "XX|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX", + ], + tick: function(pixel) { + for (var i=0; i<3; i++) { + if (!tryMove(pixel, pixel.x-1, pixel.y)) { + if (!isEmpty(pixel.x-1, pixel.y,true)) { + } + } + } + }, + density: 1300, + excludeRandom: true, + cooldown: defaultCooldown, + ignore: "cfj", +}, +elements.cfj_missile_right = { + color: "#524c41", + category: "cfj", + state: "solid", + behavior: [ + "XX|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|M2 AND EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|CR:smoke AND EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX|M1|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|M2 AND EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "XX|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX", + ], + tick: function(pixel) { + for (var i=0; i<3; i++) { + if (!tryMove(pixel, pixel.x+1, pixel.y)) { + if (!isEmpty(pixel.x+1, pixel.y,true)) { + } + } + } + }, + density: 1300, + excludeRandom: true, + cooldown: defaultCooldown, + ignore: "cfj", +}, +elements.cfj_missile_up = { + color: "#524c41", + category: "cfj", + state: "solid", + behavior: [ + "XX|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|M2 AND EX:20>missile_shrapnel|M1 AND EX:20>missile_shrapnel|M2 AND EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|CR:smoke AND EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "XX|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX", + ], + tick: function(pixel) { + for (var i=0; i<3; i++) { + if (!tryMove(pixel, pixel.x, pixel.y-1)) { + if (!isEmpty(pixel.x, pixel.y-1,true)) { + } + } + } + }, + density: 1300, + excludeRandom: true, + cooldown: defaultCooldown, + ignore: "cfj", +}, +elements.cfj_missile_down = { + color: "#524c41", + category: "cfj", + state: "solid", + behavior: [ + "XX|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|CR:smoke AND EX:20>missile_shrapnel|M2 AND EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX||EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|M2 AND EX:20>missile_shrapnel|M1 AND EX:20>missile_shrapnel|M2 AND EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel", + "XX|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX", + ], + tick: function(pixel) { + for (var i=0; i<3; i++) { + if (!tryMove(pixel, pixel.x, pixel.y+1)) { + if (!isEmpty(pixel.x, pixel.y+1,true)) { + } + } + } + }, + density: 1300, + excludeRandom: true, + cooldown: defaultCooldown, + ignore: "cfj", +}, +elements.missile_shrapnel = { + color: "#71797E", + behavior: [ + "XX|XX|XX", + "XX|EX:5 %20|XX", + "M2%20|M1%20|M2%20", + ], + burn: 90, + burnTime: 100, + density: 2000, + conduct: 1, + state: "solid", + category: "ammunition" +}, +elements.cfj_b_l = { + color: "#4c4e42", + behavior: [ + "DB|DB|DB", + "DB|XX|DB", + "DB|DB|DB", + ], + tick: function(pixel) { + for (var i=0; i<3; i++) { + if (!tryMove(pixel, pixel.x-3, pixel.y)) { + deletePixel(pixel.x,pixel.y) + } + } + }, + category: "cfj", + state: "solid", + insulate: true, + ignore: "cfj", +}, +elements.cfj_b_r = { + color: "#4c4e42", + behavior: [ + "DB|DB|DB", + "DB|XX|DB", + "DB|DB|DB", + ], +tick: function(pixel) { + for (var i=0; i<3; i++) { + if (!tryMove(pixel, pixel.x+3, pixel.y)) { + deletePixel(pixel.x,pixel.y) + } + } + }, + category: "cfj", + state: "solid", + insulate: true, + ignore: "cfj", +}, +elements.cfj_b_u = { + color: "#4c4e42", + behavior: [ + "DB|DB|DB", + "DB|XX|DB", + "DB|DB|DB", + ], + tick: function(pixel) { + for (var i=0; i<3; i++) { + if (!tryMove(pixel, pixel.x, pixel.y-3)) { + deletePixel(pixel.x,pixel.y) + } + } + }, + category: "cfj", + state: "solid", + insulate: true, + ignore: "cfj", +}, +elements.cfj_b_d = { + color: "#4c4e42", + behavior: [ + "DB|DB|DB", + "DB|XX|DB", + "DB|DB|DB", + ], + tick: function(pixel) { + for (var i=0; i<3; i++) { + if (!tryMove(pixel, pixel.x, pixel.y+3)) { + deletePixel(pixel.x,pixel.y) + } + } + }, + category: "cfj", + state: "solid", + insulate: true, + ignore: "cfj", +}, +elements.cfj_b_ul = { + color: "#4c4e42", + behavior: [ + "DB|DB|DB", + "DB|XX|DB", + "DB|DB|DB", + ], +tick: function(pixel) { + for (var i=0; i<3; i++) { + if (!tryMove(pixel, pixel.x-3, pixel.y-3)) { + deletePixel(pixel.x,pixel.y) + } + } + }, + category: "cfj", + state: "solid", + insulate: true, + ignore: "cfj", +}, +elements.cfj_b_dl = { + color: "#4c4e42", + behavior: [ + "DB|DB|DB", + "DB|XX|DB", + "DB|DB|DB", + ], + tick: function(pixel) { + for (var i=0; i<3; i++) { + if (!tryMove(pixel, pixel.x-3, pixel.y+3)) { + deletePixel(pixel.x,pixel.y) + } + } + }, + category: "cfj", + state: "solid", + insulate: true, + ignore: "cfj", +}, +elements.cfj_b_ur = { + color: "#4c4e42", + behavior: [ + "DB|DB|DB", + "DB|XX|DB", + "DB|DB|DB", + ], + tick: function(pixel) { + for (var i=0; i<3; i++) { + if (!tryMove(pixel, pixel.x+3, pixel.y-3)) { + deletePixel(pixel.x,pixel.y) + } + } + }, + category: "cfj", + state: "solid", + insulate: true, + ignore: "cfj", +}, +elements.cfj_b_dr = { + color: "#4c4e42", + behavior: [ + "DB|DB|DB", + "DB|XX|DB", + "DB|DB|DB", + ], + tick: function(pixel) { + for (var i=0; i<3; i++) { + if (!tryMove(pixel, pixel.x+3, pixel.y+3)) { + deletePixel(pixel.x,pixel.y) + } + } + }, + category: "cfj", + state: "solid", + insulate: true, + ignore: "cfj", +} \ No newline at end of file diff --git a/mods/chem.js b/mods/chem.js index 73438729..5e7a36cc 100644 --- a/mods/chem.js +++ b/mods/chem.js @@ -1,7 +1,15 @@ function toObject(color) { color = color.match(/\d+/g); - return color; + return {"r":color[0],"g":color[1],"b":color[2]}; +} + + +function RGBToHex2(rgb) { + var r = Math.min(255,parseInt(rgb.r)); + var g = Math.min(255,parseInt(rgb.g)); + var b = Math.min(255,parseInt(rgb.b)); + return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); } function react(elem1,elem2,product1,product2,temp) @@ -18,6 +26,10 @@ function acidReact(elem1,elem2,product1,product2,temp = 0) { elements[elem1].ignore.push(...product1); } + else + { + elements[elem1].ignore.push(product1); + } } if(product2 !== null) { @@ -25,6 +37,10 @@ function acidReact(elem1,elem2,product1,product2,temp = 0) { elements[elem1].ignore.push(...product2); } + else + { + elements[elem1].ignore.push(product2); + } } elements[elem1].ignore.push(elem2); } @@ -245,6 +261,14 @@ elements.hydrofluoric_acid_gas = { category:"gases", }; + +runAfterLoad(function() { + reactList("hydrofluoric_acid", eLists.WATER, { "elem1":null, "elem2":"dirty_water" }); + reactList("hydrofluoric_acid_gas", eLists.WATER, { "elem1":null, "elem2":"dirty_water" }); + delete elements.hydrofluoric_acid.reactions["dirty_water"]; + delete elements.hydrofluoric_acid_gas.reactions["dirty_water"]; +}); + elements.hydrogen_fluoride = { color: "#f2f28d", behavior: behaviors.GAS, @@ -573,6 +597,12 @@ function createAcid(name,reactions, gasReactions, color, categoryhidden, categor if(compound == "acid") { eListAddIon("HYDROGEN", [name, name+"_gas"], compound); } + runAfterLoad(function() { + reactList(name, eLists.WATER, { "elem1":null, "elem2":"dirty_water" }); + reactList(name+"_gas", eLists.WATER, { "elem1":null, "elem2":"dirty_water" }); + delete elements[name].reactions["dirty_water"]; + delete elements[name+"_gas"].reactions["dirty_water"]; + }); } function eListAddIon(listName, itemList, compoundType = "default", priority = 0) @@ -1140,6 +1170,8 @@ elements.hydrogen_sulfide = { runAfterLoad(function() { reactList("hydrogen_sulfide", eLists.WATER, { "elem1":null, "elem2":"dirty_water" }); + delete elements.hydrogen_sulfide.reactions["dirty_water"]; + delete elements.hydrogen_sulfide.reactions["iron_dichloride_solution"]; }); acidIgnore(["sulfur_dioxide","liquid_sulfur_dioxide","sulfur_dioxide_ice"]); @@ -1169,6 +1201,9 @@ elements.sulfuric_acid_gas.ignore.push("charcoal"); runAfterLoad(function() { reactList("sulfuric_acid", eLists.WATER, { "elem2":"dirty_water"}); + reactList("sulfuric_acid_gas", eLists.WATER, { "elem2":"dirty_water"}); + delete elements.sulfuric_acid.reactions["dirty_water"]; + delete elements.sulfuric_acid_gas.reactions["dirty_water"]; }); elements.sulfuric_acid.reactions["grape"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; elements.sulfuric_acid.reactions["juice"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; @@ -1553,9 +1588,9 @@ elements.titanium_tetrachloride = { density: 1728, state: "liquid", tempHigh: 136.4, - stateHigh: "titanium_tetrachloride_gas", + stateHighName: "titanium_tetrachloride_gas", tempLow: -24, - stateLow: "solid_titanium_tetrachloride", + stateLowName: "solid_titanium_tetrachloride", }; eListAddIon("TITANIUMIV","solid_titanium_tetrachloride"); eListAddIon("CHLORIDE","solid_titanium_tetrachloride"); @@ -1727,16 +1762,18 @@ elements.molten_astatine = { tempHigh: 336, }; elements.astatine_gas = { - behavior: [ - "M2|M1 AND CR:radiation%50|M2", - "M1 AND CR:radiation%50|CH:polonium,big_pop%0.1|M1 AND CR:radiation%50", - "M2|M1 AND CR:radiation%50|M2", + behavior: behaviors.GAS, + behavior2: [ + ["XX","CR:radiation%50","XX"], + ["CR:radiation%50","CH:polonium,big_pop%0.1","CR:radiation%50"], + ["XX","CR:radiation%50","XX"] ], reactions: { "quark_matter": { "elem1":"molten_stable_astatine", "elem2":"quark_matter"} }, tick: function(pixel) { pixel.temp += 5; + pixelTick(pixel,elements[pixel.element].behavior2); } } @@ -1780,7 +1817,7 @@ elements.polonium = { elements.molten_polonium = { color: ["#ace638","#acb838","#ac8a00"], behavior: [ - "XX|CR:fire,CR:radiation%12.5|XX", + "XX|CR:fire AND CR:radiation%12.5|XX", "M2 AND CR:radiation%10|CH:lead%0.1|M2 AND CR:radiation%10", "M1|M1|M1", ], @@ -1904,6 +1941,9 @@ eLists.ACIDGAS.push("hydroastatic_acid_gas"); runAfterLoad(function() { reactList("hydroastatic_acid", eLists.WATER, {"elem2":"dirty_water"}); + reactList("hydroastatic_acid_gas", eLists.WATER, {"elem2":"dirty_water"}); + delete elements.hydroastatic_acid.reactions["dirty_water"]; + delete elements.hydroastatic_acid_gas.reactions["dirty_water"]; }); elements.polonium_dioxide = { @@ -2323,7 +2363,9 @@ elements.silver_bromide = { if(!isEmpty(k,l,true) && pixelMap[k][l].element === "silver_bromide") { if(distance <= 0) {console.log("a");} - pixelMap[k][l].color = pixelColorPick(pixelMap[k][l],blendColors(RGBToHex(toObject(pixelMap[k][l].color)),RGBToHex(toObject(pixelMap[pixel.x+i][pixel.y+j].color)),1/distance)); + let rgb = hexToRGB(blendColors(RGBToHex2(toObject(pixelMap[k][l].color)),RGBToHex2(toObject(pixelMap[pixel.x+i][pixel.y+j].color)),10/(10+distance))); + pixelMap[k][l].color = "rgb("+rgb.r+","+rgb.g+","+rgb.b+")"; + //pixelMap[k][l].color = pixelColorPick(pixelMap[k][l],blendColors(RGBToHex2(toObject(pixelMap[k][l].color)),RGBToHex2(toObject(pixelMap[pixel.x+i][pixel.y+j].color)),1/distance)); } } if(pixelMap[pixel.x+i][pixel.y+j].element === "light" || pixelMap[pixel.x+i][pixel.y+j].element === "laser") @@ -2699,6 +2741,9 @@ eListAddIon("HYDROGEN","hydroiodic_acid_gas"); eListAddIon("IODIDE","hydroiodic_acid_gas"); runAfterLoad(function() { reactList("hydroiodic_acid", eLists.WATER, { "elem2":"dirty_water"}); + reactList("hydroiodic_acid_gas", eLists.WATER, { "elem2":"dirty_water"}); + delete elements.hydroiodic_acid.reactions["dirty_water"]; + delete elements.hydroiodic_acid_gas.reactions["dirty_water"]; }); @@ -3053,11 +3098,10 @@ elements.liquid_boron_trichloride = { runAfterLoad(function() { - reactList("fluoroboric_acid", eLists.WATER, { "elem2": "dirty_water" }); -}); - -runAfterLoad(function() { - reactList("fluoroboric_acid_gas", eLists.WATER, { "elem2": "dirty_water" }); + reactList("fluoroboric_acid", eLists.WATER, { "elem2":"dirty_water"}); + reactList("fluoroboric_acid_gas", eLists.WATER, { "elem2":"dirty_water"}); + delete elements.fluoroboric_acid.reactions["dirty_water"]; + delete elements.fluoroboric_acid_gas.reactions["dirty_water"]; }); createAcid("fluoroboric_acid",{},{},["#3bffdb","#00caaf","#56c4a3"],true,true,100,100,0,1000,1020,1,"TETRAFLUOROBORATE") @@ -3175,7 +3219,7 @@ runAfterLoad(function() { }); eLists.CAUSTIC.push("sodium_hydride"); -elements.sodium_hydride.ignore = defaultAcidIgnore.concat(eLists.CAUSTICIGNORE); +elements.sodium_hydride.ignore = defaultAcidIgnore.concat(eLists.CAUSTICIGNORE).concat(["sodium","molten_sodium","hydrogen"]); acidIgnore(["sodium_hydride"]); elements.molten_sodium.reactions.hydrogen = { elem1: "sodium_hydride", elem2: null}; @@ -3575,6 +3619,7 @@ elements.depleted_uranium = { runAfterLoad(function() { reactList("depleted_uranium", eLists.WATER, { elem2: "dirty_water", chance:0.25 }); + delete elements.depleted_uranium.reactions["dirty_water"]; }); @@ -3617,10 +3662,12 @@ elements.enriched_uranium = { runAfterLoad(function() { reactList("enriched_uranium", eLists.WATER, { elem2: "dirty_water", chance:0.25 }); + delete elements.enriched_uranium.reactions["dirty_water"]; }); runAfterLoad(function() { reactList("uranium", eLists.WATER, { elem2: "dirty_water", chance:0.25 }); + delete elements.uranium.reactions["dirty_water"]; }); @@ -3677,6 +3724,7 @@ elements.stable_uranium = { }; runAfterLoad(function() { reactList("stable_uranium", eLists.WATER, { elem2: "dirty_water", chance:0.25 }); + delete elements.stable_uranium.reactions["dirty_water"]; }); elements.uranium.reactions["oxygen"] = { elem1:"uranium_dioxide", elem2: null, chance:0.1}; @@ -3813,7 +3861,7 @@ function reduce(element, element2, result) { "molten_magnesium": { elem1: result, elem2: "magnesium_fluoride"}, "molten_calcium": { elem1: result, elem2: "fluorite"}, "molten_sodium": { elem1: result, elem2: "sodium_fluoride"}, - "molten_sodium": { elem1: result, elem2: "potassium_fluoride"}, + "molten_potassium": { elem1: result, elem2: "potassium_fluoride"}, }); } } @@ -4360,9 +4408,9 @@ elements.stable_plutonium = { runAfterLoad(function() { reactList("plutonium", eLists.WATER, { elem2: "dirty_water", chance:0.25 }); -}); -runAfterLoad(function() { + delete elements.plutonium.reactions["dirty_water"]; reactList("stable_plutonium", eLists.WATER, { elem2: "dirty_water", chance:0.25 }); + delete elements.stable_plutonium.reactions["dirty_water"]; }); elements.plutonium_dioxide = { @@ -5512,12 +5560,11 @@ if(!elements.caustic_soda.reactions) { elements.caustic_soda.reactions = {}; } -elements.caustic_soda.reactions["water"] = { elem1:"sodium_hydroxide", elem2:null }; -elements.caustic_soda.reactions["salt_water"] = { elem1:"sodium_hydroxide", elem2:null }; -elements.caustic_soda.reactions["sugar_water"] = { elem1:"sodium_hydroxide", elem2:null }; -elements.caustic_soda.reactions["dirty_water"] = { elem1:"sodium_hydroxide", elem2:null }; -elements.caustic_soda.reactions["seltzer"] = { elem1:"sodium_hydroxide", elem2:null }; -elements.caustic_soda.reactions["pool_water"] = { elem1:"sodium_hydroxide", elem2:null }; +runAfterLoad(function() { + reactList("caustic_soda", eLists.WATER, { elem1:"sodium_hydroxide", elem2:null }); + delete elements.sodium_hydroxide.reactions["sodium_aluminate_solution"]; + delete elements.sodium_hydroxide_gas.reactions["sodium_aluminate_solution"]; +}); elements.sodium_hydroxide_gas.tempHigh = 150; elements.sodium_hydroxide_gas.stateHigh = ["caustic_soda","steam"]; @@ -5543,13 +5590,9 @@ if(!elements.caustic_potash.reactions) { elements.caustic_potash.reactions = {}; } -elements.caustic_potash.reactions["water"] = { elem1:"potassium_hydroxide", elem2:null }; -elements.caustic_potash.reactions["salt_water"] = { elem1:"potassium_hydroxide", elem2:null }; -elements.caustic_potash.reactions["sugar_water"] = { elem1:"potassium_hydroxide", elem2:null }; -elements.caustic_potash.reactions["dirty_water"] = { elem1:"potassium_hydroxide", elem2:null }; -elements.caustic_potash.reactions["seltzer"] = { elem1:"potassium_hydroxide", elem2:null }; -elements.caustic_potash.reactions["pool_water"] = { elem1:"potassium_hydroxide", elem2:null }; - +runAfterLoad(function() { + reactList("caustic_potash", eLists.WATER, { elem1:"potassium_hydroxide", elem2:null }); +}); elements.potassium_hydroxide_gas.tempHigh = 150; elements.potassium_hydroxide_gas.stateHigh = ["caustic_potash","steam"]; @@ -5564,6 +5607,12 @@ elements.red_mud.reactions.seltzer = {"elem2":"dirty_water" }; elements.red_mud.reactions.pool_water = {"elem2":"dirty_water" }; elements.red_mud.reactions.primordial_soup = {"elem2":"dirty_water" }; +runAfterLoad(function() { + reactList("red_mud", eLists.WATER, { elem2: "dirty_water" }); + delete elements.red_mud.reactions["dirty_water"]; + delete elements.red_mud.reactions["sodium_aluminate_solution"]; +}); + acidReact("potassium_hydroxide","fertilizer","niter","ammonia",10); acidReact("potassium_hydroxide_gas","fertilizer","niter","ammonia",10); @@ -5934,10 +5983,10 @@ eListAddIon("BICARBONATE","baking_soda","base"); eListAddIon("SODIUM","baking_soda_solution","base"); eListAddIon("BICARBONATE","baking_soda_solution","base"); -elements["baking_soda"].reactions["sodium_hydroxide"] = {elem1: "sodium_carbonate_solution", elem2: "null"}; -elements["baking_soda"].reactions["sodium_hydroxide_gas"] = {elem1: "sodium_carbonate_solution", elem2: "null"}; -elements["baking_soda_solution"].reactions["sodium_hydroxide"] = {elem1: "sodium_carbonate_solution", elem2: "null"}; -elements["baking_soda_solution"].reactions["sodium_hydroxide_gas"] = {elem1: "sodium_carbonate_solution", elem2: "null"}; +elements["baking_soda"].reactions["sodium_hydroxide"] = {elem1: "sodium_carbonate_solution", elem2: null}; +elements["baking_soda"].reactions["sodium_hydroxide_gas"] = {elem1: "sodium_carbonate_solution", elem2: null}; +elements["baking_soda_solution"].reactions["sodium_hydroxide"] = {elem1: "sodium_carbonate_solution", elem2: null}; +elements["baking_soda_solution"].reactions["sodium_hydroxide_gas"] = {elem1: "sodium_carbonate_solution", elem2: null}; createSalt("sodium_acetate","sodium_acetate_solution",["#f2f2f2","#e0e0e0"],"#7ea2f2",false,true,292,-2,102,3980,1028,"SODIUM","ACETATE"); @@ -6035,7 +6084,6 @@ runAfterAutogen(function() { let i = eLists.WATER[ii]; if(!elements[i]) { - console.log(i); continue; } if(!elements[i].reactions) @@ -6106,11 +6154,11 @@ runAfterAutogen(function() { if(productsA.length > 0 && productsB.length > 0) { acidReact(i,j,productsA,productsB,0); - console.log("precipitate"); - console.log(i); - console.log(j); - console.log(productsA); - console.log(productsB); + //console.log("precipitate"); + //console.log(i); + //console.log(j); + //console.log(productsA); + //console.log(productsB); priorityA = elements[i].salt[iii].priority; priorityB = elements[j].salt[jjj].priority; continue; @@ -6142,10 +6190,10 @@ runAfterAutogen(function() { if(productsA.length > 0 && productsB.length > 0) { elements[i].reactions[j] = { elem1:productsA, elem2:productsB, chance:0.001, oneway:true }; - console.log(i); - console.log(j); - console.log(productsA); - console.log(productsB); + //console.log(i); + //console.log(j); + //console.log(productsA); + //console.log(productsB); priorityA = elements[i].salt[iii].priority; priorityB = elements[j].salt[jjj].priority; } @@ -6161,7 +6209,6 @@ runAfterAutogen(function() { let i = acids[ii]; if(!elements[i]) { - console.log(i); continue; } if(!elements[i].reactions) @@ -6234,14 +6281,36 @@ runAfterAutogen(function() { reactionTemp = 50; } acidReact(i,j,productsA,productsB,reactionTemp); - console.log("neutral"); - console.log(i); - console.log(j); - console.log(compounds); - console.log(productsA); - console.log(productsB); + if(elements[j].reactions && elements[j].reactions[i]) { + delete elements[j].reactions[i]; + } + for(let k = 0; k < productsA.length; k++) + { + if(elements[j].reactions && elements[j].reactions[productsA[k]]) { + delete elements[j].reactions[productsA[k]]; + } + if(elements[i].reactions && elements[i].reactions[productsA[k]]) { + delete elements[i].reactions[productsA[k]]; + } + } + for(let k = 0; k < productsB.length; k++) + { + if(elements[j].reactions && elements[j].reactions[productsB[k]]) { + delete elements[j].reactions[productsB[k]]; + } + if(elements[i].reactions && elements[i].reactions[productsB[k]]) { + delete elements[i].reactions[productsB[k]]; + } + } + //console.log("neutral"); + //console.log(i); + //console.log(j); + //console.log(compounds); + //console.log(productsA); + //console.log(productsB); } } } + delete elements["molten_iodine_ice"]; } }); \ No newline at end of file diff --git a/mods/controllable_pixel.js b/mods/controllable_pixel.js new file mode 100644 index 00000000..aa4bd0ac --- /dev/null +++ b/mods/controllable_pixel.js @@ -0,0 +1,75 @@ +document.onkeydown = function(ki)/*keyboard_input*/ { + //a + if (ki.keyCode == 65) { + KA = true; + //vX ++; + } + //d + if (ki.keyCode == 68) { + KD = true; + //vX ++; + } + //w + if (ki.keyCode == 87) { + KW = true; + //vY ++; + } + //s + if (ki.keyCode == 83) { + KS = true; + //vY ++; + } +} +document.onkeyup = function(i2)/*keyboard_input*/ { + //a + if (i2.keyCode == 65) { + KA = false; + //vX --; + } + //d + if (i2.keyCode == 68) { + KD = false; + //vX --; + } + //w + if (i2.keyCode == 87) { + KW = false; + //vY = 0; + } + //s + if (i2.keyCode == 83) { + KS = false; + //vY = 0; + } +} +var KA = false; +var KD = false; +var KW = false; +var KS = false; +var vX = 1; +var vY = 1; +elements.c_pixel = { + tick: function(pixel) { + /*if (vX === 3) { + vX --; + } + if (vY === 3) { + vY --; + }*/ + if (KA === true) { + tryMove (pixel,pixel.x-vX,pixel.y) + } + if (KD === true) { + tryMove (pixel,pixel.x+vX,pixel.y) + } + if (KW === true) { + tryMove (pixel,pixel.x,pixel.y-vY) + } + if (KS === true) { + tryMove (pixel,pixel.x,pixel.y+vY) + } + }, + category: "special", + states:"solid", + color:"#FFFFFF", +} \ No newline at end of file diff --git a/mods/fast_lightmap.js b/mods/fast_lightmap.js index 58cd9553..f572cb1d 100644 --- a/mods/fast_lightmap.js +++ b/mods/fast_lightmap.js @@ -266,8 +266,19 @@ elements.plasma.tick = function(pixel) { }; // Wait for loading -// if it loads too soon then width will be undefined -setTimeout(() => { initializeLightmap(width, height); }, 700); +let i = 0; +let interval = setInterval(() => { + if (typeof width !== 'undefined') { + clearInterval(interval); + initializeLightmap(width, height); + } + i += 1; + // if width is not defined for 3 seconds or longer, it's probably broken, so it will just try run the function anyways to see the error + if (i >= 30) { + clearInterval(interval); + initializeLightmap(width, height); + } +}, 100); // Add code to functions instead of replacing them let originalTick = tick; diff --git a/mods/kopalsBar.js b/mods/kopalsBar.js new file mode 100644 index 00000000..93d52140 --- /dev/null +++ b/mods/kopalsBar.js @@ -0,0 +1,175 @@ +elements.yeast = { + color: ['#AD9166', '#9A7F4E', '#D8BB8D'], + behavior: [ + 'XX|XX|XX', + 'XX|XX|XX', + 'M2|M1|M2' + ], + category: 'bar', + state: 'solid', + tempHigh: 132, + stateHigh: 'ash', + reactions: { + 'water': {elem2: 'beer', chance: 0.05}, + 'juice': {elem2: 'wine', chance: 0.05}, + 'sugar_water': {elem2: 'rum', chance: 0.05}, + 'white_juice': {elem2: 'white_wine', chance: 0.05}, + } +} + +const drinks = [ + 'beer', + 'wine', + 'vodka', + 'rum', + 'white_wine', + 'white_juice', + 'white_grape' +] + +const ings = [ + 'yeast', + 'mashed_potato' +] + +function drink(elem) { + elements.body.reactions[elem] = {elem2: null} + elements.head.reactions[elem] = {elem2: null} +} + +elements.beer = { + color: ['#FFD700', '#F4E541'], + behavior: [ + 'XX|CR:foam%15|XX', + 'M2|XX|M2', + 'M2|M1|M2' + ], + category: 'bar', + state: 'solid', + tempHigh: 78, + density: 997, + stateHigh: ['steam', 'alcohol'], + reactions: { + 'water': {elem2: 'beer', chance: 0.0125} + } +} + +elements.wine = { + color: ['#7B1113', '#8D021F'], + behavior: behaviors.LIQUID, + category: 'bar', + state: 'solid', + tempHigh: 78, + density: 997, + stain: 0.1, + stateHigh: ['steam', 'alcohol'], + reactions: { + 'juice': {elem2: 'wine', chance: 0.0125} + } +} + +elements.white_wine = { + color: ['#FAD689', '#F8E3A1'], + behavior: behaviors.LIQUID, + category: 'bar', + state: 'solid', + tempHigh: 78, + density: 997, + stain: 0.1, + stateHigh: ['steam', 'alcohol'], + reactions: { + 'white_juice': {elem2: 'white_wine', chance: 0.0125} + } +} + +elements.vodka = { + color: ['#FFFFFF', '#FFFACD'], + behavior: behaviors.LIQUID, + category: 'bar', + state: 'solid', + tempHigh: 78, + density: 997, + stateHigh: ['steam', 'alcohol'], + reactions: { + 'water': {elem2: 'vodka', chance: 0.0125} + } +} + +elements.rum = { + color: ['#A0522D', '#8B4513'], + behavior: behaviors.LIQUID, + category: 'bar', + state: 'solid', + tempHigh: 78, + stain: 0.05, + density: 997, + stateHigh: ['steam', 'alcohol'], + reactions: { + 'sugar_water': {elem2: 'rum', chance: 0.0125} + } +} + +elements.white_juice = { + color: ['#F8F0C6', '#F7E7A9'], + behavior: behaviors.LIQUID, + category: 'liquids', + state: 'solid', + tempHigh: 130, + density: elements.juice.density, + movable: true, + stateHigh: 'steam', +} + +elements.white_grape = { + color: ['#D0F0C0', '#B2E68D'], + behavior: elements.grape.behavior, + category: 'food', + density: 1154, + state: 'solid', + stateHigh: ['steam', 'sugar'], + breakInto: 'white_juice', + tempHigh: 256, + reactions: { + 'acid': {elem1: 'white_juice', chance: 0.1}, + 'acid_gas': {elem1: 'white_juice', chance: 0.1}, + 'basalt': {elem1: 'white_juice', chance: 0.1}, + 'concrete': {elem1: 'white_juice', chance: 0.1}, + 'limestone': {elem1: 'white_juice', chance: 0.1}, + 'radiation': {elem1: 'white_juice', chance: 0.1}, + 'rock': {elem1: 'white_juice', chance: 0.1}, + 'tuff': {elem1: 'white_juice', chance: 0.1}, + 'water': {elem1: 'white_juice', chance: 0.005}, + 'sugar_water': {elem1: 'white_juice', chance: 0.025}, + } +} + +elements.ingredient_eater = { + color: ['#AD9166', '#9A7F4E', '#D8BB8D'], + tool: function(pixel) { + if (ings.includes(pixel.element)) { + deletePixel(pixel.x, pixel.y); + } + }, + category: "tools", + desc: "Removes ingredients." +} + +elements.consumer = { + color: ['#FFD700', '#F4E541', '#7B1113', '#8D021F'], + tool: function(pixel) { + if (drinks.includes(pixel.element)) { + deletePixel(pixel.x, pixel.y); + } + }, + category: "tools", + desc: "Consumes stuff like juice 'n beer." +} + +for (const elem in drinks) { + drink(elem) +} + +elements.mashed_potato.reactions = {} +elements.mashed_potato.reactions['water'] = {elem2: 'vodka', chance: 0.05} +elements.grape.color = ['#7D1538', '#6F2DA8'] +elements.grape.breakIntoColor = '#4B0082' \ No newline at end of file diff --git a/mods/morepowders.js b/mods/morepowders.js index 2925f699..cf6bdb83 100644 --- a/mods/morepowders.js +++ b/mods/morepowders.js @@ -1,12 +1,5 @@ -elements.template = { - color: "#ffffff", - category: "more_powders", - state: "solid", - hidden: true, - behavior: behaviors.POWDER - } elements.powder = { - color: ["#c17d17", "#f2a32e"], + color: ["#786d6d", "#968888"], behavior: behaviors.POWDER, category: "more_powders", state: "solid", @@ -15,12 +8,11 @@ elements.powder = { "foam": { elem1: "foam_powder", elem2: "foam_powder" }, "electric": { elem1: null, elem2: "electric_powder" }, "dust": { elem1: null, elem2: "void_powder" }, + "grenade": { elem1: null, elem2: "powder_nuke" }, + "dna": { elem1: null, elem2: "alive_powder" }, + "fire": { elem1: null, elem2: "fire_powder" }, + "cold_fire": { elem1: null, elem2: "cold_fire_powder" }, }, - stateHigh: "smoke", -tempHigh: 200, -tempLow: -200, -stateLow: "cold_powder", -stateHigh: "hot_powder", } elements.gas_powder = { color: "#b98ffc", @@ -31,17 +23,30 @@ stateHigh: "smoke", tempHigh: 2000, reactions: { "up_powder": { elem1: null, elem2: "up_gas_powder" }, + "grenade": { elem1: null, elem2: "gas_powder_nuke" }, }, tempLow: -200, stateLow: "powder", } elements.up_powder = { - color: "#8ffcb9", + color: ["#8ffcb9", "#71cac5"], behavior: behaviors.AGPOWDER, category: "more_powders", state: "solid", tempLow: -200, stateLow: "powder", +reactions: { + "grenade": { elem1: null, elem2: "up_powder_nuke" }, +}, +breakInto: "up_powder_shard", +}, +elements.up_powder_shard = { + color: ["#54a59b", "#408792"], + behavior: behaviors.POWDER, + category: "more_powders", +state: "solid", +tempLow: -200, +stateLow: "up_powder", }, elements.up_gas_powder = { color: ["#a2c5da", "#a0a7d8"], @@ -68,6 +73,7 @@ tempHigh: 2000, reactions: { "gas_powder": { elem1: null, elem2: "slow_gas_powder" }, "up_powder": { elem1: null, elem2: "slow_up_powder" }, + "grenade": { elem1: null, elem2: "slow_powder_nuke" }, }, tempLow: -200, stateLow: "powder", @@ -142,20 +148,11 @@ elements.sticky_powder = { 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|LB:electric%5|SH", "SH AND M2|SH AND M1|SH AND M2", ], category: "more_powders", @@ -168,34 +165,6 @@ elements.sticky_powder = { 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", @@ -206,4 +175,161 @@ elements.sticky_powder = { "DL|XX|DL", "DL AND M2|DL AND M1|DL AND M2", ] - } \ No newline at end of file + } + elements.powder_nuke = { + color: "#46745d", + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "XX|M1 AND EX:25>powder|XX", + ], + category: "more_powders", + state: "solid", + hidden:true, + excludeRandom: true + } + elements.gas_powder_nuke = { + color: "#406a6a", + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "XX|M1 AND EX:25>gas_powder|XX", + ], + category: "more_powders", + state: "gas", + hidden:true, + excludeRandom: true + } + elements.up_powder_nuke = { + color: "#688686", + behavior: [ + "XX|M1 AND EX:25>up_powder|XX", + "XX|XX|XX", + "XX|XX|XX", + ], + category: "more_powders", + state: "solid", + hidden:true, + excludeRandom: true + } + elements.slow_powder_nuke = { + color: "#746262", + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "M1%20|M1%20 AND EX:22>slow_powder|M1%20", + ], + category: "more_powders", + state: "solid", + hidden:true, + excludeRandom: true + } + elements.rainbow_powder = { + color: ["#ff0000","#ff8800","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff"], + tick: function(pixel) { + var t = pixelTicks+pixel.x+pixel.y; + var r = Math.floor(127*(1-Math.cos(t*Math.PI/90))); + var g = Math.floor(127*(1-Math.cos(t*Math.PI/90+2*Math.PI/3))); + var b = Math.floor(127*(1-Math.cos(t*Math.PI/90+4*Math.PI/3))); + pixel.color = "rgb("+r+","+g+","+b+")"; + }, + behavior: behaviors.POWDER, + category: "more_powders", + state: "solid", + breakInto: "static", + } + elements.alive_powder = { + color: ["#f74177", "#f78177"], + behavior: behaviors.CRAWLER, + category: "more_powders", + state: "solid", + stateHigh: "smoke", + tempHigh: 100, + tempLow: -250, + stateLow: "frozen_meat", + stateHigh: "cooked_powder", + } + elements.cooked_powder = { + color: ["#b53811", "#b54211"], + behavior: behaviors.POWDER, + category: "more_powders", + state: "solid", + stateHigh: "smoke", + tempHigh: 400, + tempLow: -250, + stateLow: "frozen_meat", + stateHigh: "smoke", + } + elements.fire_powder = { + color: ["#c07d5d", "#c23000", "#c0521b"], + behavior: [ + "XX|CR:fire%2|XX", + "XX|LB:fire%4|XX", + "M2|M1|M2", + ], + category: "more_powders", + state: "solid", + density: 997, + conduct: 0.02, + stain: -0.5, + temp:218, + tempLow: -250, + stateLow: "coldfire_powder", + } + elements.coldfire_powder = { + color: ["#004fbd", "#138fb9", "#00b8b1"], + behavior: [ + "XX|CR:cold_fire%2|XX", + "XX|LB:cold_fire%4|XX", + "M2|M1|M2", + ], + category: "more_powders", + state: "solid", + density: 997, + conduct: 0.02, + stain: -0.5, + temp:-104, + tempHigh: 250, + stateHigh: "fire_powder", + } + elements.left_powder = { + color: "#645bb0", + behavior:[ + "M2|XX|XX", + "M1|XX|XX", + "M2|XX|XX", + ], + category: "more_powders", + state: "solid", + } + elements.right_powder = { + color: "#b95b5b", + behavior:[ + "XX|XX|M2", + "XX|XX|M1", + "XX|XX|M2", + ], + category: "more_powders", + state: "solid", + } + elements.color_powder = { + color: ["#6b2e2e","#6b4f2e","#6b6b2e","#2e6b2e","#2e6b6b","#2e2e6b","#6b2e6b"], + behavior: behaviors.POWDER, + category: "more_powders", + state: "solid", + density: 1.977, + customColor: true + } + worldgentypes.powder_world = { + layers: [ + [0.95, "sticky_powder"], + [0.50, "powder"], + [0.25, "slow_up_powder"], + [0.15, "slower_up_powder"], + ], + decor: [ // [element, chance, distance from top] + ["alive_powder", 0.08], + // ["alive_powder", 0.025, 10], + ], + baseHeight: 0.35 + } diff --git a/mods/mossstuff.js b/mods/mossstuff.js index 72336bd3..fcd89e9e 100644 --- a/mods/mossstuff.js +++ b/mods/mossstuff.js @@ -1,37 +1,5 @@ - -elements.freeze_ray = { - color: ["#8cf9ff","#5c59ff"], - 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 = "#96b6ff"; - pixelMap[x][y].temp = -257; - } - else { - if (elements[pixelMap[x][y].element].isGas) { continue } - if (elements[pixelMap[x][y].element].id === elements.heat_ray.id) { break } - pixelMap[x][y].temp -= 100; - pixelTempCheck(pixelMap[x][y]); - break; - } - } - deletePixel(pixel.x, pixel.y); - }, - temp: -257, - category: "energy", - state: "gas", - excludeRandom: true, - noMix: true -}; - elements.devil_ray = { color: ["#ba0000","#8f0000"], tick: function(pixel) { @@ -2330,4 +2298,4 @@ elements.yogurt.reactions.currant = { elem1: "fruit_yogurt", elem2: null } /* uhhhh i just finished changing every color in the mod and now i have enough hex codes for a lifetime oh god i added like 2 million new fruits -*/ \ No newline at end of file +*/ diff --git a/mods/pizzasstuff.js b/mods/pizzasstuff.js index 279bebdc..fe9f6ae8 100644 --- a/mods/pizzasstuff.js +++ b/mods/pizzasstuff.js @@ -1,6 +1,10 @@ +/*addMod("mossstuff.js"); removeMod("pizzasstuff.js"); -addMod("mossstuff.js"); -reload(); + +reload(); */ + +alert("THIS MOD IS NO LONGER SUPPORTED!\nThe mod 'pizzasstuff.s' and all of its contents have been moved to mossstuff.js.\nPlease install mossstuff.js to continue getting updates."); + elements.freeze_ray = { color: ["#8cf9ff","#5c59ff"], @@ -71,6 +75,12 @@ elements.beer = { category: "food", state: "solid", hidden: "TRUE", + tempHigh: 100, + stateHigh: ["fire","steam","steam"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], + isFood: true, }; elements.root_beer = { @@ -79,6 +89,12 @@ elements.root_beer = { category: "food", state: "solid", hidden: "TRUE", + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], + tempHigh: 100, + stateHigh: ["fire","steam","steam"], + isFood: true, }; elements.fruit_slushy = { @@ -90,6 +106,12 @@ elements.fruit_slushy = { category: "food", state: "solid", hidden: "TRUE", + tempHigh: 100, + stateHigh: ["fire","steam","steam"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], + isFood: true, }; elements.mold = { @@ -98,6 +120,11 @@ elements.mold = { category: "food", state: "solid", hidden: "TRUE", + tempHigh: 350, + stateHigh: ["fire","fire","ash"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], }; elements.chocolate_slushy = { @@ -109,6 +136,12 @@ elements.chocolate_slushy = { category: "food", state: "solid", hidden: "TRUE", + tempHigh: 100, + stateHigh: ["fire","steam","steam"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], + isFood: true, }; elements.chocolate_sauce = { @@ -118,6 +151,12 @@ elements.chocolate_sauce = { category: "food", state: "solid", hidden: "TRUE", + tempHigh: 350, + stateHigh: ["fire","fire","ash"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], + isFood: true, }; elements.chocolate_ice_cream = { @@ -130,6 +169,7 @@ elements.chocolate_ice_cream = { tempHigh: 15, stateHigh: "cream", temp: 0, + isFood: true, }; elements.fruit_ice_cream = { @@ -142,6 +182,7 @@ elements.fruit_ice_cream = { tempHigh: 15, stateHigh: "cream", temp: 0, + isFood: true, }; elements.snow_cone = { @@ -154,6 +195,7 @@ elements.snow_cone = { tempHigh: 15, stateHigh: "smashed_ice", temp: 0, + isFood: true, }; elements.mint_ice_cream = { @@ -167,6 +209,7 @@ elements.mint_ice_cream = { tempHigh: 15, stateHigh: "cream", temp: 0, + isFood: true, reactions: { "chocolate": { elem1: "mint_chocolate_ice_cream", elem2: null }, } @@ -182,6 +225,7 @@ elements.mint_chocolate_ice_cream = { tempHigh: 15, stateHigh: "cream", temp: 0, + isFood: true, }; @@ -193,7 +237,10 @@ elements.chocolate_yogurt = { state: "solid", hidden: "TRUE", tempLow: 0, + stateHigh: ["fire","steam","steam"], + tempHigh: 450, stateLow: "frozen_chocolate_yogurt", + isFood: true, }; elements.fruit_yogurt = { @@ -205,6 +252,9 @@ elements.fruit_yogurt = { hidden: "TRUE", tempLow: 0, stateLow: "frozen_fruit_yogurt", + isFood: true, + stateHigh: ["fire","steam","steam"], + tempHigh: 450, }; elements.frozen_fruit_yogurt = { @@ -218,6 +268,7 @@ elements.frozen_fruit_yogurt = { tempHigh: 0, stateHigh: "fruit_yogurt", temp: 0, + isFood: true, }; elements.frozen_chocolate_yogurt = { @@ -231,6 +282,7 @@ elements.frozen_chocolate_yogurt = { tempHigh: 0, stateHigh: "chocolate_yogurt", temp: 0, + isFood: true, }; elements.frying_oil = { @@ -243,7 +295,13 @@ elements.frying_oil = { "potato": { elem1: null, elem2: "fries" }, "advanced_dough": { elem1: null, elem2: "churros" }, "snow": { elem1: null, elem2: "fried_snow" }, - } + }, + tempHigh: 350, + stateHigh: ["fire","steam","steam"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], + isFood: true, }; elements.chicken_nuggets = { @@ -252,6 +310,12 @@ elements.chicken_nuggets = { category: "food", state: "solid", hidden: "TRUE", + tempHigh: 350, + stateHigh: ["fire","fire","ash"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], + isFood: true, }; elements.advanced_dough = { @@ -273,6 +337,11 @@ elements.fries = { category: "food", state: "solid", hidden: "TRUE", + tempHigh: 350, + stateHigh: ["fire","fire","ash"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], }; elements.fried_snow = { @@ -281,6 +350,12 @@ elements.fried_snow = { category: "food", state: "solid", hidden: "TRUE", + tempHigh: 350, + stateHigh: ["fire","fire","ash"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], + isFood: true, }; elements.battery_acid = { @@ -289,6 +364,12 @@ elements.battery_acid = { category: "machines", state: "solid", hidden: "TRUE", + tempHigh: 350, + stateHigh: ["steam","dioxin","stench"], + burn:3, + burnTime:500, + burnInto: ["steam","dioxin","stench"], + isFood: true, }; @@ -298,6 +379,11 @@ elements.steampunk_pancakes = { category: "machines", state: "solid", hidden: "TRUE", + tempHigh: 350, + stateHigh: ["fire","fire","ash"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], //I have no idea why i added this, but when i removed it and started the mod, the mod removed itself. Words can't explain my fucking confusion. }; @@ -308,6 +394,11 @@ elements.churros = { category: "food", state: "solid", hidden: "TRUE", + tempHigh: 350, + stateHigh: ["fire","fire","ash"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], reactions: { "chocolate": { elem1: "chocolate_churros", elem2: null }, "chocolate_sauce": { elem1: "chocolate_churros", elem2: null }, @@ -320,8 +411,27 @@ elements.chocolate_churros = { category: "food", state: "solid", hidden: "TRUE", + tempHigh: 350, + stateHigh: ["fire","fire","ash"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], }; +/*elements.color_pick = { + color: ["#ff0000","#ffd100","#00ff4b","#0005ff"], + behavior: [ + "CF|CF|CF", + "CF|DL%5|CF", + "CF|CF|CF", + ], + category: "tools", + maxSize: 0, + darkText: true, + canPlace: false, + desc: "Use on a pixel to select its element." +};*/ + elements.croissant = { color: ["#c68028","#ad7023","#905c1b","#794d16","#674112"], behavior: behaviors.POWDER, @@ -361,6 +471,12 @@ elements.rose_sauce = { category: "food", state: "solid", hidden: "TRUE", + tempHigh: 350, + stateHigh: ["fire","fire","ash"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], + isFood: true, }; elements.seasoning = { @@ -369,6 +485,12 @@ elements.seasoning = { category: "food", state: "solid", hidden: "TRUE", + tempHigh: 350, + stateHigh: ["fire","fire","ash"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], + isFood: true, }; elements.parmesan = { @@ -376,6 +498,12 @@ elements.parmesan = { behavior: behaviors.POWDER, category: "food", state: "solid", + tempHigh: 350, + stateHigh: ["fire","fire","ash"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], + isFood: true, }; elements.baking_powder = { @@ -386,6 +514,12 @@ elements.baking_powder = { reactions: { "flour": { elem1: null, elem2: "advanced_dough" }, }, + tempHigh: 350, + stateHigh: ["fire","fire","ash"], + burn:3, + burnTime:500, + burnInto: ["fire","smoke","smoke","steam","ash"], + isFood: true, }; elements.smashed_ice = { @@ -687,6 +821,7 @@ elements.cherry = { breakInto: "juice", tempHigh: 256, stateHigh: "steam", + isFood: true, breakIntoColor: "#450008", reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#bf4545","#982828"] }, @@ -701,6 +836,7 @@ elements.strawberry = { breakInto: "juice", tempHigh: 256, stateHigh: "steam", + isFood: true, breakIntoColor: ["#bf0147","#c61548","#cc2857","#c62354","#c11848"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#a82953","#941540"] }, @@ -715,6 +851,7 @@ elements.apple = { breakInto: "juice", tempHigh: 256, stateHigh: "steam", + isFood: true, breakIntoColor: ["#ffda69","#ffdb84"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#f4ff49","#ffec2f"] }, @@ -729,6 +866,7 @@ elements.green_apple = { breakInto: "juice", tempHigh: 256, stateHigh: "steam", + isFood: true, breakIntoColor: ["#ffda69","#ffdb84"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#f4ff49","#ffec2f"] }, @@ -744,6 +882,7 @@ elements.orange = { breakIntoColor: ["#ffc659","#ffb646","#ffa700","#ff8d00"], tempHigh: 256, stateHigh: "steam", + isFood: true, reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#fbd808","#ff9005"] }, } @@ -757,6 +896,7 @@ elements.kiwi = { breakInto: "juice", tempHigh: 256, stateHigh: "steam", + isFood: true, breakIntoColor: ["#a9c77e","#bad98f"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#a5d04c","#bbdc79"] }, @@ -771,6 +911,7 @@ elements.blueberry = { breakInto: "juice", tempHigh: 256, stateHigh: "steam", + isFood: true, breakIntoColor: ["#8abeee","#8aacf4","#9591ee","#787fdb","#7c74ce"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#5086c1","#5076b0"] }, @@ -785,6 +926,7 @@ elements.plum = { breakInto: "juice", tempHigh: 256, stateHigh: "steam", + isFood: true, breakIntoColor: ["#bf66c9","#d499db","#eacced"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#d8b2d8","#b266b2"] }, @@ -799,6 +941,7 @@ elements.blackberry = { breakInto: "juice", tempHigh: 256, stateHigh: "steam", + isFood: true, breakIntoColor: ["#a941a1","#ba59b2","#c570bf"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#ba59b2","#c570bf"] }, @@ -813,6 +956,7 @@ elements.peach = { breakInto: "juice", tempHigh: 256, stateHigh: "steam", + isFood: true, breakIntoColor: ["#fce5b8","#fcdab8","#fccfb8"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#ffe7dc","#ffdac8"] }, @@ -827,6 +971,7 @@ elements.lemon = { breakInto: "juice", tempHigh: 256, stateHigh: "steam", + isFood: true, breakIntoColor: ["#f8ff80","#f6ff6c","#f5ff57","#f3ff39","#f0ff00"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#ffffd8","#fffecf"] }, @@ -842,6 +987,7 @@ elements.green_grape = { breakIntoColor: ["#5f8536","#7ba84a"], tempHigh: 256, stateHigh: "steam", + isFood: true, reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#ecffdc","#c3ffa8"] }, } @@ -852,6 +998,9 @@ elements.banana = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: "#f0f060", reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#fdf8d6","#f9efa6"] }, @@ -864,6 +1013,9 @@ elements.blood_orange = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#ff4600","#ff8353"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#ffc7b4","#ffa485"] }, @@ -876,6 +1028,9 @@ elements.canary_melon = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#ffff9e","#fffcaa"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#e5ffb3","#ecff9c"] }, @@ -888,6 +1043,9 @@ elements.honeydew_melon = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#e9ffa3","#f9ffa3"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#e8ffc9","#e8ffc8"] }, @@ -900,6 +1058,9 @@ elements.cranberry = { category: "food", state: "solid", breakInto: "sauce", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#ba4242","#7a1717"], reactions: { "soda": { elem1: null, elem2: "sprite_cranberry" }, @@ -913,6 +1074,9 @@ elements.pitaya = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#ff84ae","#ffafca"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#ffd4e3","#ffafca"] }, @@ -925,6 +1089,9 @@ elements.coconut = { category: "food", state: "solid", breakInto: "milk", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#f7e5d8","#fdefe5","#fff7f1"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#fff2db","#ffefd4"] }, @@ -937,6 +1104,9 @@ elements.cloudberry = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#ffe1c7","#fff9f3"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#ffd7ab","#ffcb93"] }, @@ -949,6 +1119,9 @@ elements.crabapple = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#ff8fcf","#ffb2de"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#ffd2ec","#ffb2de"] }, @@ -961,6 +1134,9 @@ elements.cactus_fruit = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#75d802","#72d202"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#bbffc1","#84ff90"] }, @@ -973,6 +1149,9 @@ elements.pear = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#c8e39e","#99cc99"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#c3ff9c","#bcff92"] }, @@ -985,6 +1164,9 @@ elements.purpleberry = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#c08cc3","#e49cc2"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#fee6e4","#fbc3c4"] }, @@ -997,6 +1179,9 @@ elements.yellowberry = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#fffec8","#fffdaf"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#fffec8","#fffdaf"] }, @@ -1009,6 +1194,9 @@ elements.pomegranate = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#ee717f","#e94254"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#f4a1a9","#ee717f"] }, @@ -1021,6 +1209,9 @@ elements.guava = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#ff5a76","#ff8fa2"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#f6c8cd","#f2acb5"] }, @@ -1033,6 +1224,9 @@ elements.raspberry = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#f23a72","#fb79a0"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#ffb1f4","#ff91ce"] }, @@ -1045,6 +1239,9 @@ elements.gooseberry = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#8b0031","#920436"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#f1ffdb","#e3ffb7"] }, @@ -1057,6 +1254,9 @@ elements.fig = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#ff4a4a","#ea3838"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#ff8d8d","#ffabab"] }, @@ -1069,6 +1269,9 @@ elements.durian = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#faffaf","#fbffbf"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#feffe7","#f9ffb3"] }, @@ -1081,6 +1284,9 @@ elements.passionfruit = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#ffdede","#ffe4e4"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#d8adce","#c485b6"] }, @@ -1093,6 +1299,9 @@ elements.starfruit = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#f2d553","#f5dd75"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#faeeba","#f7e698"] }, @@ -1105,6 +1314,9 @@ elements.rambutan = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#faffaf","#fbffbf"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#fde0e0","#f4c1c1"] }, @@ -1117,6 +1329,9 @@ elements.nance = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#ffff66","#ffff99"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#fffee0","#fffec8"] }, @@ -1129,6 +1344,9 @@ elements.nectarine = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#ffbd8b","#ffdbc0"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#ffc3ad","#ffa584"] }, @@ -1141,6 +1359,9 @@ elements.loganberry = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#ff8f8f","#ffb7b7"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#9c91a5","#bdb5c3"] }, @@ -1153,6 +1374,9 @@ elements.currant = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#ff878f","#ffbcc0"], reactions: { "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#cc6b69","#bb3a37"] }, @@ -1175,6 +1399,9 @@ elements.mint = { behavior: behaviors.STURDYPOWDER, category: "food", state: "solid", + tempHigh: 256, + stateHigh: "steam", + isFood: true, reactions: { "cream": { elem1: null, elem2: "toorhpaste" }, "ice_cream": { elem1: null, elem2: "mint_ice_cream" }, @@ -1187,6 +1414,9 @@ elements.broccoli = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#00b215","#0b8500"], }; @@ -1217,6 +1447,9 @@ elements.hot_pepper = { behavior: behaviors.POWDER, category: "food", state: "solid", + tempHigh: 256, + stateHigh: "steam", + isFood: true, reactions: { "sauce": { elem1: null, elem2: "hot_sauce" }, } @@ -1236,6 +1469,9 @@ elements.squash = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#efbe79","#ffd599"], }; @@ -1245,6 +1481,9 @@ elements.zuchinni = { category: "food", state: "solid", breakInto: "juice", + tempHigh: 256, + stateHigh: "steam", + isFood: true, breakIntoColor: ["#80a568","#a3c88c"], }; @@ -1254,6 +1493,9 @@ elements.olive = { category: "food", state: "solid", breakInto: "olive_oil", + tempHigh: 256, + stateHigh: "steam", + isFood: true, }; elements.eggplant = { @@ -1263,6 +1505,9 @@ elements.eggplant = { state: "solid", breakInto: "juice", breakIntoColor: ["#674ea7","#351c75"], + tempHigh: 256, + stateHigh: "steam", + isFood: true, }; elements.onion = { @@ -1276,6 +1521,9 @@ elements.onion = { category: "food", state: "solid", breakInto: ["stench", null, null, null, null], + tempHigh: 256, + stateHigh: "steam", + isFood: true, }; elements.cinnamon = { @@ -1283,6 +1531,9 @@ elements.cinnamon = { behavior: behaviors.STURDYPOWDER, category: "food", state: "solid", + tempHigh: 256, + stateHigh: "steam", + isFood: true, }; elements.garlic = { @@ -1291,6 +1542,9 @@ elements.garlic = { category: "food", state: "solid", breakInto: "garlic_clove", + tempHigh: 256, + stateHigh: "steam", + isFood: true, }; elements.garlic_clove = { @@ -1299,6 +1553,9 @@ elements.garlic_clove = { category: "food", state: "solid", hidden: "TRUE", + tempHigh: 256, + stateHigh: "steam", + isFood: true, }; elements.carrot = { @@ -1312,6 +1569,9 @@ elements.carrot = { burnTime: 300, breakInto: "juice", breakIntoColor: "#f1b956", + tempHigh: 256, + stateHigh: "steam", + isFood: true, }; elements.asparagus = { @@ -1327,6 +1587,9 @@ elements.asparagus = { burnTime: 300, breakInto: "juice", breakIntoColor: "#c9ddbb", + tempHigh: 256, + stateHigh: "steam", + isFood: true, }; elements.roasted_asparagus = { @@ -1343,6 +1606,9 @@ elements.roasted_asparagus = { burnInto: "ash", burn: 20, burnTime: 300, + tempHigh: 256, + stateHigh: "steam", + isFood: true, }; elements.oreo = { @@ -1350,6 +1616,9 @@ elements.oreo = { behavior: behaviors.STURDYPOWDER, category: "food", state: "solid", + tempHigh: 256, + stateHigh: "steam", + isFood: true, reactions: { "toorhpaste": { elem1: "poison_oreo", elem2: null }, } @@ -1361,6 +1630,9 @@ elements.poison_oreo = { category: "food", state: "solid", hidden: "TRUE", + tempHigh: 256, + stateHigh: "steam", + isFood: true, }; elements.sprinkles = { @@ -1368,6 +1640,9 @@ elements.sprinkles = { behavior: behaviors.POWDER, category: "food", state: "solid", + tempHigh: 256, + stateHigh: "steam", + isFood: true, }; elements.whipped_cream = { @@ -1378,9 +1653,7 @@ elements.whipped_cream = { hidden: "TRUE", tempHigh: 130, stateHigh: "steam", - reactions: { - "coffee": { elem1: null, elem2: "cream_coffee" }, - } + isFood: true, }; elements.olive_oil = { @@ -1391,18 +1664,9 @@ elements.olive_oil = { state: "liquid", burn: 10, burnTime: 300, -}; - -elements.cream_coffee = { - color: ["#dbc1ac","#967259","#634832"], - behavior: behaviors.LIQUID, - category: "food", - state: "solid", - hidden: "TRUE", - tempLow: 0, - stateLow: "coffee_ice", - tempHigh: 130, - stateHigh: ["steam","fragrance"], + tempHigh: 256, + stateHigh: "steam", + isFood: true, }; elements.seafoam = { @@ -1417,6 +1681,9 @@ elements.pipis = { behavior: behaviors.POWDER, category: "life", state: "solid", + tempHigh: 256, + stateHigh: "steam", + isFood: true, }; elements.frog_bomb = { @@ -1490,6 +1757,39 @@ elements.holy_hand_grenade = { cooldown: defaultCooldown }, +elements.unholy_feet_bomb = { + color: ["#661a0e","#6b1f13","#803226"], + behavior: [ + "XX|EX:20>curse,fire%1|XX", + "XX|XX|XX", + "M2|M1 AND EX:20>curse,fire%1|M2", + ], + category: "weapons", + state: "solid", + density: 1300, + tempHigh: 1455.5, + stateHigh: "curse", + excludeRandom: true, + cooldown: defaultCooldown, +}, + +//for(i = 1, i++, i>10){ + +//} +/* +for (let i = 0; i < 100; i++) { + if(unholy_feet_bomb.hidden == false) { + if(curse.hidden == false) { + if(holy_hand_grenade.hidden == false) { + unholy_feet_bomb.hidden = false; + } + } + } + i = 0; + } + */ + + elements.chocolate_fountain = { color: "#3e1d07", behavior: [ @@ -1700,6 +2000,7 @@ elements.slushy_ice = { state: "solid", density: 917, breakInto: "smashed_ice", + isFood: true, }; elements.toorhpaste = { @@ -1709,7 +2010,10 @@ elements.toorhpaste = { state: "solid", reactions: { "juice": { elem1: "poison", elem2: null }, - } + }, + tempHigh: 170, + stateHigh: "steam", + isFood: true, }; if (!elements.lettuce.reactions) elements.lettuce.reactions = {}; diff --git a/mods/prideflags.js b/mods/prideflags.js new file mode 100644 index 00000000..84094219 --- /dev/null +++ b/mods/prideflags.js @@ -0,0 +1,307 @@ +let prideTextures = { + ace: [ + "b", + "b", + "g", + "g", + "w", + "w", + "p", + "p" + ], + aro: [ + "d", + "d", + "j", + "j", + "w", + "w", + "g", + "g", + "b", + "b" + ], + aroace: [ + "o", + "o", + "y", + "y", + "w", + "w", + "c", + "c", + "b", + "b" + ], + mlm: [ + "t", + "t", + "T", + "T", + "b", + "b", + "w", + "w", + "B", + "B", + "c", + "c", + "C", + "C" + ], + lesbian: [ + "o", + "o", + "y", + "y", + "w", + "w", + "p", + "p", + "m", + "m" + ], + trans: [ + "b", + "b", + "p", + "p", + "w", + "w", + "p", + "p", + "b", + "b" + ], + transfem: [ + "b", + "b", + "p", + "p", + "P", + "P", + "m", + "m", + "P", + "P", + "p", + "p", + "b", + "b" + ], + transmasc: [ + "p", + "b", + "b", + "B", + "B", + "c", + "c", + "B", + "B", + "b", + "b", + "p", + "p" + ], + nonbinary: [ + "y", + "y", + "w", + "w", + "p", + "p", + "b", + "b" + ], + genderfluid: [ + "p", + "p", + "w", + "w", + "u", + "u", + "b", + "b", + "B", + "B" + ], + agender: [ + "b", + "b", + "g", + "g", + "w", + "w", + "G", + "G", + "w", + "w", + "g", + "g", + "b", + "b" + ], + demi: [ + "g", + "g", + "l", + "l", + "p", + "p", + "w", + "w", + "p", + "p", + "l", + "l", + "g", + "g" + ] +} +elements.aro_flag = { + colorPattern: prideTextures.aro, + colorKey: { + "d": "#3da542", + "j": "#a7d479", + "w": "#ffffff", + "g": "#a9a9a9", + "b": "#000000" + }, + category: "pride", +} +elements.ace_flag = { + colorPattern: prideTextures.ace, + colorKey: { + "b": "#000000", + "g": "#a3a3a3", + "w": "#ffffff", + "p": "#800080", + }, + category: "pride", +} +elements.gay_flag = { + colorPattern: prideTextures.mlm, + colorKey: { + t: "#078D70", + T: "#26CEAA", + b: "#98E8C1", + w: "#ffffff", + B: "#7BADE2", + c: "#5049CC", + C: "#3D1A78" + }, + category: "pride", +} +elements.lesbian_flag = { + colorPattern: prideTextures.lesbian, + colorKey: { + o: "#D52D00", + y: "#FF9A56", + w: "#FFFFFF", + p: "#D162A4", + m: "#A30262", + }, + category: "pride", +} +elements.aroace_flag = { + colorPattern: prideTextures.aroace, + colorKey: { + o: "#ef9007", + y: "#f6d317", + w: "#ffffff", + c: "#45bcee", + b: "#1e3f54" + }, + category: "pride", +} +elements.trans_flag = { + colorPattern: prideTextures.trans, + colorKey: { + b: "#5BCEFA", + p: "#F5A9B8", + w: "#FFFFFF", + }, + category: "pride", +} +elements.transfem_flag = { + colorPattern: prideTextures.transfem, + colorKey: { + b: "#74deff", + p: "#ffe1ed", + P: "#ffb5d6", + m: "#ff8cbf" + }, + category: "pride", +} +elements.transmasc_flag = { + colorPattern: prideTextures.transmasc, + colorKey: { + p: "#FF8ABD", + b: "#CDF5FE", + B: "#9AEBFF", + c: "#74DFFF", + }, + category: "pride", +} +elements.nonbinary_flag = { + colorPattern: prideTextures.nonbinary, + colorKey: { + y: "#FCF434", + w: "#FFFFFF", + p: "#9C59D1", + b: "#000000" + }, + category: "pride", +} +elements.genderfluid_flag = { + colorPattern: prideTextures.genderfluid, + colorKey: { + p: "#FF76A4", + w: "#FFFFFF", + u: "#C011D7", + b: "#000000", + B: "#2F3CBE" + }, + category: "pride", +} +elements.agender_flag = { + colorPattern: prideTextures.agender, + colorKey: { + b: "#000000", + g: "#BCC4C7", + w: "#FFFFFF", + G: "#B7F684" + }, + category: "pride", +} +elements.demigirl_flag = { + colorPattern: prideTextures.demi, + colorKey: { + g: "#7F7F7F", + l: "#C4C4C4", + p: "#FDADC8", + w: "#FFFFFF" + }, + category: "pride", +} +elements.demiboy_flag = { + colorPattern: prideTextures.demi, + colorKey: { + g: "#7F7F7F", + l: "#C4C4C4", + p: "#9DD7EA", + w: "#FFFFFF" + }, + category: "pride", +} +elements.demigender_flag = { + colorPattern: prideTextures.demi, + colorKey: { + g: "#7F7F7F", + l: "#C4C4C4", + p: "#FBFF75", + w: "#FFFFFF" + }, + category: "pride", +} diff --git a/mods/pullers.js b/mods/pullers.js index 1f88c621..085871ed 100644 --- a/mods/pullers.js +++ b/mods/pullers.js @@ -2,6 +2,10 @@ // a sandboxels mod that adds pullers /* ==CHANGELOG== + Version 2.0.1 +@voidapex11 +~fixed name of mods category + Version 2.0.0 @voidapex11 ~set max size of the mod description to 1 @@ -47,7 +51,7 @@ pullerColour = '#e0adb6' elements.pullersDesc = { color: pullerColour, name: 'pullers.js', - category: "mods", + category: "Mods", behavior: behaviors.SELFDELETE, tool: function(pixel) {}, onSelect: function(pixel) { diff --git a/mods/sturdierpowders.js b/mods/sturdierpowders.js new file mode 100644 index 00000000..981f73bc --- /dev/null +++ b/mods/sturdierpowders.js @@ -0,0 +1,595 @@ +tryMove = function(pixel,nx,ny,leaveBehind,force) { + if (pixel.drag && !force) { return true; } + var info = elements[pixel.element]; + var oob = outOfBounds(nx,ny); + if (isEmpty(nx,ny,false,oob)) { // If coords is empty, move to coords + if(Math.random() > (elements[newPixel.element].friction ? elements[newPixel.element].friction : 0.02)) + { + pixel.grounded = true; + } + else + { + pixel.grounded = false; + } + movePixel(pixel,nx,ny,leaveBehind); + return true; + } + else if (!oob) { + // Reactions + newPixel = pixelMap[nx][ny]; + if(!pixel.grounded && Math.random() > (elements[newPixel.element].friction ? elements[newPixel.element].friction : 0.02)) { + newPixel.grounded = false; + } + if(Math.random() > (elements[newPixel.element].friction ? elements[newPixel.element].friction : 0.02)) + { + pixel.grounded = true; + } + var rr1 = false; + if (info.reactions !== undefined && info.reactions[newPixel.element] !== undefined) { + rr1 = reactPixels(pixel,newPixel) + if (rr1) { + return true; + } + } + if (!rr1 && elements[newPixel.element].reactions !== undefined && elements[newPixel.element].reactions[pixel.element] !== undefined && !elements[newPixel.element].reactions[pixel.element].oneway) { + if (reactPixels(newPixel,pixel)) { + return true; + } + } + // Density + if (elements[pixel.element].id !== elements[newPixel.element].id) { + if (info.density !== undefined && elements[newPixel.element].density !== undefined) { + // if the pixel's state + ">" + newPixel's state is in validDensitySwaps, and the pixel's density is larger than the newPixel's density, swap the pixels + if (validDensitySwaps[info.state][elements[newPixel.element].state] && info.density >= elements[newPixel.element].density) { + // chance depending on the difference in density + if (Math.random() < (info.density - elements[newPixel.element].density)/(info.density + elements[newPixel.element].density)) { + swapPixels(pixel,newPixel); + return true; + } + } + } + } + // else { // same-element density swapping + // if (info.density !== undefined) { + // if (validDensitySwaps[info.state][info.state]) { + // if (Math.random() < 0.01) { + // swapPixels(pixel,newPixel); + // return true; + // } + // } + // } + // } + } + return false; +} + + +function pixelTick(pixel,custom=null) { + if (pixel.start === pixelTicks) {return} + if (elements[pixel.element] === undefined) { + pixel.invalidElement = pixel.element; + changePixel(pixel,"unknown"); + return; + } + var info = elements[pixel.element]; + if (custom) { var behavior = custom; } + else if (pixel.charge && info.behaviorOn) { var behavior = info.behaviorOn; } + else { var behavior = info.behavior; } + if (pixel.flipX) { behavior = flipBehavior(behavior,"x"); } + if (pixel.flipY) { behavior = flipBehavior(behavior,"y"); } + if (pixel.r) { behavior = rotateBehavior(behavior,pixel.r); } + var x = pixel.x; + var y = pixel.y; + var move1Spots = []; + var move2Spots = []; + var supportSpots = []; + var swapSpots = []; + var leaveBehind = null; + var leaveBehind1 = null; + var leaveBehind2 = null; + var move = true; + // Parse behavior + for (var by = 0; by < behavior.length; by++) { +var behaviorby = behavior[by]; +for (var bx = 0; bx < behaviorby.length; bx++) { + var b0 = behaviorby[bx]; + if (b0 === "XX") {continue} + //if (b.includes(" OR ")) { + // b = b.split(" OR ")[Math.floor(Math.random()*b.split(" OR ").length)]; + //} + // Loop through b0.split(" AND ") + if (b0.indexOf(" AND ") !== -1) { var andsplit = b0.split(" AND "); } + else { var andsplit = [b0]; } + for (var i = 0; i < andsplit.length; i++) { + var b = andsplit[i]; + if (b.indexOf(":") !== -1) { + var arg = b.split(":")[1].split(/[\:\%]/)[0]; + if (b.indexOf("%") === -1) { + b = b.split(/[\:\%]/)[0]; + } + } + else { var arg = null;} + // If b has "%" followed by a number in it, it's a chance to move + if (b.indexOf("%") !== -1) { + // Split the string at the "%" and use the second half as the chance (float) + var chance = parseFloat(b.split("%")[1]); + //console.log(b+": "+(Math.random()*100 < chance)); + b = b.split(/[\:\%]/)[0]; + } + else { var chance = 100; } + if (chance===100 || Math.random()*100 < chance) { + var newCoords = behaviorCoords(x,y,bx,by); + switch (b) { + default: break; + case "M1": + if (info.viscosity !== undefined) { + if (!((Math.random()*100) < 100 / Math.pow(info.viscosity, 0.25))) { + newCoords.x = x; + } + } + move1Spots.push(newCoords); + break; + case "M2": + if (pixel.grounded || info.viscosity !== undefined) { + if (!((Math.random()*100) < 100 / Math.pow(info.viscosity, 0.25))) { + newCoords.x = x; + } + } + move2Spots.push(newCoords); + break; + case "SP": + supportSpots.push({x:newCoords.x,y:newCoords.y,arg:arg}); + break; + case "SA": + if (!isEmpty(newCoords.x,newCoords.y,true)) { + move = false; + } + break; + case "DL": + if (!isEmpty(newCoords.x,newCoords.y,true)) { + // if the pixel at newCoords is the same element as the pixel, ignore + newPixel = pixelMap[newCoords.x][newCoords.y]; + // if info.ignore exists and newPixel.element is in it + if (info.ignore && info.ignore.indexOf(newPixel.element) !== -1) { + continue; + } + if ((!(newPixel.element == pixel.element)) || (newCoords.x == x && newCoords.y == y)) { + if (arg != null) { var args = arg.split(","); } + if (arg == null || args.indexOf(newPixel.element) !== -1) { + if (!elements[newPixel.element].hardness || Math.random() > elements[newPixel.element].hardness) { + deletePixel(newCoords.x,newCoords.y); + if (newCoords.x == x && newCoords.y == y) { + var deleted = true; + } + swapSpots = []; + } + } + } + } + break; + case "DB": + if (!isEmpty(newCoords.x,newCoords.y,true)) { + // if the pixel at newCoords is the same element as the pixel, ignore + newPixel = pixelMap[newCoords.x][newCoords.y]; + // if info.ignore exists and newPixel.element is in it + if (info.ignore && info.ignore.indexOf(newPixel.element) !== -1) { + continue; + } + if (!(newPixel.element == pixel.element)) { + if (arg != null) { var args = arg.split(","); } + if (arg == null || args.indexOf(newPixel.element) !== -1) { + if (!elements[newPixel.element].hardness || Math.random() > elements[newPixel.element].hardness) { + deletePixel(newCoords.x,newCoords.y); + if (pixelMap[pixel.x][pixel.y] != undefined) { + deletePixel(pixel.x,pixel.y); + } + var deleted = true; + swapSpots = []; + } + } + } + } + break; + case "CH": + if (!isEmpty(newCoords.x,newCoords.y,true)) { + var newPixel = pixelMap[newCoords.x][newCoords.y]; + if (info.ignore && info.ignore.indexOf(newPixel.element) !== -1) { + continue; + } + if (!elements[newPixel.element].hardness || Math.random() > elements[newPixel.element].hardness || (newCoords.x == x && newCoords.y == y)) { + if (arg.indexOf(">") !== -1) { + var argfrom = arg.split(">")[0]; + if (argfrom.indexOf(",") !== -1) { + if (argfrom.split(",").indexOf(newPixel.element) === -1) { + continue; + } + } + else if (argfrom !== newPixel.element) { + continue; + } + var argto = arg.split(">")[1]; + } + else { + var argfrom = null; + var argto = arg; + } + if (argto.indexOf(",") !== -1) { + var argto = argto.split(",")[Math.floor(Math.random()*argto.split(",").length)]; + } + if (elements[argto]) { + if (elements[newPixel.element].id !== elements[argto].id) { + changePixel(newPixel,argto); + } + } + } + } + break; + case "SW": + if (!isEmpty(newCoords.x,newCoords.y,true)) { + var newPixel = pixelMap[newCoords.x][newCoords.y]; + if (arg != null) { var args = arg.split(","); } + if (arg == null || args.indexOf(newPixel.element) !== -1) { + if (!elements[newPixel.element].hardness || Math.random() > elements[newPixel.element].hardness) { + swapSpots.push({x:newCoords.x,y:newCoords.y}); + } + } + } + break; + case "CR": + if (isEmpty(newCoords.x,newCoords.y)) { + if (arg == null) { + arg = pixel.element; + } + else if (arg.indexOf(",") !== -1) { + arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)]; + } + if (elements[arg]) { + createPixel(arg,newCoords.x,newCoords.y); + if (info.fireColor && arg==="fire") { + pixelMap[newCoords.x][newCoords.y].color = pixelColorPick(pixelMap[newCoords.x][newCoords.y],info.fireColor); + } + pixelMap[newCoords.x][newCoords.y].temp = pixel.temp + pixelTempCheck(pixelMap[newCoords.x][newCoords.y]); + } + } + break; + case "CL": + if (isEmpty(newCoords.x,newCoords.y)) { + if (arg == null || pixel.temp >= parseFloat(arg)) { + clonePixel(pixel,newCoords.x,newCoords.y); + } + } + break; + case "CF": + if (pixel.clone) { + if (isEmpty(newCoords.x,newCoords.y)) { + createPixel(pixel.clone,newCoords.x,newCoords.y); + pixelMap[newCoords.x][newCoords.y].temp = pixel.temp; + pixelTempCheck(pixelMap[newCoords.x][newCoords.y]); + } + } + else { + if (!isEmpty(newCoords.x,newCoords.y,true)) { + newPixel = pixelMap[newCoords.x][newCoords.y]; + if (info.ignore && info.ignore.indexOf(newPixel.element) !== -1) { + continue; + } + if (newPixel.element != pixel.element && newPixel.element != "wire") { + pixel.clone = newPixel.element; + pixel.temp = newPixel.temp; + } + else if (newPixel.clone) { + pixel.clone = newPixel.clone; + pixel.temp = newPixel.temp; + } + } + } + break; + case "SH": + if (!isEmpty(newCoords.x,newCoords.y,true)) { + var newPixel = pixelMap[newCoords.x][newCoords.y]; + var con = elements[newPixel.element].conduct; + if (con != undefined) { + if (Math.random() < con) { // If random number is less than conductivity + if (!newPixel.charge && !newPixel.chargeCD && (arg == null || newPixel.element == arg)) { + newPixel.charge = (parseFloat(arg) || 1); + if (elements[newPixel.element].colorOn) { + newPixel.color = pixelColorPick(newPixel); + } + } + } + } + } + break; + case "ST": //Stick + if (!isEmpty(newCoords.x,newCoords.y,true)) { + var newPixel = pixelMap[newCoords.x][newCoords.y]; + if (info.ignore && info.ignore.indexOf(newPixel.element) !== -1) { + continue; + } + if (newPixel.element != pixel.element && (arg == null || newPixel.element == arg)) { + var sticking = true + } + } + break; + case "LB": + case "L1": + case "L2": + if (arg != null && arg.indexOf(",") !== -1) { + arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)]; + } + if (elements[arg]) { + if (b=="LB") {leaveBehind = arg;} + else if (b=="L1") {leaveBehind1 = arg;} + else if (b=="L2") {leaveBehind2 = arg;} + } + break; + case "CC": + if (!isEmpty(newCoords.x,newCoords.y,true)) { + var newPixel = pixelMap[newCoords.x][newCoords.y]; + if (arg == null) {arg = newPixel.colorObject} + else { + if (arg.indexOf(",") !== -1) { + arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)]; + } + if (!arg.startsWith("#")) { + arg = "#" + arg; + } + } + newPixel.color = pixelColorPick(newPixel,arg); + } + break; + case "HT": + if (!isEmpty(newCoords.x,newCoords.y,true)) { + var newPixel = pixelMap[newCoords.x][newCoords.y]; + // if the element isn't the same or the coords ARE the same + if (!(newPixel.element == pixel.element) || (newCoords.x == pixel.x && newCoords.y == pixel.y)) { + if (arg != null) {arg = parseFloat(arg)} + else {arg = 1} + if (isNaN(arg)) {arg = 1} + newPixel.temp += arg; + pixelTempCheck(newPixel); + } + } + break; + case "CO": + if (!isEmpty(newCoords.x,newCoords.y,true)) { + var newPixel = pixelMap[newCoords.x][newCoords.y]; + if (!(newPixel.element == pixel.element) || (newCoords.x == pixel.x && newCoords.y == pixel.y)) { + if (arg != null) {arg = parseFloat(arg)} + else {arg = 1} + if (isNaN(arg)) {arg = 1} + newPixel.temp -= arg; + pixelTempCheck(newPixel); + } + } + break; + case "FX": + if (!isEmpty(newCoords.x,newCoords.y,true)) { + var newPixel = pixelMap[newCoords.x][newCoords.y]; + if (elements[newPixel.element].flippableX) { + if (arg === "0") { newPixel.flipX = false; } + else if (arg === "1") { newPixel.flipX = true; } + newPixel.flipX = !newPixel.flipX; + } + } + break; + case "FY": + if (!isEmpty(newCoords.x,newCoords.y,true)) { + var newPixel = pixelMap[newCoords.x][newCoords.y]; + if (elements[newPixel.element].flippableY) { + if (arg === "0") { newPixel.flipY = false; } + else if (arg === "1") { newPixel.flipY = true; } + else { newPixel.flipY = !newPixel.flipY; } + } + } + break; + case "RT": + if (!isEmpty(newCoords.x,newCoords.y,true)) { + var newPixel = pixelMap[newCoords.x][newCoords.y]; + // If arg isn't null, set arg to a random choice from arg.split(",") + if (arg != null && arg.indexOf(",") !== -1) { + arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)]; + } + if (elements[newPixel.element].rotatable) { + newPixel.r = ((newPixel.r||0) + (parseInt(arg)||1)) % 4; + } + } + break; + case "BO": + if (!isEmpty(newCoords.x,newCoords.y) && (outOfBounds(newCoords.x,newCoords.y) || elements[pixelMap[newCoords.x][newCoords.y].element].id === elements[pixel.element].id || elements[pixelMap[newCoords.x][newCoords.y].element].state === "solid")) { + if (info.flippableX) { + pixel.flipX = !pixel.flipX; + } + if (info.flippableY) { + pixel.flipY = !pixel.flipY; + } + if (info.rotatable) { + // If arg isn't null, set arg to a random choice from arg.split(",") + if (arg != null && arg.indexOf(",") !== -1) { + arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)]; + } + if (pixel.r !== undefined) { + pixel.r = (pixel.r + (parseInt(arg)||2)) % 4; + } + else { pixel.r = (parseInt(arg)||2); } + } + } + break; + case "C2": + if (arg.indexOf(",") !== -1) { + arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)]; + } + var C2 = arg; + break; + case "EX": + if (!isEmpty(newCoords.x,newCoords.y)) { + if (outOfBounds(newCoords.x,newCoords.y) || (newCoords.x == x && newCoords.y == y) || (pixel.element !== pixelMap[newCoords.x][newCoords.y].element && elements[pixelMap[newCoords.x][newCoords.y].element].state !== "gas")) { + // if arg contains ">", var fire = everything after it, arg = everything before it + if (arg.indexOf(">") !== -1) { + var fire = arg.split(">")[1]; + arg = arg.split(">")[0]; + } + else { var fire = "fire" } + // arg = a number + if (arg != null) { + arg = parseInt(arg); + if (isNaN(arg)) {arg = 3} + } + else {arg = 3} + explodeAt(x,y,arg,fire); + if (!pixel.del && info.hardness !== 1) { + deletePixel(x,y); + var deleted = true; + } + swapSpots = []; + } + } + break; + } + + + } + } + } + } + if (typeof deleted !== "undefined") {return;} + if (supportSpots.length > 0) { + var supportCount = 0; + var allEmpty = true; + for (var i = 0; i < supportSpots.length; i++) { + var bx = supportSpots[i].x; + var by = supportSpots[i].y; + var arg = supportSpots[i].arg; + if (!isEmpty(bx,by,true)) { + if (info.ignore && info.ignore.indexOf(pixelMap[bx][by].element) !== -1) {continue;} + if ((arg == null && !validDensitySwaps[info.state][elements[pixelMap[bx][by].element].state]) || pixelMap[bx][by].element == arg) { + supportCount++; + } + } + } + if (supportCount == supportSpots.length) { + move = false; + } + } + + var moved = false; + + if (swapSpots.length > 0) { + var coords = swapSpots[Math.floor(Math.random()*swapSpots.length)]; + if (pixelMap[coords.x][coords.y] != undefined) { + swapPixels(pixel,pixelMap[coords.x][coords.y]); + move = false; + moved = true; + } + } + + if (typeof sticking !== "undefined") { + move = false; + } + + // Move First Priority + if (move) { + if (move1Spots.length > 0) { + // While move1Spots is not empty + while (move1Spots.length > 0) { + // coords = random item of move1Spots + var coords = move1Spots[Math.floor(Math.random()*move1Spots.length)]; + var nx = coords.x; + var ny = coords.y; + moved = tryMove(pixel,nx,ny,leaveBehind1 || leaveBehind); + if (moved) { + break; + } + else { + // remove coords from move1Spots + move1Spots.splice(move1Spots.indexOf(coords),1); + } + + + } + } + // Move Second Priority + if (!moved && move2Spots.length > 0) { + // While move2Spots is not empty + while (move2Spots.length > 0) { + // coords = random item of move2Spots + var coords = move2Spots[Math.floor(Math.random()*move2Spots.length)]; + var nx = coords.x; + var ny = coords.y; + moved = tryMove(pixel,nx,ny,leaveBehind2 || leaveBehind); + if (moved) { + if (typeof C2 !== "undefined" && elements[C2]) { + changePixel(pixel,C2); + } + break; + } + else { + // remove coords from move2Spots + move2Spots.splice(move2Spots.indexOf(coords),1); + } + } + } + } + doAirDensity(pixel); + + + // Change tempearture if needed (unused) + /*if (info.tempChange != undefined) { + pixel.temp += info.tempChange; + pixelTempCheck(pixel); + }*/ + + // Burning + doBurning(pixel); + + // Heat Transfer + if (info.insulate !== true) { + doHeat(pixel); + } + + // Electricity Transfer + doElectricity(pixel); + + // Staining + if (info.stain) { + doStaining(pixel); + } + + +} + + +behaviors.POWDER2 = function(pixel) { + if (pixel.start === pixelTicks) {return} + if (pixel.charge && elements[pixel.element].behaviorOn) { + pixelTick(pixel) + } + console.log(pixel.grounded); + if (!pixel.grounded) { + 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); + } + } + } + } + else + { + tryMove(pixel, pixel.x, pixel.y+1); + } + doDefaults(pixel); +} + +runAfterLoad(function() { + for(let i in elements) { + if(elements[i].behavior === behaviors.POWDER) { + elements[i].behavior = behaviors.POWDER2; + } + } +}); \ No newline at end of file diff --git a/mods/world_gen_test.js b/mods/world_gen_test.js index dc214aba..d097d3e3 100644 --- a/mods/world_gen_test.js +++ b/mods/world_gen_test.js @@ -50,7 +50,7 @@ var Simple1DNoise = function() { }; }; -function newHeightMap(pixelType, pixelType2, offset, amplitude1, amplitude2, scale1, scale2) { +function newHeightMap(pixelType, pixelType2, offset, amplitudes, scales) { return { color: "#000000", behavior: behaviors.WALL, @@ -61,22 +61,23 @@ function newHeightMap(pixelType, pixelType2, offset, amplitude1, amplitude2, sca pixelType: pixelType, pixelType2: pixelType2, offset: offset, - amplitude1: amplitude1, - amplitude2: amplitude2, - scale1: scale1, - scale2: scale2, - generator: new Simple1DNoise(), - generator2: new Simple1DNoise(), + amplitudes: amplitudes, + scales: scales, + generator: Array.from({length: amplitudes.length}, () => new Simple1DNoise()), excludeRandom: true, + heightMap: true, tick: function(pixel) { - generator = this.generator; - generator2 = this.generator2; - generator.setAmplitude(this.amplitude1); - generator.setScale(this.scale1); - generator2.setAmplitude(this.amplitude2); - generator2.setScale(this.scale2); - let value = generator.getVal(pixel.x/width) + generator2.getVal(pixel.x/width); - if(value + this.offset < pixel.y/height) { + let generator = this.generator; + for(let i = 0; i < generator.length; i++) + { + generator[i].setAmplitude(this.amplitudes[i]); + generator[i].setScale(this.scales[i]); + } + let value = generator.reduce((accumulator, val) => { + return accumulator + val.getVal(pixel.x/width); + console.log(accumulator); + },0); + if(value + this.offset + generateTerrainHeights() < pixel.y/height) { let element = this.pixelType; if(Array.isArray(element)) { @@ -87,6 +88,10 @@ function newHeightMap(pixelType, pixelType2, offset, amplitude1, amplitude2, sca deletePixel(pixel.x,pixel.y); } else { changePixel(pixel,element); + if(elements[element].heightMap) + { + elements[element].tick(pixel); + } } } else { let element = this.pixelType2; @@ -99,15 +104,24 @@ function newHeightMap(pixelType, pixelType2, offset, amplitude1, amplitude2, sca deletePixel(pixel.x,pixel.y); } else { changePixel(pixel,element); + if(elements[element].heightMap) + { + elements[element].tick(pixel); + } } } } }; } -elements.dunes_height_map = newHeightMap("sand", null, 0, 0.75, 0.05, 2.5, 20); -elements.oasis_height_map = newHeightMap("sand", "water_height", 0.25, 0.75, 0.05, 2.5, 20); -elements.water_height = newHeightMap("water", null, 0.5, 0, 0, 1, 1); +elements.dunes_height_map = newHeightMap("sand", null, 0.25, [0.75, 0.05, 0.02], [2.5, 20, 200]); + +elements.oasis = newHeightMap("water_height", "oasis_height_map", 0.5, [0.02], [200]); +elements.oasis_height_map = newHeightMap("sand", null, 0.25, [0.75, 0.05, 0.02], [2.5, 20, 200]); +elements.oasis_height_map2 = newHeightMap("sand", "packed_sand", 0.28, [0.75, 0.05, 0.02], [2.5, 20, 200]); +elements.oasis_height_map2.generator = elements.oasis_height_map.generator; +elements.water_height = newHeightMap("oasis_height_map2", "water", 0.25, [0.75, 0.05, 0.02], [2.5, 20, 200]); +elements.water_height.generator = elements.oasis_height_map.generator; worldgentypes.dunes = { fill: [ [0, "dunes_height_map"] @@ -115,21 +129,21 @@ worldgentypes.dunes = { }; worldgentypes.oasis = { fill: [ - [0, "oasis_height_map"] + [0, "oasis"] ] }; if (enabledMods.includes("mods/chem.js")) { - elements.ptfe_height_map = newHeightMap("polytetrafluoroethylene", "foof_height", 0.25, 0.75, 0.05, 2.5, 20); - elements.foof_height = newHeightMap("FOOF", Array(100).fill(null).concat(["oxygen","fluorine"]), 0.5, 0, 0, 1, 1); + elements.ptfe_height_map = newHeightMap("polytetrafluoroethylene", "foof_height", 0.5, [0.5, 0.05, 0.02], [2.5, 20, 200]); + elements.foof_height = newHeightMap("foof", Array(100).fill(null).concat(["oxygen","fluorine"]), 0.5, [], []); worldgentypes.FOOF_sea = { fill: [ [0, "ptfe_height_map"] ], temperature: -120 }; - elements.francium_height_map = newHeightMap("tungsten", "francium_height", 0.125, 1, 0.2, 2.5, 20); - elements.francium_height = newHeightMap("molten_francium", Array(100).fill(null).concat(["radon","radiation","radiation","radiation"]), 0.5, 0, 0, 1, 1); + elements.francium_height_map = newHeightMap("tungsten", "francium_height", 0.375, [1, 0.2, 0.02], [2.5, 20, 200]); + elements.francium_height = newHeightMap("molten_francium", Array(100).fill(null).concat(["radon","radiation","radiation","radiation"]), 0.5, [], []); worldgentypes.francium_lake = { fill: [ [0, "francium_height_map"]