From c2fbe2ad559d1de26c2349d323f2f4014aaa752f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 18 Mar 2017 17:18:12 +0100 Subject: [PATCH] Add various factoids and complete some food help --- GROUPS.md | 2 +- mods/HELP/mcl_doc/depends.txt | 1 + mods/HELP/mcl_doc/init.lua | 68 +++++++++++++++++++++++++++++ mods/ITEMS/mcl_core/craftitems.lua | 4 +- mods/ITEMS/mcl_core/nodes.lua | 2 +- mods/ITEMS/mcl_end/init.lua | 1 + mods/ITEMS/mcl_farming/carrots.lua | 7 +-- mods/ITEMS/mcl_farming/melon.lua | 1 + mods/ITEMS/mcl_farming/potatoes.lua | 1 - mods/ITEMS/mcl_farming/wheat.lua | 2 + mods/ITEMS/mcl_fishing/init.lua | 6 +++ mods/ITEMS/mcl_mushrooms/small.lua | 1 + mods/ITEMS/mcl_potions/init.lua | 13 ++++++ 13 files changed, 101 insertions(+), 8 deletions(-) diff --git a/GROUPS.md b/GROUPS.md index 077c42bf25..802133fbfc 100644 --- a/GROUPS.md +++ b/GROUPS.md @@ -113,7 +113,7 @@ These groups are used mostly for informational purposes * `food=2`: Food * `food=3`: Drink (including soups) * `food=1`: Other/unsure -* `eatable`: Item can be *directly* eaten by wielding + left click (`on_use=item_eat`). Rating is the satiation gain +* `eatable`: Item can be *directly* eaten by wielding + right click (`on_use=item_eat`). Rating is the satiation gain * `cocoa`: Node is a cocoa pod (rating is growth stage, ranging from 1 to 3) * `ammo=1`: Item is used as ammo for a weapon * `ammo_bow=1`: Item is used as ammo for bows diff --git a/mods/HELP/mcl_doc/depends.txt b/mods/HELP/mcl_doc/depends.txt index 052d4ed779..93440a2990 100644 --- a/mods/HELP/mcl_doc/depends.txt +++ b/mods/HELP/mcl_doc/depends.txt @@ -1 +1,2 @@ +doc doc_items diff --git a/mods/HELP/mcl_doc/init.lua b/mods/HELP/mcl_doc/init.lua index 96aedabf24..2dee11cac2 100644 --- a/mods/HELP/mcl_doc/init.lua +++ b/mods/HELP/mcl_doc/init.lua @@ -8,3 +8,71 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) doc.show_doc(player:get_player_name()) end end) + +-- doc_items factoids + +-- dig_by_water +doc.sub.items.register_factoid("nodes", "drop_destroy", function(itemstring, def) + if def.groups.dig_by_water then + return "Water can flow into this block and cause it to drop as an item." + end + return "" +end) + +-- usable by hoes +doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def) + if def.groups.cultivatable == 2 then + return "This block can be turned into dirt with a hoe." + elseif def.groups.cultivatable == 2 then + return "This block can be turned into farmland with a hoe." + end + return "" +end) + +-- soil +doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def) + local datastring = "" + if def.groups.soil_sapling == 2 then + datastring = datastring .. "This block acts as a soil for all saplings." .. "\n" + elseif def.groups.soil_sapling == 1 then + datastring = datastring .. "This block acts as a soil for some saplings." .. "\n" + end + if def.groups.soil_sugarcane then + datastring = datastring .. "Sugar canes will grow on this block." .. "\n" + end + if def.groups.soil_nether_wart then + datastring = datastring .. "Nether wart will grow on this block." .. "\n" + end + return datastring +end) + +-- flammable +doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def) + if def.groups.flammable then + return "This block is flammable." + end + return "" +end) + +-- destroys_items +doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def) + if def.groups.destroys_items then + return "This block destroys any item it touches." + end + return "" +end) + + +-- Comestibles +doc.sub.items.register_factoid(nil, "use", function(itemstring, def) + if def.groups.eatable and not def._doc_items_usagehelp then + if def.groups.food == 2 then + return "To eat it, wield it, then rightclick." + elseif def.groups.food == 3 then + return "To drink it, wield it, then rightclick." + else + return "To consume it, wield it, then rightclick." + end + end + return "" +end) diff --git a/mods/ITEMS/mcl_core/craftitems.lua b/mods/ITEMS/mcl_core/craftitems.lua index 4b2d8b1f22..0d430bfd8e 100644 --- a/mods/ITEMS/mcl_core/craftitems.lua +++ b/mods/ITEMS/mcl_core/craftitems.lua @@ -134,7 +134,7 @@ minetest.register_craftitem("mcl_core:apple", { stack_max = 64, on_place = minetest.item_eat(4), on_secondary_use = minetest.item_eat(4), - groups = { food = 2 }, + groups = { food = 2, eatable = 4 }, }) minetest.register_craftitem("mcl_core:apple_gold", { @@ -145,5 +145,5 @@ minetest.register_craftitem("mcl_core:apple_gold", { stack_max = 64, on_place = minetest.item_eat(8), on_secondary_use = minetest.item_eat(8), - groups = { food = 2 }, + groups = { food = 2, eatable = 8 }, }) diff --git a/mods/ITEMS/mcl_core/nodes.lua b/mods/ITEMS/mcl_core/nodes.lua index c58dcebb97..fdbd65583e 100644 --- a/mods/ITEMS/mcl_core/nodes.lua +++ b/mods/ITEMS/mcl_core/nodes.lua @@ -1512,7 +1512,7 @@ minetest.register_node("mcl_core:lava_flowing", { minetest.register_node("mcl_core:lava_source", { description = "Still Lava", _doc_items_entry_name = "Lava", - _doc_items_longdesc = "Lava is found deep underground and rather dangerous. Don't touch it, it will hurt you a lot and once you're in, it is hard to get out. Lava will also destroy all dropped items it touches. When a lava source meets water, it turns into obsidian. Flowing lava turns into stone instead.", + _doc_items_longdesc = "Lava is found deep underground and rather dangerous. Don't touch it, it will hurt you a lot and once you're in, it is hard to get out. When a lava source meets water, it turns into obsidian. Flowing lava turns into stone instead.", inventory_image = minetest.inventorycube("default_lava.png"), drawtype = "liquid", tiles = { diff --git a/mods/ITEMS/mcl_end/init.lua b/mods/ITEMS/mcl_end/init.lua index 008073d3a6..caf81bd3d2 100644 --- a/mods/ITEMS/mcl_end/init.lua +++ b/mods/ITEMS/mcl_end/init.lua @@ -245,6 +245,7 @@ minetest.register_node("mcl_end:chorus_plant", { -- Craftitems minetest.register_craftitem("mcl_end:chorus_fruit", { description = "Chorus Fruit", + _doc_items_longdesc = "Chorus fruits can be eaten to restore 4 hunger points.", wield_image = "mcl_end_chorus_fruit.png", inventory_image = "mcl_end_chorus_fruit.png", -- TODO: Teleport player diff --git a/mods/ITEMS/mcl_farming/carrots.lua b/mods/ITEMS/mcl_farming/carrots.lua index dfb10492de..c39fdcffd8 100644 --- a/mods/ITEMS/mcl_farming/carrots.lua +++ b/mods/ITEMS/mcl_farming/carrots.lua @@ -104,10 +104,11 @@ minetest.register_craftitem("mcl_farming:carrot_item", { minetest.register_craftitem("mcl_farming:carrot_item_gold", { description = "Golden Carrot", + _doc_items_longdesc = "This is a food item which can be eaten for 6 hunger points.", inventory_image = "farming_carrot_gold.png", - on_place = minetest.item_eat(3), - on_secondary_use = minetest.item_eat(3), - groups = { brewitem = 1, food = 2, eatable = 3 }, + on_place = minetest.item_eat(6), + on_secondary_use = minetest.item_eat(6), + groups = { brewitem = 1, food = 2, eatable = 6 }, }) minetest.register_craft({ diff --git a/mods/ITEMS/mcl_farming/melon.lua b/mods/ITEMS/mcl_farming/melon.lua index 8dd976538c..be14b8b162 100644 --- a/mods/ITEMS/mcl_farming/melon.lua +++ b/mods/ITEMS/mcl_farming/melon.lua @@ -108,6 +108,7 @@ mcl_farming:add_gourd("mcl_farming:melontige_unconnect", "mcl_farming:melontige_ minetest.register_craftitem("mcl_farming:melon_item", { -- Original name: “Melon” description = "Melon Slice", + _doc_items_longdesc = "This is a food item which can be eaten for 2 hunger points.", stack_max = 64, inventory_image = "farming_melon.png", on_place = minetest.item_eat(2), diff --git a/mods/ITEMS/mcl_farming/potatoes.lua b/mods/ITEMS/mcl_farming/potatoes.lua index 82813c99d7..09d4b107c0 100644 --- a/mods/ITEMS/mcl_farming/potatoes.lua +++ b/mods/ITEMS/mcl_farming/potatoes.lua @@ -95,7 +95,6 @@ minetest.register_craftitem("mcl_farming:potato_item_baked", { minetest.register_craftitem("mcl_farming:potato_item_poison", { description = "Poisonous Potato", _doc_items_longdesc = "This potato doesn't look healthy. Eating it will only poison you.", - _doc_items_usagehelp = "Hold it in your hand and rightclick to eat it. But why would you want to do this?", stack_max = 64, inventory_image = "farming_potato_poison.png", -- TODO: Cause status effects diff --git a/mods/ITEMS/mcl_farming/wheat.lua b/mods/ITEMS/mcl_farming/wheat.lua index 94ba3a877d..9dbd8441d2 100644 --- a/mods/ITEMS/mcl_farming/wheat.lua +++ b/mods/ITEMS/mcl_farming/wheat.lua @@ -139,6 +139,7 @@ minetest.register_craft({ minetest.register_craftitem("mcl_farming:cookie", { description = "Cookie", + _doc_items_longdesc = "This is a food item which can be eaten for 2 hunger points.", inventory_image = "farming_cookie.png", groups = {food=2, eatable=2}, on_place = minetest.item_eat(2), @@ -148,6 +149,7 @@ minetest.register_craftitem("mcl_farming:cookie", { minetest.register_craftitem("mcl_farming:bread", { description = "Bread", + _doc_items_longdesc = "This is a food item which can be eaten for 5 hunger points.", inventory_image = "farming_bread.png", groups = {food=2, eatable=5}, on_place = minetest.item_eat(5), diff --git a/mods/ITEMS/mcl_fishing/init.lua b/mods/ITEMS/mcl_fishing/init.lua index 3e088a499a..8b9ff1543b 100644 --- a/mods/ITEMS/mcl_fishing/init.lua +++ b/mods/ITEMS/mcl_fishing/init.lua @@ -135,6 +135,7 @@ minetest.register_craft({ -- Fish minetest.register_craftitem("mcl_fishing:fish_raw", { description = "Raw Fish", + _doc_items_longdesc = "This is a raw food item which can be eaten for 2 hunger points. But cooking it is better.", inventory_image = "mcl_fishing_fish_raw.png", on_place = minetest.item_eat(2), on_secondary_use = minetest.item_eat(2), @@ -144,6 +145,7 @@ minetest.register_craftitem("mcl_fishing:fish_raw", { minetest.register_craftitem("mcl_fishing:fish_cooked", { description = "Cooked Fish", + _doc_items_longdesc = "Mmh, fish! This food item can be eaten for 5 hunger points.", inventory_image = "mcl_fishing_fish_cooked.png", on_place = minetest.item_eat(5), on_secondary_use = minetest.item_eat(5), @@ -161,6 +163,7 @@ minetest.register_craft({ -- Salmon minetest.register_craftitem("mcl_fishing:salmon_raw", { description = "Raw Salmon", + _doc_items_longdesc = "This is a raw food item which can be eaten for 2 hunger points. But cooking it is better.", inventory_image = "mcl_fishing_salmon_raw.png", on_place = minetest.item_eat(2), on_secondary_use = minetest.item_eat(2), @@ -170,6 +173,7 @@ minetest.register_craftitem("mcl_fishing:salmon_raw", { minetest.register_craftitem("mcl_fishing:salmon_cooked", { description = "Cooked Salmon", + _doc_items_longdesc = "This is a food item which can be eaten for 6 hunger points.", inventory_image = "mcl_fishing_salmon_cooked.png", on_place = minetest.item_eat(6), on_secondary_use = minetest.item_eat(6), @@ -187,6 +191,7 @@ minetest.register_craft({ -- Clownfish minetest.register_craftitem("mcl_fishing:clownfish_raw", { description = "Clownfish", + _doc_items_longdesc = "This is a food item which can be eaten for 1 hunger point.", inventory_image = "mcl_fishing_clownfish_raw.png", on_place = minetest.item_eat(1), on_secondary_use = minetest.item_eat(1), @@ -198,6 +203,7 @@ minetest.register_craftitem("mcl_fishing:clownfish_raw", { -- TODO: Add status effect minetest.register_craftitem("mcl_fishing:pufferfish_raw", { description = "Pufferfish", + _doc_items_longdesc = "Pufferfish are a common species of fish, but they are dangerous to eat. Eating a pufferfish restores 1 hunger point, but it makes you very sick (which drains your health non-fatally).", inventory_image = "mcl_fishing_pufferfish_raw.png", on_place = minetest.item_eat(1), on_secondary_use = minetest.item_eat(1), diff --git a/mods/ITEMS/mcl_mushrooms/small.lua b/mods/ITEMS/mcl_mushrooms/small.lua index 9be30336af..f3fa6babe5 100644 --- a/mods/ITEMS/mcl_mushrooms/small.lua +++ b/mods/ITEMS/mcl_mushrooms/small.lua @@ -37,6 +37,7 @@ minetest.register_node("mcl_mushrooms:mushroom_red", { minetest.register_craftitem("mcl_mushrooms:mushroom_stew", { description = "Mushroom Stew", + _doc_items_longdesc = "Mushroom stew is a healthy soup which can be consumed for 6 hunger points.", inventory_image = "farming_mushroom_stew.png", on_place = minetest.item_eat(6, "mcl_core:bowl"), on_secondary_use = minetest.item_eat(6, "mcl_core:bowl"), diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index b441ebd420..3b36afe5b5 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -14,6 +14,8 @@ minetest.register_craft({ minetest.register_craftitem("mcl_potions:glass_bottle", { description = "Glass Bottle", + _doc_items_longdesc = "A glass bottle is used as a container for potions and can be used to collect water directly.", + _doc_items_usagehelp = "To collect water, it on a cauldron with water (which removes a level of water) or a water source (which removes no water).", inventory_image = "mcl_potions_potion_bottle_empty.png", wield_image = "mcl_potions_potion_bottle_empty.png", groups = {brewitem=1}, @@ -89,6 +91,8 @@ end minetest.register_craftitem("mcl_potions:potion_water", { description = "Water Bottle", + _doc_items_longdesc = "Water bottles can be used to brew potions and to fill cauldron. Drinking water has no effect.", + _doc_items_usagehelp = "Wield it and rightclick to drink it. Rightclick a cauldron to put the water into the cauldron.", stack_max = 1, inventory_image = potion_image("#0000FF"), wield_image = potion_image("#0000FF"), @@ -123,8 +127,13 @@ minetest.register_craftitem("mcl_potions:potion_water", { end, on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"), }) + +local how_to_drink = "To drink it, wield it, then rightclick." + minetest.register_craftitem("mcl_potions:potion_awkward", { description = "Awkward Potion", + _doc_items_longdesc = "This potion has an awkward taste and is used for brewing more potions. Drinking it has no effect.", + _doc_items_usagehelp = how_to_drink, stack_max = 1, inventory_image = potion_image("#0000FF"), wield_image = potion_image("#0000FF"), @@ -134,6 +143,8 @@ minetest.register_craftitem("mcl_potions:potion_awkward", { }) minetest.register_craftitem("mcl_potions:potion_mundane", { description = "Mundane Potion", + _doc_items_longdesc = "This potion has a clean taste and is used for brewing more potions. Drinking it has no effect.", + _doc_items_usagehelp = how_to_drink, stack_max = 1, inventory_image = potion_image("#0000FF"), wield_image = potion_image("#0000FF"), @@ -143,6 +154,8 @@ minetest.register_craftitem("mcl_potions:potion_mundane", { }) minetest.register_craftitem("mcl_potions:potion_thick", { description = "Thick Potion", + _doc_items_longdesc = "This potion has a bitter taste and is used for brewing more potions. Drinking it has no effect.", + _doc_items_usagehelp = how_to_drink, stack_max = 1, inventory_image = potion_image("#0000FF"), wield_image = potion_image("#0000FF"),