Merge branch 'R74nCom:main' into main

This commit is contained in:
kaeud 2024-03-23 12:35:05 +07:00 committed by GitHub
commit c30b84ccbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 191 additions and 66 deletions

View File

@ -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);
} }

View File

@ -35,7 +35,7 @@
"rock":"Stein", "rock":"Stein",
"rock_wall":"Steinwand", "rock_wall":"Steinwand",
"mudstone":"Schlammstein", "mudstone":"Schlammstein",
"packed_sand":"Komprimierter Sand", "packed_sand":"Komprimierter_Sand",
"plant":"Pflanze", "plant":"Pflanze",
"dead_plant":"Tote_pflanze", "dead_plant":"Tote_pflanze",
"frozen_plant":"Gefrorene_pflanze", "frozen_plant":"Gefrorene_pflanze",
@ -274,7 +274,7 @@
"homunculus":"Homunkulus", "homunculus":"Homunkulus",
"butter":"Butter", "butter":"Butter",
"cheese":"Käse", "cheese":"Käse",
"rotten_cheese":"Verrotteter Käse", "rotten_cheese":"Verrotteter_Käse",
"chocolate":"Schokolade", "chocolate":"Schokolade",
"grape":"Traube", "grape":"Traube",
"vinegar":"Essig", "vinegar":"Essig",
@ -523,21 +523,21 @@
"molten_potassium_salt":"Geschmolzenes_Kaliumsalz", "molten_potassium_salt":"Geschmolzenes_Kaliumsalz",
"molten_sodium_acetate":"Natriumacetat", "molten_sodium_acetate":"Natriumacetat",
"frozen_nitro":"Gefrorenes_Nitro", "frozen_nitro":"Gefrorenes_Nitro",
"cured_meat": "", "cured_meat": "Geheiltes_Fleisch",
"nut_oil": "", "nut_oil": "Nussöl",
"grease": "", "grease": "Fettöl",
"fat": "", "fat": "Fett",
"potassium": "", "potassium": "Kalium",
"molten_potassium": "", "molten_potassium": "Geschmolzene_Kalium",
"magnesium": "", "magnesium": "Magnesium",
"molten_magnesium": "", "molten_magnesium": "Geschmolzene_Magnesium",
"sandstorm": "", "sandstorm": "Sandsturm",
"caustic_potash": "", "caustic_potash": "Kaustisches_Kali",
"antibomb": "", "antibomb": "Antibombe",
"tornado": "", "tornado": "Tornado",
"earthquake": "", "earthquake": "Erdbeben",
"tsunami": "", "tsunami": "Tsunami",
"blaster": "", "blaster": "Blaster",
"propane_ice": "", "propane_ice": "Propan_Eis",
"molten_caustic_potash": "" "molten_caustic_potash": "Geschmolzene_Kaustisches_Kali"
} }

View File

@ -341,8 +341,8 @@
"poison_gas":"", "poison_gas":"",
"poison_ice":"", "poison_ice":"",
"antidote":"telo_pi_weka_telo_ike", "antidote":"telo_pi_weka_telo_ike",
"tea":"", "tea":"telo_kasi",
"coffee":"", "coffee":"telo_pimeja_pi_kili_lili",
"honey":"telo_jelo_suwi_pi_tan_pipi_jelo", "honey":"telo_jelo_suwi_pi_tan_pipi_jelo",
"sap":"", "sap":"",
"amber":"", "amber":"",
@ -389,9 +389,9 @@
"fire_cloud":"", "fire_cloud":"",
"color_smoke":"", "color_smoke":"",
"spray_paint":"", "spray_paint":"",
"led_r":"", "led_r":"ilo_suno_pi_loje",
"led_g":"", "led_g":"ilo_suno_pi_laso_kasi",
"led_b":"", "led_b":"ilo_suno_pi_laso_sewi",
"sulfur":"", "sulfur":"",
"molten_sulfur":"", "molten_sulfur":"",
"sulfur_gas":"", "sulfur_gas":"",
@ -523,17 +523,17 @@
"molten_potassium_salt":"", "molten_potassium_salt":"",
"molten_sodium_acetate":"", "molten_sodium_acetate":"",
"frozen_nitro":"", "frozen_nitro":"",
"cured_meat": "", "cured_meat": "moku soweli pi ko pilin musi",
"nut_oil": "", "nut_oil": "telo_jelo_pi_ko_kili_lili",
"grease": "", "grease": "telo_jelo_pi_moku_soweli",
"fat": "", "fat": "kiwen_walo_pi_moku_soweli",
"potassium": "", "potassium": "kiwen_pi_telo_pakala",
"molten_potassium": "", "molten_potassium": "",
"magnesium": "", "magnesium": "kiwen_pi_kiwen_walo_sijelo",
"molten_magnesium": "", "molten_magnesium": "",
"sandstorm": "", "sandstorm": "",
"caustic_potash": "", "caustic_potash": "",
"antibomb": "", "antibomb": "kiwen_pakala_pi_pana_ijo",
"tornado": "", "tornado": "",
"earthquake": "", "earthquake": "",
"tsunami": "", "tsunami": "",

