summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-09-01 15:33:11 +0200
committerWuzzy <almikes@aol.com>2016-09-01 15:33:11 +0200
commit37ead15697e57248da23b62e06fa9af4bb538d39 (patch)
tree0e3164cc0ef009c51968aa8f22904dfca88999b3
parent087e63ac08cfad066e8c7849baa92917bc578967 (diff)
Add notifications when new entry has been unlocked
-rw-r--r--README.md3
-rw-r--r--depends.txt1
-rw-r--r--init.lua9
-rw-r--r--sounds/doc_reveal.oggbin0 -> 8873 bytes
4 files changed, 13 insertions, 0 deletions
diff --git a/README.md b/README.md
index 248ed53..5dcc70b 100644
--- a/README.md
+++ b/README.md
@@ -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.
To get started, read `API.md` in the directory of this mod.
+
+## License of everything
+WTFPL
diff --git a/depends.txt b/depends.txt
index 20b7c42..a4d39ae 100644
--- a/depends.txt
+++ b/depends.txt
@@ -1 +1,2 @@
unified_inventory?
+central_message?
diff --git a/init.lua b/init.lua
index 730550e..3dc38cb 100644
--- a/init.lua
+++ b/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
-- Needed because a new entry is added to the list of visible entries
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
diff --git a/sounds/doc_reveal.ogg b/sounds/doc_reveal.ogg
new file mode 100644
index 0000000..3fbe176
--- /dev/null
+++ b/sounds/doc_reveal.ogg
Binary files differ