From 4b0f4050cca98c6f757313c6c4c782d22c65334a Mon Sep 17 00:00:00 2001
From: GGodPL <46885632+GGodPL@users.noreply.github.com>
Date: Fri, 21 Jul 2023 15:42:32 +0200
Subject: [PATCH 01/19] add betterMenuScreens mod
adds betterMenuScreens utility mod
---
mods/betterMenuScreens.js | 229 ++++++++++++++++++++++++++++++++++++++
1 file changed, 229 insertions(+)
create mode 100644 mods/betterMenuScreens.js
diff --git a/mods/betterMenuScreens.js b/mods/betterMenuScreens.js
new file mode 100644
index 00000000..0fa8977d
--- /dev/null
+++ b/mods/betterMenuScreens.js
@@ -0,0 +1,229 @@
+/**
+ * @typedef {object} MenuScreenLoader
+ * @property {string} name Name of the menu screen. Gets displayed on the button
+ * @property {string} parentDiv ID of the parent div. Should be the same as the ID provided in MenuScreen class via setParentDivId method
+ * @property {string} buttonDescription Description that is shown when the button is hovered
+ * @property {boolean} show Whether menu screen button should get shown on tool controls
+ * @property {() => void} [close] Closing method. Optional
+ * @property {() => void} [open] Opening method. Optional
+ * @property {() => void} [onClose] Method that gets called on close (except when menu is force closed, like when clicking on a different menu button). Optional
+ * @property {() => void} [loader] Method that injects the menu screen into HTML. Can be set to ModScreen build method. Optional
+ */
+var menuScreens = {
+ info: {
+ name: "Info",
+ parentDiv: "infoParent",
+ buttonDescription: "Brings up the element info screen",
+ show: true,
+ close: () => {
+ var infoParent = document.getElementById("infoParent");
+ var infoSearch = document.getElementById("infoSearch");
+ infoParent.style.display = "none";
+ infoSearch.value = "";
+ infoHistory = [];
+ },
+ open: showInfo
+ },
+ mods: {
+ name: "Mods",
+ parentDiv: "modParent",
+ buttonDescription: "Brings up the Mod Manager",
+ show: true,
+ close: () => {
+ var modParent = document.getElementById("modParent");
+ var modManagerUrl = document.getElementById("modManagerUrl");
+ modParent.style.display = "none";
+ modManagerUrl.value = "";
+ },
+ open: showModManager
+ },
+ settings: {
+ name: "Settings",
+ parentDiv: "settingsParent",
+ buttonDescription: "Brings up the settings screen",
+ show: true,
+ open: showSettings
+ }
+}
+
+closeMenu = (force) => {
+ if (!showingMenu) return;
+ const menu = menuScreens[showingMenu];
+ if (!menu) {
+ const menuParents = document.getElementsByClassName("menuParent");
+ for (const elem of menuParents) elem.style.display = "none";
+ showingMenu = false;
+ } else {
+ if (menu.close) menu.close();
+ else {
+ const menuParent = document.getElementById(menu.parentDiv);
+ menuParent.style.display = "none";
+ }
+ if (!force && menu.onClose) menu.onClose();
+ else showingMenu = false;
+ }
+}
+
+// injects into toolControls
+const inject = () => {
+ const toolControls = document.getElementById("toolControls");
+ const buttons = [];
+ for (const key in menuScreens) {
+ const element = menuScreens[key];
+ if (element.show) {
+ const button = document.createElement("button");
+ button.id = `betterMenuScreens_${key}Button`;
+ button.title = element.buttonDescription ?? "";
+ button.onclick = () => {
+ if (showingMenu != key) {
+ closeMenu(true);
+ if (element.open) element.open();
+ else {
+ const menuParent = document.getElementById(element.parentDiv);
+ menuParent.style.display = "block";
+ showingMenu = key;
+ }
+ } else {
+ closeMenu(true);
+ }
+ }
+ button.innerText = element.name;
+ button.className = "controlButton";
+ buttons.push(button);
+ }
+ if (element.loader) element.loader();
+ }
+ toolControls.removeChild(document.getElementById("infoButton"));
+ toolControls.removeChild(document.getElementById("modsButton"));
+ // replace the old settings button with new buttons
+ document.getElementById(`settingsButton`).replaceWith(...buttons);
+
+}
+
+class MenuScreen {
+ constructor () {
+ this.nodes = [];
+ this.innerHtml = "";
+ this.showCloseButton = true;
+ this.closeButtonText = "-";
+ }
+
+ /**
+ * Sets the screen title
+ * @param {string} [title] Screen title. "New Menu Screen" by default
+ */
+ setTitle(title = "New Menu Screen") {
+ this.title = title;
+ return this;
+ }
+
+ /**
+ * 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
+ */
+ setShowCloseButton(show) {
+ this.showCloseButton = show;
+ }
+
+ /**
+ * Sets the close button text
+ * @param {string} [text] Close button text. "-" by default
+ */
+ setCloseButtonText(text = "-") {
+ this.closeButtonText = text;
+ }
+
+ /**
+ * Sets the parent div ID. Has to be called at least once before build method is called
+ * @param {string} id Parent div ID
+ */
+ setParentDivId(id) {
+ this.parentDivId = id;
+ return this;
+ }
+
+ /**
+ * Sets the parent div class name. Changing the div class name is not recommended
+ * @param {string} [className] Parent div class name. "menuParent" by default
+ */
+ setParentDivClass(className = "menuParent") {
+ this.parentDivClass = className;
+ return this;
+ }
+
+ /**
+ * Sets the inner div ID. Has to be called at least once before build method is called
+ * @param {string} id Inner div ID
+ */
+ setInnerDivId(id) {
+ this.innerDivId = id;
+ return this;
+ }
+
+ /**
+ * Sets the inner div class name. Changing the div class name is not recommended
+ * @param {string} [className] Inner div class name. "menuScreen" by default
+ */
+ setInnerDivClass(className = "menuScreen") {
+ this.innerDivClass = className;
+ return this;
+ }
+
+ /**
+ * Adds a node to the menu screen content
+ * @param {Node|Node[]} node Any HTML node/element or array of HTML nodes/elements
+ */
+ addNode(node) {
+ if (node instanceof Array) this.nodes.push(...node);
+ else this.nodes.push(node);
+ return this;
+ }
+
+ /**
+ * Appends to menu screen contents inner html
+ * @param {string} html HTML code to append
+ */
+ appendInnerHtml(html) {
+ this.innerHtml += html;
+ return this;
+ }
+
+ /**
+ * Sets the menu screen contents inner html
+ * @param {string} html HTML code to set to
+ */
+ setInnerHtml(html) {
+ this.innerHtml = html;
+ return this;
+ }
+
+ /**
+ * Checks whether the menu screen is ready for build. That method should not be called outside of build method
+ * @private
+ */
+ _check() {
+ if (!this.parentDivId) throw "No parent div id specified";
+ if (!this.innerDivId) throw "No inner div id specified";
+ }
+
+ /**
+ * Builds the menu screen and appends it to chosen element
+ * @param {string} [id] Element id to append the menu screen to. Changing the id from default "gameDiv" is not recommended
+ */
+ build(id = "gameDiv") {
+ this._check();
+ const parent = document.createElement("div");
+ parent.className = this.parentDivClass ?? "menuParent";
+ parent.id = this.parentDivId;
+ parent.style.display = "none";
+ const inner = document.createElement("div");
+ inner.className = this.innerDivClass ?? "menuScreen";
+ inner.innerHTML = `${this.showCloseButton ? `
+ ${this.title ?? "Menu Screen"}
` + this.innerHtml + "
";
+ inner.append(this.nodes);
+ parent.appendChild(inner);
+ document.getElementById(id).appendChild(parent);
+ }
+}
+
+runAfterLoadList.push(inject);
\ No newline at end of file
From f832fac4704250c25aa2e386dcd8f958e79b1728 Mon Sep 17 00:00:00 2001
From: GGodPL <46885632+GGodPL@users.noreply.github.com>
Date: Sun, 23 Jul 2023 14:54:33 +0200
Subject: [PATCH 02/19] Update betterModManager.js
---
mods/betterModManager.js | 92 +++++++++++++++++++++++-----------------
1 file changed, 54 insertions(+), 38 deletions(-)
diff --git a/mods/betterModManager.js b/mods/betterModManager.js
index 29b7356e..1fa08b36 100644
--- a/mods/betterModManager.js
+++ b/mods/betterModManager.js
@@ -114,45 +114,61 @@ function openModList() {
showingMenu = "modList";
}
-runAfterLoadList.push(updateModManager);
-
-closeMenu = function() {
- if (!showingMenu) { return; }
- if (showingMenu == "info") {
- var infoParent = document.getElementById("infoParent");
- var infoSearch = document.getElementById("infoSearch");
- infoParent.style.display = "none";
- infoSearch.value = "";
- showingMenu = false;
- infoHistory = [];
+if (enabledMods.includes("mods/betterMenuScreens.js")) {
+ menuScreens.modList = {
+ name: "Mod manager",
+ parentDiv: "modListParent",
+ show: false,
+ close: () => {
+ var modParent = document.getElementById("modListParent");
+ var modManagerUrl = document.getElementById("modManagerUrl");
+ modParent.style.display = "none";
+ modManagerUrl.value = "";
+ showingMenu = false;
+ },
+ onClose: () => {showModManager(); console.log("hi")},
+ loader: updateModManager
}
- else if (showingMenu == "mods") {
- var modParent = document.getElementById("modParent");
- var modManagerUrl = document.getElementById("modManagerUrl");
- modParent.style.display = "none";
- modManagerUrl.value = "";
- showingMenu = false;
- }
- else if (showingMenu == "modList") {
- var modParent = document.getElementById("modListParent");
- var modManagerUrl = document.getElementById("modManagerUrl");
- modParent.style.display = "none";
- modManagerUrl.value = "";
- showingMenu = false;
- // open mod manager again so the mod list menu looks like a submenu
- showModManager();
- }
- else if (showingMenu == "settings") {
- var settingsParent = document.getElementById("settingsParent");
- settingsParent.style.display = "none";
- showingMenu = false;
- }
- else {
- // do it to all elements with the class "menuParent"
- var menuParents = document.getElementsByClassName("menuParent");
- for (var i = 0; i < menuParents.length; i++) {
- menuParents[i].style.display = "none";
+} else {
+ closeMenu = function() {
+ if (!showingMenu) { return; }
+ if (showingMenu == "info") {
+ var infoParent = document.getElementById("infoParent");
+ var infoSearch = document.getElementById("infoSearch");
+ infoParent.style.display = "none";
+ infoSearch.value = "";
+ showingMenu = false;
+ infoHistory = [];
+ }
+ else if (showingMenu == "mods") {
+ var modParent = document.getElementById("modParent");
+ var modManagerUrl = document.getElementById("modManagerUrl");
+ modParent.style.display = "none";
+ modManagerUrl.value = "";
+ showingMenu = false;
+ }
+ else if (showingMenu == "modList") {
+ var modParent = document.getElementById("modListParent");
+ var modManagerUrl = document.getElementById("modManagerUrl");
+ modParent.style.display = "none";
+ modManagerUrl.value = "";
+ showingMenu = false;
+ // open mod manager again so the mod list menu looks like a submenu
+ showModManager();
+ }
+ else if (showingMenu == "settings") {
+ var settingsParent = document.getElementById("settingsParent");
+ settingsParent.style.display = "none";
+ showingMenu = false;
+ }
+ else {
+ // do it to all elements with the class "menuParent"
+ var menuParents = document.getElementsByClassName("menuParent");
+ for (var i = 0; i < menuParents.length; i++) {
+ menuParents[i].style.display = "none";
+ }
+ showingMenu = false;
}
- showingMenu = false;
}
+ runAfterLoadList.push(updateModManager);
}
From c7c4e722b9035e2be1d038c3a6a9f7ea05ffc9cd Mon Sep 17 00:00:00 2001
From: GGodPL <46885632+GGodPL@users.noreply.github.com>
Date: Sun, 23 Jul 2023 14:56:50 +0200
Subject: [PATCH 03/19] Update betterModManager.js
---
mods/betterModManager.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mods/betterModManager.js b/mods/betterModManager.js
index 1fa08b36..2f517c59 100644
--- a/mods/betterModManager.js
+++ b/mods/betterModManager.js
@@ -126,7 +126,7 @@ if (enabledMods.includes("mods/betterMenuScreens.js")) {
modManagerUrl.value = "";
showingMenu = false;
},
- onClose: () => {showModManager(); console.log("hi")},
+ onClose: showModManager,
loader: updateModManager
}
} else {
From 3d4134e2b7f74d38668a797faf6ccc2bd4b17abf Mon Sep 17 00:00:00 2001
From: slweeb <91897291+slweeb@users.noreply.github.com>
Date: Thu, 27 Jul 2023 12:33:58 -0400
Subject: [PATCH 04/19] 1.8.5
[Version 1.8.5 - July 27, 2023]
+ Drag tool
+ Tree color variety (8 variants!)
~ Mobile UI improvements
+ Warp (Special)
+ Crumb (Hidden, from broken foods)
+ Skin (Solid)
+ Hair (Hidden)
[States]
+ Soda Ice (Hidden)
+ Bleach Ice (Hidden)
+ Frozen Vinegar (Hidden)
+ Amber (Hidden, frozen Sap)
+ Perfume (Hidden, liquid Fragrance)
+ Liquid Stench (Hidden)
[Changes]
+ Molten Dirt can solidify into some Rock
+ Tools have descriptions on info page
+ Oil dirties Water
+ Humans will panic and run when burning
+ Rad Shards and Molten Rad Glass can produce radiation
+ Light and Laser retain color when liquified
+ Slag can be formed with Dirt
+ Slag can break into Gravel
+ Corn breaks into Flour
+ Mushrooms can release Poison when broken
+ Poison and Antidote can wet soil
+ Juice can wet Flour
+ Blood can oxidize Iron and Copper
+ Fallout will infect Blood
+ Birds turn to white meat when cooked
+ Birds smash into Blood
+ Cacti can be killed by Vinegar, Bleach, Baking Soda, and Alcohol
+ Humans can be killed by Poison and Cyanide
+ Cells can be killed by Plague, Soap, Mercury, Chlorine, and Cyanide
+ Dioxin can kill Plants, Grass, Vines, Saplings, and Cacti
+ Vinegar can kill Frogs slowly
+ Vinegar can kill Grass
+ Algae dies at hot and cold temperatures
+ Dust will burn at high temperatures
+ Melted Wax will break down at high temperatures
+ Uranium conducts electricity
+ Unburn tool can put out Embers and Torches
+ Bless turns Static to Rainbow
+ Static conducts electricity
+ Grapes can turn Water into Juice
+ Primordial Soup can wet Clay Soil
+ Hydrogen produces heat during fusion
+ Helium, Hydrogen, and Mercury Gas glow when electrified
+ Cactus and Liquid Light random events
+ Cement can be made with Slaked Lime
~ Recolored Slaked Lime
~ Placing Petals or Mushroom Caps now picks a random color
~ Unhid Petal
~ Hid Root
~ Moved Bamboo to Solids
~ Moved Steel
~ Moved Melted Cheese, Butter, and Chocolate to States
~ Moved Liquid Hydrogen, Helium, and Neon to States
~ States category always appears last if unhidden
~ Humans rot more randomly
~ Bamboo Plant grows faster
~ Worms no longer break Eggs
~ Strange Matter can no longer travel through indestructible things
~ Strange Matter can no longer destroy Void
~ Tweaked Molten Uranium radiation rate
[Fixes]
~ Fixed: Alt-Tab locks Alt key
~ Fixed: Cacti break into Sap
~ Fixed: Cream deletes infinite Soda and Juice
~ Fixed: Null in info page error (e.g. tea)
~ Fixed: Unknown element in info page error (e.g. salt)
~ Fixed: Reactions, related, and aliases don't show up in tool info pages
~ Capitalization fixes
[Technical]
+ Element properties onSelect, onMouseUp, perTick, singleColor
~ Element property fireElement can accept null
---
changelog.html | 84 ++++-
changelog.txt | 82 ++++-
controls.html | 4 +-
index.html | 658 ++++++++++++++++++++++++++++++---------
mods/classic_textures.js | 30 +-
mods/devtests.js | 0
style.css | 27 +-
7 files changed, 734 insertions(+), 151 deletions(-)
create mode 100644 mods/devtests.js
diff --git a/changelog.html b/changelog.html
index 2b670327..c880002c 100644
--- a/changelog.html
+++ b/changelog.html
@@ -93,7 +93,7 @@
-
+ Rad Shards and Molten Rad Glass can produce radiation
+
+ Light and Laser retain color when liquified
+
+ Slag can be formed with Dirt
+
+ Slag can break into Gravel
+
+ Corn breaks into Flour
+
+ Mushrooms can release Poison when broken
+
+ Poison and Antidote can wet soil
+
+ Juice can wet Flour
+
+ Blood can oxidize Iron and Copper
+
+ Fallout will infect Blood
+
+ Birds turn to white meat when cooked
+
+ Birds smash into Blood
+
+ Cacti can be killed by Vinegar, Bleach, Baking Soda, and Alcohol
+
+ Humans can be killed by Poison and Cyanide
+
+ Cells can be killed by Plague, Soap, Mercury, Chlorine, and Cyanide
+
+ Dioxin can kill Plants, Grass, Vines, Saplings, and Cacti
+
+ Vinegar can kill Frogs slowly
+
+ Vinegar can kill Grass
+
+ Algae dies at hot and cold temperatures
+
+ Dust will burn at high temperatures
+
+ Melted Wax will break down at high temperatures
+
+ Uranium conducts electricity
+
+ Unburn tool can put out Embers and Torches
+
+ Bless turns Static to Rainbow
+
+ Static conducts electricity
+
+ Grapes can turn Water into Juice
+
+ Primordial Soup can wet Clay Soil
+
+ Hydrogen produces heat during fusion
+
+ Helium, Hydrogen, and Mercury Gas glow when electrified
+
+ Cactus and Liquid Light random events
+
+ Cement can be made with Slaked Lime
+
~ Recolored Slaked Lime
+
~ Placing Petals or Mushroom Caps now picks a random color
+
~ Unhid Petal
+
~ Hid Root
+
~ Moved Bamboo to Solids
+
~ Moved Steel
+
~ Moved Melted Cheese, Butter, and Chocolate to States
+
~ Moved Liquid Hydrogen, Helium, and Neon to States
+
~ States category always appears last if unhidden
+
~ Humans rot more randomly
+
~ Bamboo Plant grows faster
+
~ Worms no longer break Eggs
+
~ Strange Matter can no longer travel through indestructible things
+
~ Strange Matter can no longer destroy Void
+
~ Tweaked Molten Uranium radiation rate
+
[Fixes]
+
~ Fixed: Alt-Tab locks Alt key
+
~ Fixed: Cacti break into Sap
+
~ Fixed: Cream deletes infinite Soda and Juice
+
~ Fixed: Null in info page error (e.g. tea)
+
~ Fixed: Unknown element in info page error (e.g. salt)
+
~ Fixed: Reactions, related, and aliases don't show up in tool info pages
+
~ Capitalization fixes
+
[Technical]
+
+ Element properties onSelect, onMouseUp, perTick, singleColor
+
~ Element property fireElement can accept null
+
+
[Version 1.8.4 - July 11, 2023]
+ Image placing
@@ -112,7 +192,7 @@
+ Select any image from your computer
+ Place it on the canvas at any scale
+ Choose its element or disable smoothing in Settings
-
+ Burn it, blow it up, or make it a powder!
+
+ Burn it, blow it up, or make it a powder!
+ Paste or Drag-and-Drop images!
[Stay tuned for bigger updates in the coming months!]
[Bug Fixes]
diff --git a/changelog.txt b/changelog.txt
index f5951614..8ce47e95 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,11 +1,89 @@
[Future Plans]
+ Save Gallery
+ Human Update
- + Suggest new additions at https://link.r74n.com/sandboxels-feedback
+ + Suggest new additions at https://link.R74n.com/sandboxels-feedback
See sneak peaks for upcoming updates on the Discord: https://discord.gg/ejUc6YPQuS
-A fancier version of this changelog can be found here: https://sandboxels.r74n.com/changelog
+A fancier version of this changelog can be found here: https://sandboxels.R74n.com/changelog
+
+[Version 1.8.5 - July 27, 2023]
+ + Drag tool
+ + Tree color variety (8 variants!)
+ ~ Mobile UI improvements
+ + Warp (Special)
+ + Crumb (Hidden, from broken foods)
+ + Skin (Solid)
+ + Hair (Hidden)
+ [States]
+ + Soda Ice (Hidden)
+ + Bleach Ice (Hidden)
+ + Frozen Vinegar (Hidden)
+ + Amber (Hidden, frozen Sap)
+ + Perfume (Hidden, liquid Fragrance)
+ + Liquid Stench (Hidden)
+ [Changes]
+ + Molten Dirt can solidify into some Rock
+ + Tools have descriptions on info page
+ + Oil dirties Water
+ + Humans will panic and run when burning
+ + Rad Shards and Molten Rad Glass can produce radiation
+ + Light and Laser retain color when liquified
+ + Slag can be formed with Dirt
+ + Slag can break into Gravel
+ + Corn breaks into Flour
+ + Mushrooms can release Poison when broken
+ + Poison and Antidote can wet soil
+ + Juice can wet Flour
+ + Blood can oxidize Iron and Copper
+ + Fallout will infect Blood
+ + Birds turn to white meat when cooked
+ + Birds smash into Blood
+ + Cacti can be killed by Vinegar, Bleach, Baking Soda, and Alcohol
+ + Humans can be killed by Poison and Cyanide
+ + Cells can be killed by Plague, Soap, Mercury, Chlorine, and Cyanide
+ + Dioxin can kill Plants, Grass, Vines, Saplings, and Cacti
+ + Vinegar can kill Frogs slowly
+ + Vinegar can kill Grass
+ + Algae dies at hot and cold temperatures
+ + Dust will burn at high temperatures
+ + Melted Wax will break down at high temperatures
+ + Uranium conducts electricity
+ + Unburn tool can put out Embers and Torches
+ + Bless turns Static to Rainbow
+ + Static conducts electricity
+ + Grapes can turn Water into Juice
+ + Primordial Soup can wet Clay Soil
+ + Hydrogen produces heat during fusion
+ + Helium, Hydrogen, and Mercury Gas glow when electrified
+ + Cactus and Liquid Light random events
+ + Cement can be made with Slaked Lime
+ ~ Recolored Slaked Lime
+ ~ Placing Petals or Mushroom Caps now picks a random color
+ ~ Unhid Petal
+ ~ Hid Root
+ ~ Moved Bamboo to Solids
+ ~ Moved Steel
+ ~ Moved Melted Cheese, Butter, and Chocolate to States
+ ~ Moved Liquid Hydrogen, Helium, and Neon to States
+ ~ States category always appears last if unhidden
+ ~ Humans rot more randomly
+ ~ Bamboo Plant grows faster
+ ~ Worms no longer break Eggs
+ ~ Strange Matter can no longer travel through indestructible things
+ ~ Strange Matter can no longer destroy Void
+ ~ Tweaked Molten Uranium radiation rate
+ [Fixes]
+ ~ Fixed: Alt-Tab locks Alt key
+ ~ Fixed: Cacti break into Sap
+ ~ Fixed: Cream deletes infinite Soda and Juice
+ ~ Fixed: Null in info page error (e.g. tea)
+ ~ Fixed: Unknown element in info page error (e.g. salt)
+ ~ Fixed: Reactions, related, and aliases don't show up in tool info pages
+ ~ Capitalization fixes
+ [Technical]
+ + Element properties onSelect, onMouseUp, perTick, singleColor
+ ~ Element property fireElement can accept null
[Version 1.8.4 - July 11, 2023]
+ Image placing
diff --git a/controls.html b/controls.html
index cceda08f..923798e4 100644
--- a/controls.html
+++ b/controls.html
@@ -70,7 +70,7 @@
-