Merge branch 'R74nCom:main' into main

This commit is contained in:
Nekonico 2025-04-02 17:48:08 -07:00 committed by GitHub
commit c7a13c5b43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 59 additions and 0 deletions

40
gravity.js Normal file
View File

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

View File

@ -160,6 +160,7 @@
<tr><td>extra_element_info.js</td><td>Adds descriptions to various vanilla elements. Used to provide the functionality that desc now does before it was added to vanilla</td><td>Melecie</td></tr> <tr><td>extra_element_info.js</td><td>Adds descriptions to various vanilla elements. Used to provide the functionality that desc now does before it was added to vanilla</td><td>Melecie</td></tr>
<tr><td>extrasaveslots.js</td><td>Adds extra saves slots !SAVE IMPORTANT SAVES AS FILES!</td><td>Jayd</td></tr> <tr><td>extrasaveslots.js</td><td>Adds extra saves slots !SAVE IMPORTANT SAVES AS FILES!</td><td>Jayd</td></tr>
<tr><td>find.js</td><td>Adds a find mode that highlights a chosen element as pulsating red and yellow <a href="https://github.com/R74nCom/sandboxels/commit/de0dc088ab4d928c77587b9d0e3a7d7663e3f94a">(read commit description)</a></td><td>Alice</td></tr> <tr><td>find.js</td><td>Adds a find mode that highlights a chosen element as pulsating red and yellow <a href="https://github.com/R74nCom/sandboxels/commit/de0dc088ab4d928c77587b9d0e3a7d7663e3f94a">(read commit description)</a></td><td>Alice</td></tr>
<tr><td>hideandshowtools.js</td><td>Adds two tools, one that hides elements, and one that shows hidden elements</td><td>MicaelNotUsed</td><tr>
<tr><td>human_friendly_design.js</td><td>Makes the drag and mix tools not kill humans.</td><td>Nekonico</td></tr> <tr><td>human_friendly_design.js</td><td>Makes the drag and mix tools not kill humans.</td><td>Nekonico</td></tr>
<tr><td>insane_random_events.js</td><td>Massively buffs random events</td><td>Alice</td></tr> <tr><td>insane_random_events.js</td><td>Massively buffs random events</td><td>Alice</td></tr>
<tr><td>jaydsfunctions.js</td><td>Adds extra tools</td><td>Jayd</td></tr> <tr><td>jaydsfunctions.js</td><td>Adds extra tools</td><td>Jayd</td></tr>

18
mods/hideandshowtools.js Normal file
View File

@ -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."
};