add illogic catcher code
This commit is contained in:
parent
9ffff583e8
commit
69df2c5dd4
|
|
@ -41,7 +41,48 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)
|
||||||
category: "fey",
|
category: "fey",
|
||||||
}
|
}
|
||||||
|
|
||||||
excludedFairyElements = [];
|
var excludedFairyElements = []
|
||||||
|
var backupCategoryWhitelist = ["land","powders","weapons","food","life","corruption","states","fey","Fantastic Creatures","dyes","energy liquids","random liquids","random gases","random rocks"];
|
||||||
|
var backupElementWhitelist = ["mercury", "chalcopyrite_ore", "chalcopyrite_dust", "copper_concentrate", "fluxed_copper_concentrate", "unignited_pyrestone", "ignited_pyrestone", "everfire_dust", "extinguished_everfire_dust", "mistake", "polusium_oxide", "vaporized_polusium_oxide", "glowstone_dust", "redstone_dust", "soul_mud", "wet_soul_sand", "nitrogen_snow", "fusion_catalyst", "coal", "coal_coke", "blast_furnace_fuel", "molten_mythril"];
|
||||||
|
//forces elements that logically should be fairied, but are refused even though the condition is true, to be fairied
|
||||||
|
function defaultFairyCondition(name) {
|
||||||
|
if(typeof(elements[name]) !== "object") {
|
||||||
|
throw new Error(`Nonexistent element ${name}`);
|
||||||
|
};
|
||||||
|
var info = elements[name];
|
||||||
|
//console.log(`${name} (${JSON.stringify(elements[name])})`);
|
||||||
|
if(typeof(info.state) === "undefined") {
|
||||||
|
var state = null;
|
||||||
|
} else {
|
||||||
|
var state = info.state;
|
||||||
|
};
|
||||||
|
if(typeof(info.category) === "undefined") {
|
||||||
|
var category = "other";
|
||||||
|
} else {
|
||||||
|
var category = info.category;
|
||||||
|
};
|
||||||
|
if(excludedFairyElements.includes(name)) {
|
||||||
|
return false
|
||||||
|
};
|
||||||
|
var include = false;
|
||||||
|
if(["liquid","gas"].includes(state)) {
|
||||||
|
include = true;
|
||||||
|
};
|
||||||
|
if(info.movable) {
|
||||||
|
include = true;
|
||||||
|
};
|
||||||
|
if(backupCategoryWhitelist.includes(category)) {
|
||||||
|
include = true;
|
||||||
|
};
|
||||||
|
if(backupElementWhitelist.includes(name)) {
|
||||||
|
include = true;
|
||||||
|
};
|
||||||
|
if(category.includes("mudstone")) {
|
||||||
|
include = true;
|
||||||
|
};
|
||||||
|
//console.log(include);
|
||||||
|
return include;
|
||||||
|
};
|
||||||
|
|
||||||
if(urlParams.get('fairyIncludeRandom') !== null) { //if the variable exists at all
|
if(urlParams.get('fairyIncludeRandom') !== null) { //if the variable exists at all
|
||||||
fairyIncludeRandom = true
|
fairyIncludeRandom = true
|
||||||
|
|
@ -216,7 +257,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)
|
||||||
|
|
||||||
runAfterAutogen(function() {
|
runAfterAutogen(function() {
|
||||||
fairyArray = Object.keys(elements).filter(function(e) { //same criteria as spouts
|
fairyArray = Object.keys(elements).filter(function(e) { //same criteria as spouts
|
||||||
return (elements[e].state == "liquid" || elements[e].state == "gas" || elements[e].movable) && !excludedFairyElements.includes(elements[e]);
|
return (defaultFairyCondition(e));
|
||||||
});
|
});
|
||||||
generateFairy(fairyArray,false);
|
generateFairy(fairyArray,false);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue