From 3658cfc0f16e43b7c52f38eecf47890f815d57fc Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 18 Dec 2019 12:43:17 +0100 Subject: [PATCH] Add help texts for the new ocean plants --- mods/ITEMS/mcl_ocean/corals.lua | 20 ++++++++++++++++++++ mods/ITEMS/mcl_ocean/depends.txt | 3 ++- mods/ITEMS/mcl_ocean/kelp.lua | 24 ++++++++++++++++++++++++ mods/ITEMS/mcl_ocean/seagrass.lua | 9 ++++++--- 4 files changed, 52 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_ocean/corals.lua b/mods/ITEMS/mcl_ocean/corals.lua index 14546b4b6..758a9c4d3 100644 --- a/mods/ITEMS/mcl_ocean/corals.lua +++ b/mods/ITEMS/mcl_ocean/corals.lua @@ -1,4 +1,5 @@ local S = minetest.get_translator("mcl_ocean") +local mod_doc = minetest.get_modpath("doc") ~= nil local corals = { { "tube", S("Tube Coral Block"), S("Dead Tube Coral Block"), S("Tube Coral"), S("Dead Tube Coral"), S("Tube Coral Fan"), S("Dead Tube Coral Fan") }, @@ -72,9 +73,14 @@ local sounds_coral_plant = mcl_sounds.node_sound_leaves_defaults({footstep = mcl for c=1, #corals do local id = corals[c][1] + local doc_desc_block = S("Coral blocks live in the oceans and need a water soure next to them to survive. Without water, they die off.") + local doc_desc_coral = S("Corals grow on top of coral blocks and need to be inside a water source to survive. Without water, it will die off, as well as the coral block below.") + local doc_desc_fan = S("Corals fans grow on top of coral blocks and need to be inside a water source to survive. Without water, it will die off, as well as the coral block below.") + -- Coral Block minetest.register_node("mcl_ocean:"..id.."_coral_block", { description = corals[c][2], + _doc_items_longdesc = doc_desc_block, tiles = { "mcl_ocean_"..id.."_coral_block.png" }, groups = { pickaxey = 1, building_block = 1, coral=1, coral_block=1, coral_species=c, }, sounds = mcl_sounds.node_sound_dirt_defaults(), @@ -84,6 +90,7 @@ for c=1, #corals do }) minetest.register_node("mcl_ocean:dead_"..id.."_coral_block", { description = corals[c][3], + _doc_items_create_entry = false, tiles = { "mcl_ocean_dead_"..id.."_coral_block.png" }, groups = { pickaxey = 1, building_block = 1, coral=2, coral_block=2, coral_species=c, }, sounds = mcl_sounds.node_sound_dirt_defaults(), @@ -94,6 +101,7 @@ for c=1, #corals do -- Coral minetest.register_node("mcl_ocean:"..id.."_coral", { description = corals[c][4], + _doc_items_longdesc = doc_desc_coral, drawtype = "plantlike_rooted", paramtype = "light", paramtype2 = "meshoptions", @@ -125,6 +133,7 @@ for c=1, #corals do }) minetest.register_node("mcl_ocean:dead_"..id.."_coral", { description = corals[c][5], + _doc_items_create_entry = false, drawtype = "plantlike_rooted", paramtype = "light", paramtype2 = "meshoptions", @@ -157,6 +166,7 @@ for c=1, #corals do -- Coral Fan minetest.register_node("mcl_ocean:"..id.."_coral_fan", { description = corals[c][6], + _doc_items_longdesc = doc_desc_fan, drawtype = "plantlike_rooted", paramtype = "light", paramtype2 = "meshoptions", @@ -188,6 +198,7 @@ for c=1, #corals do }) minetest.register_node("mcl_ocean:dead_"..id.."_coral_fan", { description = corals[c][7], + _doc_items_create_entry = false, drawtype = "plantlike_rooted", paramtype = "light", paramtype2 = "meshoptions", @@ -216,6 +227,15 @@ for c=1, #corals do _mcl_hardness = 0, _mcl_blast_resistance = 0, }) + + if mod_doc then + doc.add_entry_alias("nodes", "mcl_ocean:"..id.."_coral", "nodes", "mcl_ocean:"..id.."_coral") + doc.add_entry_alias("nodes", "mcl_ocean:"..id.."_coral_fan", "nodes", "mcl_ocean:"..id.."_coral_fan") + doc.add_entry_alias("nodes", "mcl_ocean:"..id.."_coral_block", "nodes", "mcl_ocean:"..id.."_coral_block") + doc.add_entry_alias("nodes", "mcl_ocean:"..id.."_coral", "nodes", "mcl_ocean:dead_"..id.."_coral") + doc.add_entry_alias("nodes", "mcl_ocean:"..id.."_coral_fan", "nodes", "mcl_ocean:dead_"..id.."_coral_fan") + doc.add_entry_alias("nodes", "mcl_ocean:"..id.."_coral_block", "nodes", "mcl_ocean:dead_"..id.."_coral_block") + end end -- Turn corals and coral fans to dead corals if not inside a water source diff --git a/mods/ITEMS/mcl_ocean/depends.txt b/mods/ITEMS/mcl_ocean/depends.txt index d950d6079..66908e83d 100644 --- a/mods/ITEMS/mcl_ocean/depends.txt +++ b/mods/ITEMS/mcl_ocean/depends.txt @@ -1,5 +1,6 @@ mcl_core mcl_sounds mcl_dye -doc_items +doc? +doc_items? screwdriver? diff --git a/mods/ITEMS/mcl_ocean/kelp.lua b/mods/ITEMS/mcl_ocean/kelp.lua index c02bc60ab..61fdf72b6 100644 --- a/mods/ITEMS/mcl_ocean/kelp.lua +++ b/mods/ITEMS/mcl_ocean/kelp.lua @@ -1,4 +1,5 @@ local S = minetest.get_translator("mcl_ocean") +local mod_doc = minetest.get_modpath("doc") ~= nil -- List of supported surfaces for seagrass and kelp local surfaces = { @@ -74,6 +75,7 @@ end minetest.register_craftitem("mcl_ocean:kelp", { description = S("Kelp"), + _doc_items_create_entry = false, inventory_image = "mcl_ocean_kelp_item.png", wield_image = "mcl_ocean_kelp_item.png", on_place = kelp_on_place, @@ -93,7 +95,20 @@ for s=1, #surfaces do sounds.dig = leaf_sounds.dig sounds.dug = leaf_sounds.dug sounds.place = leaf_sounds.place + local doc_longdesc, doc_img, desc + if surfaces[s][1] == "dirt" then + doc_longdesc = S("Kelp grows inside water on top of dirt, sand or gravel.") + desc = S("Kelp") + doc_create = true + doc_img = "mcl_ocean_kelp_item.png" + else + doc_create = false + end minetest.register_node("mcl_ocean:kelp_"..surfaces[s][1], { + _doc_items_entry_name = desc, + _doc_items_longdesc = doc_longdesc, + _doc_items_create_entry = doc_create, + _doc_items_image = doc_img, drawtype = "plantlike_rooted", paramtype = "light", paramtype2 = "leveled", @@ -126,14 +141,22 @@ for s=1, #surfaces do _mcl_hardness = 0, _mcl_blast_resistance = 0, }) + + if mod_doc and surfaces[s][1] ~= "dirt" then + doc.add_entry_alias("nodes", "mcl_ocean:kelp_dirt", "nodes", "mcl_ocean:kelp_"..surfaces[s][1]) + end end +if mod_doc then + doc.add_entry_alias("nodes", "mcl_ocean:kelp_dirt", "craftitems", "mcl_ocean:kelp") +end -- Dried kelp stuff -- TODO: This is supposed to be eaten very fast minetest.register_craftitem("mcl_ocean:dried_kelp", { description = S("Dried Kelp"), + _doc_items_longdesc = S("Dried kelp is a food item."), inventory_image = "mcl_ocean_dried_kelp.png", wield_image = "mcl_ocean_dried_kelp.png", groups = { food = 2, eatable = 1 }, @@ -152,6 +175,7 @@ end minetest.register_node("mcl_ocean:dried_kelp_block", { description = S("Dried Kelp Block"), + _doc_items_longdesc = S("A decorative block that serves as a great furnace fuel."), tiles = { "mcl_ocean_dried_kelp_top.png", "mcl_ocean_dried_kelp_bottom.png", "mcl_ocean_dried_kelp_side.png" }, groups = { handy = 1, building_block = 1, flammable = 2 }, sounds = mcl_sounds.node_sound_leaves_defaults(), diff --git a/mods/ITEMS/mcl_ocean/seagrass.lua b/mods/ITEMS/mcl_ocean/seagrass.lua index 07019f384..55435ad8f 100644 --- a/mods/ITEMS/mcl_ocean/seagrass.lua +++ b/mods/ITEMS/mcl_ocean/seagrass.lua @@ -1,4 +1,5 @@ local S = minetest.get_translator("mcl_ocean") +local mod_doc = minetest.get_modpath("doc") ~= nil -- List of supported surfaces for seagrass local surfaces = { @@ -98,7 +99,7 @@ for s=1, #surfaces do sounds.dig = leaf_sounds.dig sounds.dug = leaf_sounds.dug sounds.place = leaf_sounds.place - local doc_longdesc, doc_hide, doc_img, desc + local doc_longdesc, doc_img, desc if surfaces[s][1] == "dirt" then doc_longdesc = S("Seagrass grows inside water on top of dirt, sand or gravel.") desc = S("Seagrass") @@ -144,9 +145,11 @@ for s=1, #surfaces do _mcl_hardness = 0, _mcl_blast_resistance = 0, }) - if surfaces[s][1] ~= "dirt" then + if mod_doc and surfaces[s][1] ~= "dirt" then doc.add_entry_alias("nodes", "mcl_ocean:seagrass_dirt", "nodes", "mcl_ocean:seagrass_"..surfaces[s][1]) end end -doc.add_entry_alias("nodes", "mcl_ocean:seagrass_dirt", "craftitems", "mcl_ocean:seagrass") +if mod_doc then + doc.add_entry_alias("nodes", "mcl_ocean:seagrass_dirt", "craftitems", "mcl_ocean:seagrass") +end