make changes

This commit is contained in:
O-01-67 2022-10-09 10:55:07 -04:00 committed by GitHub
parent c800cf0ad3
commit 39b346d40a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4119 additions and 4104 deletions

View File

@ -1,45 +1,49 @@
//Prerequisite Functions and Variables
var modName = "mods/mobs.js";
var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js";
headBodyObject = {
if(enabledMods.includes(runAfterAutogenMod)) {
//Prerequisite Functions and Variables
headBodyObject = {
"head": "body",
"creeper_head": "creeper_body",
"angelic_creeper_head": "angelic_creeper_body",
"hell_creeper_head": "hell_creeper_body",
"bombing_creeper_head": "bombing_creeper_body",
"zombie_head": "zombie_body",
};
};
var style = document.createElement('style'); //Initialize CSS for creeper spawning's status indicator
style.type = 'text/css';
style.id = 'creeperStatusStylesheet';
//initial style conditional branch
if(typeof(settings.creeperSpawning) === "undefined") { //undefined (falsy but it needs special handling)
var style = document.createElement('style'); //Initialize CSS for creeper spawning's status indicator
style.type = 'text/css';
style.id = 'creeperStatusStylesheet';
//initial style conditional branch
if(typeof(settings.creeperSpawning) === "undefined") { //undefined (falsy but it needs special handling)
style.innerHTML = '.creeperStatus { color: #E11; text-decoration: none; }';
} else {
} else {
if(!settings.creeperSpawning) { //falsy: red
style.innerHTML = '.creeperStatus { color: #E11; text-decoration: none; }';
} else if(settings.creeperSpawning) { //truthy: green
style.innerHTML = '.creeperStatus { color: #1E1; text-decoration: none; }';
};
};
document.getElementsByTagName('head')[0].appendChild(style);
};
document.getElementsByTagName('head')[0].appendChild(style);
function pyth(xA,yA,xB,yB) { //Distance function, used for explosion trigger
function pyth(xA,yA,xB,yB) { //Distance function, used for explosion trigger
var a = Math.abs(xB - xA);
var b = Math.abs(yB - yA);
var c = Math.sqrt(a**2 + b**2);
return c;
};
};
function rgbColorBound(number) { //RGB bounding function, used for safety checking color changes
function rgbColorBound(number) { //RGB bounding function, used for safety checking color changes
return Math.min(255,Math.max(0,number));
};
};
function slBound(number) { //SL bounding function (not hue), same use as above
function slBound(number) { //SL bounding function (not hue), same use as above
return Math.min(100,Math.max(0,number));
};
};
function angelicUpwardVelocity(pixel,x,y,radius,fire,smoke,power) { //Angelic Creeper's effect, "compatible" with velocity.js by including the modified version of its code in itself
function angelicUpwardVelocity(pixel,x,y,radius,fire,smoke,power) { //Angelic Creeper's effect, "compatible" with velocity.js by including the modified version of its code in itself
var info = elements[pixel.element]
if(enabledMods.includes("mods/velocity.js")) {
//console.log("yeet");
@ -57,10 +61,10 @@ function angelicUpwardVelocity(pixel,x,y,radius,fire,smoke,power) { //Angelic Cr
//console.log(`Velocities set`);
};
//console.log(`end`);
};
};
//afterFunction(pixel,x,y,radius,fire,smoke,power,damage);
function hellExplosionFire(pixel,x,y,radius,fire,smoke,power,damage) { //Angelic Creeper's effect, "compatible" with velocity.js by including the modified version of its code in itself
//afterFunction(pixel,x,y,radius,fire,smoke,power,damage);
function hellExplosionFire(pixel,x,y,radius,fire,smoke,power,damage) { //Angelic Creeper's effect, "compatible" with velocity.js by including the modified version of its code in itself
var coords = circleCoords(pixel.x,pixel.y,radius);
for (var i = 0; i < coords.length; i++) {
var x = coords[i].x;
@ -89,9 +93,9 @@ function hellExplosionFire(pixel,x,y,radius,fire,smoke,power,damage) { //Angelic
firePixel.burning = true;
};
};
};
};
function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null,afterFunction=null) { //explodeAt with additional arguments, used to allow implementation of Angelic Creeper's effect
function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null,afterFunction=null) { //explodeAt with additional arguments, used to allow implementation of Angelic Creeper's effect
// if fire contains , split it into an array
if (fire.indexOf(",") !== -1) {
fire = fire.split(",");
@ -188,13 +192,13 @@ function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null,
};
};
};
};
};
if(typeof(settings.creeperSpawning) === "undefined") { //Default creeper setting
if(typeof(settings.creeperSpawning) === "undefined") { //Default creeper setting
setSetting("creeperSpawning",false);
};
};
function updateCreeperPreferences() { //Creeper setting handler
function updateCreeperPreferences() { //Creeper setting handler
if(settings.creeperSpawning) { //If the setting is on
if(typeof(randomEvents.creeper) !== "function") { //add the event if it's missing
randomEvents.creeper = function() {
@ -228,9 +232,9 @@ function updateCreeperPreferences() { //Creeper setting handler
} else if(!settings.creeperSpawning) { //and if it's off
if(randomEvents.creeper) { delete randomEvents.creeper }; //delete it if it exists.
};
};
};
function toggleCreeperSpawning() { //Creeper toggle handler
function toggleCreeperSpawning() { //Creeper toggle handler
if(settings.creeperSpawning != true) { //If it's false
setSetting("creeperSpawning",true); //make it true and update the status display CSS
updateCreeperPreferences(); //apply
@ -240,13 +244,13 @@ function toggleCreeperSpawning() { //Creeper toggle handler
updateCreeperPreferences();
document.getElementById("creeperStatusStylesheet").innerHTML = '.creeperStatus { color: #E11; text-decoration: none; }';
};
};
};
enemyHumanoidArray = ["head","body"] //just in case
enemyHumanoidArray = ["head","body"] //just in case
spawnCreepers = ["creeper","angelic_creeper","bombing_creeper","hell_creeper"];
spawnCreepers = ["creeper","angelic_creeper","bombing_creeper","hell_creeper"];
if(settings.creeperSpawning) { //creeper spawning option
if(settings.creeperSpawning) { //creeper spawning option
randomEvents.creeper = function() {
var amount = Math.floor((Math.random() * 3)+1); //1-3
for(i = 0; i < amount; i++) { //dummy for to break
@ -273,9 +277,9 @@ if(settings.creeperSpawning) { //creeper spawning option
};
};
};
};
};
standaloneSpawnCreeper = function(amount=1) {
standaloneSpawnCreeper = function(amount=1) {
/* The amount is the maximum amount of *attempts*. Often, less creepers will spawn due to things in the way.
In a generated world, which uses half of the space, you can expect about half of this number to spawn. */
for(i = 0; i < amount; i++) { //dummy for to break
@ -293,16 +297,16 @@ standaloneSpawnCreeper = function(amount=1) {
createPixel(element,x,y);
};
};
};
};
//Prerequisite Functions and Variables
//Prerequisite Functions and Variables
function getKeyByValue(object, value) {
function getKeyByValue(object, value) {
return Object.keys(object).find(key => object[key] === value);
}
//getKeyByValue code by UncleLaz on StackOverflow: https://stackoverflow.com/questions/9907419/how-to-get-a-key-in-a-javascript-object-by-its-value"
}
//getKeyByValue code by UncleLaz on StackOverflow: https://stackoverflow.com/questions/9907419/how-to-get-a-key-in-a-javascript-object-by-its-value"
function headHasBody(pixel) {
function headHasBody(pixel) {
var pX = pixel.x;
var pY = pixel.y;
//console.log("Checking head for body");
@ -320,9 +324,9 @@ function headHasBody(pixel) {
//console.log("The head does not have corresponding body element.");
return null;
};
};
};
function bodyHasHead(pixel) {
function bodyHasHead(pixel) {
var pX = pixel.x;
var pY = pixel.y;
//console.log("Checking body for head");
@ -340,9 +344,9 @@ function bodyHasHead(pixel) {
//console.log("The body does not have corresponding head element.");
return null;
};
};
};
function zombifyHuman(pixel) {
function zombifyHuman(pixel) {
var pX = pixel.x;
var pY = pixel.y;
if(!["head","body"].includes(pixel.element)) {
@ -371,9 +375,9 @@ function zombifyHuman(pixel) {
//console.log("Body turned (body path)");
};
};
};
};
function dezombifyHuman(pixel) {
function dezombifyHuman(pixel) {
var pX = pixel.x;
var pY = pixel.y;
if(!["zombie_head","zombie_body"].includes(pixel.element)) {
@ -393,9 +397,9 @@ function dezombifyHuman(pixel) {
changePixel(pixel,"body");
};
};
};
};
elements.frozen_rotten_meat = {
elements.frozen_rotten_meat = {
color: ["#8FB588", "#8FA888"],
behavior: [
"XX|CR:plague,stench,stench%0.125 AND CH:meat>rotten_meat%1 AND CH:frozen_meat>frozen_rotten_meat%0.85|XX",
@ -409,12 +413,12 @@ elements.frozen_rotten_meat = {
hidden:true,
state: "solid",
density: 1037.5,
};
};
elements.rotten_meat.tempLow = -18;
elements.rotten_meat.stateLow = "frozen_rotten_meat";
elements.rotten_meat.tempLow = -18;
elements.rotten_meat.stateLow = "frozen_rotten_meat";
elements.zombie_blood = {
elements.zombie_blood = {
color: ["#d18228", "#9a9e2f"],
behavior: behaviors.LIQUID,
reactions: {
@ -462,28 +466,28 @@ elements.zombie_blood = {
};
};
},
};
};
var style = document.createElement('style'); //Initialize CSS for zombie spawning's status indicator
style.type = 'text/css';
style.id = 'zombieStatusStylesheet';
//initial style conditional branch
if(typeof(settings.zombieSpawning) === "undefined") { //undefined (falsy but it needs special handling)
var style = document.createElement('style'); //Initialize CSS for zombie spawning's status indicator
style.type = 'text/css';
style.id = 'zombieStatusStylesheet';
//initial style conditional branch
if(typeof(settings.zombieSpawning) === "undefined") { //undefined (falsy but it needs special handling)
style.innerHTML = '.zombieStatus { color: #E11; text-decoration: none; }';
} else {
} else {
if(!settings.zombieSpawning) { //falsy: red
style.innerHTML = '.zombieStatus { color: #E11; text-decoration: none; }';
} else if(settings.zombieSpawning) { //truthy: green
style.innerHTML = '.zombieStatus { color: #1E1; text-decoration: none; }';
};
};
document.getElementsByTagName('head')[0].appendChild(style);
};
document.getElementsByTagName('head')[0].appendChild(style);
if(typeof(settings.zombieSpawning) === "undefined") { //Default zombie setting
if(typeof(settings.zombieSpawning) === "undefined") { //Default zombie setting
setSetting("zombieSpawning",false);
};
};
function updateZombiePreferences() { //Zombie setting handler
function updateZombiePreferences() { //Zombie setting handler
if(settings.zombieSpawning) { //If the setting is on
if(typeof(randomEvents.zombie) !== "function") { //add the event if it's missing
randomEvents.zombie = function() {
@ -517,9 +521,9 @@ function updateZombiePreferences() { //Zombie setting handler
} else if(!settings.zombieSpawning) { //and if it's off
if(randomEvents.zombie) { delete randomEvents.zombie }; //delete it if it exists.
};
};
};
function toggleZombieSpawning() { //Zombie toggle handler
function toggleZombieSpawning() { //Zombie toggle handler
if(settings.zombieSpawning != true) { //If it's false
setSetting("zombieSpawning",true); //make it true and update the status display CSS
updateZombiePreferences(); //apply
@ -529,11 +533,11 @@ function toggleZombieSpawning() { //Zombie toggle handler
updateZombiePreferences();
document.getElementById("zombieStatusStylesheet").innerHTML = '.zombieStatus { color: #E11; text-decoration: none; }';
};
};
};
spawnZombies = ["zombie","baby_zombie"];
spawnZombies = ["zombie","baby_zombie"];
if(settings.zombieSpawning) { //zombie spawning option
if(settings.zombieSpawning) { //zombie spawning option
randomEvents.zombie = function() {
var amount = Math.floor((Math.random() * 3)+1); //1-3
for(i = 0; i < amount; i++) { //dummy for to break
@ -560,9 +564,9 @@ if(settings.zombieSpawning) { //zombie spawning option
};
};
};
};
};
standaloneSpawnZombie = function(amount=1) {
standaloneSpawnZombie = function(amount=1) {
/* The amount is the maximum amount of *attempts*. Often, less zombies will spawn due to things in the way.
In a generated world, which uses half of the space, you can expect about half of this number to spawn. */
for(i = 0; i < amount; i++) { //dummy for to break
@ -580,9 +584,9 @@ standaloneSpawnZombie = function(amount=1) {
createPixel(element,x,y);
};
};
};
};
/*Start Main Zombie
/*Start Main Zombie
..................
.........###......
.......#######....
@ -597,9 +601,9 @@ standaloneSpawnZombie = function(amount=1) {
.......##...##....
.......##...##....
..................
*/
*/
elements.zombie = {
elements.zombie = {
color: ["#567C44","#199A9A","#41369B"],
category: "life",
properties: {
@ -626,9 +630,9 @@ elements.zombie = {
},
related: ["zombie_body","zombie_head"],
desc: "<em>I'd rather this be toggleable mid-game than require a reload.</em><br/><br/><span class=\"zombieStatus\">If this text is green or underlined, zombies (all types) can spawn.</span> <span onclick=toggleZombieSpawning() style=\"color: #ff00ff;\";>Click here</span> to toggle zombie spawning. If it's on, zombies can spawn through random events."
};
};
elements.zombie_body = {
elements.zombie_body = {
color: "#27719D",
category: "life",
hidden: true,
@ -729,9 +733,9 @@ elements.zombie_body = {
};*/
};
},
};
};
elements.zombie_head = {
elements.zombie_head = {
color: "#567C44",
category: "life",
hidden: true,
@ -920,11 +924,11 @@ elements.zombie_head = {
//console.log("Meh.");
};
},
};
};
//Baby Zombie
elements.baby_zombie = {
elements.baby_zombie = {
color: "#199A9A",
category: "life",
hidden: true,
@ -1107,9 +1111,9 @@ elements.baby_zombie = {
},
related: ["zombie"],
desc: "Baby zombies: smaller, faster, and more annoying.",
};
};
/*Start Main Creeper
/*Start Main Creeper
##################
######### ######
####### ####
@ -1124,9 +1128,9 @@ elements.baby_zombie = {
####### ### ####
####### ### ####
##################
*/
*/
elements.creeper = {
elements.creeper = {
color: ["#D2D2D2", "#BFDFB9", "#94CE89", "#78D965", "#5ED54C", "#58C546", "#50B143", "#479143", "#559552", "#3F8738", "#5B8B59"],
category: "life",
properties: {
@ -1153,9 +1157,9 @@ elements.creeper = {
},
related: ["creeper_body","creeper_head"],
desc: "<em>I'd rather this be toggleable mid-game than require a reload.</em><br/><br/><span class=\"creeperStatus\">If this text is green or underlined, creepers can spawn.</span> <span onclick=toggleCreeperSpawning() style=\"color: #ff00ff;\";>Click here</span> to toggle creeper spawning. If it's on, creepers (all types) can spawn through random events."
};
};
elements.creeper_body = {
elements.creeper_body = {
color: ["#D2D2D2", "#BFDFB9", "#94CE89", "#78D965", "#5ED54C", "#58C546", "#50B143", "#479143", "#559552", "#3F8738", "#5B8B59"],
category: "life",
hidden: true,
@ -1378,9 +1382,9 @@ elements.creeper_body = {
};
};
},
};
};
elements.creeper_head = {
elements.creeper_head = {
color: ["#5B8B59", "#3F8738", "#559552", "#479143", "#50B143", "#58C546"],
category: "life",
hidden: true,
@ -1534,7 +1538,7 @@ elements.creeper_head = {
break;
};
if(isEmpty(nX,nY)) {
////console.log(`Skipping pixel (${nX},${nY}) (empty)`)
//console.log(`Skipping pixel (${nX},${nY}) (empty)`)
continue;
};
if(!isEmpty(nX,nY,true)) {
@ -1573,7 +1577,7 @@ elements.creeper_head = {
break;
};
if(isEmpty(nX,nY)) {
////console.log(`Skipping pixel (${nX},${nY}) (empty)`)
//console.log(`Skipping pixel (${nX},${nY}) (empty)`)
continue;
};
if(!isEmpty(nX,nY,true)) {
@ -1657,9 +1661,9 @@ elements.creeper_head = {
//console.log("Meh.");
};
},
};
};
/*End Main Creeper
/*End Main Creeper
##################
##################
##################
@ -1674,11 +1678,11 @@ elements.creeper_head = {
####### ### ####
####### ### ####
##################
*/
*/
//Angelic Creeper
elements.angelic_creeper = { //let's get this one out of the way first
elements.angelic_creeper = { //let's get this one out of the way first
color: ["#f5ef56", "#fcbddf", "#de8aa8", "#e35d95", "#eb4974", "#ed3ea7", "#d645a3", "#a84556", "#9e4f6c", "#91315b", "#8c4963"],
category: "life",
properties: {
@ -1705,9 +1709,9 @@ elements.angelic_creeper = { //let's get this one out of the way first
},
related: ["angelic_creeper_body","angelic_creeper_head"],
desc: 'A creeper type from <em>Extra Creeper Types</em> <a href="https://www.curseforge.com/minecraft/mc-mods/extra-creeper-types">(CF)</a>. It sends things upward.'
};
};
elements.angelic_creeper_body = {
elements.angelic_creeper_body = {
color: ["#d2d2d2", "#fcbddf", "#de8aa8", "#e35d95", "#eb4974", "#ed3ea7", "#d645a3", "#a84556", "#9e4f6c", "#91315b", "#8c4963"],
category: "life",
hidden: true,
@ -1949,8 +1953,8 @@ elements.angelic_creeper_body = {
};
};
},
},
elements.angelic_creeper_head = {
},
elements.angelic_creeper_head = {
color: ["#f5ef56", "#f0ea4f", "#f0ea60"],
category: "life",
hidden: true,
@ -2227,11 +2231,11 @@ elements.angelic_creeper_head = {
//console.log("Meh.");
};
},
};
};
//Bombing Creeper
elements.bombing_creeper = {
elements.bombing_creeper = {
color: ["#5b8b59", "#3f8738", "#559552", "#479143", "#50b143", "#58c546", "#e83c3c", "#c92a2a", "#f53d3d", "#ad3131"],
category: "life",
properties: {
@ -2258,9 +2262,9 @@ elements.bombing_creeper = {
},
related: ["bombing_creeper_body","bombing_creeper_head"],
desc: 'A creeper type from <em>Extra Creeper Types</em> <a href="https://www.curseforge.com/minecraft/mc-mods/extra-creeper-types">(CF)</a>. It spawns more explosives when it explodes.'
};
};
elements.bombing_creeper_body = {
elements.bombing_creeper_body = {
color: ["#e83c3c", "#c92a2a", "#f53d3d", "#ad3131"],
category: "life",
hidden: true,
@ -2484,9 +2488,9 @@ elements.bombing_creeper_body = {
};
};
},
};
};
elements.bombing_creeper_head = {
elements.bombing_creeper_head = {
color: ["#5B8B59", "#3F8738", "#559552", "#479143", "#50B143", "#58C546"],
category: "life",
hidden: true,
@ -2763,11 +2767,11 @@ elements.bombing_creeper_head = {
//console.log("Meh.");
};
},
};
};
//Hell Creeper
elements.hell_creeper = {
elements.hell_creeper = {
color: ["#D2D2D2", "#ff141e", "#fc3232", "#DFAFAF", "#e84a4a", "#ce7979", "#d95555", "#d53c3c", "#c53636", "#b13333", "#913535", "#954242", "#872828", "#8b4949", "#2b0304"],
category: "life",
properties: {
@ -2794,9 +2798,9 @@ elements.hell_creeper = {
},
related: ["hell_creeper_body","hell_creeper_head"],
desc: 'A creeper type from <em>Extra Creeper Types</em> <a href="https://www.curseforge.com/minecraft/mc-mods/extra-creeper-types">(CF)</a>. It has a small explosion radius, but spawns a lot of fire around its explosion.'
};
};
elements.hell_creeper_body = {
elements.hell_creeper_body = {
color: ["#D2D2D2", "#ff141e", "#fc3232", "#DFAFAF", "#e84a4a", "#ce7979", "#d95555", "#d53c3c", "#c53636", "#b13333", "#913535", "#954242", "#872828", "#8b4949", "#2b0304"],
category: "life",
hidden: true,
@ -3014,9 +3018,9 @@ elements.hell_creeper_body = {
};
};
},
};
};
elements.hell_creeper_head = {
elements.hell_creeper_head = {
color: ["#D2D2D2", "#ff141e", "#fc3232", "#e84a4a", "#b13333", "#913535", "#954242", "#872828", "#8b4949", "#2b0304", "#111111", "#faae3c", "#f5e131"],
category: "life",
hidden: true,
@ -3290,41 +3294,41 @@ elements.hell_creeper_head = {
//console.log("Meh.");
};
},
};
};
/* Creeper generation
___#___#___#___#___#___#___#___#___#___
__#___#___#___#___#___#___#___#___#___#
_#___#___#___#___#___#___#___#___#___#_
#___#___#___#___#___#___#___#___#___#__
___#___#___#___#___#___#___#___#___#___
__#___#___#___#___#___#___#___#___#___#
_#___#___#___#___#___#___#___#___#___#_
#___#___#___#___#___#___#___#___#___#__
___#___#___#___#___#___#___#___#___#___
__#___#___#___#___#___#___#___#___#___#
_#___#___#___#___#___#___#___#___#___#_
#___#___#___#___#___#___#___#___#___#__
___#___#___#___#___#___#___#___#___#___
__#___#___#___#___#___#___#___#___#___#
_#___#___#___#___#___#___#___#___#___#_
#___#___#___#___#___#___#___#___#___#__
*/
/* Creeper generation
___#___#___#___#___#___#___#___#___#___
__#___#___#___#___#___#___#___#___#___#
_#___#___#___#___#___#___#___#___#___#_
#___#___#___#___#___#___#___#___#___#__
___#___#___#___#___#___#___#___#___#___
__#___#___#___#___#___#___#___#___#___#
_#___#___#___#___#___#___#___#___#___#_
#___#___#___#___#___#___#___#___#___#__
___#___#___#___#___#___#___#___#___#___
__#___#___#___#___#___#___#___#___#___#
_#___#___#___#___#___#___#___#___#___#_
#___#___#___#___#___#___#___#___#___#__
___#___#___#___#___#___#___#___#___#___
__#___#___#___#___#___#___#___#___#___#
_#___#___#___#___#___#___#___#___#___#_
#___#___#___#___#___#___#___#___#___#__
*/
//This code is a lot worse than I'd have liked it to be...
urlParams = new URLSearchParams(window.location.search);
urlParams = new URLSearchParams(window.location.search);
//Include generated creepers in Random tool?
if(urlParams.get('creeperIncludeRandom') !== null) { //if the variable exists at all
//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)
} else { //if it doesn't (and it returns null)
creeperIncludeRandom = false
}
}
//Start Creeper Template Functions {
//Start Creeper Template Functions {
autoCreeperPlacerTick = function(pixel) {
var creeperElement = elements[pixel.element].creeperType;
@ -3842,9 +3846,9 @@ if(urlParams.get('creeperIncludeRandom') !== null) { //if the variable exists at
};
};
//End Creeper Template Functions }
//End Creeper Template Functions }
//Start Color Functions and Variables {
//Start Color Functions and Variables {
function sumArray(array) { //Sum of array numbers
return array.reduce((partialSum, a) => partialSum + a, 0);
};
@ -3988,7 +3992,7 @@ if(urlParams.get('creeperIncludeRandom') !== null) { //if the variable exists at
//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]];
//End Color Functions and Variables }
//End Color Functions and Variables }
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
@ -4003,7 +4007,7 @@ if(urlParams.get('creeperIncludeRandom') !== null) { //if the variable exists at
},
};
runAfterLoad(function() {
runAfterAutogen(function() {
creeperElements = Object.keys(elements);
creeperElements.push(["rock","sand"]);
//creeperElements = ["water","steel","dirt",["dirt","sand"],"frostwind","antimatter,acid","fire,nonexist"]; //Test array
@ -4067,10 +4071,13 @@ runAfterLoad(function() {
};
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][0] % 360),slBound(colorsArray[q][1]),slBound(colorsArray[q][2]));
colorObjectArray[q] = hexToRGB(colorsArray[q]); //hex to RGB
var coq = colorObjectArray[q]; //pull the object
colorsArray[q] = `rgb(${coq.r},${coq.g},${coq.b})`; //and change to the RGB from its values
};
//End color gen
@ -4081,6 +4088,7 @@ runAfterLoad(function() {
elements[placerName] = {
creeperType: elementOfCreeper,
color: colorsArray,
colorObject: colorObjectArray,
category: "auto creepers",
properties: {
dead: false,
@ -4098,6 +4106,7 @@ runAfterLoad(function() {
elements[bodyName] = {
creeperType: elementOfCreeper,
color: colorsArray,
colorObject: colorObjectArray,
category: "auto creepers",
hidden: true,
excludeRandom: true,
@ -4133,6 +4142,7 @@ runAfterLoad(function() {
elements[headName] = {
creeperType: elementOfCreeper,
color: colorsArray,
colorObject: colorObjectArray,
category: "auto creepers",
hidden: true,
excludeRandom: true,
@ -4178,11 +4188,11 @@ runAfterLoad(function() {
headBodyObject[headName] = bodyName;
};
});
});
//Standalone generator function
//Standalone generator function
function generateCreeper(creeperElements,isAfterScriptLoading=false) {//it can be a single element, though
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),
@ -4375,4 +4385,9 @@ function generateCreeper(creeperElements,isAfterScriptLoading=false) {//it can b
//console.log("nyetted " + placerName);
};
};
};
} else {
alert(`The ${runAfterAutogenMod} mod is required and has been automatically inserted (reload for this to take effect).`)
enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
};