1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-10 00:43:27 +02:00
ComfyFactorio/maps/planet_prison/mod/afk.lua

20 lines
474 B
Lua
Raw Normal View History

local public = {}
local _evt = require("utils.event")
--[[
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