mirror of
https://gitlab.com/rubenwardy/awards.git
synced 2024-11-14 14:40:30 +01:00
Add awards.remove(..)
util
This commit is contained in:
parent
c4709de60f
commit
457eedb913
|
@ -197,6 +197,8 @@ end
|
||||||
* return true to cancel HUD from appearing.
|
* return true to cancel HUD from appearing.
|
||||||
* `awards.unlock(player_name, award_name)`
|
* `awards.unlock(player_name, award_name)`
|
||||||
* gives an award to a player
|
* gives an award to a player
|
||||||
|
* `awards.remove(player_name, award_name)`
|
||||||
|
* removes an award from a player
|
||||||
* `awards.get_award_states(player_name)`
|
* `awards.get_award_states(player_name)`
|
||||||
* Returns list of tables, sorted by `score`, each having the fields:
|
* Returns list of tables, sorted by `score`, each having the fields:
|
||||||
|
|
||||||
|
|
|
@ -183,6 +183,21 @@ function awards.unlock(name, award)
|
||||||
end
|
end
|
||||||
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)
|
function awards.get_award_states(name)
|
||||||
local hash_is_unlocked = {}
|
local hash_is_unlocked = {}
|
||||||
local retval = {}
|
local retval = {}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user