2014-06-26 06:36:57 -06:00
--growthbug: units only grow when the current tick is 0 mod 10, so only 1/10 units will grow naturally. this script periodically sets the birth time of each unit so that it will grow
2014-06-27 01:46:22 -06:00
--to run periodically, use "repeat -time 2 months -command fix/growthBug now". see repeat.lua for details
2014-06-26 06:36:57 -06:00
-- author expwnent
local args = { ... }
if args [ 1 ] ~= nil then
2014-06-27 01:46:22 -06:00
print ( " fix/growthbug usage " )
print ( " fix/growthbug " )
2014-06-26 06:36:57 -06:00
print ( " fix the growth bug for all units on the map " )
2014-06-27 01:46:22 -06:00
print ( " fix/growthbug help " )
2014-06-26 06:36:57 -06:00
print ( " print this help message " )
2014-06-27 01:46:22 -06:00
print ( " repeat -time [n] [years/months/ticks/days/etc] -command fix/growthbug " )
2014-06-26 06:36:57 -06:00
print ( " run this script every n time units " )
2014-06-27 01:46:22 -06:00
print ( " repeat -cancel fix/growthbug " )
2014-06-26 06:36:57 -06:00
print ( " stop automatically running this script " )
end
local count = 0
2014-06-27 04:09:01 -06:00
for _ , unit in ipairs ( df.global . world.units . all ) do
2014-06-26 06:36:57 -06:00
local offset = unit.relations . birth_time % 10 ;
if offset ~= 0 then
count = count + 1
unit.relations . birth_time = unit.relations . birth_time - offset
end
end
print ( " Fixed growth bug for " .. count .. " units. " )
2014-06-27 04:09:01 -06:00