Spawn kill 5 minute delay
This commit is contained in:
parent
fad810c120
commit
8277621575
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
--read some basic information
|
--read some basic information
|
||||||
local factions_worldid = minetest.get_worldpath()
|
local factions_worldid = minetest.get_worldpath()
|
||||||
|
local storage = minetest.get_mod_storage()
|
||||||
|
|
||||||
--! @class factions
|
--! @class factions
|
||||||
--! @brief main class for factions
|
--! @brief main class for factions
|
||||||
@ -24,8 +25,6 @@ factions.factions = {}
|
|||||||
factions.parcels = {}
|
factions.parcels = {}
|
||||||
factions.players = {}
|
factions.players = {}
|
||||||
|
|
||||||
|
|
||||||
factions.factions = {}
|
|
||||||
--- settings
|
--- settings
|
||||||
factions.protection_max_depth = config.protection_max_depth
|
factions.protection_max_depth = config.protection_max_depth
|
||||||
factions.power_per_parcel = config.power_per_parcel
|
factions.power_per_parcel = config.power_per_parcel
|
||||||
@ -984,8 +983,12 @@ function(player)
|
|||||||
local pos = player:get_pos()
|
local pos = player:get_pos()
|
||||||
|
|
||||||
local parcel_faction = factions.get_faction_at(pos)
|
local parcel_faction = factions.get_faction_at(pos)
|
||||||
|
-- Login-Time-Stamp
|
||||||
if parcel_faction and parcel_faction.is_admin == false then
|
local key = "LTS:"..name
|
||||||
|
local value = storage:get_int(key)
|
||||||
|
-- 300 seconds = 5 minutes
|
||||||
|
-- Kill unstamped players.
|
||||||
|
if parcel_faction and parcel_faction.is_admin == false and (value == 0 or os.time() - value >= 300) then
|
||||||
if not faction or parcel_faction.name ~= faction.name then
|
if not faction or parcel_faction.name ~= faction.name then
|
||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
if player then
|
if player then
|
||||||
@ -994,6 +997,11 @@ function(player)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if value == 0 then
|
||||||
|
local v = os.time()
|
||||||
|
storage:set_int(key,v)
|
||||||
|
value = v
|
||||||
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1007,6 +1015,9 @@ minetest.register_on_leaveplayer(
|
|||||||
end
|
end
|
||||||
removeHud(player,"1")
|
removeHud(player,"1")
|
||||||
removeHud(player,"2")
|
removeHud(player,"2")
|
||||||
|
-- Login-Time-Stamp
|
||||||
|
local key = "LTS:"..name
|
||||||
|
storage:set_int(key,os.time())
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user