Bugfixing Scripts

fix/* scripts fix various bugs and issues, some of them obscure.


Makes it so that future caravans won’t bring barrels full of blood, ichor, or goo.


Fixes construction jobs that are stuck trying to build a wall while standing on the same exact tile (Bug 5991), designates the tile restricted traffic to hopefully avoid jamming it again, and unsuspends them.


Removes uninteresting dead units from the unit list. Doesn’t seem to give any noticeable performance gain, but migrants normally stop if the unit list grows to around 3000 units, and this script reduces it back.


Removes water from all buckets in your fortress, allowing them to be used for making lye. Skips buckets in buildings (eg a well), being carried, or currently used by a job.


Avoids 5-10% FPS loss due to constant recalculation of insulation for dwarves at maximum fatness, by reducing the cap from 1,000,000 to 999,999. Recalculation is triggered in steps of 250 units, and very fat dwarves constantly bounce off the maximum value while eating.


Reset the GiveWater and GiveFood timers of all units as appropriate.


Diagnoses and fixes issues with nonexistant ‘items occupying site’, usually caused by autodump bugs or other hacking mishaps. Checks that:

  1. Item has flags.on_ground <=> it is in the correct block item list
  2. A tile has items in block item list <=> it has occupancy.item
  3. The block item lists are sorted


Aborts loyalty cascades by fixing units whose own civ is the enemy.


Run this after every migrant wave to ensure your population cap is not exceeded.

The reason for population cap problems is that the population value it is compared against comes from the last dwarven caravan that successfully left for mountainhomes. This script instantly updates it. Note that a migration wave can still overshoot the limit by 1-2 dwarves because of the last migrant bringing his family. Likewise, king arrival ignores cap.


Instantly sets the temperature of all free-lying items to be in equilibrium with the environment, which stops temperature updates until something changes. To maintain this efficient state, use tweak fast-heat.


Fix doors that are stuck open due to incorrect map occupancy flags, eg due to incorrect use of teleport.