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/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, +},