2025-09-01 16:27:13 -04:00
|
|
|
// To create a mod:
|
2022-01-16 20:17:12 -05:00
|
|
|
// Create a new Javascript file like this one.
|
|
|
|
|
// Add the file to the mods folder on GitHub, or host it somewhere else.
|
2023-09-22 12:31:57 -04:00
|
|
|
// https://github.com/R74nCom/sandboxels/tree/main/mods
|
2022-01-16 20:17:12 -05:00
|
|
|
|
2025-09-01 16:27:13 -04:00
|
|
|
// To learn about modding, check the wiki: https://sandboxels.wiki.gg/wiki/Modding
|
Version 1.12 - July 17, 2025 - Saves For All
[Version 1.12 - July 17, 2025 - Saves For All]
+ Featured Saves tab
+ Discord Saves tab
+ Browse community-made saves from our server
+ Lye, a reactive powder
+ Invar, a dark metal alloy (Hidden)
+ Streak View (Press 4)
[Steam Edition Changes]
+ Workshop support
+ Add and load community-made saves
+ Publish saves for everyone to discover
+ Save tagging support
+ Rich Presence support for Discord and Steam Chat
+ Show off your current element and canvas state
~ Saves are stored in a new game data folder instead of slots
+ Mods can be loaded from the game data folder for offline use
~ Dependencies are currently not supported for local files
+ "Open Data Folder" button in Settings
+ Steam automatically selects supported languages
+ Save author name will default to Steam username
- Hid "Clear Saves" button
~ Version and element count are shown again
[Changes]
+ Button click animations
+ Corn has gravity
+ Cloner elements can be set by clicking over them
+ Dyes can be mixed into liquids
+ Sand can be dyed into Color Sand
+ Stained Glass can be made by melting Glass with certain metals
+ Batteries are breakable
+ Vaccine and Antidote can freeze
+ Small amounts of Vaccine can be made by boiling Antibody
+ Vaccine can be made by mixing Antibody with Sugar Water
+ Cream can be turned into Yogurt
+ Clay and Brick Rubble makes Clay Soil
+ Slime rots Meat
+ Glue turns Crumb into Bread
+ Yeast ferments Wheat
+ Vinegar-Ammonia reaction
+ Bleach-Baking Soda reaction
+ Blood bubbles before boiling
+ Infection passively creates Plague
+ Pool Water slowly breaks down DNA
+ Distilling Oil with Hydrogen makes Sulfur and Water (Claus process)
+ Greek Fire is made with Oil and Sap, instead of Sulfur
+ Sulfur stains Silver
+ Candy from freezing Honey or Molasses has a unique color
+ Ember changes color when hitting elements with flame colors
+ Plasma can heat existing pixels when placed over them
+ Magnesium-Acid reaction produces Hydrogen
+ Gold variants are immune to Acid
+ Acid decomposes at extreme temperatures
+ Ammonia decomposes at high temperatures
+ Copper Sulfate reacts with other carbs like Sugar
+ Molten Caustic Potash electrolysis
+ Virus and Strange Matter ignore Pointer
+ Neutrons radiate Glass Shards
+ Cancer kills Homunculi
+ Anesthesia and Alcohol Gas calm Humans
~ Human will be selected when using Pick on Head or Body
~ Tweaked Diamond formation
~ Walls and Pipes don't change Light color
~ God Ray is better at extinguishing fires
~ Ember no longer produces Fire on its own
~ Salt Water electrolysis produces Lye (Chloralkali process)
~ Sodium-Water reaction produces Lye
~ Improved Sodium-Acid reaction
~ Potassium-Acid reaction is more violent
~ Acid no longer deletes Smoke or Fire
~ Gallium-Aluminum reaction is more destructive
~ Supernovae create Mercury and Aluminum
~ Antimatter no longer explodes when hitting the border
~ Lightning no longer explodes when hitting the border on Void mode
~ Uranium releases Radiation more consistently when falling
~ Rats release Plague more consistently when falling
~ Molten Stained Glass has colorful Fire
+ Rainbow and Static affect the color of Fire
~ Canvas will shrink dynamically to fit screen width
+ Empty canvases will be reset automatically when window is resized
+ Saves menu tabs
~ Saves menu takes up more screen space
~ Modded saves automatically reload the save and remove new mods after session
+ Sandboxels will reload on canvas reset after changing mods
+ TPS is restored after unloading a save
+ Button to reload after adding or removing mods
~ Currently-loaded save will be underscored in menu
~ Saves keep track of standalone version (i.e. Steam)
~ Save warnings use native Sandboxels prompts
~ Reset Warning setting affects save loading popup on non-empty canvas
- Loading a save no longer changes your selected view
~ 'Reset Scene' buttons in Settings now confirm before resetting
~ Cursor color is affected by theme color
~ Canvas Size and Worldgen settings automatically reset empty canvases
~ Updated styling of bottom links
~ Links are underlined when hovered over
~ Prompts are closed when elements are deselected
~ Confirm buttons for data reset prompts are red to show danger
~ Entering an invalid TPS no longer resets to 30 TPS
~ Recolored Gold
~ Recolored Zinc
~ Recolored Nickel
~ Recolored Tungsten
~ Recolored Sulfur
~ Recolored Brass
~ Recolored Sterling
~ Recolored Solder
~ Recolored Molten Aluminum and removed heat glow
~ Recolored Molten Caustic Potash and removed Fire
~ Recolored Soda made from Juice
~ Poison, Radiation, God Ray, Aluminum, Insulation, Bead, and Color Sand display with dark text
~ Prop tool can convert between boolean and number types
+ Broth alias 'Soup'
+ Jelly alias 'Jam'
+ Soda alias 'Cola'
+ Hard Yolk alias 'Fried Egg'
+ Gunpowder alias 'Black Powder'
[Bug Fixes]
~ Fixed: Enabled mods can be stuck behind input box
~ Fixed: Flies and Bees get stuck on Loop border modes
~ Fixed: Rock Wall and Bless can't be used as Image element
~ Fixed: Screenshots don't include background color if it was never set
~ Fixed: Corrupted save error messages don't appear
~ Fixed: Large save canvases can go off-screen
~ Fixed: Cheerful Mode setting button has old behavior
~ Fixed: Cheerful Mode setting 'Refresh Page' button doesn't work
~ Fixed: runEveryTick() runs even when paused
~ Fixed: World gen replaces Destroyable border pixels with Wall
~ Fixed: Random events and modded per-tick events don't happen when stepping ticks
~ Fixed: Maximum cursor size doesn't fill entire canvas with odd widths
~ Fixed: Unpaint tool removes fancy textures
~ Fixed: Category buttons don't glow in Unlock as Discovered mode
~ Fixed: Coolers and Freezers affect insulative elements
~ Fixed: Lightning heats insulative elements
~ Fixed: Dark element button text isn't triggered by buttonColor
~ Fixed: Force-loaded mod dependencies don't load properly on Steam
~ Fixed: Theme background doesn't affect entire page on Steam Edition
[Technical]
+ New helper functions:
+ getPixel(x, y) -> Pixel object or null
+ tryCreate(element, x, y, replace?) -> Pixel object or null
+ tryDelete(x, y) -> Pixel object or null
+ 'onCollide' element property, called when the pixel moves into any other (function(pixel1,pixel2))
+ 'onClicked' element property, called when the pixel is clicked on (function(pixel,element))
+ 'skip' pixel property, skips simulation of the pixel
+ 'RL' behavior rule, releases an element in any available space
+ 'clear' view property for clearing the canvas layers, defaults to true
+ modIsEnabled(str) function, checks only file names (e.g. "glow.js")
+ promptChoose() for multiple-choice prompts
+ promptDir() for direction-based prompts
~ Debug console has been re-enabled on Steam Edition
~ Pick and Erase tools are no longer hard-coded
~ Sensor 'sense' property can take multiple comma-separated values
~ Save version is now sb5
2025-07-17 13:49:09 -04:00
|
|
|
// Or join our Discord: https://r74n.com/discord/
|
|
|
|
|
|
2025-09-01 16:27:13 -04:00
|
|
|
// To add it in the Mod Manager:
|
Version 1.12 - July 17, 2025 - Saves For All
[Version 1.12 - July 17, 2025 - Saves For All]
+ Featured Saves tab
+ Discord Saves tab
+ Browse community-made saves from our server
+ Lye, a reactive powder
+ Invar, a dark metal alloy (Hidden)
+ Streak View (Press 4)
[Steam Edition Changes]
+ Workshop support
+ Add and load community-made saves
+ Publish saves for everyone to discover
+ Save tagging support
+ Rich Presence support for Discord and Steam Chat
+ Show off your current element and canvas state
~ Saves are stored in a new game data folder instead of slots
+ Mods can be loaded from the game data folder for offline use
~ Dependencies are currently not supported for local files
+ "Open Data Folder" button in Settings
+ Steam automatically selects supported languages
+ Save author name will default to Steam username
- Hid "Clear Saves" button
~ Version and element count are shown again
[Changes]
+ Button click animations
+ Corn has gravity
+ Cloner elements can be set by clicking over them
+ Dyes can be mixed into liquids
+ Sand can be dyed into Color Sand
+ Stained Glass can be made by melting Glass with certain metals
+ Batteries are breakable
+ Vaccine and Antidote can freeze
+ Small amounts of Vaccine can be made by boiling Antibody
+ Vaccine can be made by mixing Antibody with Sugar Water
+ Cream can be turned into Yogurt
+ Clay and Brick Rubble makes Clay Soil
+ Slime rots Meat
+ Glue turns Crumb into Bread
+ Yeast ferments Wheat
+ Vinegar-Ammonia reaction
+ Bleach-Baking Soda reaction
+ Blood bubbles before boiling
+ Infection passively creates Plague
+ Pool Water slowly breaks down DNA
+ Distilling Oil with Hydrogen makes Sulfur and Water (Claus process)
+ Greek Fire is made with Oil and Sap, instead of Sulfur
+ Sulfur stains Silver
+ Candy from freezing Honey or Molasses has a unique color
+ Ember changes color when hitting elements with flame colors
+ Plasma can heat existing pixels when placed over them
+ Magnesium-Acid reaction produces Hydrogen
+ Gold variants are immune to Acid
+ Acid decomposes at extreme temperatures
+ Ammonia decomposes at high temperatures
+ Copper Sulfate reacts with other carbs like Sugar
+ Molten Caustic Potash electrolysis
+ Virus and Strange Matter ignore Pointer
+ Neutrons radiate Glass Shards
+ Cancer kills Homunculi
+ Anesthesia and Alcohol Gas calm Humans
~ Human will be selected when using Pick on Head or Body
~ Tweaked Diamond formation
~ Walls and Pipes don't change Light color
~ God Ray is better at extinguishing fires
~ Ember no longer produces Fire on its own
~ Salt Water electrolysis produces Lye (Chloralkali process)
~ Sodium-Water reaction produces Lye
~ Improved Sodium-Acid reaction
~ Potassium-Acid reaction is more violent
~ Acid no longer deletes Smoke or Fire
~ Gallium-Aluminum reaction is more destructive
~ Supernovae create Mercury and Aluminum
~ Antimatter no longer explodes when hitting the border
~ Lightning no longer explodes when hitting the border on Void mode
~ Uranium releases Radiation more consistently when falling
~ Rats release Plague more consistently when falling
~ Molten Stained Glass has colorful Fire
+ Rainbow and Static affect the color of Fire
~ Canvas will shrink dynamically to fit screen width
+ Empty canvases will be reset automatically when window is resized
+ Saves menu tabs
~ Saves menu takes up more screen space
~ Modded saves automatically reload the save and remove new mods after session
+ Sandboxels will reload on canvas reset after changing mods
+ TPS is restored after unloading a save
+ Button to reload after adding or removing mods
~ Currently-loaded save will be underscored in menu
~ Saves keep track of standalone version (i.e. Steam)
~ Save warnings use native Sandboxels prompts
~ Reset Warning setting affects save loading popup on non-empty canvas
- Loading a save no longer changes your selected view
~ 'Reset Scene' buttons in Settings now confirm before resetting
~ Cursor color is affected by theme color
~ Canvas Size and Worldgen settings automatically reset empty canvases
~ Updated styling of bottom links
~ Links are underlined when hovered over
~ Prompts are closed when elements are deselected
~ Confirm buttons for data reset prompts are red to show danger
~ Entering an invalid TPS no longer resets to 30 TPS
~ Recolored Gold
~ Recolored Zinc
~ Recolored Nickel
~ Recolored Tungsten
~ Recolored Sulfur
~ Recolored Brass
~ Recolored Sterling
~ Recolored Solder
~ Recolored Molten Aluminum and removed heat glow
~ Recolored Molten Caustic Potash and removed Fire
~ Recolored Soda made from Juice
~ Poison, Radiation, God Ray, Aluminum, Insulation, Bead, and Color Sand display with dark text
~ Prop tool can convert between boolean and number types
+ Broth alias 'Soup'
+ Jelly alias 'Jam'
+ Soda alias 'Cola'
+ Hard Yolk alias 'Fried Egg'
+ Gunpowder alias 'Black Powder'
[Bug Fixes]
~ Fixed: Enabled mods can be stuck behind input box
~ Fixed: Flies and Bees get stuck on Loop border modes
~ Fixed: Rock Wall and Bless can't be used as Image element
~ Fixed: Screenshots don't include background color if it was never set
~ Fixed: Corrupted save error messages don't appear
~ Fixed: Large save canvases can go off-screen
~ Fixed: Cheerful Mode setting button has old behavior
~ Fixed: Cheerful Mode setting 'Refresh Page' button doesn't work
~ Fixed: runEveryTick() runs even when paused
~ Fixed: World gen replaces Destroyable border pixels with Wall
~ Fixed: Random events and modded per-tick events don't happen when stepping ticks
~ Fixed: Maximum cursor size doesn't fill entire canvas with odd widths
~ Fixed: Unpaint tool removes fancy textures
~ Fixed: Category buttons don't glow in Unlock as Discovered mode
~ Fixed: Coolers and Freezers affect insulative elements
~ Fixed: Lightning heats insulative elements
~ Fixed: Dark element button text isn't triggered by buttonColor
~ Fixed: Force-loaded mod dependencies don't load properly on Steam
~ Fixed: Theme background doesn't affect entire page on Steam Edition
[Technical]
+ New helper functions:
+ getPixel(x, y) -> Pixel object or null
+ tryCreate(element, x, y, replace?) -> Pixel object or null
+ tryDelete(x, y) -> Pixel object or null
+ 'onCollide' element property, called when the pixel moves into any other (function(pixel1,pixel2))
+ 'onClicked' element property, called when the pixel is clicked on (function(pixel,element))
+ 'skip' pixel property, skips simulation of the pixel
+ 'RL' behavior rule, releases an element in any available space
+ 'clear' view property for clearing the canvas layers, defaults to true
+ modIsEnabled(str) function, checks only file names (e.g. "glow.js")
+ promptChoose() for multiple-choice prompts
+ promptDir() for direction-based prompts
~ Debug console has been re-enabled on Steam Edition
~ Pick and Erase tools are no longer hard-coded
~ Sensor 'sense' property can take multiple comma-separated values
~ Save version is now sb5
2025-07-17 13:49:09 -04:00
|
|
|
// If it is in the mods folder, you can just use the name of the file. (example_mod.js)
|
2022-01-16 20:17:12 -05:00
|
|
|
// If it is hosted somewhere else, you can use the full URL, including the HTTPS://.
|
|
|
|
|
|
|
|
|
|
// Adding elements:
|
2025-09-01 16:27:13 -04:00
|
|
|
elements.mustard = {
|
|
|
|
|
color: "#ffff00",
|
2022-01-16 20:17:12 -05:00
|
|
|
behavior: behaviors.LIQUID,
|
|
|
|
|
category: "liquids",
|
|
|
|
|
state: "liquid",
|
2025-09-01 16:27:13 -04:00
|
|
|
density: 1100,
|
|
|
|
|
viscosity: 60000,
|
|
|
|
|
}
|
2022-01-16 20:17:12 -05:00
|
|
|
|
|
|
|
|
// Changing existing elements:
|
|
|
|
|
elements.water.color = "#ff0000";
|
|
|
|
|
elements.water.behavior = behaviors.WALL;
|
|
|
|
|
|
|
|
|
|
// Removing elements:
|
|
|
|
|
// Be aware, things may break
|
|
|
|
|
delete elements.ketchup;
|
|
|
|
|
|
2025-09-01 16:27:13 -04:00
|
|
|
// Custom behaviors:
|
|
|
|
|
elements.blue_sand = {
|
|
|
|
|
color: "#0000ff",
|
|
|
|
|
behavior: [
|
|
|
|
|
"XX|XX|XX",
|
|
|
|
|
"XX|XX|XX",
|
|
|
|
|
"M2|M1|M2"
|
|
|
|
|
],
|
|
|
|
|
category: "land",
|
|
|
|
|
state: "solid"
|
|
|
|
|
}
|
2022-01-16 20:17:12 -05:00
|
|
|
|
2022-02-11 15:29:59 -05:00
|
|
|
// Raw JavaScript behaviors:
|
2025-09-01 16:27:13 -04:00
|
|
|
elements.mud.tick = function(pixel) {
|
2022-02-11 15:29:59 -05:00
|
|
|
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",
|
|
|
|
|
};
|
|
|
|
|
|
2025-09-01 16:27:13 -04:00
|
|
|
// Reactions:
|
|
|
|
|
elements.sugar_stick = {
|
|
|
|
|
color: "#ffffff",
|
|
|
|
|
behavior: behaviors.STURDYPOWDER,
|
|
|
|
|
reactions: {
|
|
|
|
|
"water": { elem1:null, elem2:"sugar_water", chance:0.1 },
|
|
|
|
|
"salt_water": { elem1:null, elem2:"sugar_water", chance:0.1 }
|
|
|
|
|
},
|
|
|
|
|
state: "solid",
|
|
|
|
|
density: 1580
|
2022-01-19 20:05:54 -05:00
|
|
|
}
|
2022-01-20 15:02:20 -05:00
|
|
|
|
2025-09-01 16:27:13 -04:00
|
|
|
// Add reactions to existing elements:
|
|
|
|
|
// Include this block once to ensure the property exists
|
|
|
|
|
if (!elements.water.reactions) elements.water.reactions = {};
|
|
|
|
|
elements.water.reactions.mustard = { "elem1":null, "elem2":"mustard_water" };
|
|
|
|
|
elements.water.reactions.soap = { "elem1":null, "elem2":"soapy_water" };
|
2022-01-16 20:17:12 -05:00
|
|
|
|
2025-09-01 16:27:13 -04:00
|
|
|
// Custom element renderers:
|
|
|
|
|
elements.ball.renderer = function(pixel,ctx) {
|
|
|
|
|
// Draw three horizontal squares
|
|
|
|
|
drawSquare(ctx,"#00ff00",pixel.x-1,pixel.y);
|
|
|
|
|
drawSquare(ctx,"#00ff00",pixel.x,pixel.y);
|
|
|
|
|
drawSquare(ctx,"#00ff00",pixel.x+1,pixel.y);
|
|
|
|
|
};
|
|
|
|
|
// See 1.10example.js for more rendering examples.
|