Examples
These mods come from the game's tests/ directory. Their numbers match the project examples. Download a JSON file and load it in Steam Alchemy. In Godot Editor, open the matching .tscn scene in tests/.
001 — Default mod
Basic recipes, conditional operations, a global counter, and visual class palettes. Combine Fire with Water to create Steam.
Source: tests/001_default.json. Download JSON.
JSON mod
{
"settings": {
"is_borderless": false,
"is_cloneable": false,
"is_initial_spawning_enabled": true,
"is_void_button_visible": true,
"void_filter": [
"Water"
]
},
"reactions": [
{
"reagents": [
"Counter",
"Cursor"
],
"result": [
{
"type": "if",
"condition": "g('Counter', 'count') > 5",
"then": [
{
"type": "set",
"target": {
"id": "Counter",
"name": "count"
},
"value": "0"
}
],
"else": [
{
"type": "set",
"target": {
"id": "Counter",
"name": "count"
},
"value": {
"type": "computed",
"expression": "g('Counter', 'count') + 1"
}
}
]
},
{
"type": "remove",
"target": {
"id": "Water"
}
},
{
"type": "if",
"condition": "quantity('Water') > 0",
"then": [
"Water",
"Water"
]
}
]
},
{
"reagents": [
"Fire",
"Earth"
],
"result": [
"❤️"
]
},
{
"reagents": [
"Fire",
"Water"
],
"result": [
"Steam"
]
},
{
"reagents": [
"Earth",
"Water"
],
"result": [
"Mud"
]
},
{
"reagents": [
"Air",
"Fire",
"Earth",
"Water"
],
"result": [
"Life"
]
},
{
"reagents": [
"Life",
"❤️"
],
"result": [
"Life",
"Life"
]
},
{
"reagents": [
"Elemental_Classes_Demo",
"Cursor"
],
"result": [
"demo_default",
"demo_fire",
"demo_water",
"demo_air",
"demo_earth",
"demo_marine",
"demo_ocean",
"demo_alien",
"demo_magic"
]
},
{
"reagents": [
"Metallic_Classes_Demo",
"Cursor"
],
"result": [
"demo_iron",
"demo_silver",
"demo_tin",
"demo_copper",
"demo_uranium",
"demo_gold",
"demo_lead",
"demo_nickel",
"demo_platinum"
]
},
{
"reagents": [
"Color_Classes_Demo",
"Cursor"
],
"result": [
"demo_red",
"demo_blue",
"demo_yellow",
"demo_green",
"demo_teal",
"demo_lapis",
"demo_purple",
"demo_magenta"
]
},
{
"reagents": [
"Inverted_Elemental_Classes_Demo",
"Cursor"
],
"result": [
"demo_inv_fire",
"demo_inv_water",
"demo_inv_air",
"demo_inv_earth",
"demo_inv_marine",
"demo_inv_ocean",
"demo_inv_alien",
"demo_inv_magic"
]
},
{
"reagents": [
"Inverted_Metallic_Classes_Demo",
"Cursor"
],
"result": [
"demo_inv_iron",
"demo_inv_silver",
"demo_inv_tin",
"demo_inv_copper",
"demo_inv_uranium",
"demo_inv_gold",
"demo_inv_lead",
"demo_inv_nickel",
"demo_inv_platinum"
]
},
{
"reagents": [
"Inverted_Color_Classes_Demo",
"Cursor"
],
"result": [
"demo_inv_red",
"demo_inv_blue",
"demo_inv_yellow",
"demo_inv_green",
"demo_inv_teal",
"demo_inv_lapis",
"demo_inv_purple",
"demo_inv_magenta"
]
}
],
"elements": {
"Player": {
"display": [
"Player ",
{
"type": "bind",
"target": {
"id": "Player",
"name": "id"
}
}
],
"custom_props": {
"id": {
"type": "number",
"value": 0
}
},
"is_static": true,
"class": "earth demo"
},
"Metal": {
"display": "Metal",
"class": "metal"
},
"Water": {
"display": "Water",
"class": "teal",
"is_cloneable": true
},
"Water2": {
"display": "[b]Water2[/b]",
"class": "water"
},
"Fire": {
"display": "[pulse color=red]Fire!!![/pulse]",
"class": [
"fire",
{
"class": "water",
"props": [
"background_color"
]
}
]
},
"Earth": {
"display": "[rainbow]Earth[/rainbow]",
"class": "earth"
},
"❤️": {
"display": "[wave amp=50.0 freq=5.0]❤️❤️❤️❤️[/wave]",
"class": [
"air"
]
},
"Steam": {
"class": "steam"
},
"Life": {
"class": [
"life",
"test"
]
},
"Cursor": {
"display": "[b]Cursor[/b]",
"is_static": true
},
"Counter": {
"custom_props": {
"count": {
"type": "number",
"value": 0
}
},
"is_static": true,
"display": [
"C[i]C[b]C[/b][/i][b]C[/b]C: [b]",
{
"type": "bind",
"target": {
"id": "Counter",
"name": "count",
"precision": 1
}
},
"[/b]"
]
},
"Test": {
"class": "test"
},
"Elemental_Classes_Demo": {
"class": "alien",
"display": "Elemental Classes"
},
"Metallic_Classes_Demo": {
"class": "platinum",
"display": "Metallic Classes"
},
"Color_Classes_Demo": {
"class": "magenta",
"display": "Color Classes"
},
"Inverted_Elemental_Classes_Demo": {
"class": "alien-inverted",
"display": "Inverted Elemental"
},
"Inverted_Metallic_Classes_Demo": {
"class": "platinum-inverted",
"display": "Inverted Metallic"
},
"Inverted_Color_Classes_Demo": {
"class": "magenta-inverted",
"display": "Inverted Color"
},
"demo_fire": {
"class": "fire",
"display": "fire demo"
},
"demo_water": {
"class": "water",
"display": "water demo"
},
"demo_air": {
"class": "air",
"display": "air demo"
},
"demo_earth": {
"class": "earth",
"display": "earth demo"
},
"demo_marine": {
"class": "marine",
"display": "marine demo"
},
"demo_ocean": {
"class": "ocean",
"display": "ocean demo"
},
"demo_alien": {
"class": "alien",
"display": "alien demo"
},
"demo_magic": {
"class": "magic",
"display": "magic demo"
},
"demo_iron": {
"class": "iron",
"display": "iron demo"
},
"demo_silver": {
"class": "silver",
"display": "silver demo"
},
"demo_tin": {
"class": "tin",
"display": "tin demo"
},
"demo_copper": {
"class": "copper",
"display": "copper demo"
},
"demo_uranium": {
"class": "uranium",
"display": "uranium demo"
},
"demo_gold": {
"class": "gold",
"display": "gold demo"
},
"demo_lead": {
"class": "lead",
"display": "lead demo"
},
"demo_nickel": {
"class": "nickel",
"display": "nickel demo"
},
"demo_platinum": {
"class": "platinum",
"display": "platinum demo"
},
"demo_red": {
"class": "red",
"display": "red demo"
},
"demo_blue": {
"class": "blue",
"display": "blue demo"
},
"demo_yellow": {
"class": "yellow",
"display": "yellow demo"
},
"demo_green": {
"class": "green",
"display": "green demo"
},
"demo_teal": {
"class": "teal",
"display": "teal demo"
},
"demo_lapis": {
"class": "lapis",
"display": "lapis demo"
},
"demo_purple": {
"class": "purple",
"display": "purple demo"
},
"demo_magenta": {
"class": "magenta",
"display": "magenta demo"
},
"demo_inv_fire": {
"class": "fire-inverted",
"display": "fire-inv demo"
},
"demo_inv_water": {
"class": "water-inverted",
"display": "water-inv demo"
},
"demo_inv_air": {
"class": "air-inverted",
"display": "air-inv demo"
},
"demo_inv_earth": {
"class": "earth-inverted",
"display": "earth-inv demo"
},
"demo_inv_marine": {
"class": "marine-inverted",
"display": "marine-inv demo"
},
"demo_inv_ocean": {
"class": "ocean-inverted",
"display": "ocean-inv demo"
},
"demo_inv_alien": {
"class": "alien-inverted",
"display": "alien-inv demo"
},
"demo_inv_magic": {
"class": "magic-inverted",
"display": "magic-inv demo"
},
"demo_inv_iron": {
"class": "iron-inverted",
"display": "iron-inv demo"
},
"demo_inv_silver": {
"class": "silver-inverted",
"display": "silver-inv demo"
},
"demo_inv_tin": {
"class": "tin-inverted",
"display": "tin-inv demo"
},
"demo_inv_copper": {
"class": "copper-inverted",
"display": "copper-inv demo"
},
"demo_inv_uranium": {
"class": "uranium-inverted",
"display": "uranium-inv demo"
},
"demo_inv_gold": {
"class": "gold-inverted",
"display": "gold-inv demo"
},
"demo_inv_lead": {
"class": "lead-inverted",
"display": "lead-inv demo"
},
"demo_inv_nickel": {
"class": "nickel-inverted",
"display": "nickel-inv demo"
},
"demo_inv_platinum": {
"class": "platinum-inverted",
"display": "platinum-inv demo"
},
"demo_inv_red": {
"class": "red-inverted",
"display": "red-inv demo"
},
"demo_inv_blue": {
"class": "blue-inverted",
"display": "blue-inv demo"
},
"demo_inv_yellow": {
"class": "yellow-inverted",
"display": "yellow-inv demo"
},
"demo_inv_green": {
"class": "green-inverted",
"display": "green-inv demo"
},
"demo_inv_teal": {
"class": "teal-inverted",
"display": "teal-inv demo"
},
"demo_inv_lapis": {
"class": "lapis-inverted",
"display": "lapis-inv demo"
},
"demo_inv_purple": {
"class": "purple-inverted",
"display": "purple-inv demo"
},
"demo_inv_magenta": {
"class": "magenta-inverted",
"display": "magenta-inv demo"
}
},
"classes": {
"default": {
"display": "test!",
"background_color": {
"type": "RGBA",
"red": 255,
"green": 0,
"blue": 0,
"alpha": 0.5
}
}
},
"events": {
"on_start": [
"Fire",
"Earth",
"Water",
"❤️",
"Air",
"Counter",
"Cursor",
"Water2",
"Metal",
"Test",
"Elemental_Classes_Demo",
"Metallic_Classes_Demo",
"Color_Classes_Demo",
"Inverted_Elemental_Classes_Demo",
"Inverted_Metallic_Classes_Demo",
"Inverted_Color_Classes_Demo"
],
"on_join": [
"Player"
],
"on_leave": [
{
"type": "remove",
"target": {
"id": "Player"
}
}
]
},
"functions": {
"test_func": {
"args": {
"arg1": {
"type": "number"
},
"arg2": {
"type": "string"
},
"arg3": {
"type": "array"
}
},
"result": [
{
"type": "set",
"target": {
"id": "Counter",
"name": "count"
},
"value": {
"type": "computed",
"expression": "g(arg('arg2'), 'count') + arg('arg1')"
}
},
{
"type": "spawn",
"element": {
"type": "arg",
"name": "arg2"
}
},
{
"type": "run_reaction",
"reaction": {
"type": "arg",
"name": "arg3"
}
}
]
}
}
}002 — Descriptions and progress bars
Hover over Player, Slime, and Fire Sword to see descriptions with icons, formatted text, bound values, and progress bars. Combine Player with Slime to reduce health. Use Fire Sword against Slime and repair it at Anvil.
Source: tests/002_descriptions.json. Download JSON.
JSON mod
{
"settings": {
"is_borderless": false,
"is_cloneable": true,
"is_initial_spawning_enabled": true,
"is_void_button_visible": true,
"void_filter": []
},
"elements": {
"Player": {
"display": [
{
"type": "icon",
"name": "user",
"size": 18,
"color": "#439CB2"
},
" [b]Player[/b]",
{
"type": "progress",
"value": {
"type": "bind",
"target": {
"id": "Player",
"name": "hp"
}
},
"color": "#439CB2",
"width": 70,
"height": 8
}
],
"class": "cyan",
"custom_props": {
"hp": {
"type": "number",
"value": 100,
"events": {
"min": {
"value": 0,
"is_included": true,
"do": [
"Ghost",
{
"type": "remove",
"target": {
"id": "Player"
}
}
]
},
"max": {
"value": 100,
"is_included": true
}
}
}
},
"description": {
"value": [
"[center]",
{
"type": "icon",
"name": "heart",
"size": 16,
"color": "#439CB2"
},
" Health: ",
{
"type": "bind",
"target": {
"id": "Player",
"name": "hp",
"precision": 0
}
},
"/ 100[/center]",
{
"type": "progress",
"value": {
"type": "bind",
"target": {
"id": "Player",
"name": "hp"
}
},
"color": "#439CB2",
"width": 200,
"height": 12
},
"\nReact with a Slime to see the health drop."
]
}
},
"Ghost": {
"display": [
{
"type": "icon",
"name": "ghost",
"size": 18,
"color": "#A62872"
},
" Ghost"
],
"class": "magic",
"description": {
"value": "The lingering spirit of a fallen Player."
}
},
"Slime": {
"is_static": true,
"display": [
{
"type": "icon",
"name": "droplet",
"size": 16,
"color": "#69A264"
},
" Slime",
{
"type": "progress",
"value": {
"type": "bind",
"target": {
"id": "Slime",
"name": "hp"
}
},
"color": "#69A264",
"width": 150,
"height": 6
}
],
"class": "green",
"custom_props": {
"hp": {
"type": "number",
"value": 7,
"events": {
"min": {
"value": 0,
"is_included": true,
"do": [
{
"type": "set",
"target": {
"id": "Slime",
"name": "hp"
},
"value": 7
},
{
"type": "set",
"target": {
"id": "Slime",
"name": "drops_needed"
},
"value": {
"type": "computed",
"expression": "g('Slime', 'drops_needed') - 1"
}
},
{
"type": "if",
"condition": "g('Slime', 'drops_needed') <= 0",
"then": [
"Mystery Box",
{
"type": "set",
"target": {
"id": "Slime",
"name": "drops_needed"
},
"value": 5
}
],
"else": [
"Diamond"
]
}
]
},
"max": {
"value": 7,
"is_included": true
}
}
},
"drops_needed": {
"type": "number",
"value": 5,
"events": {
"min": {
"value": 0,
"is_included": true
},
"max": {
"value": 5,
"is_included": true
}
}
}
},
"description": {
"value": [
"A common creature of these glowing plains. It emits a constant sickly squelch as it leaves a slimy trail behind.\n\n",
{
"type": "icon",
"name": "heart",
"size": 16,
"color": "#69A264"
},
" Health: ",
{
"type": "bind",
"target": {
"id": "Slime",
"name": "hp",
"precision": 0
}
},
"/7\n",
{
"type": "progress",
"value": {
"type": "bind",
"target": {
"id": "Slime",
"name": "hp"
}
},
"color": "#69A264",
"width": 120,
"height": 8
},
"\nDamage: 15\nSpeed: 1\nDefense: 0\n\n",
{
"type": "icon",
"name": "gift",
"size": 16,
"color": "#69A264"
},
" Drop: Mystery Box [color=#69A264][Slay ",
{
"type": "bind",
"target": {
"id": "Slime",
"name": "drops_needed",
"precision": 0
}
},
" more to open][/color]\n",
{
"type": "progress",
"value": {
"type": "bind",
"target": {
"id": "Slime",
"name": "drops_needed"
}
},
"color": "#69A264",
"width": 120,
"height": 6
}
]
}
},
"Diamond": {
"display": [
{
"type": "icon",
"name": "gem",
"size": 18,
"color": "#439CB2"
},
" Diamond"
],
"class": "cyan",
"description": {
"value": "A shiny rare gem that gleams with brilliance. It may be used to enhance weapons, imbuing them with more attack damage.\n\nImbue Effect: [color=#8BC34A]+40%[/color] attack damage.\n\n[color=#439CB2][b]Rare Material[/b][/color]"
}
},
"Fire Sword": {
"display": [
{
"type": "icon",
"name": "sword",
"size": 18,
"color": "#E8968B"
},
" Fire Sword"
],
"class": "fire-inverted",
"custom_props": {
"durability": {
"type": "number",
"value": 50,
"events": {
"min": {
"value": 0,
"is_included": true,
"do": [
"Broken Sword",
{
"type": "remove",
"target": {
"id": "Fire Sword"
}
}
]
},
"max": {
"value": 50,
"is_included": true
}
}
}
},
"description": {
"color": {
"type": "RGBA",
"red": 209,
"green": 69,
"blue": 51,
"alpha": 1.0
},
"value": [
"A sword forged in the heart of a volcano.\nIt radiates intense heat.\n\n",
{
"type": "icon",
"name": "flame",
"size": 16,
"color": "#E8968B"
},
" Damage: [color=#E8968B]15 Fire[/color]\nDurability: ",
{
"type": "bind",
"target": {
"id": "Fire Sword",
"name": "durability",
"precision": 0
}
},
" / 50\n",
{
"type": "progress",
"value": {
"type": "bind",
"target": {
"id": "Fire Sword",
"name": "durability"
}
},
"color": "#E8968B",
"width": 150,
"height": 10
},
"\n[color=#E8968B]Hit a Slime to lose durability. Use an Anvil to repair.[/color]"
]
}
},
"Broken Sword": {
"display": [
{
"type": "icon",
"name": "sword",
"size": 18,
"color": "#555555"
},
" Broken Sword"
],
"class": "iron",
"description": {
"value": "A ruined blade. It has lost its fire, but maybe an Anvil can reforge it."
}
},
"Anvil": {
"display": [
{
"type": "icon",
"name": "anvil",
"size": 18,
"color": "#989898"
},
" Anvil"
],
"class": "default",
"description": {
"value": "A heavy iron anvil. \n\n[color=#8BC34A]Can repair weapons.[/color]"
}
},
"Mystery Box": {
"display": [
{
"type": "icon",
"name": "gift",
"size": 18,
"color": "#989898"
},
" Mystery Box"
],
"class": "default",
"description": {
"value": "A reward for slaying 5 Slimes. \n[color=#E656FF]React with Player to open![/color]"
}
}
},
"classes": {
"default": {
"background_color": {
"type": "RGBA",
"red": 50,
"green": 50,
"blue": 50,
"alpha": 1.0
},
"color": {
"type": "RGBA",
"red": 255,
"green": 255,
"blue": 255,
"alpha": 1.0
}
},
"green": {
"background_color": {
"type": "RGBA",
"red": 170,
"green": 224,
"blue": 161,
"alpha": 1.0
},
"color": {
"type": "RGBA",
"red": 40,
"green": 100,
"blue": 40,
"alpha": 1.0
}
},
"cyan": {
"background_color": {
"type": "RGBA",
"red": 109,
"green": 213,
"blue": 237,
"alpha": 1.0
},
"color": {
"type": "RGBA",
"red": 25,
"green": 100,
"blue": 120,
"alpha": 1.0
}
},
"red": {
"background_color": {
"type": "RGBA",
"red": 229,
"green": 115,
"blue": 115,
"alpha": 1.0
},
"color": {
"type": "RGBA",
"red": 100,
"green": 20,
"blue": 20,
"alpha": 1.0
}
},
"fire-inverted": {
"background_color": {
"type": "RGBA",
"red": 209,
"green": 69,
"blue": 51,
"alpha": 0.9
},
"color": {
"type": "RGB",
"red": 255,
"green": 231,
"blue": 228
}
},
"iron": {
"background_color": {
"type": "RGBA",
"red": 223,
"green": 220,
"blue": 214,
"alpha": 0.9
},
"color": {
"type": "RGB",
"red": 71,
"green": 43,
"blue": 29
}
},
"magic": {
"background_color": {
"type": "RGBA",
"red": 255,
"green": 228,
"blue": 244,
"alpha": 0.9
},
"color": {
"type": "RGB",
"red": 166,
"green": 40,
"blue": 114
}
}
},
"events": {
"on_start": [
"Player",
"Slime",
"Fire Sword",
"Anvil"
]
},
"reactions": [
{
"reagents": [
"Player",
"Slime"
],
"result": [
"Player",
{
"type": "set",
"target": {
"id": "Player",
"name": "hp"
},
"value": {
"type": "computed",
"expression": "g('Player', 'hp') - 15"
}
}
]
},
{
"reagents": [
"Fire Sword",
"Slime"
],
"result": [
"Fire Sword",
{
"type": "set",
"target": {
"id": "Fire Sword",
"name": "durability"
},
"value": {
"type": "computed",
"expression": "g('Fire Sword', 'durability') - 1"
}
},
{
"type": "set",
"target": {
"id": "Slime",
"name": "hp"
},
"value": {
"type": "computed",
"expression": "g('Slime', 'hp') - 4"
}
}
]
},
{
"reagents": [
"Broken Sword",
"Anvil"
],
"result": [
"Anvil",
"Fire Sword",
{
"type": "remove",
"target": {
"id": "Broken Sword"
}
},
{
"type": "set",
"target": {
"id": "Fire Sword",
"name": "durability"
},
"value": 50
}
]
},
{
"reagents": [
"Fire Sword",
"Anvil"
],
"result": [
"Fire Sword",
"Anvil",
{
"type": "set",
"target": {
"id": "Fire Sword",
"name": "durability"
},
"value": 50
}
]
},
{
"reagents": [
"Mystery Box",
"Player"
],
"spawn_style": "short",
"result": [
"Player",
{
"type": "remove",
"target": {
"id": "Mystery Box"
}
},
"Diamond",
"Diamond",
"Diamond",
"Diamond",
"Diamond"
]
}
]
}003 — Functions and arguments
Combine Activator with Counter to call a function with number, string, and array arguments. The function updates the counter, spawns Water, and runs the operations passed in an argument.
Source: tests/003_functions.json. Download JSON.
JSON mod
{
"settings": {
"is_borderless": false,
"is_cloneable": false,
"is_initial_spawning_enabled": true,
"is_void_button_visible": true,
"void_filter": []
},
"elements": {
"Activator": {
"display": "Activator",
"class": "magic"
},
"Counter": {
"custom_props": {
"count": {
"type": "number",
"value": 0
}
},
"is_static": true,
"display": [
"Counter: ",
{
"type": "bind",
"target": {
"id": "Counter",
"name": "count",
"precision": 0
}
}
]
},
"Reward": {
"display": "Reward",
"class": "gold"
},
"Water": {
"display": "Water",
"class": "water"
}
},
"classes": {
"magic": {
"background_color": {
"type": "RGBA",
"red": 150,
"green": 50,
"blue": 255,
"alpha": 1.0
}
},
"gold": {
"background_color": {
"type": "RGBA",
"red": 255,
"green": 215,
"blue": 0,
"alpha": 1.0
},
"color": {
"type": "RGBA",
"red": 0,
"green": 0,
"blue": 0,
"alpha": 1.0
}
}
},
"events": {
"on_start": [
"Activator",
"Counter"
],
"on_join": [],
"on_leave": []
},
"functions": {
"test_func": {
"args": {
"arg1": {
"type": "number"
},
"arg2": {
"type": "string"
},
"arg3": {
"type": "array"
}
},
"result": [
{
"type": "set",
"target": {
"id": "Counter",
"name": "count"
},
"value": {
"type": "computed",
"expression": "g(arg('arg2'), 'count') + arg('arg1')"
}
},
{
"type": "spawn",
"element": "Water",
"quantity": {
"type": "computed",
"expression": "g('Counter', 'count') * 2"
}
},
{
"type": "run_reaction",
"reaction": {
"type": "arg",
"name": "arg3"
}
}
]
}
},
"reactions": [
{
"reagents": [
"Activator",
"Counter"
],
"spawn_style": "short",
"result": [
{
"type": "call",
"function": "test_func",
"args": {
"arg1": {
"type": "computed",
"expression": "g('Counter', 'count') + 1"
},
"arg2": "Counter",
"arg3": [
"Reward",
"Reward"
]
}
},
"Activator"
]
}
]
}004 — Selector filters
Combine Garbage Collector with Battery to remove one rotten item. The selector checks each candidate's is_rotten property with g(el_id(), 'is_rotten'). Its default limit is one instance.
Source: tests/004_selectors.json. Download JSON.
JSON mod
{
"settings": {
"is_borderless": false,
"is_cloneable": false,
"is_initial_spawning_enabled": true,
"is_void_button_visible": true,
"void_filter": []
},
"elements": {
"Garbage Collector": {
"display": "Garbage Collector",
"class": "magic"
},
"Battery": {
"display": "Battery",
"class": "tech",
"is_static": true
},
"FreshApple": {
"display": "Fresh Apple",
"class": "nature",
"custom_props": {
"is_rotten": {
"type": "boolean",
"value": false
}
}
},
"RottenApple": {
"display": "Rotten Apple",
"class": "dark",
"custom_props": {
"is_rotten": {
"type": "boolean",
"value": true
}
}
},
"SpoiledMeat": {
"display": "Spoiled Meat",
"class": "dark",
"custom_props": {
"is_rotten": {
"type": "boolean",
"value": true
}
}
},
"Stone": {
"display": "Stone",
"class": "tech"
}
},
"classes": {
"magic": {
"background_color": {
"type": "RGBA",
"red": 100,
"green": 200,
"blue": 255,
"alpha": 1.0
}
},
"tech": {
"background_color": {
"type": "RGBA",
"red": 150,
"green": 150,
"blue": 150,
"alpha": 1.0
}
},
"nature": {
"background_color": {
"type": "RGBA",
"red": 50,
"green": 200,
"blue": 50,
"alpha": 1.0
}
},
"dark": {
"background_color": {
"type": "RGBA",
"red": 100,
"green": 50,
"blue": 150,
"alpha": 1.0
}
}
},
"events": {
"on_start": [
"Garbage Collector",
"Battery",
"FreshApple",
"RottenApple",
"RottenApple",
"SpoiledMeat",
"Stone"
],
"on_join": [],
"on_leave": []
},
"reactions": [
{
"reagents": [
"Garbage Collector",
"Battery"
],
"spawn_style": "short",
"result": [
{
"type": "remove",
"target": {
"filter": "g(el_id(), 'is_rotten') == true"
}
},
"Garbage Collector"
]
}
]
}005 — Animated class changes
Combine ClassSwitcher with Trigger to change ClassSwitcher from lead to gold. set_class uses the reagents group. stop keeps the reagents on the board after the color change.
Source: tests/005_dynamic_class.json. Download JSON.
JSON mod
{
"settings": {
"is_borderless": false,
"is_cloneable": false,
"is_initial_spawning_enabled": true,
"is_void_button_visible": true,
"void_filter": []
},
"elements": {
"ClassSwitcher": {
"display": "ClassSwitcher",
"class": "lead"
},
"Trigger": {
"display": "Trigger",
"class": "magic"
}
},
"events": {
"on_start": ["ClassSwitcher", "Trigger"],
"on_join": [],
"on_leave": []
},
"reactions": [
{
"reagents": ["ClassSwitcher", "Trigger"],
"result": [
{
"type": "set_class",
"target": {"from": "reagents", "id": "ClassSwitcher"},
"class": "gold"
},
{"type": "stop"}
]
}
]
}006 — Element events and a countdown
Bomb starts a 10-second countdown when spawned. on_tick subtracts 1 / tps() from its remaining time. The text and progress bar follow the counter. When the timer expires, Bomb is removed and on_destroyed spawns four Explosion elements.
Source: tests/006_element_events.json. Download JSON.
JSON mod
{
"settings": {
"is_borderless": false,
"is_cloneable": false,
"is_initial_spawning_enabled": true,
"is_void_button_visible": true,
"void_filter": []
},
"elements": {
"Bomb": {
"class": "lead",
"custom_props": {
"remaining": {
"type": "number",
"value": 10,
"events": {
"min": {
"value": 0,
"do": [
{
"type": "set_event_enabled",
"target": {
"id": "Bomb"
},
"event": "on_tick",
"is_enabled": false
},
{
"type": "remove",
"target": {
"id": "Bomb"
}
}
]
},
"max": {
"value": 10
}
}
}
},
"display": [
"Bomb: ",
{
"type": "bind",
"target": {
"id": "Bomb",
"name": "remaining",
"precision": 1
}
},
{
"type": "progress",
"value": {
"type": "bind",
"target": {
"id": "Bomb",
"name": "remaining"
}
},
"color": "#ff5c35",
"width": 100
}
],
"events": {
"on_spawned": {
"do": [
{
"type": "set",
"target": {
"id": "Bomb",
"name": "remaining"
},
"value": 10
},
{
"type": "set_event_enabled",
"target": {
"id": "Bomb"
},
"event": "on_tick",
"is_enabled": true
}
]
},
"on_destroyed": {
"do": [
"Explosion",
"Explosion",
"Explosion",
"Explosion"
]
},
"on_tick": {
"is_enabled": false,
"do": [
{
"type": "set",
"target": {
"id": "Bomb",
"name": "remaining"
},
"value": {
"type": "computed",
"expression": "g('Bomb', 'remaining') - 1.0 / tps()"
}
}
]
}
}
},
"Explosion": {
"display": "Explosion",
"class": "fire"
}
},
"events": {
"on_start": [
"Bomb"
],
"on_join": [],
"on_leave": []
},
"reactions": []
}007 — Property events
Loading the mod runs a sequence of assignments and event toggles. The counter demonstrates min, max, at, and set_event_enabled. Each enabled event spawns a marker. The counter finishes at 4.
Source: tests/007_property_events.json. Download JSON.
JSON mod
{
"settings": {
"is_borderless": false,
"is_cloneable": false,
"is_initial_spawning_enabled": true,
"is_void_button_visible": true,
"void_filter": []
},
"elements": {
"Counter": {
"display": [
"Counter: ",
{
"type": "bind",
"target": {
"id": "Counter",
"name": "value"
}
}
],
"class": "lead",
"custom_props": {
"value": {
"type": "number",
"value": 1,
"events": {
"min": {
"value": 0,
"do": ["Min triggered"]
},
"max": {
"value": 4,
"do": ["Max triggered"]
},
"at": {
"value": 2,
"is_enabled": false,
"do": ["At triggered"]
}
}
}
}
},
"Min triggered": {
"display": "min event",
"class": "cyan"
},
"Max triggered": {
"display": "max event",
"class": "fire"
},
"At triggered": {
"display": "at event",
"class": "gold"
}
},
"events": {
"on_start": [
"Counter",
{
"type": "set",
"target": {"id": "Counter", "name": "value"},
"value": 2
},
{
"type": "set_event_enabled",
"target": {"id": "Counter", "name": "value"},
"event": "at",
"is_enabled": true
},
{
"type": "set",
"target": {"id": "Counter", "name": "value"},
"value": 2
},
{
"type": "set_event_enabled",
"target": {"id": "Counter", "name": "value"},
"event": "at",
"is_enabled": false
},
{
"type": "set",
"target": {"id": "Counter", "name": "value"},
"value": 2
},
{
"type": "set",
"target": {"id": "Counter", "name": "value"},
"value": -1
},
{
"type": "set_event_enabled",
"target": {"id": "Counter", "name": "value"},
"event": "min",
"is_enabled": false
},
{
"type": "set",
"target": {"id": "Counter", "name": "value"},
"value": -1
},
{
"type": "set",
"target": {"id": "Counter", "name": "value"},
"value": 5
},
{
"type": "set_event_enabled",
"target": {"id": "Counter", "name": "value"},
"event": "max",
"is_enabled": false
},
{
"type": "set",
"target": {"id": "Counter", "name": "value"},
"value": 5
}
],
"on_join": [],
"on_leave": []
},
"reactions": []
}008 — Mining, local properties, and dynamic reactions
Combine Mine with one or more Stone Pickaxes. Each participating pickaxe loses 10% of its own durability. The reaction produces Stone and has a 35% chance to add Copper Ore, Coal, or Iron Ore.
Repair damaged pickaxes at Workshop. Sell resources at Shop to increase the separate Money element's balance. Resource descriptions show their prices.
This example combines local properties, dynamic reagent selectors, aliases, grouped set, and targeted function calls.
Source: tests/008_selectors.json. Download JSON.
JSON mod
{
"settings": {
"is_borderless": false,
"is_cloneable": false,
"is_initial_spawning_enabled": true,
"is_void_button_visible": true,
"void_filter": []
},
"elements": {
"Mine": {
"display": "Mine",
"class": "lead",
"is_static": true,
"description": "Combine with one or more working pickaxes. All selected pickaxes lose 10% durability. Each reaction produces Stone, with a 35% chance of an extra resource."
},
"Stone Pickaxe": {
"display": [
"Stone Pickaxe [",
{
"type": "bind",
"target": {
"name": "durability",
"precision": 0
}
},
"%]"
],
"class": "lead",
"is_static": true,
"is_cloneable": true,
"description": "Durability belongs to this pickaxe only. Clone it to make an independent copy. Broken pickaxes are removed. Repair at the Workshop.",
"custom_props": {
"durability": {
"scope": "local",
"type": "number",
"value": 100,
"events": {
"min": {
"value": 0
},
"max": {
"value": 100
}
}
}
}
},
"Workshop": {
"display": "Workshop",
"class": "cyan",
"is_static": true,
"description": "Combine with one or more damaged pickaxes to repair the entire selected group."
},
"Shop": {
"display": "Shop",
"class": "gold",
"is_static": true,
"description": "Combine with one or more priced resources to sell them."
},
"Money": {
"display": [
"Money: $",
{
"type": "bind",
"target": {
"name": "amount",
"precision": 0
}
}
],
"class": "gold",
"is_static": true,
"description": "Selling resources at the Shop increases it.",
"custom_props": {
"amount": {
"type": "number",
"value": 0,
"events": {
"min": {
"value": 0
}
}
}
}
},
"Stone": {
"display": "Stone",
"class": "lead",
"description": [
"Price: $",
{
"type": "bind",
"target": {
"name": "cost",
"precision": 0
}
},
". Sell at the Shop."
],
"custom_props": {
"cost": {
"type": "number",
"value": 1
}
}
},
"Copper Ore": {
"display": "Copper Ore",
"class": "gold",
"description": [
"Price: $",
{
"type": "bind",
"target": {
"name": "cost",
"precision": 0
}
},
". Sell at the Shop."
],
"custom_props": {
"cost": {
"type": "number",
"value": 5
}
}
},
"Coal": {
"display": "Coal",
"class": "dark",
"description": [
"Price: $",
{
"type": "bind",
"target": {
"name": "cost",
"precision": 0
}
},
". Sell at the Shop."
],
"custom_props": {
"cost": {
"type": "number",
"value": 3
}
}
},
"Iron Ore": {
"display": "Iron Ore",
"class": "lead",
"description": [
"Price: $",
{
"type": "bind",
"target": {
"name": "cost",
"precision": 0
}
},
". Sell at the Shop."
],
"custom_props": {
"cost": {
"type": "number",
"value": 8
}
}
}
},
"events": {
"on_start": [
"Mine",
"Stone Pickaxe",
"Stone Pickaxe",
"Workshop",
"Shop",
"Money"
],
"on_join": [],
"on_leave": []
},
"functions": {
"sell": {
"args": {
"price": {
"type": "number"
}
},
"result": [
{
"type": "set",
"target": {
"id": "Money",
"name": "amount"
},
"value": {
"type": "computed",
"expression": "g('Money', 'amount') + arg('price')"
}
}
]
}
},
"reactions": [
{
"reagents": [
"Mine",
{
"id": "Stone Pickaxe",
"filter": "l(el_uuid(), 'durability') > 0",
"limit": -1,
"alias": "tools"
}
],
"result": [
{
"type": "set",
"target": {
"from": "tools",
"id": "Stone Pickaxe",
"limit": -1,
"name": "durability"
},
"value": {
"type": "computed",
"expression": "l(el_uuid(), 'durability') - 10"
}
},
"Stone",
{
"type": "if",
"condition": "randf() < 0.35",
"then": [
{
"type": "spawn",
"element": {
"type": "computed",
"expression": "['Copper Ore', 'Coal', 'Iron Ore'].pick_random()"
}
}
]
},
{
"type": "remove",
"target": {
"from": "tools",
"filter": "l(el_uuid(), 'durability') <= 0",
"limit": -1
}
}
]
},
{
"reagents": [
"Workshop",
{
"id": "Stone Pickaxe",
"filter": "l(el_uuid(), 'durability') < 100",
"limit": -1,
"alias": "damaged_tools"
}
],
"result": [
{
"type": "set",
"target": {
"from": "damaged_tools",
"id": "Stone Pickaxe",
"limit": -1,
"name": "durability"
},
"value": 100
}
]
},
{
"reagents": [
"Shop",
{
"filter": "g(el_id(), 'cost') != null",
"limit": -1,
"alias": "goods"
}
],
"result": [
{
"type": "call",
"function": "sell",
"target": { "from": "goods", "limit": -1 },
"args": {
"price": {
"type": "computed",
"expression": "g(el_id(), 'cost')"
}
}
}
]
}
]
}009 — Selectable light bulbs
Each bulb starts with its own charge of 100. Box-select one bulb, or Shift-click it and press Enter, to turn it on. Its class changes from unlit to lit, and its charge decreases by 1 every tick.
Selecting another bulb turns the previous one off. An empty bulb turns off through charge.events.at. Combine Charger with one or more bulbs to give each participating bulb 10 charge, up to 100. Select a recharged bulb again to turn it on.
The reaction saves the selected UUIDs in Bulb.active through group('selected'). Later ticks select those UUIDs and update their local charge with a grouped set.
Source: tests/009_reagents.json. Download JSON.
JSON mod
{
"settings": {},
"classes": {
"unlit": {
"background_color": "#303238",
"color": "#aeb4c0",
"icon_color": "#7b8494"
},
"lit": {
"background_color": "#fff2a6",
"color": "#664400",
"icon_color": "#cf8c00",
"is_shining": true
}
},
"elements": {
"Charger": {
"display": "Charger",
"is_static": true,
"description": "Combine with one or more Light Bulbs. Only participating bulbs gain 10 charge, up to 100."
},
"Bulb": {
"display": [
{
"type": "icon",
"name": "lightbulb"
},
" Light Bulb [",
{
"type": "bind",
"target": {
"name": "charge",
"precision": 0
}
},
"]",
{
"type": "progress",
"value": {
"type": "bind",
"target": {
"name": "charge"
}
}
}
],
"class": "unlit",
"is_static": true,
"description": "Select this bulb to turn it on. It glows and uses 1 charge per tick. Selecting another bulb turns the previous one off. Empty bulbs turn off. Recharge at Charger and select again.",
"custom_props": {
"charge": {
"scope": "local",
"type": "number",
"value": 100,
"events": {
"min": {
"value": 0
},
"max": {
"value": 100
},
"at": {
"value": 0,
"do": [
{
"type": "set_class",
"target": {
"uuid": {
"type": "computed",
"expression": "el_uuid()"
}
},
"class": "unlit"
}
]
}
}
},
"active": {
"type": "array",
"value": []
}
},
"events": {
"on_tick": {
"is_enabled": true,
"do": [
{
"type": "set",
"target": {
"id": "Bulb",
"filter": "el_uuid() in g('Bulb', 'active') and l(el_uuid(), 'charge') > 0",
"limit": -1,
"name": "charge"
},
"value": {
"type": "computed",
"expression": "l(el_uuid(), 'charge') - 1"
}
}
]
}
}
}
},
"events": {
"on_start": [
"Charger",
"Bulb",
"Bulb",
"Bulb"
],
"on_join": [],
"on_leave": []
},
"reactions": [
{
"reagents": [
"Charger",
{
"id": "Bulb",
"limit": -1
}
],
"result": [
{
"type": "set",
"target": {
"from": "reagents",
"id": "Bulb",
"limit": -1,
"name": "charge"
},
"value": {
"type": "computed",
"expression": "l(el_uuid(), 'charge') + 10"
}
}
]
},
{
"reagents": [
{
"id": "Bulb",
"alias": "selected"
}
],
"result": [
{
"type": "set_class",
"target": {
"id": "Bulb",
"filter": "el_uuid() in g('Bulb', 'active')",
"limit": -1
},
"class": "unlit"
},
{
"type": "set",
"target": {
"id": "Bulb",
"name": "active"
},
"value": {
"type": "computed",
"expression": "group('selected')"
}
},
{
"type": "set_class",
"target": {
"from": "selected",
"filter": "l(el_uuid(), 'charge') > 0"
},
"class": "lit"
}
]
}
]
}For the field reference, see the modding guide.