1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-09 13:37:02 +02:00

23 lines
498 B
Lua
Raw Normal View History

2021-03-22 12:46:02 +01:00
local Public = {}
--[[
on_inactive_players - Performs operation on inactive players from the game
if they exceed time.
@param time - Maximum time a player can be inactive.
--]]
2021-03-28 16:58:54 +02:00
Public.on_inactive_players = function(time)
if not time then
time = 5
end
2021-03-22 12:46:02 +01:00
for _, p in pairs(game.connected_players) do
2021-03-28 16:58:54 +02:00
local afk = p.afk_time
time = time * 60 * 60
2021-03-22 12:46:02 +01:00
if afk >= time then
2021-03-28 16:58:54 +02:00
game.kick_player(p, 'Kicked by script')
2021-03-22 12:46:02 +01:00
end
end
end
2021-03-22 12:46:02 +01:00
return Public