add game&rawdata
This commit is contained in:
parent
0133cd976c
commit
49b34b5546
45731 changed files with 709831 additions and 0 deletions
47
gamedata/scripts/mob_combat.script
Normal file
47
gamedata/scripts/mob_combat.script
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
----------------------------------------------------------------------------------------------------
|
||||
-- Mob combat
|
||||
----------------------------------------------------------------------------------------------------
|
||||
-- Ðàçðàáîò÷èê: Andrey Fidrya (Zmey) af@svitonline.com
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
||||
class "mob_combat"
|
||||
|
||||
function mob_combat:__init(obj, storage)
|
||||
self.object = obj
|
||||
self.st = storage
|
||||
end
|
||||
|
||||
function mob_combat:combat_callback()
|
||||
printf("_bp: mob_combat:combat_callback()")
|
||||
if self.st.enabled and self.object:get_enemy() then
|
||||
if db.storage[self.object:id()].active_scheme then
|
||||
if xr_logic.try_switch_to_another_section(self.object, self.st, db.actor) then
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------------------------------------------------------
|
||||
function add_to_binder(npc, ini, scheme, section, storage)
|
||||
printf("DEBUG: add_to_binder: npc:name()='%s', scheme='%s', section='%s'", npc:name(), scheme, section)
|
||||
|
||||
local new_action = mob_combat(npc, storage)
|
||||
storage.action = new_action
|
||||
|
||||
xr_logic.subscribe_action_for_events(npc, storage, new_action)
|
||||
end
|
||||
|
||||
function set_scheme(npc, ini, scheme, section, gulag_name)
|
||||
local st = xr_logic.assign_storage_and_bind(npc, ini, scheme, section)
|
||||
st.logic = xr_logic.cfg_get_switch_conditions(ini, section, npc)
|
||||
st.enabled = true
|
||||
end
|
||||
|
||||
function disable_scheme(npc, scheme)
|
||||
local st = db.storage[npc:id()][scheme]
|
||||
if st then
|
||||
st.enabled = false
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue