Last active
December 6, 2025 23:36
-
-
Save bryanbraun/952c914a1a4526fc20d9e6c251950220 to your computer and use it in GitHub Desktop.
A sandboxels mod (https://sandboxels.r74n.com)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // rainbow_slime_min.js | |
| // Minimal Sandboxels mod: adds a simple "Rainbow Slime" liquid element. | |
| // Purpose: minimum working example — no per-pixel color writes, no helper wrappers. | |
| (function() { | |
| if (typeof elements === "undefined") { | |
| console.warn("rainbow_slime_min.js: Sandboxels globals not found. Load this as a mod inside Sandboxels."); | |
| return; | |
| } | |
| // avoid overwriting existing elements | |
| if (elements.rainbow_slime) { | |
| console.log("rainbow_slime_min.js: element 'rainbow_slime' already exists — skipping registration."); | |
| return; | |
| } | |
| elements.rainbow_slime = { | |
| name: "Rainbow Slime", | |
| // static color only (engine-friendly hex string). | |
| // If your build requires an object {r,g,b}, try {r:255,g:59,b:48} instead. | |
| color: "#FF3B30", | |
| category: "liquids", | |
| // Basic physical properties (reasonable defaults) | |
| density: 1000, | |
| conductivity: 0.05, | |
| viscosity: 0.6, | |
| tempHigh: 1000, | |
| stateHigh: "steam", | |
| tempLow: -273, | |
| stateLow: null, | |
| // Simple liquid-like behavior expressed as a behavior string. | |
| // This avoids custom tick() code that could call engine internals differently across builds. | |
| // The string below makes it fall, flow, and have a tiny chance to 'stay' (so it doesn't vanish). | |
| behavior: [ | |
| "XX|CR:5|XX", | |
| "M2|CH:0|M2", | |
| "XX|FX:0|XX" | |
| ].join(";"), | |
| // Basic reaction example (harmless) | |
| reactions: { | |
| "water": { elem1: "water", elem2: "rainbow_slime", result1: "rainbow_slime", result2: "water", chance: 0.25 } | |
| }, | |
| info: "A simple colorful slime. (Minimal example — no dynamic color or particles.)" | |
| }; | |
| // Add a residue element if none exists (simple solid) | |
| if (!elements.slime_residue) { | |
| elements.slime_residue = { | |
| name: "Slime Residue", | |
| color: "#9B59B6", | |
| category: "solids", | |
| behavior: "XX|CR:1|XX", | |
| density: 800, | |
| tempHigh: 1000, | |
| stateHigh: "steam", | |
| info: "Sticky residue left by Rainbow Slime." | |
| }; | |
| } | |
| console.log("rainbow_slime_min.js loaded: rainbow_slime + slime_residue registered."); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment