Add documentation to Beds and Algae

This commit is contained in:
Dallas DeBruin 2021-06-03 11:48:57 -04:00
parent 2d53a62342
commit 1cdd518fe5
10 changed files with 79 additions and 3 deletions

11
mods/algae/doc/algae.ent Normal file
View File

@ -0,0 +1,11 @@
Algae
-----------------
The algae mod implements 3 different decorative algae mosses.
"Thin", "Medium", and "Thick"
These will appear in:
1. Forest biomes near the shore
2. Savana biomes near the shore
3. Rainforest Biomes near papyrus
-----------------
* They are purely decorative.
* When placed, they will be given a random rotation.

3
mods/algae/doc/algae.img Normal file
View File

@ -0,0 +1,3 @@
algae_thin_1.png
algae_medium_1.png
algae_thick_1.png

View File

@ -5,6 +5,19 @@ local S = minetest.get_translator("algae")
-- Algae
--
-----Load documentation via doc_helper------------------------
local MP = minetest.get_modpath(minetest.get_current_modname())
local docpath = MP .. DIR_DELIM .. "doc"
doc.add_category("_aglae",
{
name = "_algae",
description = "Algae Mod Documentation",
build_formspec = doc.entry_builders.text_and_square_gallery,
})
doc.build_entries(docpath, "_algae")
------Registrations--------
local algae_thin_def = {
description = S("Thin algae"),
drawtype = "nodebox",

View File

@ -1,4 +1,4 @@
name = algae
description = Algae mapgen addition to "Minetest Game"
depends = default
depends = default, doc_helper
min_minetest_version = 5.0

14
mods/beds/doc/beds.ent Normal file
View File

@ -0,0 +1,14 @@
Beds
-----------------
Beds allow players to skip the night by sleeping.
To sleep, right click on the bed.
In singleplayer mode, the night gets skipped immediately.
If multiplayer mode, you see how many other players are in bed too,
if all players are sleeping the night gets skipped.
The night skip can be forced if more than half of
the players are lying in bed and use this option.
-----------------
Another feature is a controlled respawning.
If you have slept in bed (not just lying in it)
your respawn point is set to the beds location
and you will respawn there after death.

1
mods/beds/doc/beds.img Normal file
View File

@ -0,0 +1 @@
beds_bed_fancy.png

View File

@ -0,0 +1,12 @@
-- beds/documentation.lua
-----Load documentation via doc_helper------------------------
local MP = minetest.get_modpath(minetest.get_current_modname())
local docpath = MP .. DIR_DELIM .. "doc"
doc.add_category("_beds",
{
name = "_beds",
description = "Bed Documentation",
build_formspec = doc.entry_builders.text_and_square_gallery,
})
doc.build_entries(docpath, "_beds")

View File

@ -24,3 +24,4 @@ dofile(modpath .. "/functions.lua")
dofile(modpath .. "/api.lua")
dofile(modpath .. "/beds.lua")
dofile(modpath .. "/spawns.lua")
dofile(modpath .. "/documentation.lua")

View File

@ -1,3 +1,3 @@
name = beds
description = Minetest Game mod: beds
depends = default, wool
depends = default, wool, doc_helper

View File

@ -28,11 +28,32 @@ doc.build_entries = function(path, category)
end
end
-- Scrollable freeform text with an optional standard gallery (3 rows, 1:1 aspect ratio)
doc.entry_builders.text_and_square_gallery = function(data, playername)
-- How much height the image gallery “steals” from the text widget
local stolen_height = 0
local formstring = ""
-- Only add the gallery if images are in the data, otherwise, the text widget gets all of the space
if data.images ~= nil then
local gallery
gallery, stolen_height = doc.widgets.gallery(data.images, playername, nil, doc.FORMSPEC.ENTRY_END_Y + 0.2, 1, nil, nil, nil, false)
formstring = formstring .. gallery
end
formstring = formstring .. doc.widgets.text(data.text,
doc.FORMSPEC.ENTRY_START_X,
doc.FORMSPEC.ENTRY_START_Y,
doc.FORMSPEC.ENTRY_WIDTH - 0.4,
doc.FORMSPEC.ENTRY_HEIGHT - stolen_height)
return formstring
end
local docpath = MP .. DIR_DELIM .. "doc"
doc.add_category("fun",
{
name = "fun",
description = "FUN!",
build_formspec = doc.entry_builders.text_and_gallery,
build_formspec = doc.entry_builders.text_and_square_gallery,
})
doc.build_entries(docpath, "fun")