From 93c0c878d9ced0fad2e7336c1015b843ef55dd53 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 23 Jan 2023 14:21:33 -0500 Subject: [PATCH] delete old mods (5) remove parts of mobs.js that are moving to the new mod --- mods/mobs.js | 816 --------------------------------------------------- 1 file changed, 816 deletions(-) diff --git a/mods/mobs.js b/mods/mobs.js index 7bb6af09..66c79a35 100644 --- a/mods/mobs.js +++ b/mods/mobs.js @@ -5113,822 +5113,6 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu /* ------------------------- - End skeleton elements - ------------------------- */ - - /* Creeper generation - ___#___#___#___#___#___#___#___#___#___ - __#___#___#___#___#___#___#___#___#___# - _#___#___#___#___#___#___#___#___#___#_ - #___#___#___#___#___#___#___#___#___#__ - ___#___#___#___#___#___#___#___#___#___ - __#___#___#___#___#___#___#___#___#___# - _#___#___#___#___#___#___#___#___#___#_ - #___#___#___#___#___#___#___#___#___#__ - ___#___#___#___#___#___#___#___#___#___ - __#___#___#___#___#___#___#___#___#___# - _#___#___#___#___#___#___#___#___#___#_ - #___#___#___#___#___#___#___#___#___#__ - ___#___#___#___#___#___#___#___#___#___ - __#___#___#___#___#___#___#___#___#___# - _#___#___#___#___#___#___#___#___#___#_ - #___#___#___#___#___#___#___#___#___#__ - */ - - //This code is a lot worse than I'd have liked it to be... - - //Include generated creepers in Random tool? - if(urlParams.get('creeperIncludeRandom') !== null) { //if the variable exists at all - creeperIncludeRandom = true - } else { //if it doesn't (and it returns null) - creeperIncludeRandom = false - } - - //Generate creepers - if(urlParams.get('generateCreepers') !== null) { //if the variable exists at all - generateCreepers = true - } else { //if it doesn't (and it returns null) - generateCreepers = false - } - - //Start Creeper Template Functions { - - autoCreeperPlacerTick = function(pixel) { - var creeperElement = elements[pixel.element].creeperType; - var headName,bodyName; - if(typeof(creeperElement === "string")) { //comma separated string check - if(creeperElement.includes(",")) { //if it is - creeperElement = creeperElement.split(","); //to array - creeperElement = creeperElement.filter(function(e) { //strip nonexistent elements - return typeof(elements[e]) === "object"; - }); - }; - }; - if(Array.isArray(creeperElement)) { - headName = `${creeperElement.join("_")}_creeper_head`; //auto head element name - bodyName = `${creeperElement.join("_")}_creeper_body`; //auto body element name - } else { - headName = `${creeperElement}_creeper_head`; //auto head element name - bodyName = `${creeperElement}_creeper_body`; //auto body element name - }; - if (isEmpty(pixel.x, pixel.y+1)) { - createPixel(bodyName, pixel.x, pixel.y+1); - pixel.element = headName; - pixel.color = pixelColorPick(pixel) - } else if (isEmpty(pixel.x, pixel.y-1)) { - createPixel(headName, pixel.x, pixel.y-1); - pixel.element = bodyName; - pixel.color = pixelColorPick(pixel) - } else { - deletePixel(pixel.x, pixel.y); - }; - }; - - autoCreeperBodyTick = function(pixel) { - var creeperElement = elements[pixel.element].creeperType; - var headName,bodyName,explodeInto; - if(typeof(creeperElement === "string")) { //comma separated string check - if(creeperElement.includes(",")) { //if it is - creeperElement = creeperElement.split(","); //to array - creeperElement = creeperElement.filter(function(e) { //strip nonexistent elements - return typeof(elements[e]) === "object"; - }); - }; - }; - if(Array.isArray(creeperElement)) { - headName = `${creeperElement.join("_")}_creeper_head`; //auto head element name - bodyName = `${creeperElement.join("_")}_creeper_body`; //auto body element name - explodeInto = creeperElement.join(","); //auto body element name - } else { - headName = `${creeperElement}_creeper_head`; //auto head element name - bodyName = `${creeperElement}_creeper_body`; //auto body element name - explodeInto = creeperElement; //auto body element name - }; - if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall - if (!isEmpty(pixel.x, pixel.y-2, true)) { // Drag head down - var headPixel = pixelMap[pixel.x][pixel.y-2]; - if (headPixel.element == headName) { - if (isEmpty(pixel.x, pixel.y-1)) { - movePixel(pixelMap[pixel.x][pixel.y-2], pixel.x, pixel.y-1); - } - else { - swapPixels(pixelMap[pixel.x][pixel.y-2], pixelMap[pixel.x][pixel.y-1]); - } - } - } - } - doHeat(pixel); - doBurning(pixel); - doElectricity(pixel); - if (pixel.dead) { - // Turn into rotten_meat if pixelTicks-dead > 500 - if (pixelTicks-pixel.dead > 200) { - Math.random() < 0.1 ? changePixel(pixel,"gunpowder") : changePixel(pixel,"rotten_meat"); - } - return - } - - // Find the head - if (!isEmpty(pixel.x, pixel.y-1, true) && pixelMap[pixel.x][pixel.y-1].element == headName) { - var head = pixelMap[pixel.x][pixel.y-1]; - if (head.dead) { // If head is dead, kill body - pixel.dead = head.dead; - } - } - else { var head = null } - - if (isEmpty(pixel.x, pixel.y-1)) { - // create blood if decapitated 10% chance - if (Math.random() < 0.1) { - createPixel("blood", pixel.x, pixel.y-1); - // set dead to true 15% chance - if (Math.random() < 0.15) { - pixel.dead = pixelTicks; - } - } - } - else if (head == null) { return } - else if (Math.random() < 0.1) { // Move 10% chance - var movesToTry = [ - [1*pixel.dir,0], - [1*pixel.dir,-1], - ]; - // While movesToTry is not empty, tryMove(pixel, x, y) with a random move, then remove it. if tryMove returns true, break. - while (movesToTry.length > 0) { - var move = movesToTry.splice(Math.floor(Math.random() * movesToTry.length), 1)[0]; - if (isEmpty(pixel.x+move[0], pixel.y+move[1]-1)) { - if (tryMove(pixel, pixel.x+move[0], pixel.y+move[1])) { - movePixel(head, head.x+move[0], head.y+move[1]); - break; - }; - }; - }; - // 15% chance to change direction while not chasing a human - if(!head.following) { - if (Math.random() < 0.15) { - pixel.dir *= -1; - //console.log("*turns around cutely to face ${pixel.dir < 0 ? 'left' : 'right'}*"); - }; - }/* else { - //console.log("*chases cutely*"); - };*/ - }; - - if(pixel.charge) { - pixel.charged = true; - }; - - if(head) { - if(typeof(head.charge) !== "undefined") { - if(head.charge) { - pixel.charged = true; - }; - }; - if(typeof(head.charged) !== "undefined") { - if(head.charged) { - pixel.charged = true; - }; - }; - }; - - if(typeof(pixel.charged) === "undefined") { - pixel.charged = false; - }; - - if(pixel.charged) { - var explosionRadius = 7; - if(!pixel.didChargeBlueTinted) { //do once, on initial charge - //console.log("something something halsey lyric"); - var color = pixel.color; - if(color.startsWith("rgb")) { - //console.log("rgb detected"); - color = color.split(","); //split color for addition - var red = parseFloat(color[0].substring(4)); - var green = parseFloat(color[1]); - var blue = parseFloat(color[2].slice(0,-1)); - red = rgbColorBound(red + 51); - green = rgbColorBound(green + 51); - blue = rgbColorBound(blue + 102); - color = `rgb(${red},${green},${blue})`; - pixel.color = color; - //console.log("color set"); - } else if(color.startsWith("hsl")) { - //console.log("hsl detected"); - color = color.split(","); //split color for addition - var hue = parseFloat(color[0].substring(4)); - var saturation = parseFloat(color[1].slice(0,-1)); - var luminance = parseFloat(color[2].slice(0,-2)); - hue = hue % 360; //piecewise hue shift - if(hue <= 235 && hue >= 135) { - hue = 185; - } else if(hue < 135) { - hue += 50; - } else if(hue > 235 && hue < 360) { - hue -= 50; - }; - saturation = slBound (saturation + 10); - luminance = slBound(luminance + 20); - color = `hsl(${hue},${saturation}%,${luminance}%)`; - pixel.color = color; - //console.log("color set"); - }; - pixel.didChargeBlueTinted = true; - }; - } else { - var explosionRadius = 5; - }; - - if(pixel.burning) { - pixel.hissing = true; - if(!pixel.hissStart) { - pixel.hissStart = pixelTicks; - }; - if(!pixel.burnStart) { //I don't like errors. - pixel.burnStart = pixel.ticks; - }; - if(pixelTicks - pixel.burnStart > 30) { - //console.log("Kaboom?"); - explodeAt(pixel.x,pixel.y,explosionRadius,creeperElement); - //console.log("Yes, Rico, kaboom."); - }; - }; - - //Head hissing color handler: keeps track of head's hissing for coloring purposes - for(i = 0; i < 1; i++) { //dummy for loop - if(pixel.dead || !head || head.dead) { //can't hiss without a head according to the classic creeper anatomy - //console.log("ss-- oof"); - pixel.hissing = false; - break; - }; - if(head.hissing) { - //console.log("Ssssssss"); - if(!head.hissStart) { - //console.log("t-30 ticks or whatever it was"); - head.hissStart = pixelTicks; - }; - - //Color code { - var ticksHissing = pixelTicks - head.hissStart; - var color = pixel.color; //do on each hissing tick - if(color.startsWith("rgb")) { - //console.log("rgb detected"); - color = color.split(","); //split color for addition - var red = parseFloat(color[0].substring(4)); - var green = parseFloat(color[1]); - var blue = parseFloat(color[2].slice(0,-1)); - red = rgbColorBound(red + ticksHissing); - green = rgbColorBound(green + ticksHissing); - blue = rgbColorBound(blue + ticksHissing); - color = `rgb(${red},${green},${blue})`; - pixel.color = color; - //console.log("color set"); - } else if(color.startsWith("hsl")) { - //console.log("hsl detected"); - color = color.split(","); //split color for addition - var hue = parseFloat(color[0].substring(4)); - var saturation = parseFloat(color[1].slice(0,-1)); - var luminance = parseFloat(color[2].slice(0,-2)); - //console.log("the j"); - luminance = slBound(luminance + 1.176); - //console.log(luminance); - color = `hsl(${hue},${saturation}%,${luminance}%)`; - pixel.color = color; - //console.log("color set"); - }; - //} - }; - }; - }; - - autoCreeperHeadTick = function(pixel) { - var creeperElement = elements[pixel.element].creeperType; - var headName,bodyName,explodeInto; - if(typeof(creeperElement === "string")) { //comma separated string check - if(creeperElement.includes(",")) { //if it is - creeperElement = creeperElement.split(","); //to array - creeperElement = creeperElement.filter(function(e) { //strip nonexistent elements - return typeof(elements[e]) === "object"; - }); - }; - }; - if(Array.isArray(creeperElement)) { - headName = `${creeperElement.join("_")}_creeper_head`; //auto head element name - bodyName = `${creeperElement.join("_")}_creeper_body`; //auto body element name - explodeInto = creeperElement.join(","); //auto body element name - } else { - headName = `${creeperElement}_creeper_head`; //auto head element name - bodyName = `${creeperElement}_creeper_body`; //auto body element name - explodeInto = creeperElement; //auto body element name - }; - doHeat(pixel); - doBurning(pixel); - doElectricity(pixel); - if (pixel.dead) { - // Turn into rotten_meat if pixelTicks-dead > 500 - if (pixelTicks-pixel.dead > 200) { - Math.random() < 0.1 ? changePixel(pixel,"gunpowder") : changePixel(pixel,"rotten_meat"); - return - } - } - - // Find the body - if (!isEmpty(pixel.x, pixel.y+1, true) && pixelMap[pixel.x][pixel.y+1].element == bodyName) { - var body = pixelMap[pixel.x][pixel.y+1]; - if (body.dead) { // If body is dead, kill head - pixel.dead = body.dead; - } - } - else { var body = null } - - if(body) { - if(body.dir !== pixel.dir) { //hacky workaround: lock head dir to body dir - pixel.dir = body.dir; - }; - }; - - if (isEmpty(pixel.x, pixel.y+1)) { - tryMove(pixel, pixel.x, pixel.y+1); - // create blood if severed 10% chance - if (isEmpty(pixel.x, pixel.y+1) && !pixel.dead && Math.random() < 0.1) { - createPixel("blood", pixel.x, pixel.y+1); - // set dead to true 15% chance - if (Math.random() < 0.15) { - pixel.dead = pixelTicks; - } - } - } - - //start of most new code - var pX = pixel.x; - var pY = pixel.y; - - if(pixel.charge) { - pixel.charged = true; - }; - - if(body) { - if(typeof(body.charge) !== "undefined") { - if(body.charge) { - pixel.charged = true; - }; - }; - if(typeof(body.charged) !== "undefined") { - if(body.charged) { - pixel.charged = true; - }; - }; - }; - - if(typeof(pixel.charged) === "undefined") { - pixel.charged = false; - }; - - if(pixel.charged) { - var explosionRadius = 10; - if(!pixel.didChargeBlueTinted) { //do once, on initial charge - //console.log("something something halsey lyric"); - var color = pixel.color; - if(color.startsWith("rgb")) { - //console.log("rgb detected"); - color = color.split(","); //split color for addition - var red = parseFloat(color[0].substring(4)); - var green = parseFloat(color[1]); - var blue = parseFloat(color[2].slice(0,-1)); - red = rgbColorBound(red + 51); - green = rgbColorBound(green + 51); - blue = rgbColorBound(blue + 102); - color = `rgb(${red},${green},${blue})`; - pixel.color = color; - //console.log("color set"); - } else if(color.startsWith("hsl")) { - //console.log("hsl detected"); - color = color.split(","); //split color for addition - var hue = parseFloat(color[0].substring(4)); - var saturation = parseFloat(color[1].slice(0,-1)); - var luminance = parseFloat(color[2].slice(0,-2)); - hue = hue % 360; //piecewise hue shift - if(hue <= 235 && hue >= 135) { - hue = 185; - } else if(hue < 135) { - hue += 50; - } else if(hue > 235 && hue < 360) { - hue -= 50; - }; - saturation = slBound (saturation + 10); - luminance = slBound(luminance + 20); - color = `hsl(${hue},${saturation}%,${luminance}%)`; - pixel.color = color; - //console.log("color set"); - }; - pixel.didChargeBlueTinted = true; - }; - } else { - var explosionRadius = 7; - }; - - //Human detection loop (looks ahead according to direction and sets the "following" variable to true, telling the body to lock the direction) - var directionAdverb = "left"; - if(pixel.dir > 0) { - directionAdverb = "right"; - }; - //console.log(`Looking ${directionAdverb}`) - if(pixel.dir === -1) { - for(i = -4; i < 4+1; i++) { - var oY = i; - //console.log(`Starting row look at row ${pY+oY}`) - for(j = (-1); j > (-16 - 1); j--) { - var oX = j; - var nX = pX+oX; - var nY = pY+oY; - if(outOfBounds(nX,nY)) { - //console.log(`Stopping row look at pixel (${nX},${nY}) due to OoB`) - break; - }; - if(isEmpty(nX,nY)) { - ////console.log(`Skipping pixel (${nX},${nY}) (empty)`) - continue; - }; - if(!isEmpty(nX,nY,true)) { - var newPixel = pixelMap[nX][nY]; - var newElement = newPixel.element; - if(enemyHumanoidArray.includes(newElement)) { - //console.log(`Human part found at (${nX},${nY})`) - if(!newPixel.dead) { - pixel.following = true; - //console.log(`Human detected at (${nX},${nY})`) - //Start "hissing" if a human is close enough - if(coordPyth(pX,pY,nX,nY) <= 3.15) { //probably misapplying the tolerance from the MC Wiki line: "Creepers will chase after any player, as long as it is within a 16 block (±5%) radius" - pixel.hissing = true; - if(!pixel.hissStart) { - pixel.hissStart = pixelTicks; - }; - }; - }; - } else { - //console.log(`Stopping row look at pixel (${nX},${nY}) due to non-human pixel in the way`) - break; //can't see through humans - }; - }; - }; - }; - } else if(pixel.dir === 1) { - for(i = -4; i < 4+1; i++) { - var oY = i; - //console.log(`Starting row look at row ${pY+oY}`) - for(j = 1; j < 16 + 1; j++) { - var oX = j; - var nX = pX+oX; - var nY = pY+oY; - if(outOfBounds(nX,nY)) { - //console.log(`Stopping row look at pixel (${nX},${nY}) due to OoB`) - break; - }; - if(isEmpty(nX,nY)) { - ////console.log(`Skipping pixel (${nX},${nY}) (empty)`) - continue; - }; - if(!isEmpty(nX,nY,true)) { - var newPixel = pixelMap[nX][nY]; - var newElement = newPixel.element; - if(enemyHumanoidArray.includes(newElement)) { - //console.log(`Human part found at (${nX},${nY})`) - if(!newPixel.dead) { - pixel.following = true; - //console.log(`Human detected at (${nX},${nY})`) - //Start "hissing" if a human is close enough - if(coordPyth(pX,pY,nX,nY) <= 3.15) { - pixel.hissing = true; - if(!pixel.hissStart) { - pixel.hissStart = pixelTicks; - }; - }; - break; - }; - } else { - //console.log(`Stopping row look at pixel (${nX},${nY}) due to non-human pixel in the way`) - break; - }; - }; - }; - }; - }; - - //Pre-explosion handler: keeps track of time before the kaboom - for(i = 0; i < 1; i++) { //dummy for loop - if(pixel.hissing) { - //console.log("Ssssssss"); - if(pixel.dead || !body || body.dead) { //can't explode without a body according to the classic creeper anatomy - //console.log("ss-- oof"); - pixel.hissing = false; - break; - }; - if(!pixel.hissStart) { - //console.log("t-30 ticks or whatever it was"); - pixel.hissStart = pixelTicks; - }; - //Color code { - var ticksHissing = pixelTicks - pixel.hissStart; - var color = pixel.color; //do on each hissing tick - if(color.startsWith("rgb")) { - //console.log("rgb detected"); - color = color.split(","); //split color for addition - var red = parseFloat(color[0].substring(4)); - var green = parseFloat(color[1]); - var blue = parseFloat(color[2].slice(0,-1)); - red = rgbColorBound(red + ticksHissing); - green = rgbColorBound(green + ticksHissing); - blue = rgbColorBound(blue + ticksHissing); - color = `rgb(${red},${green},${blue})`; - pixel.color = color; - //console.log("color set"); - } else if(color.startsWith("hsl")) { - //console.log("hsl detected"); - color = color.split(","); //split color for addition - var hue = parseFloat(color[0].substring(4)); - var saturation = parseFloat(color[1].slice(0,-1)); - var luminance = parseFloat(color[2].slice(0,-2)); - luminance = slBound(luminance + 1.176); - color = `hsl(${hue},${saturation}%,${luminance}%)`; - pixel.color = color; - //console.log("color set"); - }; - //} - - if(pixelTicks - pixel.hissStart > 30) { - //console.log("Kaboom?"); - //console.log(`Exploding with element ${creeperElement} and radius ${explosionRadius} (charged: ${pixel.charged})`); - explodeAt(body.x,body.y,explosionRadius,explodeInto); - //console.log("Yes, Rico, kaboom."); - }; - }; - }; - - if(Math.random() < 0.01) { //1% chance each tick to lose interest - pixel.following = false; - //console.log("Meh."); - }; - }; - - //End Creeper Template Functions } - - var placeholderColor = "#FF00FF"; - - var hslOffsets = [[0, -5, 5], [0, -20, 10], [0, 0, 10], [0, -20, 10], [0, -35, 0], [0, -20, -30], [0, 10, -10], [0, 10, 20], [0, -20, 10], [0, -10, 5]]; - - var colorOfRandomCreeper = ["#7ba883", "#8aba8a", "#87b292", "#8aba8a", "#71a171", "#346434", "#4d6d72", "#a0caad", "#8aba8a", "#7dac7f"] - //random_creeper's final color but all values of the sixth one increased by 16 decimal and then everything's R and B -= 48 decimal - - elements.spawn_random_creeper = { - color: colorOfRandomCreeper, - behavior: behaviors.WALL, - category: "special", - excludeRandom: false, //see below - movable: true, - tick: function(pixel) { - changePixel(pixel,spawnCreepers[Math.floor(Math.random() * spawnCreepers.length)]) //spawnCreepers is already excludeRandom filtered - }, - }; - - //Standalone generator function - - function generateCreeper(creeperElements,isAfterScriptLoading=false) {//it can be a single element, though - //To specify an array creeper, have the array be inside another array. - /*For reasons related to how element colors are loaded, if this function is being run from a JS mod file, isAfterScriptLoading should be false. - Otherwise, you'll get TypeErrors for some reason when trying to place your creeper. If this is being run after the game has loaded (e.g. in the console), - then isAfterScriptLoading should be true or you might also get TypeErrors (this latter case was a bit inconsistent when I tested it, but - the former case wasn't. **isAfterScriptLoading must be false when this function is run from a JS mod file**. - If isAfterScriptLoading is true, buttons (depending on the hiding setting) will be added to the auto creeper category, the 3 new elements per creeper will be assigned IDs, and the footer will be updated with the increased element counts.*/ - if(typeof(creeperElements) === "string") { //it should be an array, so string check - //console.log("String detected"); - if(creeperElements.includes(",")) { //comma-separated string? - //console.log("Splitting string to array"); - creeperElements = creeperElements.split(","); //,SS to array - } else { - //console.log("Wrapping string in array"); - creeperElements = [creeperElements]; //single string to array - }; - }; - for(aaf = 0; aaf < creeperElements.length; aaf++) { - var elementOfCreeper = creeperElements[aaf]; - var startColor; - var randomExcl = 0; - //console.log("randomExcl set") - //console.log(elementOfCreeper); - - var headName,bodyName,placerName,descElement; - - if(typeof(elementOfCreeper === "string")) { //comma separated string check - if(elementOfCreeper.includes(",")) { //if it is - elementOfCreeper = elementOfCreeper.split(","); //to array - elementOfCreeper = elementOfCreeper.filter(function(e) { //strip nonexistent elements - return typeof(elements[e]) === "object"; - }); - }; - }; - if(Array.isArray(elementOfCreeper)) { - headName = `${elementOfCreeper.join("_")}_creeper_head`; //auto head element name - bodyName = `${elementOfCreeper.join("_")}_creeper_body`; //auto body element name - placerName = `${elementOfCreeper.join("_")}_creeper`; //auto placer element name - descElement = elementOfCreeper.join(", "); //auto explosion element list - - //array case color concatenator and excludeRandom handler - startColor = []; - //console.log(elementOfCreeper); - for(ll = 0; ll < elementOfCreeper.length; ll++) { - if(typeof(elements[elementOfCreeper[ll]].excludeRandom !== "undefined")) { //if excludeRandom exists (prevent TypeError) - if(elements[elementOfCreeper[ll]].excludeRandom) { //it it's true - randomExcl = 1; //the whole array creeper is excluded - //console.log("array nyet" + elementOfCreeper); - }; - }; - //console.log(elementOfCreeper[ll]); - startColor = startColor.concat(elements[elementOfCreeper[ll]].color); - }; - } else { //they should all be strings, so here - headName = `${elementOfCreeper}_creeper_head`; //auto head element name - bodyName = `${elementOfCreeper}_creeper_body`; //auto body element name - placerName = `${elementOfCreeper}_creeper`; //auto placer element name - descElement = elementOfCreeper; //auto explosion element - startColor = elements[elementOfCreeper].color; - if(typeof(elements[elementOfCreeper].excludeRandom !== "undefined")) { //if excludeRandom exists (prevent TypeError) - if(elements[elementOfCreeper].excludeRandom) { //it it's true - //console.log("nyet " + elementOfCreeper); - randomExcl = 1; //the creeper is excluded - } else { - //console.log("allow " + elementOfCreeper); - randomExcl = 0; - }; - }; - }; - //Color gen - if(Array.isArray(startColor)) { //Average arrays, make colors rgb() - startColor = averageRgbPrefixedColorArray(startColor); - } else { - startColor = rgbHexCatcher(startColor); - }; - var preColor = rgbStringToHSL(startColor); - var colorsArray = [preColor, preColor, preColor, preColor, preColor, preColor, preColor, preColor, preColor, preColor] - var colorObjectArray = []; - for(q = 0; q < hslOffsets.length; q++) { - colorsArray[q] = addArraysInPairs(colorsArray[q],hslOffsets[q]); - colorsArray[q] = hslToHex(...colorsArray[q]); - colorObjectArray[q] = hexToRGB(colorsArray[q]); //outputs hex - if(isAfterScriptLoading) { // if it's after the hex -> RGB conversion - var coq = colorObjectArray[q]; //pull the object - //console.log(coq.r); - colorsArray[q] = `rgb(${coq.r},${coq.g},${coq.b})`; //and change to the RGB from its values - }; - }; - - //End color gen - - //console.log(`${headName}; ${bodyName}; ${placerName}; ${descElement}`) - - //Placer - elements[placerName] = { - movable: true, - creeperType: elementOfCreeper, - color: colorsArray, - colorObject: colorObjectArray, - category: "auto creepers", - properties: { - dead: false, - dir: 1, - panic: 0, - following: false, - }, - tick: function(pixel) { - autoCreeperPlacerTick(pixel); - }, - related: [bodyName,headName,"creeper"], - desc: `Auto-generated creeper.
Explodes into ${descElement}.`, - }; - - eLists.CREEPER.push(placerName); - - //Body - elements[bodyName] = { - movable: true, - creeperType: elementOfCreeper, - color: colorsArray, - colorObject: colorObjectArray, - category: "auto creepers", - hidden: true, - excludeRandom: true, - density: 1500, - state: "solid", - conduct: 25, - tempHigh: 250, - stateHigh: "cooked_meat", - tempLow: -30, - stateLow: "frozen_meat", - burn: 10, - burnTime: 250, - burnInto: ["cooked_meat","cooked_meat","cooked_meat","cooked_meat","gunpowder"], - breakInto: ["blood","gunpowder"], - reactions: { - "cancer": { "elem1":"cancer", "chance":0.005 }, - "radiation": { "elem1":["ash","meat","rotten_meat","cooked_meat"], "chance":0.4 }, - "plague": { "elem1":"plague", "chance":0.05 }, - }, - properties: { - dead: false, - dir: 1, - panic: 0, - charged: false, - didChargeBlueTinted: false, - }, - tick: function(pixel) { - autoCreeperBodyTick(pixel); - }, - }; - - //Head - elements[headName] = { - movable: true, - creeperType: elementOfCreeper, - color: colorsArray, - colorObject: colorObjectArray, - category: "auto creepers", - hidden: true, - excludeRandom: true, - density: 1080, - state: "solid", - conduct: 25, - tempHigh: 250, - stateHigh: "cooked_meat", - tempLow: -30, - stateLow: "frozen_meat", - burn: 10, - burnTime: 250, - burnInto: ["cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","gunpowder"], - breakInto: "blood", - reactions: { - "cancer": { "elem1":"cancer", "chance":0.005 }, - "radiation": { "elem1":["ash","meat","rotten_meat","cooked_meat"], "chance":0.4 }, - "plague": { "elem1":"plague", "chance":0.05 }, - "oxygen": { "elem2":"carbon_dioxide", "chance":0.5 }, - }, - properties: { - dead: false, - following: false, - hissing: false, - charged: false, - didChargeBlueTinted: false, - }, - tick: function(pixel) { - autoCreeperHeadTick(pixel); - }, - }; - if(isAfterScriptLoading) { - elementCount += 3; //placer, body, head - createElementButton(placerName) - if(settings["unhide"] === 0) { //hide some elements: body and head would be hidden, so only update hidden count - hiddenCount += 2; - } else if(settings["unhide"] === 1) { //unhide all elements: b/h would not be hidden, so only create their buttons - createElementButton(bodyName); - createElementButton(headName); - } else if(settings["unhide"] === 2) { - settings.unlocked[bodyName] ? createElementButton(bodyName) : hiddenCount++; //ternary: if headName is unlocked, create button, else increase hiddenCount - settings.unlocked[headName] ? createElementButton(headName) : hiddenCount++; //above with headName - }; - elements[placerName].id = nextid++; //set placer's id to nextid and then increment nextid - elements[bodyName].id = nextid++; //repeat with body and head - elements[headName].id = nextid++; - headBodyObject[headName] = bodyName; - document.getElementById("extraInfo").innerHTML = "

There are " + elementCount + " elements, including " + hiddenCount + " hidden ones.

©2021-" + new Date().getFullYear() + ". All Rights Reserved. R74n

"; //update extra info counts (and the copyright year, due to the method used) - }; - if(creeperIncludeRandom) { - randomExcl ? elements[placerName].excludeRandom = true : elements[placerName].excludeRandom = false; - } else { - elements[placerName].excludeRandom = true; - }; - if(!randomExcl) { - //console.log("spawn enabling " + placerName); - spawnCreepers.push(placerName); - } else { - //console.log("nyetted " + placerName); - }; - }; - }; - - runAfterAutogen(function() { - if(generateCreepers) { - var tempArray = Object.keys(elements); - tempArray.push(["rock", "sand"]); - generateCreeper(tempArray,false) - }; - }); - - var solidBlacklist = ["mistake", "birthpool", "firesea"]; //exclude these since they seem to be liquid - - solids = Object.keys(elements).filter(function(e) { - return elements[e].category === "solids" && !solidBlacklist.includes(e); - }); - - for(i = 0; i < solids.length; i++) { //A lot of elements in solids, particularly metals, are missing a "state: solid". - var solidName = solids[i] - elements[solidName].state = "solid"; - }; - } else { if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) }; if(!enabledMods.includes(explodeAtPlusMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,explodeAtPlusMod) };