Divergent/mods/Nitpicker's Modpack/gamedata/scripts/ish_fixed_bolt_manager.script

26 lines
722 B
Plaintext
Raw Permalink Normal View History

2024-03-17 20:18:03 -04:00
-- BoltManager - Nitpicker's Modpack
-- Last modified: 2021.07.26
-- https://github.com/Ishmaeel/NitpickerModpack
function itms_manager.bolt_manager() -- limit bolt count in actor inventory
ResetTimeEvent("cycle", "bolt_manager", 60)
local sim = alife()
local bolt_max_num = itms_manager.ini_manager:r_float_ex("settings", "bolt_max_num") or 99
local cnt = 0
local id, sec, se_obj
local function itr(temp, obj)
sec = obj:section()
if (sec == "bolt") or (sec == "bolt_bullet") then
cnt = cnt + 1
if (cnt > bolt_max_num) then
obj:destroy_object()
end
end
end
db.actor:iterate_ruck(itr, nil)
return false
end