mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-31 04:51:40 +09:00
Work Around For Desync
This commit is contained in:
@@ -8,12 +8,14 @@
|
|||||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
local Game = require('FactorioStdLib.Game@^0.8.0')
|
||||||
local Server = require('ExpGamingCore.Server@^4.0.0')
|
local Server = require('ExpGamingCore.Server@^4.0.0')
|
||||||
local Role -- ExpGamingCore.Role@^4.0.0
|
local Role -- ExpGamingCore.Role@^4.0.0
|
||||||
|
local Admin -- ExpGamingAdmin.AdminLib@^4.0.0
|
||||||
|
|
||||||
-- Module Define
|
-- Module Define
|
||||||
local module_verbose = false
|
local module_verbose = false
|
||||||
local ThisModule = {
|
local ThisModule = {
|
||||||
on_init=function()
|
on_init=function()
|
||||||
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then Role = require('ExpGamingCore.Role@^4.0.0') end
|
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then Role = require('ExpGamingCore.Role@^4.0.0') end
|
||||||
|
if loaded_modules['ExpGamingAdmin.AdminLib@^4.0.0'] then Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,6 +33,11 @@ Event.register(-1,function(event)
|
|||||||
if tree and tree.valid then tree.destroy() end
|
if tree and tree.valid then tree.destroy() end
|
||||||
end
|
end
|
||||||
end):on_event(defines.events.on_marked_for_deconstruction,function(self,event)
|
end):on_event(defines.events.on_marked_for_deconstruction,function(self,event)
|
||||||
|
-- the _env should be auto loaded but it does not for some reason
|
||||||
|
local _ENV = _ENV or setmetatable({},{__index=_G})
|
||||||
|
_ENV.Game = self._env.Game
|
||||||
|
_ENV.Role = self._env.Role
|
||||||
|
_ENV.Admin = self._env.Admin
|
||||||
local chache = self.data.chache[event.player_index]
|
local chache = self.data.chache[event.player_index]
|
||||||
if not chache then
|
if not chache then
|
||||||
local player = Game.get_player(event)
|
local player = Game.get_player(event)
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ script.on_init(function(event)
|
|||||||
game.print{'ExpGamingBot-autoMessage.message',{'ExpGamingBot-autoMessage.map-time',tick_to_display_format(game.tick)}}
|
game.print{'ExpGamingBot-autoMessage.message',{'ExpGamingBot-autoMessage.map-time',tick_to_display_format(game.tick)}}
|
||||||
self.reopen = true
|
self.reopen = true
|
||||||
end):on_event(defines.events.on_player_joined_game,function(self,event)
|
end):on_event(defines.events.on_player_joined_game,function(self,event)
|
||||||
|
-- the _env should be auto loaded but it does not for some reason
|
||||||
|
local _ENV = _ENV or setmetatable({},{__index=_G})
|
||||||
|
_ENV.Game = self._env.Game
|
||||||
|
_ENV.Role = self._env.Role
|
||||||
local player = Game.get_player(event)
|
local player = Game.get_player(event)
|
||||||
if not player then return end
|
if not player then return end
|
||||||
local data = self.data
|
local data = self.data
|
||||||
@@ -60,6 +64,9 @@ script.on_init(function(event)
|
|||||||
player_return({'ExpGamingBot-autoMessage.message',message},nil,player)
|
player_return({'ExpGamingBot-autoMessage.message',message},nil,player)
|
||||||
end
|
end
|
||||||
end):on_event('error',function(self,err)
|
end):on_event('error',function(self,err)
|
||||||
|
-- the _env should be auto loaded but it does not for some reason
|
||||||
|
local _ENV = _ENV or setmetatable({},{__index=_G})
|
||||||
|
_ENV.Sync = self._env.Sync
|
||||||
if Sync then Sync.emit_embeded{
|
if Sync then Sync.emit_embeded{
|
||||||
title='Auto Message Error',
|
title='Auto Message Error',
|
||||||
color=Color.to_hex(defines.textcolor.bg),
|
color=Color.to_hex(defines.textcolor.bg),
|
||||||
|
|||||||
@@ -88,9 +88,12 @@ function popup.open(style,data,players)
|
|||||||
Server.new_thread{
|
Server.new_thread{
|
||||||
data={players=players,popup=_popup,data=data}
|
data={players=players,popup=_popup,data=data}
|
||||||
}:on_event('tick',function(thread)
|
}:on_event('tick',function(thread)
|
||||||
|
-- the _env should be auto loaded but it does not for some reason
|
||||||
|
local _ENV = _ENV or setmetatable({},{__index=_G})
|
||||||
|
_ENV.popup = self._env.popup
|
||||||
if #thread.data.players == 0 then thread:close() return end
|
if #thread.data.players == 0 then thread:close() return end
|
||||||
local player = table.remove(thread.data.players,1)
|
local player = table.remove(thread.data.players,1)
|
||||||
if _popup.left then _popup.left:close(player) end
|
if thread.data.popup.left then thread.data.popup.left:close(player) end
|
||||||
local flow = popup.flow(player)
|
local flow = popup.flow(player)
|
||||||
flow.style.visible=true
|
flow.style.visible=true
|
||||||
local _frame = flow.add{
|
local _frame = flow.add{
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ return function(event)
|
|||||||
-- posible error handling if needed
|
-- posible error handling if needed
|
||||||
error(err)
|
error(err)
|
||||||
end):on_event(defines.events.on_player_respawned,function(self,event)
|
end):on_event(defines.events.on_player_respawned,function(self,event)
|
||||||
|
-- the _env should be auto loaded but it does not for some reason
|
||||||
|
local _ENV = _ENV or setmetatable({},{__index=_G})
|
||||||
|
_ENV.Game = self._env.Game
|
||||||
if self.data.players[event.player_index] then
|
if self.data.players[event.player_index] then
|
||||||
local remove = {}
|
local remove = {}
|
||||||
local player = Game.get_player(event)
|
local player = Game.get_player(event)
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ script.on_init(function(event)
|
|||||||
Server.new_thread{
|
Server.new_thread{
|
||||||
name='afk-kick',
|
name='afk-kick',
|
||||||
}:on_event('tick',function(self)
|
}:on_event('tick',function(self)
|
||||||
|
-- the _env should be auto loaded but it does not for some reason
|
||||||
|
local _ENV = _ENV or setmetatable({},{__index=_G})
|
||||||
|
_ENV.get_allowed_afk_time = self._env.get_allowed_afk_time
|
||||||
if (game.tick%3600) ~= 0 then return end
|
if (game.tick%3600) ~= 0 then return end
|
||||||
for _,player in pairs(game.connected_players) do
|
for _,player in pairs(game.connected_players) do
|
||||||
local afk = #game.connected_players < 3 and 10 or get_allowed_afk_time(player)
|
local afk = #game.connected_players < 3 and 10 or get_allowed_afk_time(player)
|
||||||
@@ -14,6 +17,9 @@ script.on_init(function(event)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end):on_event('error',function(self,err)
|
end):on_event('error',function(self,err)
|
||||||
|
-- the _env should be auto loaded but it does not for some reason
|
||||||
|
local _ENV = _ENV or setmetatable({},{__index=_G})
|
||||||
|
_ENV.Sync = self._env.Sync
|
||||||
if Sync then
|
if Sync then
|
||||||
Sync.emit_embeded{
|
Sync.emit_embeded{
|
||||||
title='Auto Kick Error',
|
title='Auto Kick Error',
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ for name,group in pairs(_root_list) do
|
|||||||
data=element
|
data=element
|
||||||
}:on_event('timeout',function(self)
|
}:on_event('timeout',function(self)
|
||||||
if self.data and self.data.valid then
|
if self.data and self.data.valid then
|
||||||
element.parent.parent['game-settings-are-you-sure'].state = false
|
self.data.parent.parent['game-settings-are-you-sure'].state = false
|
||||||
self.data.parent.style.visible = false
|
self.data.parent.style.visible = false
|
||||||
self.data.state = false
|
self.data.state = false
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user