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

View File

@ -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

View File

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

View File

@ -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(),

View File

@ -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