[WIP] Lluita contra jefes. Eliminats actors de la zona de combat
This commit is contained in:
@@ -2,6 +2,7 @@ local shine_step = 1
|
||||
local shine_wait = 0
|
||||
local shine_pos = 0
|
||||
local map_backup = {}
|
||||
local actors_backup = {}
|
||||
|
||||
function collision(a, b)
|
||||
return (a.x+a.bb.x+a.bb.w >= b.x+b.bb.x)
|
||||
@@ -18,6 +19,51 @@ function remove_actor(actor)
|
||||
end
|
||||
end
|
||||
|
||||
function set_actors_enabled_by_room(_enabled, _reason, room0, room1)
|
||||
print("set_actors_enabled_by_room")
|
||||
print(" hab_list")
|
||||
room1 = room1 or room0
|
||||
local rw=(room1-room0)%mapa_rooms_per_piso
|
||||
local hab_list = {}
|
||||
y = room0
|
||||
while y<=room1 do
|
||||
for x=y, y+rw do
|
||||
hab_list[x]=true
|
||||
print(" "..x)
|
||||
end
|
||||
y = y+mapa_rooms_per_piso
|
||||
end
|
||||
|
||||
for index, actor in pairs(actors) do
|
||||
if hab_list[actor.hab] and actor~=abad then
|
||||
if actor.name then print(" "..actor.name) end
|
||||
if actor.disable_reason then print(" "..actor.disable_reason) end
|
||||
if actor.enabled then print("ENABLED") end
|
||||
|
||||
if not _enabled then
|
||||
print("DISABLE ACTORS")
|
||||
-- disable
|
||||
if actor.enabled then
|
||||
-- Si el actor està actiu -> deshabilitar amb motiu
|
||||
actor.enabled=_enabled
|
||||
actor.disable_reason = _reason
|
||||
print("-> ".._reason)
|
||||
end
|
||||
else
|
||||
-- enable
|
||||
if actor.disable_reason and actor.disable_reason==_reason then
|
||||
-- Si l'actor te un motiu per haver estat deshabilitat -> habilitar i borrar motiu
|
||||
actor.enabled=_enabled
|
||||
actor.disable_reason = ""
|
||||
else
|
||||
-- Habilitar l'actor si no te atribut disable_reason
|
||||
actor.enabled=_enabled
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function disable_actor_by_id( remove_set )
|
||||
local id_list = {}
|
||||
local ok = false
|
||||
|
||||
Reference in New Issue
Block a user