A utility library for Dwarf Fortress DFHack scripts that provides various helper functions for item management, unit tracking, job creation, and stockpile management.
- Lua Utilities
- Logging Utilities
- Item Processing
- Jobs Processing
- Building Processing
- Units Processing
- DFHack Utilities
Utility functions for working with Lua tables and values.
Converts all keys in a table to string representations and returns them as an array.
Checks if any element in the table matches the given value.
Checks if all elements in the table match the given value. Returns false if table is empty.
Returns a new array with all elements converted to lowercase.
Counts the number of entries in a table.
Prints a formatted log message with a key prefix.
Functions for identifying and processing different types of items.
RL.isRefuseBodyPart(item)- Checks if item is a refuse body part (scale, feather, cartilage, claw, nerve)RL.isTooth(item)- Checks if item is a toothRL.isSkull(item)- Checks if item is a skullRL.isBone(item)- Checks if item is a boneRL.isShell(item)- Checks if item is a shellRL.isHorn(item)- Checks if item is a hornRL.isHoof(item)- Checks if item is a hoofRL.isHair(item)- Checks if item is hairRL.isWool(item)- Checks if item is wool
Checks if an item could be stored in the specified stockpile and returns coordinates where to put this item. Does not check quality filters of the stockpile. Time-consuming operation because of a lot of ifs.
Functions for creating and managing jobs and laborers.
Checks if coordinates are already targeted by other jobs.
Checks if a unit is available for a job (not currently working, not caged or chained, not in active military duty).
Checks if a unit has the specified labor enabled, is available, can access the building, and is assigned to the given burrow.
Finds a citizen who can perform work at the specified workshop and is assigned to the given burrow.
Checks if an item already has a job attached to it.
Creates a job of the specified type at the given position, linked to the building, for the item, and assigns an available unit to it. If there's a wheelbarrow, use it to bring the item.
Functions for working with buildings, especially stockpiles.
Collects all map tiles occupied by a building.
Finds any tile occupied by a building.
Finds an available wheelbarrow assigned to a stockpile.
Checks if a stockpile has any free tiles without items or pending jobs. Could be use to store items that should occupy the whole tile.
Checks if a stockpile has both free tiles and is configured to accept any materials.
Functions for managing and inspecting units (dwarves, animals, etc).
Checks if a unit can path to a building.
Checks if a unit is assigned to a specified burrow.
Returns the cause of death and killer name (if applicable) for a dead unit.
Miscellaneous utilities for debugging and UI display.
Prints all elements of a table in a safe way to the stderr.log file. Useful for debugging.
Splits text into lines of a maximum length with color formatting for UI display.
Counts the number of lines in a text chunk for UI layout purposes.