Add help texts for the new ocean plants

This commit is contained in:
Wuzzy 2019-12-18 12:43:17 +01:00
parent ee5e50f139
commit 3658cfc0f1
4 changed files with 52 additions and 4 deletions

@ -1,4 +1,5 @@
local S = minetest.get_translator("mcl_ocean") local S = minetest.get_translator("mcl_ocean")
local mod_doc = minetest.get_modpath("doc") ~= nil
local corals = { 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") }, { "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 for c=1, #corals do
local id = corals[c][1] 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 -- Coral Block
minetest.register_node("mcl_ocean:"..id.."_coral_block", { minetest.register_node("mcl_ocean:"..id.."_coral_block", {
description = corals[c][2], description = corals[c][2],
_doc_items_longdesc = doc_desc_block,
tiles = { "mcl_ocean_"..id.."_coral_block.png" }, tiles = { "mcl_ocean_"..id.."_coral_block.png" },
groups = { pickaxey = 1, building_block = 1, coral=1, coral_block=1, coral_species=c, }, groups = { pickaxey = 1, building_block = 1, coral=1, coral_block=1, coral_species=c, },
sounds = mcl_sounds.node_sound_dirt_defaults(), 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", { minetest.register_node("mcl_ocean:dead_"..id.."_coral_block", {
description = corals[c][3], description = corals[c][3],
_doc_items_create_entry = false,
tiles = { "mcl_ocean_dead_"..id.."_coral_block.png" }, tiles = { "mcl_ocean_dead_"..id.."_coral_block.png" },
groups = { pickaxey = 1, building_block = 1, coral=2, coral_block=2, coral_species=c, }, groups = { pickaxey = 1, building_block = 1, coral=2, coral_block=2, coral_species=c, },
sounds = mcl_sounds.node_sound_dirt_defaults(), sounds = mcl_sounds.node_sound_dirt_defaults(),
@ -94,6 +101,7 @@ for c=1, #corals do
-- Coral -- Coral
minetest.register_node("mcl_ocean:"..id.."_coral", { minetest.register_node("mcl_ocean:"..id.."_coral", {
description = corals[c][4], description = corals[c][4],
_doc_items_longdesc = doc_desc_coral,
drawtype = "plantlike_rooted", drawtype = "plantlike_rooted",
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions", paramtype2 = "meshoptions",
@ -125,6 +133,7 @@ for c=1, #corals do
}) })
minetest.register_node("mcl_ocean:dead_"..id.."_coral", { minetest.register_node("mcl_ocean:dead_"..id.."_coral", {
description = corals[c][5], description = corals[c][5],
_doc_items_create_entry = false,
drawtype = "plantlike_rooted", drawtype = "plantlike_rooted",
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions", paramtype2 = "meshoptions",
@ -157,6 +166,7 @@ for c=1, #corals do
-- Coral Fan -- Coral Fan
minetest.register_node("mcl_ocean:"..id.."_coral_fan", { minetest.register_node("mcl_ocean:"..id.."_coral_fan", {
description = corals[c][6], description = corals[c][6],
_doc_items_longdesc = doc_desc_fan,
drawtype = "plantlike_rooted", drawtype = "plantlike_rooted",
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions", paramtype2 = "meshoptions",
@ -188,6 +198,7 @@ for c=1, #corals do
}) })
minetest.register_node("mcl_ocean:dead_"..id.."_coral_fan", { minetest.register_node("mcl_ocean:dead_"..id.."_coral_fan", {
description = corals[c][7], description = corals[c][7],
_doc_items_create_entry = false,
drawtype = "plantlike_rooted", drawtype = "plantlike_rooted",
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions", paramtype2 = "meshoptions",
@ -216,6 +227,15 @@ for c=1, #corals do
_mcl_hardness = 0, _mcl_hardness = 0,
_mcl_blast_resistance = 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 end
-- Turn corals and coral fans to dead corals if not inside a water source -- Turn corals and coral fans to dead corals if not inside a water source

@ -1,5 +1,6 @@
mcl_core mcl_core
mcl_sounds mcl_sounds
mcl_dye mcl_dye
doc_items doc?
doc_items?
screwdriver? screwdriver?

@ -1,4 +1,5 @@
local S = minetest.get_translator("mcl_ocean") local S = minetest.get_translator("mcl_ocean")
local mod_doc = minetest.get_modpath("doc") ~= nil
-- List of supported surfaces for seagrass and kelp -- List of supported surfaces for seagrass and kelp
local surfaces = { local surfaces = {
@ -74,6 +75,7 @@ end
minetest.register_craftitem("mcl_ocean:kelp", { minetest.register_craftitem("mcl_ocean:kelp", {
description = S("Kelp"), description = S("Kelp"),
_doc_items_create_entry = false,
inventory_image = "mcl_ocean_kelp_item.png", inventory_image = "mcl_ocean_kelp_item.png",
wield_image = "mcl_ocean_kelp_item.png", wield_image = "mcl_ocean_kelp_item.png",
on_place = kelp_on_place, on_place = kelp_on_place,
@ -93,7 +95,20 @@ for s=1, #surfaces do
sounds.dig = leaf_sounds.dig sounds.dig = leaf_sounds.dig
sounds.dug = leaf_sounds.dug sounds.dug = leaf_sounds.dug
sounds.place = leaf_sounds.place 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], { 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", drawtype = "plantlike_rooted",
paramtype = "light", paramtype = "light",
paramtype2 = "leveled", paramtype2 = "leveled",
@ -126,14 +141,22 @@ for s=1, #surfaces do
_mcl_hardness = 0, _mcl_hardness = 0,
_mcl_blast_resistance = 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 end
if mod_doc then
doc.add_entry_alias("nodes", "mcl_ocean:kelp_dirt", "craftitems", "mcl_ocean:kelp")
end
-- Dried kelp stuff -- Dried kelp stuff
-- TODO: This is supposed to be eaten very fast -- TODO: This is supposed to be eaten very fast
minetest.register_craftitem("mcl_ocean:dried_kelp", { minetest.register_craftitem("mcl_ocean:dried_kelp", {
description = S("Dried Kelp"), description = S("Dried Kelp"),
_doc_items_longdesc = S("Dried kelp is a food item."),
inventory_image = "mcl_ocean_dried_kelp.png", inventory_image = "mcl_ocean_dried_kelp.png",
wield_image = "mcl_ocean_dried_kelp.png", wield_image = "mcl_ocean_dried_kelp.png",
groups = { food = 2, eatable = 1 }, groups = { food = 2, eatable = 1 },
@ -152,6 +175,7 @@ end
minetest.register_node("mcl_ocean:dried_kelp_block", { minetest.register_node("mcl_ocean:dried_kelp_block", {
description = S("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" }, 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 }, groups = { handy = 1, building_block = 1, flammable = 2 },
sounds = mcl_sounds.node_sound_leaves_defaults(), sounds = mcl_sounds.node_sound_leaves_defaults(),

@ -1,4 +1,5 @@
local S = minetest.get_translator("mcl_ocean") local S = minetest.get_translator("mcl_ocean")
local mod_doc = minetest.get_modpath("doc") ~= nil
-- List of supported surfaces for seagrass -- List of supported surfaces for seagrass
local surfaces = { local surfaces = {
@ -98,7 +99,7 @@ for s=1, #surfaces do
sounds.dig = leaf_sounds.dig sounds.dig = leaf_sounds.dig
sounds.dug = leaf_sounds.dug sounds.dug = leaf_sounds.dug
sounds.place = leaf_sounds.place 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 if surfaces[s][1] == "dirt" then
doc_longdesc = S("Seagrass grows inside water on top of dirt, sand or gravel.") doc_longdesc = S("Seagrass grows inside water on top of dirt, sand or gravel.")
desc = S("Seagrass") desc = S("Seagrass")
@ -144,9 +145,11 @@ for s=1, #surfaces do
_mcl_hardness = 0, _mcl_hardness = 0,
_mcl_blast_resistance = 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]) doc.add_entry_alias("nodes", "mcl_ocean:seagrass_dirt", "nodes", "mcl_ocean:seagrass_"..surfaces[s][1])
end end
end end
if mod_doc then
doc.add_entry_alias("nodes", "mcl_ocean:seagrass_dirt", "craftitems", "mcl_ocean:seagrass") doc.add_entry_alias("nodes", "mcl_ocean:seagrass_dirt", "craftitems", "mcl_ocean:seagrass")
end