e4s-sdk/gamedata/scripts/mob_state_mgr.script
2026-06-17 23:06:51 +03:00

35 lines
850 B
Text

function get_state(ini, section, obj)
local state = utils.cfg_get_string(ini, section, "state", obj, false, "", "")
if (state == "") then
return nil
end
return state
end
function set_state(obj, actor, state)
if not state then
return
end
local obj_clsid = get_clsid(obj)
--printf("mob_state_mgr <set_state>: [%s].clsid = %s, state = %s", obj:name(), tostring(obj_clsid), state)
if obj_clsid == clsid.bloodsucker_s then
if state == "invis" then
obj:set_invisible(true)
return
elseif state == "vis" then
obj:set_invisible(false)
return
end
else
-- Ó íåîïîçíàííûõ ìîíñòðîâ ïóñòàÿ ñòðîêà ("") ÿâëÿåòñÿ äîïóñòèìûì (çàîäíî è äåôîëòíûì) ñîñòîÿíèåì
if state == "" then
return
end
end
abort("mob_state_mgr: object '%s': unknown state '%s' requested",
obj:name(), state)
end