Modding tutorial/Element properties

From Sandboxels Wiki
Jump to navigation Jump to search

This page lists some of the properties that can be specified on elements while modding.

List of properties

Property name Data type Meaning
name String Name of the element. If none is present, element object key will be used instead (e.g. elements.test_element -> TestElement)
alias String
Array
Other name(s) of the element (e.g. "Hydrochloric Acid" for Acid element)
category String The category the element button appears in. Entering "tools" places it above the element picker
desc String Description of the element, shown in Lookup
extraInfo String Description of the element added as backward compatibility with 'extra_element_info.js' mod. It's only visible in Lookup if desc is not present
related String - Element
Array (String - Element)
Related element(s), shown under "See Also" in Lookup (e.g. Human is linked to Body and Head)
hidden Boolean Whether the element is hidden from the element picker by default
darkText Boolean Whether the element button uses dark or bright text
canPlace Boolean Whether the element can be placed; true by default on elements that don't have a tool function
nocheer Boolean Whether this element is hidden in Cheerful Mode
forceAutoGen Boolean Whether automatic state generation will occur regardless of the existance of stateHigh
color String - color
Array (String - color)
Color of the pixels of the element. The actual color can vary a bit from the specified value
colorOn String - color
Array (String - color)
Color of the pixels of the element when charged
customColor Boolean Whether the user can choose the pixel color (e.g. Art)
forceSaveColor Boolean Whether pixels of the element store their original color in the save file
singleColor Boolean Whether pixels of the element will have the same color when placed while drawing continuously
colorPattern Array (String) Texture pattern of the element
colorKey Object (key - pattern key, value - color string) Texture colors of the element (map certain pattern keys to colors)
behavior Behavior array
Function(pixel)
Defines how the element works. See Behavior for more info and how behavior arrays are constructed
behaviorOn Behavior array
Function(pixel)
Defines how the element works when charged
tick Function(pixel) Defines how the element works, works independently from behavior (you can use both or either)
tool Function(pixel) Defines how the element works if the element is tool
onMouseDown Function Called when the element is selected and mouse button is pressed
onMouseUp Function Called when the element is selected and mouse button is released
onSelect Function Called when the element gets selected
onUnselect Function Called when the element stops being selected
onMix Function(pixel) Called when a pixel of the element is mixed
perTick Function Called every tick if element is selected
hoverStat Function(pixel) Provides hover information for a pixel
reactions Reactions object Reactions of the element
temp Number The default temperature of pixels of the element
tempLow Number The temperature at which the pixel turns into the element specified by stateLow
stateLow String - element The element that the pixel turns into after reaching the temperature specified by tempLow
stateLowName String Name of the element that will be generated as stateLow with automatic state generation
stateLowColor String - color Color of the element that will be generated as stateLow with automatic state generation
stateLowColorMultiplier String - color Multiplier of the original color that will be used as a color of the element that will be generated as stateLow with automatic state generation
tempHigh Number The temperature at which the pixel turns into the element specified by stateHigh
stateHigh String - element The element that the pixel turns into after reaching the temperature specified by tempHigh
stateHighName String Name of the element that will be generated as stateHigh with automatic state generation
stateHighColor String - color Color of the element that will be generated as stateHigh with automatic state generation
stateHighColorMultiplier String - color Multiplier of the original color that will be used as a color of the element that will be generated as stateHigh with automatic state generation
extraTempLow Object (key - temperature, value - element) Defines other temperatures below tempLow at which element turns into other elements
extraTempHigh Object (key - temperature, value - element) Defines other temperatures above tempHigh at which element turns into other elements
state String ("solid", "liquid" or "gas") The state of matter of the element
density Number Density of the element in kg/m³. See Density for more info.
insulate Boolean Whether the element insulates from heat and electricity
viscosity Number Viscosity of the element in cP
conduct Number (0-1) Conductivity of an element
stain Number (-1-1) How much pixels of the element stain other pixels (negative numbers clean stains)
stainSelf Boolean Whether the element can stain itself
charge Number Charge that pixels of the element spawn with
movable Boolean Whether the element is movable; by default true for all element with tick function or behavior that contains M1 or M2 rules
hardness Number (0-1) Chance of resisting damage in % (e.g. 5% would be 0.05)
foodNeed Number Amount of food needed for an egg to be spawned
properties Object (key - property name, value - default value) Default values of custom properties that pixels of the element will have
maxSize Number Maximum brush size allowed when placing the element
baby String - element Element that will be spawned from an egg
egg String - element Element to be used as an egg (Egg by default)
eggColor String - color Color of the element's egg
seed String - element
Boolean
Element to be used as a seed of the element (when seed is a string)
Whether the element is a seed (when seed is a boolean)
noMix Boolean Whether the element will be ignored when mixing
ignoreAir Boolean Whether the element should ignore air density
excludeRandom Boolean Whether the element should be excluded from random events
cooldown Number Amount of ticks you have to wait after placing the element before you can place it again
isFood Boolean Whether the element can be mixed into Dough or Batter
ignore Array (String - element) Elements that the element will ignore (e.g. in DL, DB, CH, ST or CF behavior rules)
canContain Boolean Whether pixels of the element can contain other pixels
burn Number Flammability of the element
burning Boolean Whether the element is burning by default
burnTime Number Amount of ticks pixels of the element can burn for
burnInto String - element Element that pixels of the element will turn into when they burn down
extinguish Boolean Whether the element can extinguish fire
fireColor' String - color Color of the fire
fireElement String - element Element that will be used as fire
rotatable Boolean Whether the element can rotate in 4 directions
flippableX Boolean Whether the element can be flipped on the X-axis when placed
flippableY Boolean Whether the element can be flipped on the Y-axis when placed
breakInto String - element Element that pixels of the element will turn into when they get smashed
breakIntoColor String - color Color of pixels of the element after they are smashed

In source code

In the game's source code, there is a commented out list of properties:

// name - display name of the element [optional]
// color - color of the element's pixel
// behavior - behavior of the element
// ignore - elements to ignore in behavior [must be an array]
// category - category in which the element will show up in
// density - density of the element [only used for movable elements] (kg/m^3)
// state - solid, liquid, or gas [only used for movable elements]
// reactions - instructions for when elements attempt to move onto each other (object)
// conduct - conductivity of the element (0-1)
// behaviorOn - behavior to override when powered
// colorOn - color to change to when powered
// temp - default temperature of the element (Celsius)
// tempHigh - highest temperature before state change (Celsius)
// tempLow - lowest temperature before state change (Celsius)
// stateHigh - element transformed into when tempHigh is reached
// stateLow - element transformed into when tempLow is reached
// viscosity - how slow a liquid will move (higher = slower) (cps)
// burn - chance of burning per tick (0-100) (%)
// burnTime - time to burn (ticks)
// burnInto - element to turn into after burning
// fireColor - color of the flame given off when burning
// burning - whether the element is burning on creation
// charge - charge of the element on creation
// hardness - chance of resisting damage (0-1)