From b556e9926cc7d0f2954315ca8180074582ff14a2 Mon Sep 17 00:00:00 2001 From: Lodeloet Date: Wed, 2 Apr 2025 17:24:33 +0200 Subject: [PATCH 1/5] gravity.js a mod for sandboxels that adds a gravity block were you can create plannets with and much more! --- gravity.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 gravity.js diff --git a/gravity.js b/gravity.js new file mode 100644 index 00000000..da48e66c --- /dev/null +++ b/gravity.js @@ -0,0 +1,40 @@ +elements.gravity_point = { + color: "#FFD700", // Goudkleurig + behavior: behaviors.STURDYPOWDER, + category: "special", + state: "solid", + density: 5000, + max_gravity_distance: 100, // Bereik van zwaartekracht + gravity_strength: 1, // Kracht van zwaartekracht + + tick: function(pixel) { + for (var x = -pixel.max_gravity_distance; x <= pixel.max_gravity_distance; x++) { + for (var y = -pixel.max_gravity_distance; y <= pixel.max_gravity_distance; y++) { + var nx = pixel.x + x; + var ny = pixel.y + y; + + if (!isEmpty(nx, ny, true)) { + var npixel = pixelMap[nx][ny]; + + if (npixel && npixel.element !== "gravity_point") { + var dx = nx - pixel.x; + var dy = ny - pixel.y; + var distance = Math.sqrt(dx * dx + dy * dy); + + if (distance < 1) distance = 1; // Voorkom delen door 0 + if (distance <= pixel.max_gravity_distance) { + var force = (pixel.gravity_strength * 100) / (distance * distance); + var angle = Math.atan2(dy, dx); + var vx = -Math.cos(angle) * force; + var vy = -Math.sin(angle) * force; + + // Voeg snelheid toe aan objecten + npixel.vx = (npixel.vx || 0) + vx; + npixel.vy = (npixel.vy || 0) + vy; + } + } + } + } + } + } +}; From 4a54108898cd07d990abfd5ebbe48e655adbdbde Mon Sep 17 00:00:00 2001 From: MicaelNotUsed Date: Wed, 2 Apr 2025 20:49:43 -0300 Subject: [PATCH 2/5] Add hideandshowtools.js Hide and Show tools is a mod that adds two tools: Hide tool, which you click on pixels to hide them, and Show tool, where you click on pixels to show them if they're hidden. --- mods/hideandshowtools.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 mods/hideandshowtools.js diff --git a/mods/hideandshowtools.js b/mods/hideandshowtools.js new file mode 100644 index 00000000..78d1065e --- /dev/null +++ b/mods/hideandshowtools.js @@ -0,0 +1,18 @@ +elements.hide = { + color: "#000000", + tool: function(pixel){ + pixel.alpha = 0 + }, + category: "tools", + canPlace: false, + desc: "Use on pixels to hide them.", +}; +elements.show = { + color: "#ffffff", + tool: function(pixel){ + pixel.alpha = 1 + }, + category: "tools", + canPlace: false, + desc: "Use on pixels to show them, can also unpaint elements." +}; \ No newline at end of file From ef2eb9f2e83bd66c69ed3c51d2663010ec302be7 Mon Sep 17 00:00:00 2001 From: MicaelNotUsed Date: Wed, 2 Apr 2025 20:51:34 -0300 Subject: [PATCH 3/5] Update mod-list.html to include hideandshowtools.js --- mod-list.html | 1 + 1 file changed, 1 insertion(+) diff --git a/mod-list.html b/mod-list.html index 96137945..3e818e3e 100644 --- a/mod-list.html +++ b/mod-list.html @@ -179,6 +179,7 @@ texturepack.jsAdds tools that let you create and share custom texture packsnousernamefound text.jsAdds tools to write textRedBirdly the_ground.jsAdds several rock types, worldgen settings, and gemstonesAlice +hideandshowtools.jsAdds two tools, one that hides elements, and one that shows hidden elementsMicaelNotUsed Science & Chemistry alcohol.jsAdds methanol, (iso-)propanol, and butanolAlice From 9d55a3dc76f8785afbb9a6c21063e547c63da61f Mon Sep 17 00:00:00 2001 From: MicaelNotUsed Date: Wed, 2 Apr 2025 20:53:53 -0300 Subject: [PATCH 4/5] Update hideandshowtools.js --- mods/hideandshowtools.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/hideandshowtools.js b/mods/hideandshowtools.js index 78d1065e..63a3370a 100644 --- a/mods/hideandshowtools.js +++ b/mods/hideandshowtools.js @@ -14,5 +14,5 @@ elements.show = { }, category: "tools", canPlace: false, - desc: "Use on pixels to show them, can also unpaint elements." -}; \ No newline at end of file + desc: "Use on pixels to show them." +}; From 0621f87cc52d50418087a8cbe5b1a3d1d610251b Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Wed, 2 Apr 2025 20:40:39 -0400 Subject: [PATCH 5/5] alphabetize --- mod-list.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod-list.html b/mod-list.html index 3e818e3e..c41e32cc 100644 --- a/mod-list.html +++ b/mod-list.html @@ -160,6 +160,7 @@ extra_element_info.jsAdds descriptions to various vanilla elements. Used to provide the functionality that desc now does before it was added to vanillaMelecie extrasaveslots.jsAdds extra saves slots !SAVE IMPORTANT SAVES AS FILES!Jayd find.jsAdds a find mode that highlights a chosen element as pulsating red and yellow (read commit description)Alice +hideandshowtools.jsAdds two tools, one that hides elements, and one that shows hidden elementsMicaelNotUsed human_friendly_design.jsMakes the drag and mix tools not kill humans.Nekonico insane_random_events.jsMassively buffs random eventsAlice jaydsfunctions.jsAdds extra toolsJayd @@ -179,7 +180,6 @@ texturepack.jsAdds tools that let you create and share custom texture packsnousernamefound text.jsAdds tools to write textRedBirdly the_ground.jsAdds several rock types, worldgen settings, and gemstonesAlice -hideandshowtools.jsAdds two tools, one that hides elements, and one that shows hidden elementsMicaelNotUsed Science & Chemistry alcohol.jsAdds methanol, (iso-)propanol, and butanolAlice