Skip to content

Instantly share code, notes, and snippets.


Gordon W gbwellman

View GitHub Profile
View construct-creature.lua
-- Uses a reaction to spawn a living creature that uses the materials of the reagents as body components. Reactions must begin with LUA_HOOK_CONSTRUCTCREATURE
You can have as many reagents as you like.
Reagents starting with USE will replace materials used in the creature, in the order that they are defined.
Make sure that each USE reagent consists of one item only. Otherwise, the second item taken will be counted as the second material.
Using tools as intermediary reagents is probably your best option for expensive creatures.
The product field determines the creature produced, where the material is CREATURE_MAT:(your creature):NONE. The probability should be set at 0 to avoid actually creating a boulder.
If you want to select a specific caste, the product field should have a PRODUCT_DIMENSION for the caste.
However, to make the creature's color show up based on its material, the creature must have 16 castes, one for each color.