1
0
mirror of https://gitlab.com/rubenwardy/awards.git synced 2025-07-16 14:50:24 +02:00

Add awards.remove(..) util

This commit is contained in:
marco_a
2024-04-30 16:52:59 +02:00
parent c4709de60f
commit 457eedb913
2 changed files with 17 additions and 0 deletions

View File

@ -183,6 +183,21 @@ function awards.unlock(name, award)
end
end
function awards.remove(name, award)
local data = awards.player(name)
local awdef = awards.registered_awards[award]
assert(awdef, "Unable to remove an award which doesn't exist!")
if data.disabled or
(not data.unlocked[award]) then
return
end
minetest.log("action", "Award " .. award .." has been removed from ".. name)
data.unlocked[award] = nil
awards.save()
end
function awards.get_award_states(name)
local hash_is_unlocked = {}
local retval = {}