From d35d8d3431f1c02f70c281558fa211d3bd7642ca Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Tue, 5 Jun 2012 14:06:29 +0400 Subject: [PATCH] Add the script to fix lagging fat dwarves. --- library/xml | 2 +- scripts/fix/fat-dwarves.lua | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 scripts/fix/fat-dwarves.lua diff --git a/library/xml b/library/xml index 7d5c349a4..8c0794489 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 7d5c349a40dc1f211de2d37aeece4a3d9d631ed2 +Subproject commit 8c07944891f09391cc02098074ffc8080b43b184 diff --git a/scripts/fix/fat-dwarves.lua b/scripts/fix/fat-dwarves.lua new file mode 100644 index 000000000..5394f6770 --- /dev/null +++ b/scripts/fix/fat-dwarves.lua @@ -0,0 +1,24 @@ +-- Makes fat dwarves non-fat. +-- +-- See for more info: +-- http://www.bay12games.com/dwarves/mantisbt/view.php?id=5971 + +local num_fat = 0 +local num_lagging = 0 + +for _,v in ipairs(df.global.world.units.all) do + local fat = v.counters2.stored_fat + if fat > 850000 then + v.counters2.stored_fat = 500000 + if v.race == df.global.ui.race_id then + print(fat,dfhack.TranslateName(dfhack.units.getVisibleName(v))) + num_fat = num_fat + 1 + if fat > 999990 then + num_lagging = num_lagging + 1 + end + end + end +end + +print("Fat dwarves cured: "..num_fat) +print("Lag sources: "..num_lagging)