Add notifications when new entry has been unlocked
This commit is contained in:
parent
087e63ac08
commit
37ead15697
@ -21,3 +21,6 @@ This mod helps you in writing extensive documentation for your mod or subgame.
|
|||||||
You can write about basically anything in the presentation you prefer.
|
You can write about basically anything in the presentation you prefer.
|
||||||
|
|
||||||
To get started, read `API.md` in the directory of this mod.
|
To get started, read `API.md` in the directory of this mod.
|
||||||
|
|
||||||
|
## License of everything
|
||||||
|
WTFPL
|
||||||
|
@ -1 +1,2 @@
|
|||||||
unified_inventory?
|
unified_inventory?
|
||||||
|
central_message?
|
||||||
|
9
init.lua
9
init.lua
@ -79,6 +79,15 @@ function doc.mark_entry_as_revealed(playername, category_id, entry_id)
|
|||||||
doc.data.players[playername].stored_data.revealed_count[category_id] = doc.data.players[playername].stored_data.revealed_count[category_id] + 1
|
doc.data.players[playername].stored_data.revealed_count[category_id] = doc.data.players[playername].stored_data.revealed_count[category_id] + 1
|
||||||
-- Needed because a new entry is added to the list of visible entries
|
-- Needed because a new entry is added to the list of visible entries
|
||||||
doc.data.players[playername].entry_textlist_needs_updating = true
|
doc.data.players[playername].entry_textlist_needs_updating = true
|
||||||
|
if minetest.get_modpath("central_message") ~= nil then
|
||||||
|
local cat = doc.data.categories[category_id]
|
||||||
|
cmsg.push_message_player(minetest.get_player_by_name(playername), string.format("New help entry unlocked: %s > %s", cat.def.name, entry.name))
|
||||||
|
end
|
||||||
|
local last_sound = doc.data.players[playername].last_reveal_sound
|
||||||
|
if last_sound == nil or os.difftime(os.time(), last_sound) >= 1 then
|
||||||
|
minetest.sound_play({ name = "doc_reveal", gain = 0.2 }, { to_player = playername })
|
||||||
|
doc.data.players[playername].last_reveal_sound = os.time()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
BIN
sounds/doc_reveal.ogg
Normal file
BIN
sounds/doc_reveal.ogg
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user