diff --git a/mods/customexplosion.js b/mods/customexplosion.js index 50a74d6f..d473d2f2 100644 --- a/mods/customexplosion.js +++ b/mods/customexplosion.js @@ -1,103 +1,17 @@ //This mod was made by Alex the transfem, https://discord.com/users/778753696804765696 on discord and https://www.tiktok.com/@alextheagenenby?_t=8hoCVI3NRhu&_r=1 on tiktok. -//How to use this: -//in the reactions of an element, this is what it could look like: -//reactions: { "water": elem1: "CustomExplosion", items: "fire,fire,hydrogen,sodiumhydroxide" } -//OR -//reactions: { "water": elem1: "CustomExplosion", items: "EX:10>fire,fire,hydrogen.sodiumhydroxide" } (this one has a customizeable blast radius) -function reactPixels(pixel1,pixel2) { - var r = elements[pixel1.element].reactions[pixel2.element]; - if (r.setting && settings[r.setting]===0) { - return false; - } - // r has the attribute "y" which is a range between two y values - // r.y example: [10,30] - // return false if y is defined and pixel1's y is not in the range - if (r.tempMin !== undefined && pixel1.temp < r.tempMin) { - return false; - } - if (r.tempMax !== undefined && pixel1.temp > r.tempMax) { - return false; - } - if (r.burning1 !== undefined && Boolean(pixel1.burning) !== r.burning1) { - return false; - } - if (r.burning2 !== undefined && Boolean(pixel2.burning) !== r.burning2) { - return false; - } - if (r.charged && !pixel.charge) { - return false; - } - if (r.chance !== undefined && Math.random() > r.chance) { - return false; - } - if (r.y !== undefined && (pixel1.y < r.y[0] || pixel1.y > r.y[1])) { - return false; - } - if (r.elem1 !== undefined) { - // if r.elem1 is an array, set elem1 to a random element from the array, otherwise set it to r.elem1 - if (Array.isArray(r.elem1)) { - var elem1 = r.elem1[Math.floor(Math.random() * r.elem1.length)]; - if(elem1 == "customExplosion"){ - if(r.items !== undefined){ - elements.customExplosion.rItems = r.items - } else{ - return false; - } - } - } else { - var elem1 = r.elem1; - if(elem1 == "customExplosion"){ - if(r.items !== undefined){ - elements.customExplosion.rItems = r.items - } else{ - return false; - } - } - } - - if (elem1 == null) { - deletePixel(pixel1.x,pixel1.y); - } - else { - changePixel(pixel1,elem1); - } - } - if (r.charge1) { pixel1.charge = r.charge1; } - if (r.temp1) { pixel1.temp += r.temp1; pixelTempCheck(pixel1); } - if (r.color1) { // if it's a list, use a random color from the list, else use the color1 attribute - pixel1.color = pixelColorPick(pixel1, Array.isArray(r.color1) ? r.color1[Math.floor(Math.random() * r.color1.length)] : r.color1); - } - if (r.attr1) { // add each attribute to pixel1 - for (var key in r.attr1) { - pixel1[key] = r.attr1[key]; - } - } - if (r.elem2 !== undefined) { - // if r.elem2 is an array, set elem2 to a random element from the array, otherwise set it to r.elem2 - if (Array.isArray(r.elem2)) { - var elem2 = r.elem2[Math.floor(Math.random() * r.elem2.length)]; - } else { var elem2 = r.elem2; } - - if (elem2 == null) { - deletePixel(pixel2.x,pixel2.y); - } - else { - changePixel(pixel2,elem2); - } - } - if (r.charge2) { pixel2.charge = r.charge2; } - if (r.temp2) { pixel2.temp += r.temp2; pixelTempCheck(pixel2); } - if (r.color2) { // if it's a list, use a random color from the list, else use the color2 attribute - pixel2.color = pixelColorPick(pixel2, Array.isArray(r.color2) ? r.color2[Math.floor(Math.random() * r.color2.length)] : r.color2); - } - if (r.attr2) { // add each attribute to pixel2 - for (var key in r.attr2) { - pixel2[key] = r.attr2[key]; - } - } - if (r.func) { r.func(pixel1,pixel2); } - return r.elem1!==undefined || r.elem2!==undefined; -} +//how to use: +//the "customExplosion" function is to be used in reactions, like so: +//"water": { +//func: function (pixel1, pixel2) {customExplosion(pixel1, pixel2, 5, ["fire", "fire", "pop", "hydrogen", "sodiumhydroxide", "potassiumhydroxide","sodiumhydroxide", "potassiumhydroxide","sodiumhydroxide", "potassiumhydroxide"])} +//} +//and the element you just have to select and enter "EX:(radius)>(elem1),(elem2),(elem3)" and so on. do not include spaces. +function customExplosion(pixel1, pixel2, radius, list) { + let x = pixel1.x; + let y = pixel1.y; + deletePixel(x, y); + deletePixel(pixel2.x, pixel2.y); + explodeAt(x, y, radius, list); +}; elements.customExplosion = { items: "", rItems: "", @@ -109,20 +23,4 @@ elements.customExplosion = { console.log(items); elements.customExplosion.behavior = [["XX", "XX", "XX"], ["XX", `EX:4>${items}`, "XX"], ["XX", "XX", "XX"]] }, - tick: function(pixel){ - let items = elements.customExplosion.rItems; - if (items !== ""){ - items = elements.customExplosion.rItems; - } else { - items = elements.customExplosion.items; - } - - console.log(items) - if(!items.includes("EX:")){ - elements.customExplosion.behavior = [["XX", "XX", "XX"], ["XX", `EX:4>${items}`, "XX"], ["XX", "XX", "XX"]] - } else{ - elements.customExplosion.behavior = [["XX", "XX", "XX"], ["XX", items, "XX"], ["XX", "XX", "XX"]] - } - - } } diff --git a/mods/morechemistry.js b/mods/morechemistry.js index edd3088d..7d221900 100644 --- a/mods/morechemistry.js +++ b/mods/morechemistry.js @@ -1,4 +1,11 @@ //This mod was made by Alex the transfem, https://discord.com/users/778753696804765696 on discord and https://www.tiktok.com/@alextheagenenby?_t=8hoCVI3NRhu&_r=1 on tiktok. +function customExplosion(pixel1, pixel2, radius, list) { + let x = pixel1.x; + let y = pixel1.y; + deletePixel(x, y); + deletePixel(pixel2.x, pixel2.y); + explodeAt(x, y, radius, list); +}; function reactPixels(pixel1,pixel2) { var r = elements[pixel1.element].reactions[pixel2.element]; if (r.setting && settings[r.setting]===0) { @@ -441,6 +448,7 @@ elements.aqua_regia = { "acid_ice", "acid", "nitric_acid", + "NaK", ], "reactions": { "ash": { @@ -517,8 +525,8 @@ elements.aqua_regia = { elements.potassium = { behavior: behaviors.POWDER, color: ["#545454", "#737373", "#7d7d7d", "#8f8f8f"], - "category": "solids", - "state": "solid", + "category": "powders", + "state": "powder", "alias": "K", reactions: { "water": { "elem1": "potassiumhydroxide", "elem2": ["fire", "fire", "pop", "water"], }, @@ -532,6 +540,7 @@ elements.potassium = { "acid_water": { "elem1": null, "elem2": ["water", "pop", "pop"], }, "nitric_acid": { "elem1": null, "elem2": ["fire", "pop", "fire", "pop", "hydrogen"], }, "chloroauric_acid": {"elem1": "gold", "elem2": ["fire", "fire", "pop", "pop"], }, + "liquid_chloroauric_acid": {"elem1": "gold", "elem2": ["fire", "fire", "pop", "pop"], }, }, } elements.potassiumhydroxide = { @@ -665,10 +674,7 @@ elements.acid.ignore.push("gold_coin"); if(enabledMods.includes("mods/nousersthings.js")) { elements.acid.ignore.push("filter"); } -if(!enabledMods.includes("mods/customexplosion.js")){ - alert("This mod needs customexplosion.js to work. Without enabling it you may run into some issues, Please enable it in the mods menu."); -} - +elements.acid.ignore.push("NaK"); elements.NaK = { behavior: behaviors.LIQUID, category: "liquids", @@ -677,7 +683,25 @@ elements.NaK = { color: "#848484", reactions: { "water": { - elem1: "customExplosion", items: "EX:6>fire,fire,hydrogen,pop,sodiumhydroxide,potassiumhydroxide", + func: function (pixel1, pixel2) {customExplosion(pixel1, pixel2, 5, ["fire", "fire", "pop", "hydrogen", "sodiumhydroxide", "potassiumhydroxide","sodiumhydroxide", "potassiumhydroxide","sodiumhydroxide", "potassiumhydroxide"])} + }, + acid: { + func: function (pixel1, pixel2) {customExplosion(pixel1, pixel2, 6, ["fire", "pop", "hydrogen", "water", "pop", "hydrogen", "hydrogen"])} + }, + acid_water: { + func: function (pixel1, pixel2) {customExplosion(pixel1, pixel2, 3, ["pop", "hydrogen", "hydrogen", "water"])} + }, + chloroauric_acid: { elem1: "gold", + func: function (pixel1, pixel2) {customExplosion(pixel1, pixel2, 7, ["fire", "fire", "pop", "hydrogen", "gold_coin", "hydrogen", "pop"])} + }, + liquid_chloroauric_acid: { elem1: "gold", + func: function (pixel1, pixel2) {customExplosion(pixel1, pixel2, 7, ["fire", "fire", "pop", "hydrogen", "gold_coin", "hydrogen", "hydrogen", "pop"])} + }, + nitric_acid:{ + func: function (pixel1, pixel2) {customExplosion(pixel1, pixel2, 6, ["fire", "fire", "pop", "hydrogen", "hydrogen", "pop"])} + }, + aqua_regia: { + func: function (pixel1, pixel2) {customExplosion(pixel1, pixel2, 9, ["fire", "fire", "pop", "hydrogen", "fire", "fire", "hydrogen", "pop", "flash"])} } - }, -}; + }, + }; diff --git a/mods/nousersthings.js b/mods/nousersthings.js index fbe87a9c..48593797 100644 --- a/mods/nousersthings.js +++ b/mods/nousersthings.js @@ -1268,8 +1268,6 @@ elements.soup = { color: "#3d2812", behavior: behaviors.LIQUID, category: "food", - tempHigh: 100, - stateHigh: "steam", onMix: function(soup,ingredient) { if (elements[ingredient.element].isFood && elements[ingredient.element].id !== elements.soup.id && elements[ingredient.element].id !== elements.broth.id) { var rgb1 = soup.color.match(/\d+/g); @@ -1280,7 +1278,13 @@ elements.soup = { Math.round((parseInt(rgb1[1])+parseInt(rgb2[1]))/2), Math.round((parseInt(rgb1[2])+parseInt(rgb2[2]))/2) ]; - changePixel(ingredient, "soup") + if (!soup.elemlist){ + soup.elemlist = []; + } + soup.decidedHigh = soup.elemlist[Math.floor(Math.random()*soup.elemlist.length)]; + soup.elemlist.push(ingredient.element) + soup.stateHigh = soup.elemlist; + changePixel(ingredient, "soup"); // convert rgb to hex var hex = RGBToHex(rgb); soup.color = pixelColorPick(soup, hex); @@ -1291,26 +1295,22 @@ elements.soup = { } } }, + tick: function(pixel) { + if (!pixel.decidedHigh){ + pixel.decidedHigh = "steam"; + } + if (pixel.temp > 100){ + if (Math.random() < 0.5) { + changePixel(pixel, "steam"); + } else { + changePixel(pixel, pixel.decidedHigh) + } + } + }, density: 1100, stain: 0.02, state: "liquid", }, elements.broth.onMix = function(pixel){ changePixel(pixel, "soup") -}//, -//elements.portal_in = { -// color: "#FFA000", -// behavior: behaviors.WALL, -// tick: function(pixel) { -// }, -// category: "machines", -// state: "solid", -//}, -//elements.portal_out = { -// color: "#0000FF", -// behavior: behaviors.WALL, -// tick: function(pixel) { -// }, -// category: "machines", -// state: "solid", -//} +}