Current Systems
Enhanced System
Purpose: The Enhanced System takes the raws as they are now and adds new token options to them. These additional tokens are declared in curly brackets {} and so are not read by DF itself, but instead by the system.
System Modules: Enhanced Buildings, Enhanced Items, Enhanced Reactions
enhancedBuildings
Raw File Type: Building
Eventful Functions: - onJobInitiated
- onJobCompleted
Custom Events: Accepted Tokens: (in no particular order yet)
- {POWER_PRODUCED:#} - Amount of power produced if {MECHANICAL}
- {GEAR_POINT:x} - Location of gear connection point if {MECHANICAL}
- {ON_FINISH} - Sets up a trigger for when the building is finished
- {DESCRIPTION:string} - Sets a description to be used for the journal utility in the future
- {ON_DECONSTRUCT} - Sets up a trigger for when the building is being deconstructed
- {OUTSIDE_ONLY} - If present, will only allow construction if all squares are outside
- {REPEATING_SCRIPT} - A dfhack script to run at a specific frequency (if # == 0 the script is only run once)
- {ON_REMOVED} - Sets up a trigger for when the building is fully removed (from deconstruction)
- {ON_START} - Sets up a trigger for when the building is started (after materials are gathered)
- {MECHANICAL} - Sets the building as a mechanical building through require('plugins.building-hacks').registerBuilding
- {REQUIRED_MAGMA:#} - Amount of magma needed around and/or under the building to be constructed
- {POWER_CONSUMED:#} - Amount of power consumed if {MECHANICAL}
- {CONSTRUCTION_TIME:skill:basedur:skilldecrease:mindur} - Changes the amount of time it takes to construct the building once all materials are brought to it
- {MAX_AMOUNT:#} - Max number of this building that can be constructed (equivalent to {FORBIDDEN_BUILDING:THIS_BUILDING:#}
- {FORBIDDEN_BUILDING:A:B} - Amount of specific building needed to exist in order for this building to not be constructed
- {REQUIRED_BUILDING:A:B} - Amount of specific building needed to exist in order for this building to be constructed
- {REQUIRED_WATER:#} - Amount of water needed around and/or under the building to be constructed
- {ON_QUEUE} - Sets up a trigger for when the building is started (before materials are gathered)
- {INSIDE_ONLY} - If present, will only allow construction if all squares are inside
- {NEEDS_POWER} - Sets needs_power to true for registerBuilding
- {AUTO_GEARS} - Sets auto_gears to true for registerBuilding
- {SCRIPT} - A dfhack script to run once with a specific probability
Simple Examples: [BUILDING_WORKSHOP:FOUNTAIN]
[NAME:Fountain]
{DESCRIPTION:A building that continually produces mist}
... DF Building Stuff ...
{REQUIRED_WATER:4}
{ON_FINISH}
{REPEATING_SCRIPT:map/spawn-flow -pos [ BUILDING_LOCATION ] -type Mist -density 100:25}
[BUILDING_WORKSHOP:COMPLEX_BUILDING]
[NAME:Complex Building]
{DESCRIPTION:A complex building that takes a long time to build}
... DF Building Stuff ...
{CONSTRUCTION_TIME:MECHANICS:1000:10:1} Base construction time is 1000 ticks, lowers by 10 for each skill level, max build speed is 1
[BUILDING_WORKSHOP:WINDMILL]
[NAME:Windmill]
{DESCRIPTION:A building that can only be built outside and makes power}
... DF Building Stuff ...
{OUTSIDE_ONLY}
{MECHANICAL}
{AUTO_GEARS}
{POWER_PRODUCED:25}
enhancedItems
Raw File Type: Item
Eventful Functions: - onProjItemCheckImpact
- onUnitAttack
- onProjItemCheckMovement
- onInventoryChange
Custom Events: - onItemAction
- onItemProjectile
Accepted Tokens: (in no particular order yet)
- {ON_PARRY} - Sets up a trigger for when a unit parries with the item
- {ON_PROJECTILE_FIRED} - Sets up a trigger for when an item projectile is fired
- {ATTRIBUTE_CHANGE:target:attribute:change:chance} - Equivalent to {SCRIPT:unit/change-attribute ...}
- {DESCRIPTION:string} - Sets a description to be used for the journal utility in the future
- {ON_PROJECTILE_HIT} - Sets up a trigger for when an item projectile hits
- {SYNDROME_CHANGE:target:syndrome:change:chance} - Equivalent to {SCRIPT:unit/change-syndrome ...}
- {SCRIPT} - A dfhack script to run with a specific chance when triggered
- {ATTRIBUTE:A:B} - Used as a shortcut for ON_EQUIP and ON_UNEQUIP attribute changes
- {ON_PROJECTILE_MOVE} - Sets up a trigger for when an item projectile moves
- {ON_EQUIP} - Sets up a trigger for when the item is equipped
- {CLASS:string} - Define an item class, not currently used for anything
- {ON_BLOCK} - Sets up a trigger for when a unit blocks with the item
- {ON_ATTACK} - Sets up a trigger for when a unit attacks (melee) with the item
- {FIRE_RATE:base:change:max} - Adjust the fire rate for ranged weapons
- {ON_UNEQUIP} - Sets up a trigger for when the item is unequipped
- {REPEATING_SCRIPT} - A dfhack script to run with a specific frequency
- {SKILL_CHANGE:target:skill:change:chance} - Equivalent to {SCRIPT:unit/change-skill ...}
- {ON_SHOOT} - Sets up a trigger for when a unit attacks (ranged) with the item
- {ON_WOUND} - Sets up a trigger for when a unit wounds another unit with the item
- {SKILL:A:B} - Used as a shortcut for ON_EQUIP and ON_UNEQUIP skill changes
Simple Examples: [ITEM_SHIELD:ITEM_SHIELD_EXAMPLE]
[NAME:Example Shield]
{DESCRIPTION:Knocks enemy backwards half the time when you block}
... DF Item Stuff ...
{ON_BLOCK}
{SCRIPT:unit/propel -unit OPPONENT -source BLOCKER -velocity [ 50 50 0 ] -mode Relative:50}
[ITEM_WEAPON:RAPID_FIRE_CROSSBOW]
[NAME:Fast Shooting Crossbow]
{DESCRIPTION:Shoots bolts very fast}
... DF Item Stuff ...
{FIRE_RATE:10:2:1} -- Base fire rate is 10, increases by 2 for each skill level, max shot speed is 1
[ITEM_WEAPON:BLOOD_SWORD]
[NAME:Blood Sword]
{DESCRIPTION:Drains blood from opponent when wounded}
... DF Item Stuff ...
{ON_WOUND}
{SCRIPT:unit/change-body -unit OPPONENT -blood \-10:100}
{SCRIPT:unit/change-body -unit HOLDER -blood 10:100}
enhancedReactions
Raw File Type: Reaction
Eventful Functions: - onReactionComplete
- onJobCompleted
- onJobInitiated
Custom Events: Accepted Tokens: (in no particular order yet)
- {REACTION_TIME:skill:basedur:skilldecrease:mindur} - Changes the amount of time it takes to complete the reaction once all materials are brought to it
- {REQUIRED_MAGMA:#} - Amount of nearby magma required for the reaction (does not consume the magma)
- {ON_FINISH} - Sets up a trigger for when the reaction is finished (no product necessary)
- {DESCRIPTION:string} - Sets a description to be used for the journal utility in the future
- {REQUIRED_WATER:#} - Amount of nearby water required for the reaction (does not consume the water)
- {PRODUCT:probability:amount:type:subtype:mattype:matsubtype} - Add custom products to a reaction (only for when the reaction finishes)
- {REPEATING_SCRIPT} - A dfhack script to run with a specific frequency
- {ON_QUEUE} - Sets up a trigger for when the reaction is started (before materials are gathered)
- {SCRIPT} - A dfhack script to run with a specific chance when triggered
- {ON_PRODUCT} - Sets up a trigger for when the reaction is finished and a product is created
- {ON_START} - Sets up a trigger for when the reaction is started (after materials are gathered)
- {CREATE:probability:amount:type:subtype:mattype:matsubtype} - Add custom products to a reaction (produced for any specified trigger)
Simple Examples: [REACTION:MAKE_WAX_CRAFTS]
{REACTION_TIME:WAX_WORKING:1:1:1}
{PRODUCT:100:7:LIQUID:WATER:NONE:NONE}
{PRODUCT:100:150:FLOW:MATERIALDUST:INORGANIC:SLADE}
{ON_QUEUE} -- Triggers when the reaction is queued
{SCRIPT:devel/print-args ON_QUEUE REACTION_NAME WORKER_ID BUILDING_ID [ LOCATION ]:100}
{ON_START} -- Triggers after the ingredients are gathered
{SCRIPT:devel/print-args ON_START REACTION_NAME WORKER_ID BUILDING_ID [ LOCATION ]:100}
{ON_FINISH} -- Triggers when the reaction is finished, no product needed
{SCRIPT:devel/print-args ON_FINISH REACTION_NAME WORKER_ID BUILDING_ID [ LOCATION ]:100}
{ON_PRODUCT} -- Triggers when the reaction is finished and a product is produced
{SCRIPT:devel/print-args ON_PRODUCT REACTION_NAME WORKER_ID BUILDING_ID [ LOCATION ]:100}
[NAME:make wax crafts]
[BUILDING:CRAFTSMAN:CUSTOM_SHIFT_W]
[REAGENT:wax:150:GLOB:NONE:NONE:NONE]
[REACTION_CLASS:WAX]
[PRODUCT:100:1:CRAFTS:NONE:GET_MATERIAL_FROM_REAGENT:wax:NONE]
[SKILL:WAX_WORKING]