mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Fixed Stutter wit only one cam
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user