forked from minetest-mods/areas
Allow custom checks before allowing a player to protect new areas (#74)
This commit is contained in:
13
api.lua
13
api.lua
@ -1,9 +1,22 @@
|
||||
local hudHandlers = {}
|
||||
|
||||
areas.registered_protection_conditions = {}
|
||||
areas.registered_on_adds = {}
|
||||
areas.registered_on_removes = {}
|
||||
areas.registered_on_moves = {}
|
||||
|
||||
areas.callback_origins = {}
|
||||
|
||||
function areas:registerProtectionCondition(func)
|
||||
table.insert(areas.registered_protection_conditions, func)
|
||||
local debug_info = debug.getinfo(func, "S")
|
||||
areas.callback_origins[func] = {
|
||||
mod = core.get_current_modname() or "??",
|
||||
source = debug_info.short_src or "??",
|
||||
line = debug_info.linedefined or "??"
|
||||
}
|
||||
end
|
||||
|
||||
function areas:registerOnAdd(func)
|
||||
table.insert(areas.registered_on_adds, func)
|
||||
end
|
||||
|
Reference in New Issue
Block a user