Use status effects for elixirs and cold demon slow.
This commit is contained in:
parent
b486af8627
commit
e9ae30dfc9
4 changed files with 37 additions and 16 deletions
23
init.lua
23
init.lua
|
@ -112,6 +112,29 @@ function fun_caves.register_status(def)
|
|||
}
|
||||
end
|
||||
|
||||
function fun_caves.set_status(player_name, status, time, param)
|
||||
local player = minetest.get_player_by_name(player_name)
|
||||
local def = fun_caves.registered_status[status]
|
||||
if not (def and player) then
|
||||
return
|
||||
end
|
||||
|
||||
if not param then
|
||||
param = {}
|
||||
end
|
||||
|
||||
if time then
|
||||
param.remove = minetest.get_gametime() + time
|
||||
end
|
||||
|
||||
if player_name and status and fun_caves.db.status[player_name] then
|
||||
fun_caves.db.status[player_name][status] = param
|
||||
if def.start then
|
||||
def.start(player)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--dofile(fun_caves.path .. "/recipe_list.lua")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue