switches implemented
This commit is contained in:
36
switches.lua
Normal file
36
switches.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
switches={
|
||||
cooldown=0,
|
||||
wait=0,
|
||||
current_list=nil,
|
||||
current_index=-1,
|
||||
}
|
||||
switches[1]={}
|
||||
switches[1][18]={1, 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,255)
|
||||
switches.current_index=switches.current_index+1
|
||||
if switches.current_index>#switches.current_list then
|
||||
switches.current_list=nil
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user