View File

@ -240,9 +240,9 @@
"brass":"", "brass":"",
"bronze":"", "bronze":"",
"sterling":"", "sterling":"",
"gallium":"", "gallium":"",
"molten_gallium":"", "molten_gallium":"熔融镓",
"gallium_gas":"", "gallium_gas":"镓气",
"rose_gold":"玫瑰金", "rose_gold":"玫瑰金",
"purple_gold":"紫金", "purple_gold":"紫金",
"blue_gold":"蓝金", "blue_gold":"蓝金",
@ -304,9 +304,9 @@
"candy":"糖果", "candy":"糖果",
"coffee_bean":"咖啡豆", "coffee_bean":"咖啡豆",
"coffee_ground":"咖啡粉", "coffee_ground":"咖啡粉",
"nut":"", "nut":"花生",
"nut_meat":"", "nut_meat":"花生碎",
"nut_butter":"", "nut_butter":"花生酱",
"jelly":"布丁", "jelly":"布丁",
"baking_soda":"苏打粉", "baking_soda":"苏打粉",
"yogurt":"", "yogurt":"",
@ -331,8 +331,8 @@
"dye":"染料", "dye":"染料",
"ink":"墨水", "ink":"墨水",
"mercury":"汞", "mercury":"汞",
"mercury_gas":"", "mercury_gas":"汞气",
"solid_mercury":"", "solid_mercury":"固体汞",
"blood":"血", "blood":"血",
"vaccine":"疫苗", "vaccine":"疫苗",
"antibody":"", "antibody":"",
@ -346,11 +346,11 @@
"honey":"蜂蜜", "honey":"蜂蜜",
"sap":"树叶", "sap":"树叶",
"amber":"", "amber":"",
"caramel":"", "caramel":"焦糖",
"molasses":"", "molasses":"",
"ketchup":"蕃茄酱", "ketchup":"蕃茄酱",
"mayo":"", "mayo":"蛋黄酱",
"melted_chocolate":"", "melted_chocolate":"熔融巧克力",
"liquid_hydrogen":"", "liquid_hydrogen":"",
"liquid_oxygen":"", "liquid_oxygen":"",
"liquid_nitrogen":"", "liquid_nitrogen":"",
@ -372,7 +372,7 @@
"neon":"氖气", "neon":"氖气",
"liquid_neon":"", "liquid_neon":"",
"smog":"", "smog":"",
"stench":"", "stench":"",
"liquid_stench":"", "liquid_stench":"",
"fragrance":"香水", "fragrance":"香水",
"perfume":"香水", "perfume":"香水",
@ -406,8 +406,8 @@
"neutron":"", "neutron":"",
"proton":"", "proton":"",
"electric":"电", "electric":"电",
"uranium":"", "uranium":"",
"molten_uranium":"", "molten_uranium":"熔融铀",
"diamond":"钻石", "diamond":"钻石",
"gold_coin":"硬币", "gold_coin":"硬币",
"rust":"", "rust":"",
@ -442,7 +442,7 @@
"room_temp":"", "room_temp":"",
"positron":"", "positron":"",
"tnt":"", "tnt":"",
"c4":"", "c4":"C4",
"grenade":"", "grenade":"",
"dynamite":"", "dynamite":"",
"gunpowder":"", "gunpowder":"",
@ -503,7 +503,7 @@
"molten_pyrite":"", "molten_pyrite":"",
"broth_ice":"", "broth_ice":"",
"frozen_vinegar":"", "frozen_vinegar":"",
"sauce_ice":"", "sauce_ice":"酱冰",
"alcohol_ice":"酒冰", "alcohol_ice":"酒冰",
"bleach_ice":"", "bleach_ice":"",
"chlorine_ice":"", "chlorine_ice":"",
@ -524,9 +524,9 @@
"molten_sodium_acetate":"", "molten_sodium_acetate":"",
"frozen_nitro":"", "frozen_nitro":"",
"cured_meat": "", "cured_meat": "",
"nut_oil": "", "nut_oil": "花生油",
"grease": "", "grease": "",
"fat": "", "fat": "",
"potassium": "", "potassium": "",
"molten_potassium": "", "molten_potassium": "",
"magnesium": "", "magnesium": "",

View File

