From 5e7a7a01470e74319852dd876ce5a7cb055cee43 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 4 Oct 2024 15:59:10 -0700 Subject: [PATCH] prepare to be called by force (the script) --- fix/wildlife.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fix/wildlife.lua b/fix/wildlife.lua index cbd5e13b2..bd80f2433 100644 --- a/fix/wildlife.lua +++ b/fix/wildlife.lua @@ -102,6 +102,17 @@ local function is_active_wildlife(unit) unit.flags2.roaming_wilderness_population_source end +-- called by force for the "Wildlife" event +function free_all_wildlife(include_hidden) + for _,unit in ipairs(df.global.world.units.active) do + if is_active_wildlife(unit) and + (include_hidden or not dfhack.units.isHidden(unit)) + then + detach_unit(unit) + end + end +end + local function unstick_surface_wildlife(opts) local unstuck = {} local week_ago_ticks = math.max(0, df.global.cur_year_tick - TICKS_PER_WEEK)