diff --git a/mods/Gemstones.js b/mods/Gemstones.js index 7216e0de..f5fb0ee1 100644 --- a/mods/Gemstones.js +++ b/mods/Gemstones.js @@ -6,7 +6,7 @@ elements.ruby = { density: 265, burn: 1000, burnTime: 300, - burnInto: ["carbon_dioxide",null,null], + burnInto: ["carbon_dioxide"], }; elements.sappire = { color: ["#2986cc","#16537e","#0086ff","#9da0f7","#54aeff"], @@ -16,7 +16,7 @@ elements.sappire = { density: 265, burn: 1000, burnTime: 300, - burnInto: ["carbon_dioxide",null,null], + burnInto: ["carbon_dioxide"], }; elements.emerald = { color: ["#6aa84f","#8fce00","#7cc95a","#8fce00","#c4dabd"], @@ -26,5 +26,55 @@ elements.emerald = { density: 265, burn: 1000, burnTime: 300, - burnInto: ["carbon_dioxide",null,null], + burnInto: ["carbon_dioxide"], +}, + elements.jade = { + color: ["#93c47d","#64af44","#6aa84f","#b6d7a8","#c3eab3"], + behavior: behaviors.POWDER, + category: "powders", + state: "solid", + density: 265, + burn: 1000, + burnTime: 300, + burnInto: ["carbon_dioxide"], +}, + elements.amythist = { + color: ["#674ea7","#860b94","#7e0bdf","#b982e7","#d8aefc"], + behavior: behaviors.POWDER, + category: "powders", + state: "solid", + density: 265, + burn: 1000, + burnTime: 300, + burnInto: ["carbon_dioxide"], +}, + elements.topaz = { + color: ["#e69138","#dca975","#f9cb9c","#dc852d","#ffe994"], + behavior: behaviors.POWDER, + category: "powders", + state: "solid", + density: 265, + burn: 1000, + burnTime: 300, + burnInto: ["carbon_dioxide"], +}, + elements.onyx = { + color: ["#484742","#3b3b3b","#cfccc0","#56544d","#ffe994"], + behavior: behaviors.POWDER, + category: "powders", + state: "solid", + density: 265, + burn: 1000, + burnTime: 300, + burnInto: ["carbon_dioxide"], +}, + elements.opal = { + color: ["#0cbfda","#e06666","#00ce85","#56544d","#444444"], + behavior: behaviors.POWDER, + category: "powders", + state: "solid", + density: 265, + burn: 1000, + burnTime: 300, + burnInto: ["carbon_dioxide"], } diff --git a/mods/code_library.js b/mods/code_library.js index 6cb305ae..183e0fb4 100644 --- a/mods/code_library.js +++ b/mods/code_library.js @@ -878,8 +878,18 @@ case "set": color.s = saturationChange; break; + case ">": + case ">=": + case "min": //lower-bounds the color + color.s = Math.max(color.s,saturationChange); //math.max to bound it to the higher of the input number or the existing color + break; + case "<": + case "<=": + case "max": //upper-bounds the color + color.s = Math.min(color.s,saturationChange); //math.min to bound it to the lower of the input number or the existing color + break; default: - throw new Error("operationType must be \"add\", \"subtract\", \"multiply\", \"divide\", or \"set\""); + throw new Error("Operation must be \"add\", \"subtract\", \"multiply\", \"divide\", \"set\", \"min\", or \"max\""); }; color.h = Math.round(color.h % 360); @@ -918,8 +928,18 @@ case "set": color.l = luminanceChange; break; + case ">": + case ">=": + case "min": + color.l = Math.max(color.l,luminanceChange); + break; + case "<": + case "<=": + case "max": + color.l = Math.min(color.l,luminanceChange); + break; default: - throw new Error("operationType must be \"add\", \"subtract\", \"multiply\", \"divide\", or \"set\""); + throw new Error("Operation must be \"add\", \"subtract\", \"multiply\", \"divide\", \"set\", \"min\", or \"max\""); }; color.h = Math.round(color.h % 360); @@ -958,8 +978,18 @@ case "set": color.h = hueChange; break; + case ">": + case ">=": + case "min": + color.h = Math.max(color.h,hueChange); + break; + case "<": + case "<=": + case "max": + color.h = Math.min(color.h,hueChange); + break; default: - throw new Error("operationType must be \"add\", \"subtract\", \"multiply\", \"divide\", or \"set\""); + throw new Error("Operation must be \"add\", \"subtract\", \"multiply\", \"divide\", \"set\", \"min\", or \"max\""); }; color.h = Math.round(color.h % 360); diff --git a/mods/color_tools.js b/mods/color_tools.js index 521ed8c5..465084f3 100644 --- a/mods/color_tools.js +++ b/mods/color_tools.js @@ -10,7 +10,7 @@ if(enabledMods.includes(libraryMod)) { var hueAmount = 1; var hueOp = "add"; - var ops = ["add","subtract","multiply","divide","set","+","-","*","x","×","/","÷","="]; + var ops = ["add","subtract","multiply","divide","set","min","max","+","-","*","x","×","/","÷","=",">",">=","<","<="]; function saturationPrompt() { var preSaturation = prompt("Enter the value you want to use"); @@ -34,7 +34,7 @@ if(enabledMods.includes(libraryMod)) { alert(`No operation was specified! Defaulting to "add".`); preSatOp = "add"; } else { - alert(`Invalid operation! Only "add", "subract", "multiply", "divide", and "set" are accepted (defaulting to "add").`); + alert(`Invalid operation! Only "add", "subract", "multiply", "divide", "set", "min", and "max" are accepted (defaulting to "add").`); preSatOp = "add"; }; }; @@ -65,7 +65,7 @@ if(enabledMods.includes(libraryMod)) { alert(`No operation was specified! Defaulting to "add".`); preLumOp = "add"; } else { - alert(`Invalid operation! Only "add", "subract", "multiply", "divide", and "set" are accepted (defaulting to "add").`); + alert(`Invalid operation! Only "add", "subract", "multiply", "divide", "set", "min", and "max" are accepted (defaulting to "add").`); preLumOp = "add"; }; }; @@ -99,7 +99,7 @@ if(enabledMods.includes(libraryMod)) { alert(`No operation was specified! Defaulting to "add".`); preHueOp = "add"; } else { - alert(`Invalid operation! Only "add", "subract", "multiply", "divide", and "set" are accepted (defaulting to "add").`); + alert(`Invalid operation! Only "add", "subract", "multiply", "divide", "set", "min", and "max" are accepted (defaulting to "add").`); preHueOp = "add"; }; }; diff --git a/mods/more_clouds.js b/mods/more_clouds.js index 67e90d11..bcbc13c6 100644 --- a/mods/more_clouds.js +++ b/mods/more_clouds.js @@ -184,6 +184,23 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) ignoreAir: true, conduct: 0.01, }; + } else { + elements[`auto_${cloudName}`] = { + color: startColor, + insulate: true, + colorObject: newColorObject, + behavior: [ + ["XX","XX","XX"], + ["XX",`CH:${elementOfCloud}%0.05`,"M1%2.5 AND BO"], + ["XX","XX","XX"] + ], + category: "clouds", + temp: firstTemp, + state: "gas", + density: 0.6, + ignoreAir: true, + conduct: 0.01, + }; }; eLists.CLOUD.push(cloudName); diff --git a/mods/structure_test.js b/mods/structure_test.js index 46214e6e..69685eb8 100644 --- a/mods/structure_test.js +++ b/mods/structure_test.js @@ -1,67 +1,317 @@ -elements.room = { - name: "Room", - color: "#ffffff", - arr: [], - tick: function(pixel) { - pixel.arr=[["brick", "brick", "brick", "brick", "brick", "brick", "brick", "glass", "glass", "glass", "glass", "glass", "brick", "brick", "brick", "brick", "brick", "brick", "brick"], - ["brick", "brick", "brick", "brick", "brick", "brick", "brick", "glass", "glass", "glass", "glass", "glass", "brick", "battery","brick", "brick", "brick", "brick", "brick"], - ["glass", "glass", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "light","light_bulb","air", "air", "air", "glass", "glass"], - ["glass", "glass", "light", "light", "air", "air", "air", "air", "air", "air", "air", "air", "air", "light", "air", "air", "air", "glass", "glass"], - ["glass", "glass", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "wood", "brass"], - ["glass", "glass", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "wood", "wood" ], - ["brick", "brick", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "wood", "wood" ], - ["brick", "brick", "iron", "straw", "straw", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "wood", "wood" ], - ["brick", "brick", "iron", "straw", "straw", "straw", "straw", "straw", "straw", "straw", "iron", "air", "air", "air", "air", "air", "air", "wood", "wood" ], - ["brick", "brick", "iron", "straw", "straw", "straw", "straw", "straw", "straw", "straw", "iron", "air", "air", "light", "air", "air", "air", "wood", "brass"], - ["brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick"], - ["brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick"]] +arrayLoaderVoids = ["air", "null", null]; +buildingOneSegmentDoor = ["concrete","wood_plank","concrete","wood_plank","concrete"]; +buildingOneSegmentWindows = ["concrete","glass_pane","concrete","glass_pane","concrete"]; +buildingOneSegmentConcrete = ["concrete","concrete","concrete","concrete","concrete"]; -/*pixel.arr = [["brick","brick","brick","brick","brick"], //(Test pixel.array) - ["brick","air", "iron", "air", "brick"], - ["brick","iron", "air", "iron", "brick"], - ["brick","air", "air", "air", "brick"], - ["brick","brick","brick","brick","brick"]]*/ +buildingTwoSegments = [ + ["concrete","concrete","concrete","concrete","concrete"], + ["concrete","concrete","concrete","concrete","concrete"], + ["brick","wood_plank","brick"], + ["glass_pane","wood_plank","glass_pane"], + ["brick","brick","brick"], + ["wood","wood_plank","wood_plank","wood_plank","wood"], + ["wood_plank","wood_plank","wood_plank"], + ["wood_plank"] +]; - aa = (0 - (Math.floor(pixel.arr[0].length / 2))) - na = Math.abs(aa) - if(pixel.arr[0].length % 2 == 1) { - bb = ((Math.floor(pixel.arr[0].length / 2)) + 1) - } else if(pixel.arr[0].length % 2 == 0) { - bb = (Math.floor(pixel.arr[0].length / 2)) - } +oldRoom= [["brick", "brick", "brick", "brick", "brick", "brick", "brick", "glass", "glass", "glass", "glass", "glass", "brick", "brick", "brick", "brick", "brick", "brick", "brick"], + ["brick", "brick", "brick", "brick", "brick", "brick", "brick", "glass", "glass", "glass", "glass", "glass", "brick", "battery","brick", "brick", "brick", "brick", "brick"], + ["glass", "glass", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "light","light_bulb","air", "air", "air", "glass", "glass"], + ["glass", "glass", "light", "light", "air", "air", "air", "air", "air", "air", "air", "air", "air", "light", "air", "air", "air", "glass", "glass"], + ["glass", "glass", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "wood", "brass"], + ["glass", "glass", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "wood", "wood" ], + ["brick", "brick", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "wood", "wood" ], + ["brick", "brick", "iron", "straw", "straw", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "wood", "wood" ], + ["brick", "brick", "iron", "straw", "straw", "straw", "straw", "straw", "straw", "straw", "iron", "air", "air", "air", "air", "air", "air", "wood", "wood" ], + ["brick", "brick", "iron", "straw", "straw", "straw", "straw", "straw", "straw", "straw", "iron", "air", "air", "light", "air", "air", "air", "wood", "brass"], + ["brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick"], + ["brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick"]] - cc = (0 - (Math.floor(pixel.arr.length / 2))) - nc = Math.abs(cc) - if(pixel.arr.length % 2 == 1) { - dd = ((Math.floor(pixel.arr.length / 2)) + 1) - } else if(pixel.arr.length % 2 == 0) { - dd = (Math.floor(pixel.arr.length / 2)) +altRoom= [["brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick"], + ["brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "battery","brick", "brick", "brick", "brick", "brick"], + ["glass", "glass", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "light","light_bulb","air", "air", "air", "glass", "glass"], + ["glass", "glass", "light", "light", "air", "air", "air", "air", "air", "air", "air", "air", "air", "light", "air", "air", "air", "glass", "glass"], + ["brass", "wood", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "wood", "brass"], + ["wood", "wood", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "wood", "wood" ], + ["wood", "wood", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "wood", "wood" ], + ["wood", "wood", "air", "air", "iron", "straw", "straw", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "wood", "wood" ], + ["wood", "wood", "air", "air", "iron", "straw", "straw", "straw", "straw", "straw", "straw", "straw", "iron", "air", "air", "air", "air", "wood", "wood" ], + ["brass", "wood", "air", "air", "iron", "straw", "straw", "straw", "straw", "straw", "straw", "straw", "iron", "light", "air", "air", "air", "wood", "brass"], + ["brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick"], + ["brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "battery", "brick", "brick", "brick", "brick", "brick"]] + +/*function r0to255() { + return Math.floor(Math.random() * 256); +};*/ + +function loadPixelRowFromArray(pixelArray,centerX,centerY,evenLengthBiasedLeft=true,doOverwrite=true) { + var arrayLength = pixelArray.length; + var leftmostOffset = (evenLengthBiasedLeft ? Math.floor(0 - ((arrayLength - 1) / 2)) : Math.ceil(0 - ((arrayLength - 1) / 2))) //floor and ceil have no effect on the integer values produced by odd lengths + var forEnd = 0 - leftmostOffset; + //var randomColor = `rgb(${r0to255()},${r0to255()},${r0to255()})`; + for(i = 0; i < arrayLength; i++) { + var newElement = pixelArray[i]; + var x = (centerX + leftmostOffset) + i; + var y = centerY; + if(outOfBounds(x,y)) { + continue; + }; + if(newElement === "null" || newElement === null) { //do nothing if element is null + continue; + }; + //console.log([x,y]); + if(!isEmpty(x,y,true)) { + if(doOverwrite) { + deletePixel(x,y); + if(newElement !== "air") { //if the new element is "air", don't create a pixel after deleting + createPixel(newElement,x,y); + }; + continue; + //pixelMap[x][y].color = randomColor; + } else {; + if(newElement === "air") { //delete on "air" even if doOverwrite is false + deletePixel(x,y); + } else { + continue; + }; + }; + }; + if(!arrayLoaderVoids.includes(newElement)) { //don't create anything if the element is a special void + createPixel(newElement,x,y); } - for (let j = cc; j < dd; j++) { - for (let i = aa; i < bb; i++) { - if(!isEmpty(pixel.x+i,pixel.y+j) && !outOfBounds(pixel.x+i,pixel.y+j)) { - if(pixel.arr[j+nc][i+na] != "null" || pixel.arr[j+nc][i+na] == "air") { - deletePixel(pixel.x+i,pixel.y+j) - } - } - if(pixel.arr[j+nc][i+na]) { - if(isEmpty(pixel.x+i,pixel.y+j) && pixel.arr[j+nc][i+na] != "null" && pixel.arr[j+nc][i+na] != "air" && !outOfBounds(pixel.x+i,pixel.y+j)) { - createPixel(pixel.arr[j+nc][i+na],pixel.x+i,pixel.y+j) - } - } - } - } - }, - category:"structures", - insulate: true, - state: "solid", - excludeRandom: true, + //pixelMap[x][y].color = randomColor; + }; }; -elements.altroom = { - name: "Altered Room", +delete elements.rad_glass.stateHigh; + +elements.glass.hardness = 0.25, +elements.rad_glass.hardness = 0.25, + +//Prereq elements +elements.glass_pane = { + color: ["#5e807d","#679e99"], + behavior: behaviors.SUPPORT, + reactions: { + "radiation": { "elem1":"rad_glass_pane", "chance":0.33 }, + }, + tempHigh: 1500, + hardness: 0.2, + category: "solids", + state: "solid", + density: 2500, + breakInto: "glass_shard", +}; + +elements.rad_glass_pane = { + color: ["#648c64","#6aad83"], + behavior: [ + "XX|CR:radiation%0.075|XX", + "SP AND CR:radiation%0.075|XX|SP AND CR:radiation%0.075", + "XX|M1 AND CR:radiation%0.075|XX", + ], + tempHigh: 1500, + hardness: 0.2, + stateHigh: "molten_rad_glass", + category: "solids", + state: "solid", + density: 2500, + breakInto: "rad_glass_shard", + hidden: true +}; + +elements.wood.hardness = 0.2; + +elements.wood_plank = { + color: "#ab6c3f", + behavior: behaviors.SUPPORT, + tempHigh: 400, + stateHigh: ["ember","charcoal","fire","fire","fire"], + category: "solids", + burn: 5, + burnTime: 300, + burnInto: ["ember","charcoal","fire"], + state: "solid", + hardness: 0.2, + breakInto: "sawdust", +}; + +elements.rad_glass.breakInto = "rad_glass_shard"; + +if(!elements.glass_shard.reactions) { + elements.glass_shard.reactions = {}; +}; +elements.glass_shard.reactions.radiation = { "elem1":"rad_glass_shard", "chance":0.33 }; + +if(!elements.molten_glass.reactions) { + elements.molten_glass.reactions = {}; +}; +elements.molten_glass.reactions.radiation = { "elem1":"molten_rad_glass", "chance":0.33 }; + +elements.rad_glass_shard = { + color: ["#648c64","#6aad83","#6a9171"], + behavior: [ + "XX|CR:radiation%0.075|XX", + "CR:radiation%0.075|XX|CR:radiation%0.075", + "M2|M1 AND CR:radiation%0.075|M2", + ], + tempHigh: 1500, + stateHigh: "molten_rad_glass", + category: "powders", + state: "solid", + density: 2500, +}; + +elements.molten_rad_glass = { + behavior: [ + "XX|CR:radiation%0.15 AND CR:fire%2.5|XX", + "M2 AND CR:radiation%0.15|XX|M2 AND CR:radiation%0.15", + "M1|M1 AND CR:radiation%0.15|M1", + ], +}; + +//Seeds +elements.building_1_seed = { + tick: function(pixel) { + for(cx = -4; cx <= 4; cx++) { + for(cy = -4; cy <= 4; cy++) { + if(cx === 0 && cy === 0) { + continue; + }; + var finalCoords = [pixel.x+cx,pixel.y+cy]; + if(isEmpty(...finalCoords,true)) { + continue; + } else { + var otherPixel = pixelMap[finalCoords[0]][finalCoords[1]]; + if(otherPixel.element === pixel.element) { + deletePixel(...finalCoords); + }; + }; + }; + }; + if(!isEmpty(pixel.x,pixel.y-1,true)) { + swapPixels(pixel,pixelMap[pixel.x][pixel.y-1]); + return; + }; + if(!tryMove(pixel,pixel.x,pixel.y+1)) { + var randomHeight = 13 + Math.floor(Math.random() * (8 + 1)) //min 12, variance 8 + var currentHeight = pixel.y + 2; + var endHeight = pixel.y - randomHeight; + //bottom 2 rows of concrete, 2 door layers and another concrete (the three of those counting against the final height) + loadPixelRowFromArray(buildingOneSegmentConcrete,pixel.x,currentHeight,true,false); + currentHeight--; + loadPixelRowFromArray(buildingOneSegmentConcrete,pixel.x,currentHeight,true,false); + currentHeight--; + loadPixelRowFromArray(buildingOneSegmentDoor,pixel.x,currentHeight,true,true); + currentHeight--; + loadPixelRowFromArray(buildingOneSegmentDoor,pixel.x,currentHeight,true,true); + currentHeight--; + loadPixelRowFromArray(buildingOneSegmentConcrete,pixel.x,currentHeight,true,true); + currentHeight--; + //start looped alternating rows + while(currentHeight > endHeight) { + //console.log(currentHeight) + if(outOfBounds(pixel.x,pixel.y)) { + break; + }; + loadPixelRowFromArray(buildingOneSegmentWindows,pixel.x,currentHeight,true,true); + currentHeight--; + loadPixelRowFromArray(buildingOneSegmentConcrete,pixel.x,currentHeight,true,true); + currentHeight--; + }; + }; + }, + excludeRandom: true, + desc: "Creates a miniature building made of concrete and glass.", + cooldown: 6, + state: "solid", + hardness: 1, + category: "structures", + color: ["#adadad", "#70b8ba", "#adadad", "#70b8ba", "#adadad"], +}; + +elements.building_2_seed = { + tick: function(pixel) { + for(cx = -4; cx <= 4; cx++) { + for(cy = -4; cy <= 4; cy++) { + if(cx === 0 && cy === 0) { + continue; + }; + var finalCoords = [pixel.x+cx,pixel.y+cy]; + if(isEmpty(...finalCoords,true)) { + continue; + } else { + var otherPixel = pixelMap[finalCoords[0]][finalCoords[1]]; + if(otherPixel.element === pixel.element) { + deletePixel(...finalCoords); + }; + }; + }; + }; + if(!isEmpty(pixel.x,pixel.y-1,true)) { + swapPixels(pixel,pixelMap[pixel.x][pixel.y-1]); + return; + }; + if(!tryMove(pixel,pixel.x,pixel.y+1)) { + var currentHeight = pixel.y + 2; + for(q = 0; q < buildingTwoSegments.length; q++) { + if(q >= buildingTwoSegments.length) { + break; + }; + loadPixelRowFromArray(buildingTwoSegments[q],pixel.x,currentHeight--,true,(q > 1)); + }; + }; + }, + excludeRandom: true, + desc: "Creates a miniature house.", + cooldown: 6, + state: "solid", + hardness: 1, + category: "structures", + color: ["#f05d43", "#f05d43", "#b06f33"], +}; + +elements.room_seed = { color: "#ffffff", - arr: [], + tick: function(pixel) { + if(!tryMove(pixel,pixel.x,pixel.y+1)) { + var currentHeight = pixel.y; + for(q = oldRoom.length - 1; q > -1; q--) { + loadPixelRowFromArray(oldRoom[q],pixel.x,currentHeight--,true,true); + }; + }; + }, + desc: "Creates a large room.", + excludeRandom: true, + cooldown: 10, + state: "solid", + hardness: 1, + category: "structures", +}; + +elements.altered_room_seed = { + color: "#ffffff", + tick: function(pixel) { + if(!tryMove(pixel,pixel.x,pixel.y+1)) { + var currentHeight = pixel.y; + for(q = altRoom.length - 1; q > -1; q--) { + loadPixelRowFromArray(altRoom[q],pixel.x,currentHeight--,true,true); + }; + }; + }, + desc: "Creates a variant form of the large room used in the old nested structure test.", + excludeRandom: true, + cooldown: 10, + state: "solid", + hardness: 1, + category: "structures", +}; + +elements.altroom_compat = { + name: "Altered Room (Old)", + hidden: true, + color: "#ffffff", + desc: "An old version of the variant room, kept for compatibility because I don't know how to rework the structure test.", tick: function(pixel) { pixel.arr=[["brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick"], ["brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "brick", "battery","brick", "brick", "brick", "brick", "brick"], @@ -112,57 +362,58 @@ elements.altroom = { excludeRandom: true, }, -elements.nst = { - name: "Nested Structure Test", +elements.nested_structure_test = { + name: "Nested Structure Test (Old)", color: "#ffffff", - arr: [], + cooldown: 13, + desc: "An old test of structure spawners in structure spawners. Creates several rooms stacked on top of each other.", tick: function(pixel) { - pixel.arr=[["altroom", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - ["altroom", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - ["altroom", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - ["altroom", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - ["altroom", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], - [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ]] + pixel.arr=[["altroom_compat", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + ["altroom_compat", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + ["altroom_compat", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + ["altroom_compat", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + ["altroom_compat", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ], + [ "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "brick", "brick" ]] aa = (0 - (Math.floor(pixel.arr[0].length / 2))) na = Math.abs(aa) @@ -199,3 +450,12 @@ elements.nst = { state: "solid", excludeRandom: true, }; + +function _toggleDesertBuildings() { + var layer = worldgentypes.desert.layers[0]; + if(layer[1] !== "building_1_seed") { //if the first layer isn't a building layer, add one + worldgentypes.desert.layers.unshift([0.95,"building_1_seed",0.01]); + } else if(layer[1] === "building_1_seed") { //if the first layer is a building layer, remove it + worldgentypes.desert.layers.shift(); + }; +};