From af2eb5c494a6af484e8a76b5ea30bed231c0fd7e Mon Sep 17 00:00:00 2001 From: Boxeled Date: Mon, 29 Jul 2024 16:15:10 -0500 Subject: [PATCH 1/3] Create periodic_and_more.js This is a WIP mod for Sandboxels. --- mods/periodic_and_more.js | 81 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 mods/periodic_and_more.js diff --git a/mods/periodic_and_more.js b/mods/periodic_and_more.js new file mode 100644 index 00000000..170feddc --- /dev/null +++ b/mods/periodic_and_more.js @@ -0,0 +1,81 @@ +// This is how to add a new mod to the game. + +// Create a new Javascript file like this one. +// Add the file to the mods folder on GitHub, or host it somewhere else. +// https://github.com/R74nCom/sandboxels/tree/main/mods + +// To add it in the Mod Loader: +// If it is in the mods folder, you can just use the name of the file. +// If it is hosted somewhere else, you can use the full URL, including the HTTPS://. + +// Adding elements: +elements.mayo = { + color: "#ffffff", + behavior: behaviors.LIQUID, + category: "liquids", + viscosity: 100000, + state: "liquid", + density: 720, +}; + +// Changing existing elements: +elements.water.color = "#ff0000"; +elements.water.behavior = behaviors.WALL; + +// Removing elements: +// Be aware, things may break +delete elements.ketchup; + +// Adding behavior presets: +behaviors.SELFDELETE = [ + "XX|XX|XX", + "XX|DL|XX", + "XX|XX|XX", +]; + +// Raw JavaScript behaviors: +behaviors.mud.tick = function(pixel) { + if (tryMove(pixel, pixel.x, pixel.y+1)) { + console.log("Moved!"); + } + else { + console.log("Couldn't move!") + } +}; + +// Create a new tool: +elements.sand_exploder = { + color: "#ff0000", + tool: function(pixel) { + if (pixel.element == "sand") { + pixel.element = "explosion" + } + }, + category: "tools", +}; + +// Add reactions to existing elements +if (!elements.water.reactions) { // Include this block once + elements.water.reactions = {} // This creates the property if it doesn't exist +} +elements.water.reactions.mayo = { "elem1":null, "elem2":"mayo_water" } +elements.water.reactions.soap = { "elem1":null, "elem2":"soapy_water" } + +// Run after all mods are loaded, for cross-mod compatibility +runAfterLoad(function() { + // Your code here + console.log("Hello World!"); +}); + +// Run if another mod is active +if (enabledMods.includes("mods/test.js")) { + runAfterLoad(function() { + // Your code here + console.log("Hello World!"); + }); +} + +// Creating eLists: +eLists.PERIODIC = ["beryllium", "scandium", "vanadium", "manganese", "cobalt"]; +// Adding elements to eLists: +eLists.CONDIMENT.push("honey"); From 09d45a1b55f159a90c843517cd585dd3e285de4b Mon Sep 17 00:00:00 2001 From: Boxeled Date: Mon, 29 Jul 2024 17:29:16 -0500 Subject: [PATCH 2/3] Update periodic_and_more.js --- mods/periodic_and_more.js | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/mods/periodic_and_more.js b/mods/periodic_and_more.js index 170feddc..a78b1836 100644 --- a/mods/periodic_and_more.js +++ b/mods/periodic_and_more.js @@ -1,20 +1,10 @@ -// This is how to add a new mod to the game. -// Create a new Javascript file like this one. -// Add the file to the mods folder on GitHub, or host it somewhere else. -// https://github.com/R74nCom/sandboxels/tree/main/mods - -// To add it in the Mod Loader: -// If it is in the mods folder, you can just use the name of the file. -// If it is hosted somewhere else, you can use the full URL, including the HTTPS://. - -// Adding elements: -elements.mayo = { - color: "#ffffff", - behavior: behaviors.LIQUID, - category: "liquids", +elements.beryllium = { + color: "#b3b3b3", + behavior: behaviors.WALL, + category: "periodic", viscosity: 100000, - state: "liquid", + state: "solid", density: 720, }; From 918e0668cb803a135d66b5ddef2bba21d84c7441 Mon Sep 17 00:00:00 2001 From: Boxeled Date: Mon, 29 Jul 2024 17:34:36 -0500 Subject: [PATCH 3/3] Update periodic_and_more.js Updated for Cross-mod compatibility --- mods/periodic_and_more.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/periodic_and_more.js b/mods/periodic_and_more.js index a78b1836..e92023a2 100644 --- a/mods/periodic_and_more.js +++ b/mods/periodic_and_more.js @@ -58,7 +58,7 @@ runAfterLoad(function() { }); // Run if another mod is active -if (enabledMods.includes("mods/test.js")) { +if (enabledMods.includes["mods/chem.js", "mods/moreChemistry.js", "mods/metals.js", "mods/halogen.js", "mods/noblegas.js", "mods/radioactive.js", "mods/nousersthings.js"]) { runAfterLoad(function() { // Your code here console.log("Hello World!");