@ -146,6 +146,7 @@
<tr><td>replace_all.js</td><td>Adds a way to replace every pixel of an element with another element<br><a href="https://github.com/R74nCom/sandboxels/commit/0066cea82345a5bc3a990df858239104e8ca9d44">Read the commit description for usage</a></td><td>Alice</td></tr> <tr><td>replace_all.js</td><td>Adds a way to replace every pixel of an element with another element<br><a href="https://github.com/R74nCom/sandboxels/commit/0066cea82345a5bc3a990df858239104e8ca9d44">Read the commit description for usage</a></td><td>Alice</td></tr>
<tr><td>replace.js</td><td>Adds a tool that replaces every pixel of a specified element with another specified element. (The prompt to specify these is toggled by pressing " or by the button in the element description)</td><td>Alice</td></tr> <tr><td>replace.js</td><td>Adds a tool that replaces every pixel of a specified element with another specified element. (The prompt to specify these is toggled by pressing " or by the button in the element description)</td><td>Alice</td></tr>
<tr><td>save_loading.js</td><td>Adds the ability to save and load scenes from files (See the info page of the element)</td><td>Alice</td></tr> <tr><td>save_loading.js</td><td>Adds the ability to save and load scenes from files (See the info page of the element)</td><td>Alice</td></tr>
<tr><td>selective_paint.js</td><td>Adds a tool to paint only selected elements</td><td>SquareScreamYT</td></tr>
<tr><td>stripe_paint.js</td><td>Adds a tool to paint with stripes</td><td>Alice</td></tr> <tr><td>stripe_paint.js</td><td>Adds a tool to paint with stripes</td><td>Alice</td></tr>
<tr><td>the_ground.js</td><td>Adds several rock types, worldgen settings, and gemstones</td><td>Alice</td></tr> <tr><td>the_ground.js</td><td>Adds several rock types, worldgen settings, and gemstones</td><td>Alice</td></tr>

View File

@ -2,7 +2,7 @@
Created by SquareScreamYT <@918475812884344852> and RealerRaddler <@914371295561535508> Created by SquareScreamYT <@918475812884344852> and RealerRaddler <@914371295561535508>
Thanks to Alice <@697799964985786450>, nousernamefound <@316383921346707468>, Adora the Transfem <@778753696804765696> and Fioushemastor <@738828785482203189> for helping :) Thanks to Alice <@697799964985786450>, nousernamefound <@316383921346707468>, Adora the Transfem <@778753696804765696> and Fioushemastor <@738828785482203189> for helping :)
v1.10.1 v1.10.2
you can support me at my youtube: https://youtube.com/@sqec you can support me at my youtube: https://youtube.com/@sqec
@ -328,6 +328,12 @@ Changelog (v1.10.1)
Changelog (v1.10.2)
- added chocolate chip, sprinkles and topping explosions
*/ */
/* /*
@ -6420,3 +6426,16 @@ elements.tapioca_leaves = {
state: "solid", state: "solid",
density: 1050 density: 1050
} }
elements.sprinkle_bomb = {
color: ["#eb726a", "#ebca6a", "#88eb6a", "#6aaceb", "#eb6ade"],
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"XX|M1 AND EX:10>sprinkles|XX",
],
category: "food",
state: "solid",
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
}

View File

@ -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;

View File

@ -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) {

42
mods/electricityTest.js Normal file
View File

@ -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);
}
}
}
}

View File

@ -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;

View File

@ -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(() => {
if (i < 4) continue; for (const i in views) {
const option = document.createElement("option"); if (i < 4) continue;
option.setAttribute("value", i); const option = document.createElement("option");
option.innerText = views[i]; option.setAttribute("value", i);
document.querySelector('.setting-span[setting="view"]').querySelector("select").appendChild(option); option.innerText = views[i];
viewKey[i] = views[i]; document.querySelector('.setting-span[setting="view"]').querySelector("select").appendChild(option);
} 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);
}) })

View File

@ -2344,3 +2344,28 @@ 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")
elements.sun.breakInto = "spacedust"

30
mods/selective_paint.js Normal file
View File

@ -0,0 +1,30 @@
selectivePaintElem = ""
elements.selective_paint = {
color: ["#c27070","#c29c70","#c2c270","#70c270","#70c2c2","#7070c2","#c270c2"],
onSelect: function() {
var answer = prompt("Please input the desired element to paint. It will not work if you enter multiple elements types while paused.",(selectivePaintElem||undefined));
if (!answer) { return }
selectivePaintElem = mostSimilarElement(answer);
},
tool: function(pixel) {
if (pixel.element == selectivePaintElem) {
if (!shiftDown) {
pixel.color = pixelColorPick(pixel,currentColor)
}
else {
// convert the hex of currentColor to rgb and set it as a string
var rgb = currentColor.replace("#","").match(/.{1,2}/g);
for (var i = 0; i < rgb.length; i++) {
rgb[i] = parseInt(rgb[i],16);
}
pixel.color = "rgb(" + rgb.join(",") + ")"
}
delete pixel.origColor;
}
},
customColor: true,
category: "tools",
canPlace: false,
excludeRandom:true,
desc: "Use on selected pixels to change their color."
}

View File

@ -89,6 +89,7 @@ elements.video = {
} }
}; };
currentVideoFrames = [];
video.currentTime = 0; video.currentTime = 0;
video.onseeked = () => { video.onseeked = () => {