dep
This commit is contained in:
parent
a1f7c8f6ea
commit
e7b7e7c722
128
mods/test_2.js
128
mods/test_2.js
|
|
@ -1,3 +1,7 @@
|
|||
var modName = "mods/test_2.js";
|
||||
var libraryMod = "mods/code_library.js";
|
||||
|
||||
if(enabledMods.includes(libraryMod)) {
|
||||
alert("this requires code library and i am out of time to add a dependency if-block");
|
||||
|
||||
function defaultIonizationColorFormula(state) {
|
||||
|
|
@ -13,7 +17,11 @@ function thirdTestDefaultIonizationColorFormula(state) {
|
|||
return convertColorFormats({r: lum, g: lum, b: lum},"hex");
|
||||
};
|
||||
|
||||
scientificElements = {
|
||||
function fourthTestDefaultIonizationColorFormula(state) {
|
||||
return convertColorFormats({r: 0x9f + (state * 4), g: 0xff - state, b: 0x7f - (state * 3)},"hex");
|
||||
};
|
||||
|
||||
scientificElementoids = {
|
||||
defaultium: { sublimates: false, solidColor: "#EEEEEE", solidDensity: 1000, meltingPoint: 1200, solidHardness: 0.8,
|
||||
liquidColor: "#FFFFFF", liquidDensity: 850, liquidViscosity: 4000, boilingPoint: 2500,
|
||||
gasColor: "#FFDDFF", gasDensity: 3.5,
|
||||
|
|
@ -34,9 +42,22 @@ scientificElements = {
|
|||
ionizationEnergies_eV: [11,22,33,44,55,66,77,88,99,110,121,1337],
|
||||
ionizationColorFormula: thirdTestDefaultIonizationColorFormula,
|
||||
defaultState: "gas"
|
||||
},
|
||||
|
||||
trollolium: { sublimates: false, solidColor: "#559933", solidDensity: 6969, meltingPoint: 1337, solidHardness: 0.69,
|
||||
liquidColor: "#55aa33", liquidDensity: 4201, liquidViscosity: 12345, boilingPoint: 4444,
|
||||
gasColor: "#9fff7f", gasDensity: 2.2,
|
||||
ionizationEnergies_eV: [],
|
||||
ionizationColorFormula: fourthTestDefaultIonizationColorFormula,
|
||||
defaultState: "solid"
|
||||
}
|
||||
};
|
||||
|
||||
for(var q = 1; q < 30; q++) {
|
||||
scientificElementoids.trollolium.ionizationEnergies_eV.push(q);
|
||||
};
|
||||
scientificElementoids.trollolium.ionizationEnergies_eV.push(747.5802880508742);
|
||||
|
||||
behaviors.HOT_GAS = [
|
||||
"CR:fire%0.25 AND M2|M1|CR:fire%0.25 AND M2",
|
||||
"M1|XX|M1",
|
||||
|
|
@ -49,10 +70,80 @@ behaviors.SUPERHOT_GAS = [
|
|||
"CR:plasma%0.1 AND M2|M1|CR:plasma%0.1 AND M2"
|
||||
],
|
||||
|
||||
tupleAdverbs = ['Singly', 'Doubly', 'Triply', 'Quadruply', 'Quintuply', 'Sextuply', 'Septuply', 'Octuply', 'Nonuply', 'Decuply', 'Undecuply', 'Duodecuply', 'Tredecuply', 'Quattuordecuply', 'Quindecuply', 'Sexdecuply', 'Septendecuply', 'Octodecuply', 'Novemdecuply', 'Vigintuply', 'Unvigintuply', 'Duovigintuply', 'Trevigintuply', 'Quattuorvigintuply', 'Quinvigintuply', 'Sexvigintuply', 'Septenvigintuply', 'Octovigintuply', 'Novemvigintuply', 'Trigintuply'].map(x => x.toLowerCase());
|
||||
first9 = [ "singly", "doubly", "triply", "quadruply", "quintuply", "sextuply", "septuply", "octuply", "nonuply", "ERROR" ];
|
||||
|
||||
for(element in scientificElements) {
|
||||
var elemInfo = scientificElements[element];
|
||||
ones = ["", "un", "duo", "tre", "quattuor", "quin", "sex", "septen", "octo", "novem", "ERROR"];
|
||||
|
||||
tens = ["", "dec", "vigint", "trigint", "quadragint", "quinquagint", "sexagint", "septuagint", "octogint", "nonagint", "ERROR"];
|
||||
|
||||
hundreds = ["", "cent", "ducent", "trecent", "quadringent", "quingent", "sescent", "septingent", "octingent", "nongent", "ERROR"];
|
||||
|
||||
thousands = ["", "mill", "dumill", "trimill", "quadrimill", "quinmill", "sexmill", "septimill", "octimill", "nonimill", "ERROR"];
|
||||
|
||||
function getTupleAdverb(number) { //this code is horrendous
|
||||
if(number == "0") { return "nullly" };
|
||||
number--;
|
||||
if(number <= 8) {
|
||||
return first9[number];
|
||||
} else {
|
||||
number++;
|
||||
|
||||
var onesPlace = Math.floor(number % 10);
|
||||
var tensPlace = Math.floor((number / 10) % 10);
|
||||
var hundredsPlace = Math.floor((number / 100) % 10);
|
||||
var thousandsPlace = Math.floor((number / 1000) % 10);
|
||||
|
||||
var tupleOnes = ones[onesPlace];
|
||||
var tupleTens = tens[tensPlace];
|
||||
var tupleHundreds = hundreds[hundredsPlace];
|
||||
var tupleThousands = thousands[thousandsPlace];
|
||||
|
||||
if(tupleOnes.endsWith("tre")) {
|
||||
if(!tupleTens.startsWith("d") && !tupleTens.startsWith("s")) { //tre is not tres before d, and not as many people double the S
|
||||
tupleOnes = "tres";
|
||||
//this entire code block is basically so we can use trescentuple for 103-uple and trecentuple for 300-uple
|
||||
};
|
||||
};
|
||||
|
||||
if(number > 100 && tupleTens !== "") { //tens before something have an number after them
|
||||
tupleTens += "number";
|
||||
};
|
||||
|
||||
if(number > 1000 && tupleHundreds !== "") { //hundreds before something have an number after them
|
||||
tupleHundreds += "number";
|
||||
};
|
||||
|
||||
tuple = tupleOnes + tupleTens + tupleHundreds + tupleThousands + "uply";
|
||||
|
||||
return tuple;
|
||||
};
|
||||
};
|
||||
|
||||
function makeScrapColor(colorIn) {
|
||||
var colorInput = colorIn; //side effects?
|
||||
|
||||
//make sure in is array
|
||||
if(!(colorInput instanceof Array)) {
|
||||
colorInput = [colorInput];
|
||||
};
|
||||
|
||||
colorInput = colorInput.map(color => convertColorFormats(color,"hex"));
|
||||
|
||||
//prepare final color
|
||||
var finalColor = [];
|
||||
|
||||
var lumOffsets = [1.2,1,0.8];
|
||||
for(var i in colorInput) {
|
||||
for(var j in lumOffsets) {
|
||||
finalColor.push(changeLuminance(colorInput[i],lumOffsets[j],"multiply","hex"));
|
||||
};
|
||||
};
|
||||
|
||||
return finalColor;
|
||||
};
|
||||
|
||||
for(element in scientificElementoids) {
|
||||
var elemInfo = scientificElementoids[element];
|
||||
|
||||
if(!elemInfo.liquidColor) {
|
||||
elemInfo.liquidColor = makeMoltenColor(elemInfo.solidColor);
|
||||
|
|
@ -64,6 +155,7 @@ for(element in scientificElements) {
|
|||
|
||||
var names = {
|
||||
solid: elemInfo.meltingPoint <= 0 ? element + "_ice" : "solid_" + element,
|
||||
powder: elemInfo.meltingPoint <= 0 ? element + "_snow" : "powdered_" + element,
|
||||
liquid: (elemInfo.meltingPoint > 200 ? "molten_" : "liquid_") + element,
|
||||
gas: element + "_gas"
|
||||
};
|
||||
|
|
@ -83,14 +175,27 @@ for(element in scientificElements) {
|
|||
elements[names.solid].color = elemInfo.solidColor;
|
||||
elements[names.solid].density = elemInfo.solidDensity;
|
||||
elements[names.solid].hardness = elemInfo.solidHardness;
|
||||
elements[names.solid].breakInto = names.powder;
|
||||
elements[names.solid].temp = Math.min(20, elemInfo.meltingPoint * 1.1);
|
||||
elements[names.solid].tempHigh = elemInfo.meltingPoint;
|
||||
elements[names.solid].stateHigh = elemInfo.sublimates ? names.gas : names.liquid;
|
||||
elements[names.solid].behavior = behaviors.POWDER;
|
||||
elements[names.solid].behavior = behaviors.WALL;
|
||||
elements[names.solid].category = "powders";
|
||||
elements[names.solid].state = "solid";
|
||||
elements[names.solid].hidden = true;
|
||||
|
||||
elements[names.powder] ??= {};
|
||||
elements[names.powder].color = makeScrapColor(elemInfo.solidColor);
|
||||
elements[names.powder].density = elemInfo.solidDensity * 0.7;
|
||||
elements[names.powder].hardness = elemInfo.solidHardness * 0.7;
|
||||
elements[names.powder].temp = Math.min(20, elemInfo.meltingPoint * 1.1);
|
||||
elements[names.powder].tempHigh = elemInfo.meltingPoint;
|
||||
elements[names.powder].stateHigh = elemInfo.sublimates ? names.gas : names.liquid;
|
||||
elements[names.powder].behavior = behaviors.POWDER;
|
||||
elements[names.powder].category = "powders";
|
||||
elements[names.powder].state = "powder";
|
||||
elements[names.powder].hidden = true;
|
||||
|
||||
if(elemInfo.sublimates != true) {
|
||||
elements[names.liquid] ??= {};
|
||||
elements[names.liquid].color = elemInfo.liquidColor;
|
||||
|
|
@ -126,9 +231,9 @@ for(element in scientificElements) {
|
|||
|
||||
for(j in ionizationTemperatures) {
|
||||
j = parseInt(j); // for some reason JS is suddenly deciding to use strings for array iterators
|
||||
var plasmaName = (tupleAdverbs[j] + "_ionized_" + element).replace("singly_","");
|
||||
var lastPlasmaName = (tupleAdverbs[j - 1] + "_ionized_" + element).replace("singly_","");
|
||||
var nextPlasmaName = (tupleAdverbs[j + 1] + "_ionized_" + element).replace("singly_","");
|
||||
var plasmaName = (getTupleAdverb(j + 1) + "_ionized_" + element).replace("singly_","");
|
||||
var lastPlasmaName = (getTupleAdverb(j) + "_ionized_" + element).replace("singly_","");
|
||||
var nextPlasmaName = (getTupleAdverb(j + 2) + "_ionized_" + element).replace("singly_","");
|
||||
var plasmaTemp = ionizationTemperatures[j];
|
||||
|
||||
elements[plasmaName] = {
|
||||
|
|
@ -145,7 +250,7 @@ for(element in scientificElements) {
|
|||
|
||||
if(j < lastTempsIndex) {
|
||||
elements[plasmaName].tempHigh = ionizationTemperatures[j + 1];
|
||||
//console.log(j,tupleAdverbs[j],nextPlasmaName);
|
||||
//console.log(j,getTupleAdverb(j),nextPlasmaName);
|
||||
elements[plasmaName].stateHigh = nextPlasmaName;
|
||||
};
|
||||
};
|
||||
|
|
@ -153,3 +258,8 @@ for(element in scientificElements) {
|
|||
|
||||
elements[names[elemInfo.defaultState]].hidden = false;
|
||||
};
|
||||
} else {
|
||||
alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`)
|
||||
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod)
|
||||
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue