Fixed Manager.sandbox to work with upvalues

This commit is contained in:
Cooldude2606
2018-10-26 15:06:24 +01:00
parent b928d593f6
commit b8ec2b2ca0
6 changed files with 4 additions and 99 deletions

View File

@@ -6,21 +6,6 @@ local Server = require('ExpGamingCore.Server@^4.0.0')
Server.add_module_to_interface('ExpGui','ExpGamingCore.Gui')
local function on_player_respawned(self,event)
-- the _env should be auto loaded but does not, so to prevent desyncs it cant be an anon function
if self.data.players[event.player_index] then
local remove = {}
local player = Game.get_player(event)
for index,cam in pairs(self.data.players[event.player_index]) do
if cam.valid then table.insert(self.data.cams,{cam=cam,entity=player.character,surface=player.surface})
else table.insert(remove,index) end
end
for n,index in pairs(remove) do
table.remove(self.data.players[event.player_index],index-n+1)
end
end
end
--- Adds a server thread that allows the camera follows to be toggled off and on
return function(event)
Server.new_thread{
@@ -40,7 +25,6 @@ return function(event)
end
self.data.cam_index = self.data.cam_index+update
end):on_event(defines.events.on_player_respawned,function(self,event)
-- the _env should be auto loaded but does not, so to prevent desyncs it cant be an anon function
if self.data.players[event.player_index] then
local remove = {}
local player = Game.get_player(event)