Merge branch 'R74nCom:main' into main
This commit is contained in:
commit
42c69ff3d6
|
|
@ -9960,6 +9960,7 @@
|
||||||
else { changePixel(pixel, elem2); }
|
else { changePixel(pixel, elem2); }
|
||||||
}
|
}
|
||||||
if (r.func) { r.func(pixel,pixel) }
|
if (r.func) { r.func(pixel,pixel) }
|
||||||
|
if (r.color2) { pixel.color = pixelColorPick(pixel,r.color2) }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ignore: ["sun"],
|
ignore: ["sun"],
|
||||||
|
|
@ -15520,7 +15521,7 @@ window.onload = function() {
|
||||||
return elements[e].excludeRandom != true && elements[e].category != "tools" && !elements[e].tool;
|
return elements[e].excludeRandom != true && elements[e].category != "tools" && !elements[e].tool;
|
||||||
});
|
});
|
||||||
gameCanvas.addEventListener("mousedown", mouseClick);
|
gameCanvas.addEventListener("mousedown", mouseClick);
|
||||||
gameCanvas.addEventListener("mousedown", function(){
|
gameCanvas.addEventListener("mousedown", function(e){
|
||||||
if (elements[currentElement] && elements[currentElement].onMouseDown) {
|
if (elements[currentElement] && elements[currentElement].onMouseDown) {
|
||||||
elements[currentElement].onMouseDown(e);
|
elements[currentElement].onMouseDown(e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
/* TODO
|
||||||
|
- [x] powder heater & coller
|
||||||
|
- [x] block roomtemp
|
||||||
|
- [x] no smoke from cold fire
|
||||||
|
*/
|
||||||
|
|
||||||
|
elements.powder_heater = {
|
||||||
|
category: "machines",
|
||||||
|
behavior: [
|
||||||
|
"XX|HT:2|XX",
|
||||||
|
"HT:2|XX|HT:2",
|
||||||
|
"M2|HT:2 AND M1|M2",
|
||||||
|
],
|
||||||
|
color: "#881111",
|
||||||
|
insulate: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.powder_cooler = {
|
||||||
|
category: "machines",
|
||||||
|
behavior: [
|
||||||
|
"XX|CO:2|XX",
|
||||||
|
"CO:2|XX|CO:2",
|
||||||
|
"M2|CO:2 AND M1|M2",
|
||||||
|
],
|
||||||
|
color: "#111188",
|
||||||
|
insulate: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.powder_superheater = {
|
||||||
|
category: "machines",
|
||||||
|
behavior: [
|
||||||
|
"XX|HT:10|XX",
|
||||||
|
"HT:10|XX|HT:10",
|
||||||
|
"M2|HT:10 AND M1|M2",
|
||||||
|
],
|
||||||
|
color: "#dd1111",
|
||||||
|
insulate: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.powder_freeze = {
|
||||||
|
category: "machines",
|
||||||
|
behavior: [
|
||||||
|
"XX|CO:10|XX",
|
||||||
|
"CO:10|XX|CO:10",
|
||||||
|
"M2|CO:10 AND M1|M2",
|
||||||
|
],
|
||||||
|
color: "#1111dd",
|
||||||
|
insulate: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.roomtemper = {
|
||||||
|
color: "#29632f",
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
tick: function(pixel) {
|
||||||
|
for (var i = 0; i < squareCoords.length; i++) {
|
||||||
|
var coord = squareCoords[i];
|
||||||
|
var x = pixel.x+coord[0];
|
||||||
|
var y = pixel.y+coord[1];
|
||||||
|
if (!isEmpty(x,y, true)) {
|
||||||
|
if(pixelMap[x][y].temp < -230) {
|
||||||
|
pixelMap[x][y].temp = (pixelMap[x][y].temp + 7)
|
||||||
|
} else if(pixelMap[x][y].temp > 270) {
|
||||||
|
pixelMap[x][y].temp = (pixelMap[x][y].temp - 7)
|
||||||
|
} else if (pixelMap[x][y].temp < 20) {
|
||||||
|
pixelMap[x][y].temp = (pixelMap[x][y].temp + 2)
|
||||||
|
} else if (pixelMap[x][y].temp > 20) {
|
||||||
|
pixelMap[x][y].temp = (pixelMap[x][y].temp - 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
category:"machines",
|
||||||
|
state:"solid",
|
||||||
|
insulate: true,
|
||||||
|
noMix: true,
|
||||||
|
movable: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
elements.cold_fire.behavior = [
|
||||||
|
"M1|M1|M1",
|
||||||
|
"M2|DL%8|M2",
|
||||||
|
"XX|M2|XX",
|
||||||
|
]
|
||||||
|
|
@ -153,7 +153,7 @@ class MenuScreen {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets close button visibility. When false the close button will not be added to the menu screen
|
* Sets close button visibility. When false the close button will not be added to the menu screen
|
||||||
* @param {boolean} show Visibility of the close button
|
* @param {boolean} show Visibility of the close g button
|
||||||
*/
|
*/
|
||||||
setShowCloseButton(show) {
|
setShowCloseButton(show) {
|
||||||
this.showCloseButton = show;
|
this.showCloseButton = show;
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,19 @@ const settingType = {
|
||||||
SELECT: [4, null]
|
SELECT: [4, null]
|
||||||
}
|
}
|
||||||
class Setting {
|
class Setting {
|
||||||
constructor (name, storageName, type, disabled = false, defaultValue = null) {
|
constructor (name, storageName, type, disabled = false, defaultValue = null, description = "", customValidator = () => true) {
|
||||||
this.tabName = null;
|
this.tabName = null;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.storageName = storageName;
|
this.storageName = storageName;
|
||||||
this.type = type[0];
|
this.type = type[0];
|
||||||
this.disabled = disabled;
|
this.disabled = disabled;
|
||||||
this.defaultValue = defaultValue ?? type[1];
|
this.defaultValue = defaultValue ?? type[1];
|
||||||
|
this.description = description;
|
||||||
|
this.validate = customValidator;
|
||||||
}
|
}
|
||||||
|
|
||||||
set(value) {
|
set(value) {
|
||||||
|
if (!this.validate(value)) return false;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
const settings = JSON.parse(localStorage.getItem(`${this.tabName}/settings`)) ?? {};
|
const settings = JSON.parse(localStorage.getItem(`${this.tabName}/settings`)) ?? {};
|
||||||
settings[this.name] = value;
|
settings[this.name] = value;
|
||||||
|
|
@ -61,7 +64,7 @@ class Setting {
|
||||||
const id = "betterSettings/" + this.modName + "/" + this.storageName;
|
const id = "betterSettings/" + this.modName + "/" + this.storageName;
|
||||||
const span = document.createElement("span");
|
const span = document.createElement("span");
|
||||||
span.className = "setting-span";
|
span.className = "setting-span";
|
||||||
span.title = 'Default: "' + this.defaultValue + '"' + (this.disabled ? ". This setting is disabled." : "");
|
span.title = 'Default: "' + this.defaultValue + '"' + (this.disabled ? ". This setting is disabled" : "") + (this.description ? `. ${this.description}` : "");
|
||||||
span.innerText = this.name + " ";
|
span.innerText = this.name + " ";
|
||||||
const element = document.createElement("input");
|
const element = document.createElement("input");
|
||||||
switch (this.type) {
|
switch (this.type) {
|
||||||
|
|
@ -162,12 +165,14 @@ class SettingsTab {
|
||||||
if (this.categories.has(category)) this.categories.get(category).push(setting);
|
if (this.categories.has(category)) this.categories.get(category).push(setting);
|
||||||
else this.categories.set(category, [setting]);
|
else this.categories.set(category, [setting]);
|
||||||
this.registry.set(setting.storageName, setting);
|
this.registry.set(setting.storageName, setting);
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
registerSettings(category = "General", ...settings) {
|
registerSettings(category = "General", ...settings) {
|
||||||
for (const setting of settings) {
|
for (const setting of settings) {
|
||||||
this.registerSetting(setting, category);
|
this.registerSetting(setting, category);
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
set(name, value) {
|
set(name, value) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
doElectricity = function (pixel) {
|
||||||
|
if (pixel.charge) {
|
||||||
|
// Check each adjacent pixel, if that pixel's charge is false, set it to the same charge
|
||||||
|
for (var i = 0; i < adjacentCoords.length; i++) {
|
||||||
|
var x = pixel.x+adjacentCoords[i][0];
|
||||||
|
var y = pixel.y+adjacentCoords[i][1];
|
||||||
|
if (!isEmpty(x,y,true)) {
|
||||||
|
var newPixel = pixelMap[x][y];
|
||||||
|
var con = elements[newPixel.element].conduct;
|
||||||
|
if (con == undefined) {continue}
|
||||||
|
if (Math.random() < con) { // If random number is less than conductivity
|
||||||
|
if (!newPixel.charge && !newPixel.chargeCD) {
|
||||||
|
newPixel.charge = 1;
|
||||||
|
if (elements[newPixel.element].colorOn) {
|
||||||
|
newPixel.color = pixelColorPick(newPixel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (elements[newPixel.element].insulate != true) { // Otherwise heat the pixel (Resistance simulation)
|
||||||
|
newPixel.temp += pixel.charge/4;
|
||||||
|
if (con < 0.8) { newPixel.chargeCD = 8; }
|
||||||
|
pixelTempCheck(newPixel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pixel.charge -= 0.25;
|
||||||
|
if (pixel.charge <= 0) {
|
||||||
|
delete pixel.charge;
|
||||||
|
pixel.chargeCD = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Lower charge cooldown
|
||||||
|
else if (pixel.chargeCD) {
|
||||||
|
pixel.chargeCD -= 1;
|
||||||
|
if (pixel.chargeCD <= 0) {
|
||||||
|
delete pixel.chargeCD;
|
||||||
|
if (elements[pixel.element].colorOn) {
|
||||||
|
pixel.color = pixelColorPick(pixel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -257,7 +257,7 @@ if (enabledMods.includes("mods/betterMenuScreens.js")) {
|
||||||
|
|
||||||
// ugly way of doing it but probably works
|
// ugly way of doing it but probably works
|
||||||
const checkType = (key, value) => {
|
const checkType = (key, value) => {
|
||||||
if (key == "behavior" && (typeof value == "function" || (value instanceof Array && value.filter(e => e instanceof Array && e.filter(s => typeof s == "string").length == e.length).length == value.length))) return true;
|
if (key == "behavior" && (typeof value == "function" || (value instanceof Array && value.filter(e => typeof e == "string").length == value.length))) return true;
|
||||||
else if (key == "behavior") return false;
|
else if (key == "behavior") return false;
|
||||||
if (["darkText", "hidden", "insulate", "noMix", "isFood", "forceAutoGen", "customColor", "ignoreAir", "excludeRandom", "burning", "flipX", "flipY", "flippableX", "flippableY"].includes(key) && typeof value != "boolean") return false;
|
if (["darkText", "hidden", "insulate", "noMix", "isFood", "forceAutoGen", "customColor", "ignoreAir", "excludeRandom", "burning", "flipX", "flipY", "flippableX", "flippableY"].includes(key) && typeof value != "boolean") return false;
|
||||||
if (["name", "category", "desc", "alias", "seed", "baby", "state", "stateHigh", "stateHighName", "stateHighColor", "stateLow", "stateLowNmae", "stateLowColor"].includes(key) && typeof value != "string") return false;
|
if (["name", "category", "desc", "alias", "seed", "baby", "state", "stateHigh", "stateHighName", "stateHighColor", "stateLow", "stateLowNmae", "stateLowColor"].includes(key) && typeof value != "string") return false;
|
||||||
|
|
|
||||||
|
|
@ -34,18 +34,19 @@ setView = (n) => {
|
||||||
document.querySelector('span[setting="view"]').children[0].value = view ?? 0;
|
document.querySelector('span[setting="view"]').children[0].value = view ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const i in views) {
|
runAfterLoadList.push(() => {
|
||||||
|
for (const i in views) {
|
||||||
if (i < 4) continue;
|
if (i < 4) continue;
|
||||||
const option = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
option.setAttribute("value", i);
|
option.setAttribute("value", i);
|
||||||
option.innerText = views[i];
|
option.innerText = views[i];
|
||||||
document.querySelector('.setting-span[setting="view"]').querySelector("select").appendChild(option);
|
document.querySelector('.setting-span[setting="view"]').querySelector("select").appendChild(option);
|
||||||
viewKey[i] = views[i];
|
viewKey[i] = views[i];
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const vcrFont = new FontFace("VCR", "url(mods/VCR_OSD_MONO.ttf)");
|
const vcrFont = new FontFace("VCR", "url(mods/VCR_OSD_MONO.ttf)");
|
||||||
vcrFont.load().then(font => {
|
vcrFont.load().then(font => {
|
||||||
console.log(font);
|
|
||||||
document.fonts.add(font);
|
document.fonts.add(font);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2344,3 +2344,27 @@ elements.scuffed_circle_brush = {
|
||||||
createPixel(circleElem, thisx, thisy)
|
createPixel(circleElem, thisx, thisy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elements.spacedust_cola = {
|
||||||
|
color: ["#090033", "#0a0027", "#0a001b", "#0b000f"],
|
||||||
|
behavior: elements.soda.behavior,
|
||||||
|
tempHigh: 104,
|
||||||
|
stateHigh: ["steam", "carbon_dioxide", "spacedust", "spacedust"],
|
||||||
|
category: "liquids",
|
||||||
|
state: "liquid",
|
||||||
|
reactions: {head: {elem1: null, chance: 0.02}},
|
||||||
|
density: elements.tungsten.density,
|
||||||
|
}
|
||||||
|
elements.spacedust = {
|
||||||
|
color: ["#090033", "#0a0027", "#0a001b", "#0b000f", "#090033", "#0a0027", "#0a001b", "#0b000f", "#090033", "#0a0027", "#0a001b", "#0b000f", "#090033", "#0a0027", "#0a001b", "#0b000f", "#090033", "#0a0027", "#0a001b", "#0b000f", "#090033", "#0a0027", "#0a001b", "#0b000f", "#ffffff"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
category: "special",
|
||||||
|
state: "solid",
|
||||||
|
reactions: {
|
||||||
|
"acid": {elem1: null, elem2: ["hydrogen", "helium", "hydrogen", "helium", "hydrogen", "helium", "hydrogen", "hydrogen", "hydrogen", "hydrogen", "metal_scrap"], chance: 0.02},
|
||||||
|
"seltzer": {elem1: null, elem2: "spacedust_cola"},
|
||||||
|
"soda": {elem1: null, elem2: "spacedust_cola"},
|
||||||
|
},
|
||||||
|
density: elements.tungsten.density,
|
||||||
|
}
|
||||||
|
elements.acid.ignore.push("spacedust")
|
||||||
|
elements.acid.ignore.push("spacedust_cola")
|
||||||
|
|
@ -89,6 +89,7 @@ elements.video = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
currentVideoFrames = [];
|
||||||
video.currentTime = 0;
|
video.currentTime = 0;
|
||||||
|
|
||||||
video.onseeked = () => {
|
video.onseeked = () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue