Add reveal example
This commit is contained in:
parent
58018177f5
commit
be8a79dd19
18
doc.lua
18
doc.lua
@ -43,14 +43,28 @@ doc.new_category("example_hide", {
|
||||
})
|
||||
|
||||
-- This entry will start hidden. The user will not see it until it gets
|
||||
-- revealed by using doc.mark_entry_as_revealed.
|
||||
-- TODO: Add example for that, too.
|
||||
-- revealed by using doc.mark_entry_as_revealed. Note that you should
|
||||
-- NOT hide entries if there is no way for the player to reveal them.
|
||||
doc.new_entry("example_hide", "hidden", {
|
||||
name = "Hidden Entry",
|
||||
hidden = true,
|
||||
data = "This entry is hidden.",
|
||||
})
|
||||
|
||||
-- This chat command demonstrates how to use `doc.mark_entry_as_revealed`.
|
||||
minetest.register_chatcommand("doc_example_reveal", {
|
||||
param = "",
|
||||
description = "Reveal the hidden entry of the doc_example mod",
|
||||
privs = {},
|
||||
func = function(playername, params)
|
||||
-- This reveals the previously created entry
|
||||
doc.mark_entry_as_revealed(playername, "example_hide", "hidden")
|
||||
minetest.chat_send_player(playername, "The hidden doc_example entry has been revealed! Look into the category “Example Hidden” to see it.")
|
||||
end,
|
||||
})
|
||||
--[[ In actual game, you would probably want to invent more engaging ways to
|
||||
reveal entries. ;-) ]]
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
--[[ A simple category with 3 entries: Cities.
|
||||
Now we're getting somewhere! This time, we define a custom build_formspec
|
||||
|
Loading…
x
Reference in New Issue
Block a user