diff --git a/ExpCore/gui.lua b/ExpCore/gui.lua index 8742e312..d054cb06 100644 --- a/ExpCore/gui.lua +++ b/ExpCore/gui.lua @@ -55,7 +55,7 @@ local function _thread() thread = Server.new_thread{name='camera-follow',data={cams={},cam_index=1}} thread:on_event('tick',function(self) local _cam = self.data.cams[self.data.cam_index] - if not _cam then self.data.cam_index = 1 return end + if not _cam then self.data.cam_index = 1 _cam = self.data.cams[self.data.cam_index] end if not _cam.cam.valid then table.remove(self.data.cams,self.data.cam_index) elseif not _cam.entity.valid then table.remove(self.data.cams,self.data.cam_index) else _cam.cam.position = _cam.entity.position if not _cam.surface then _cam.cam.surface_index = _cam.entity.surface.index end self.data.cam_index = self.data.cam_index+1 @@ -118,7 +118,7 @@ Event.register(defines.events.on_tick, function(event) end if Gui._global().cams and is_type(Gui._global().cams,'table') and #Gui._global().cams > 0 then local _cam = Gui._global().cams[Gui._global().cam_index] - if not _cam then Gui._global().cam_index = 1 return end + if not _cam then Gui._global().cam_index = 1 _cam = Gui._global().cams[Gui._global().cam_index] end if not _cam.cam.valid then table.remove(Gui._global().cams,Gui._global().cam_index) elseif not _cam.entity.valid then table.remove(Gui._global().cams,Gui._global().cam_index) else _cam.cam.position = _cam.entity.position if not _cam.surface then _cam.cam.surface_index = _cam.entity.surface.index end Gui._global().cam_index = Gui._global().cam_index+1