switches={ cooldown=0, wait=0, current_list=nil, current_index=-1, [1]={[0]={20, 53,41}}, [11]={[21]={11, 57,45}}, [35]={[14]={32, 50,38,26,53,41,29}}, [53]={[14]={72, 42,30}}, [61]={[14]={54, 54,42}}, [76]={[19]={77, 50,38,26}, [22]={57, 53,41}}, [80]={[18]={36, 56,44}}, [39]={[27]={39, 62,63}} } --switches[11]={[21]={11, 57,45}} --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 sound.play(audio_switch) 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