jinsoulite and alkahest handling

This commit is contained in:
Laetitia (O-01-67) 2022-12-20 14:38:58 -05:00 committed by GitHub
parent ae69e7132c
commit a031b476c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 51 additions and 1 deletions

View File

@ -273,6 +273,35 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
var newPixel = pixelMap[fX][fY];
var newElement = newPixel.element;
if(newElement !== testName) {
//Jinsoulite handling
if(jinsouliteSpreadWhitelist && jinsouliteSpreadWhitelist.includes(newPixel.element)) {
if(newPixel.value > 0) { //if jinsoulitoid and value is positive
//if compressor has no recorded water, initialize to zero
if(typeof(pixel.absorbed.water) === "undefined") { pixel.absorbed.water = 0 };
//add jinsoulite's water to compressor water
pixel.absorbed.water += newPixel.value;
};
};
//Alkahest handling
if(newPixel.element === "alkahest") {
//get properties that are actually elements
var elementEntries = Object.keys(newPixel).filter(function(key) { return elementExists(key) });
for(i = 0; i < elementEntries.length; i++) {
//iterate through element properties
//store elemname for readability
var key = elementEntries[i];
//store amount for readability
var value = newPixel[key];
//initialize nonexistent names
if(typeof(pixel.absorbed[key]) === "undefined") {
pixel.absorbed[key] = 0;
};
//add amounts
pixel.absorbed[key] += value;
};
};
if(typeof(pixel.absorbed[newElement]) === "undefined") {
pixel.absorbed[newElement] = 0;
};
@ -298,6 +327,27 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
};
};
};
/*
for(q = -2; q <= 2; q++) {
for(q2 = -2; q2 <= 2; q2++) {
if(Object.keys(pixel.absorbed).length > 0) {
for(elementName in pixel.absorbed) {
if(pixel.absorbed[elementName] >= singularityNumber) {
if(isEmpty(outputPos.x+q,outputPos.y+q2,false)) {
if(!elementExists(`${elementName}_singularity`)) {
generateSingularity(elementName,true);
};
createPixel(`${elementName}_singularity`,outputPos.x+q,outputPos.y+q2);
pixel.absorbed[elementName] -= singularityNumber;
} else {
break;
};
};
};
};
};
};
*/
},
};
@ -325,4 +375,4 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) };
alert(`The "${runAfterAutogenMod}" and "${libraryMod}" mods are required; any missing mods in this list have been automatically inserted (reload for this to take effect).`)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
};
};