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,3 +1,7 @@
var modName = "mods/mobs.js";
var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js";
if(enabledMods.includes(runAfterAutogenMod)) {
//Prerequisite Functions and Variables //Prerequisite Functions and Variables
headBodyObject = { headBodyObject = {
@ -1534,7 +1538,7 @@ elements.creeper_head = {
break; break;
}; };
if(isEmpty(nX,nY)) { if(isEmpty(nX,nY)) {
////console.log(`Skipping pixel (${nX},${nY}) (empty)`) //console.log(`Skipping pixel (${nX},${nY}) (empty)`)
continue; continue;
}; };
if(!isEmpty(nX,nY,true)) { if(!isEmpty(nX,nY,true)) {
@ -1573,7 +1577,7 @@ elements.creeper_head = {
break; break;
}; };
if(isEmpty(nX,nY)) { if(isEmpty(nX,nY)) {
////console.log(`Skipping pixel (${nX},${nY}) (empty)`) //console.log(`Skipping pixel (${nX},${nY}) (empty)`)
continue; continue;
}; };
if(!isEmpty(nX,nY,true)) { if(!isEmpty(nX,nY,true)) {
@ -4003,7 +4007,7 @@ if(urlParams.get('creeperIncludeRandom') !== null) { //if the variable exists at
}, },
}; };
runAfterLoad(function() { runAfterAutogen(function() {
creeperElements = Object.keys(elements); creeperElements = Object.keys(elements);
creeperElements.push(["rock","sand"]); creeperElements.push(["rock","sand"]);
//creeperElements = ["water","steel","dirt",["dirt","sand"],"frostwind","antimatter,acid","fire,nonexist"]; //Test array //creeperElements = ["water","steel","dirt",["dirt","sand"],"frostwind","antimatter,acid","fire,nonexist"]; //Test array
@ -4067,10 +4071,13 @@ runAfterLoad(function() {
}; };
var preColor = rgbStringToHSL(startColor); var preColor = rgbStringToHSL(startColor);
var colorsArray = [preColor, preColor, preColor, preColor, preColor, preColor, preColor, preColor, preColor, preColor] var colorsArray = [preColor, preColor, preColor, preColor, preColor, preColor, preColor, preColor, preColor, preColor]
var colorObjectArray = [];
for(q = 0; q < hslOffsets.length; q++) { for(q = 0; q < hslOffsets.length; q++) {
colorsArray[q] = addArraysInPairs(colorsArray[q],hslOffsets[q]); colorsArray[q] = addArraysInPairs(colorsArray[q],hslOffsets[q]);
colorsArray[q] = hslToHex((colorsArray[q][0] % 360),slBound(colorsArray[q][1]),slBound(colorsArray[q][2])); 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 //End color gen
@ -4081,6 +4088,7 @@ runAfterLoad(function() {
elements[placerName] = { elements[placerName] = {
creeperType: elementOfCreeper, creeperType: elementOfCreeper,
color: colorsArray, color: colorsArray,
colorObject: colorObjectArray,
category: "auto creepers", category: "auto creepers",
properties: { properties: {
dead: false, dead: false,
@ -4098,6 +4106,7 @@ runAfterLoad(function() {
elements[bodyName] = { elements[bodyName] = {
creeperType: elementOfCreeper, creeperType: elementOfCreeper,
color: colorsArray, color: colorsArray,
colorObject: colorObjectArray,
category: "auto creepers", category: "auto creepers",
hidden: true, hidden: true,
excludeRandom: true, excludeRandom: true,
@ -4133,6 +4142,7 @@ runAfterLoad(function() {
elements[headName] = { elements[headName] = {
creeperType: elementOfCreeper, creeperType: elementOfCreeper,
color: colorsArray, color: colorsArray,
colorObject: colorObjectArray,
category: "auto creepers", category: "auto creepers",
hidden: true, hidden: true,
excludeRandom: true, excludeRandom: true,
@ -4376,3 +4386,8 @@ function generateCreeper(creeperElements,isAfterScriptLoading=false) {//it can b
}; };
}; };
}; };
} 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));
};