mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-10 00:43:27 +02:00
19 lines
449 B
Lua
19 lines
449 B
Lua
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.
|
|
@param func - Callback that will be called.
|
|
--]]
|
|
Public.on_inactive_players = function(time, func)
|
|
for _, p in pairs(game.connected_players) do
|
|
local afk = p.afk_time / 60 / 60
|
|
if afk >= time then
|
|
func(p)
|
|
end
|
|
end
|
|
end
|
|
|
|
return Public
|