26 lines
722 B
Plaintext
26 lines
722 B
Plaintext
-- 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
|