Files
cacaus/switches.lua
2022-10-24 16:34:13 +02:00

37 lines
936 B
Lua

switches={
cooldown=0,
wait=0,
current_list=nil,
current_index=-1,
}
switches[11]={}
switches[11][21]={11, 57,45}
function switches.start(hab,tile)
if switches.cooldown>0 then return end
mapa_set_tile_by_index(hab,tile,57)
switches.current_list=switches[hab+1][tile]
print(tile)
switches.current_index=2
switches.wait=0
switches.cooldown=60
end
function switches.update()
if switches.cooldown>0 then switches.cooldown=switches.cooldown-1 end
if switches.current_list==nil then return end
--cls(4)
switches.wait=switches.wait+1
if switches.wait==6 then
switches.wait=0
mapa_set_tile_by_index(switches.current_list[1]-1,switches.current_list[switches.current_index]+1,256)
switches.current_index=switches.current_index+1
if switches.current_index>#switches.current_list then
switches.current_list=nil
end
end
end