Refactor of commands

This commit is contained in:
Cooldude2606
2019-03-01 20:24:23 +00:00
parent e547f76d6f
commit 62dcfe8694
288 changed files with 5364 additions and 1067 deletions

View File

@@ -0,0 +1,29 @@
local Sync = Sync
local get_allowed_afk_time = self
local Server = require('ExpGamingCore.Server')
local Color = require('FactorioStdLib.Color')
Event[defines.events.on_tick] = nil
script.on_init(function(event)
Server.new_thread{
name='afk-kick',
}:on_event('tick',function(self)
if (game.tick%3600) ~= 0 then return end
for _,player in pairs(game.connected_players) do
local afk = #game.connected_players < 3 and 10 or get_allowed_afk_time(player)
if afk then
if player.afk_time > afk*3600 then game.kick_player(player,'AFK For Too Long ('..math.floor(afk)..' Minutes)') end
end
end
end):on_event('error',function(self,err)
if Sync then
Sync.emit_embedded{
title='Auto Kick Error',
color=Color.to_hex(defines.textcolor.bg),
description='Auto Kick Error - Closed Thread',
Error=err
}
end
self:close()
end):open()
end)