* syntax for mass generation
to use it, the element input must start with an asterisk *
if it is exactly "*all" (without the quotes), generation will be done for every element
otherwise, you have flags; **the string has to start with an asterisk; do not put an asterisk before any flags besides the first one in the element input string**
if the "noauto" flag is present (regardless of any others), generation will run only on non-generated elements
if the "auto" flag is present, generation will be limited to *only* generated elements; this can be combined with the lower flags:
"nofairies": exclude fairies
"nocreepers": exclude creepers
"noclouds": exclude clouds
"nospouts": exclude spouts
"nobombs": exclude bombs
This commit is contained in:
parent
e0515f765e
commit
13067761de
|
|
@ -95,6 +95,56 @@ elements.generator_prompt = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function parseForLateGenerationParameter(input) {
|
function parseForLateGenerationParameter(input) {
|
||||||
|
if(input.startsWith("*")) {
|
||||||
|
var elemList = Object.keys(elements);
|
||||||
|
input = input.toLowerCase().substring(1);
|
||||||
|
if(input === "all") {
|
||||||
|
return elemList;
|
||||||
|
} else {
|
||||||
|
input = input.split(" "); //'*nocreeper nofairy' to ['nocreeper' 'nofairy']
|
||||||
|
//include no auto elements
|
||||||
|
if(input.includes("noauto")) {
|
||||||
|
return Object.keys(elements).filter(function(name) { return elements[name].autoType === undefined });
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var filteredList = elemList;
|
||||||
|
|
||||||
|
//include only auto elements
|
||||||
|
if(input.includes("auto")) {
|
||||||
|
filteredList = filteredList.filter(function(name) { return elements[name].autoType !== undefined });
|
||||||
|
//console.log("limit to autogens", filteredList.length);
|
||||||
|
};
|
||||||
|
//exclude fairies
|
||||||
|
if(input.includes("nofairy") || input.includes("nofairies")) {
|
||||||
|
filteredList = filteredList.filter(function(name) { return elements[name].autoType !== "fairy" });
|
||||||
|
//console.log("remove fairies", filteredList.length);
|
||||||
|
};
|
||||||
|
//exclude spouts
|
||||||
|
if(input.includes("nospout") || input.includes("nospouts")) {
|
||||||
|
filteredList = filteredList.filter(function(name) { return elements[name].autoType !== "spout" });
|
||||||
|
//console.log("remove spouts", filteredList.length);
|
||||||
|
};
|
||||||
|
//exclude creepers
|
||||||
|
if(input.includes("nocreeper") || input.includes("nocreepers")) {
|
||||||
|
filteredList = filteredList.filter(function(name) { return elements[name].autoType !== "creeper" });
|
||||||
|
//console.log("remove creepers", filteredList.length);
|
||||||
|
};
|
||||||
|
//exclude clouds
|
||||||
|
if(input.includes("nocloud") || input.includes("noclouds")) {
|
||||||
|
filteredList = filteredList.filter(function(name) { return elements[name].autoType !== "cloud" });
|
||||||
|
//console.log("remove clouds", filteredList.length);
|
||||||
|
};
|
||||||
|
//exclude bombs
|
||||||
|
if(input.includes("nobomb") || input.includes("nobombs")) {
|
||||||
|
filteredList = filteredList.filter(function(name) { return elements[name].autoType !== "bomb" });
|
||||||
|
//console.log("remove bombs", filteredList.length);
|
||||||
|
};
|
||||||
|
|
||||||
|
//console.log(input);
|
||||||
|
return filteredList;
|
||||||
|
};
|
||||||
|
};
|
||||||
if(typeof(input) === "string") { //it should be an array, so string check
|
if(typeof(input) === "string") { //it should be an array, so string check
|
||||||
input = input.replace(/ /g,"_");
|
input = input.replace(/ /g,"_");
|
||||||
//console.log("String detected");
|
//console.log("String detected");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue