Add more tooltips for nodes
This commit is contained in:
parent
df9d5ef98a
commit
4b01bf3c02
@ -691,7 +691,6 @@ minetest.register_node(
|
||||
"default:rope",
|
||||
{
|
||||
description = S("Rope"),
|
||||
_tt_help = S("Can be climbed"),
|
||||
drawtype = "nodebox",
|
||||
tiles = {"default_rope.png"},
|
||||
inventory_image = "default_rope_inventory.png",
|
||||
@ -718,7 +717,7 @@ minetest.register_node(
|
||||
"default:papyrus",
|
||||
{
|
||||
description = S("Papyrus"),
|
||||
_tt_help = S("Can be climbed") .. "\n" .. S("Grows on sand or dirt near water"),
|
||||
_tt_help = S("Grows on sand or dirt near water"),
|
||||
drawtype = "nodebox",
|
||||
tiles = {"default_papyrus.png"},
|
||||
inventory_image = "default_papyrus_inventory.png",
|
||||
@ -833,7 +832,6 @@ minetest.register_node(
|
||||
"default:ladder",
|
||||
{
|
||||
description = S("Ladder"),
|
||||
_tt_help = S("Can be climbed"),
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"default_ladder_sides.png",
|
||||
|
@ -1,11 +1,12 @@
|
||||
# Extended Tooltip (`tt`)
|
||||
This mod extends the tooltip of items to add more informative texts.
|
||||
|
||||
Features:
|
||||
It displays the following useful information:
|
||||
* Weapon damage and speed
|
||||
* Tool information
|
||||
* Tool properties
|
||||
* Noteworthy block properties
|
||||
* Food satiation
|
||||
* Custom help text (added by mods) (example:
|
||||
* Custom help text (added by mods)
|
||||
|
||||
## License
|
||||
MIT License.
|
||||
|
@ -1,18 +1,21 @@
|
||||
local S = minetest.get_translator("tt")
|
||||
local color = "#d0ffd0"
|
||||
local color_danger = "#ffff00"
|
||||
local color_good = "#00ff00"
|
||||
|
||||
tt = {}
|
||||
tt.registered_snippets = {}
|
||||
|
||||
local function append_descs()
|
||||
for itemstring, def in pairs(minetest.registered_items) do
|
||||
if itemstring ~= "" and itemstring ~= "air" and itemstring ~= "ignore" and itemstring ~= "unknown" and def ~= nil and def.description ~= nil and def._tt_ignore ~= true then
|
||||
if itemstring ~= "" and itemstring ~= "air" and itemstring ~= "ignore" and itemstring ~= "unknown" and def ~= nil and def.description ~= nil and def.description ~= "" and def._tt_ignore ~= true then
|
||||
local desc = def.description
|
||||
local orig_desc = desc
|
||||
-- Custom text
|
||||
if def._tt_help then
|
||||
desc = desc .. "\n" .. minetest.colorize(color, def._tt_help)
|
||||
end
|
||||
-- Tool info
|
||||
if def.tool_capabilities then
|
||||
-- Digging stats
|
||||
if def.tool_capabilities.groupcaps then
|
||||
@ -56,6 +59,51 @@ local function append_descs()
|
||||
desc = desc .. "\n" .. minetest.colorize(color, msg)
|
||||
end]]
|
||||
end
|
||||
-- Node info
|
||||
-- Damage-related
|
||||
do
|
||||
if def.damage_per_second and def.damage_per_second > 0 then
|
||||
desc = desc .. "\n" .. minetest.colorize(color_danger, S("Contact damage: @1 per second", def.damage_per_second))
|
||||
end
|
||||
if def.drowning and def.drowning > 0 then
|
||||
desc = desc .. "\n" .. minetest.colorize(color_danger, S("Drowning damage: @1", def.drowning))
|
||||
end
|
||||
local tmp = minetest.get_item_group(itemstring, "fall_damage_add_percent")
|
||||
if tmp > 0 then
|
||||
desc = desc .. "\n" .. minetest.colorize(color_danger, S("Fall damage: +@1%", tmp))
|
||||
elseif tmp == -100 then
|
||||
desc = desc .. "\n" .. minetest.colorize(color_good, S("No fall damage"))
|
||||
elseif tmp < 0 then
|
||||
desc = desc .. "\n" .. minetest.colorize(color, S("Fall damage: @1%", tmp))
|
||||
end
|
||||
end
|
||||
-- Movement-related node facts
|
||||
if minetest.get_item_group(itemstring, "disable_jump") == 1 and not def.climbable then
|
||||
if def.liquidtype == "none" then
|
||||
desc = desc .. "\n" .. minetest.colorize(color, S("No jumping"))
|
||||
else
|
||||
desc = desc .. "\n" .. minetest.colorize(color, S("No swimming upwards"))
|
||||
end
|
||||
end
|
||||
if def.climbable then
|
||||
if minetest.get_item_group(itemstring, "disable_jump") == 1 then
|
||||
desc = desc .. "\n" .. minetest.colorize(color, S("Climbable (only downwards)"))
|
||||
else
|
||||
desc = desc .. "\n" .. minetest.colorize(color, S("Climbable"))
|
||||
end
|
||||
end
|
||||
if minetest.get_item_group(itemstring, "slippery") >= 1 then
|
||||
desc = desc .. "\n" .. minetest.colorize(color, S("Slippery"))
|
||||
end
|
||||
tmp = minetest.get_item_group(itemstring, "bouncy")
|
||||
if tmp >= 1 then
|
||||
desc = desc .. "\n" .. minetest.colorize(color, S("Bouncy (@1%)", tmp))
|
||||
end
|
||||
-- Node appearance
|
||||
tmp = def.light_source
|
||||
if tmp and tmp >= 1 then
|
||||
desc = desc .. "\n" .. minetest.colorize(color, S("Luminance: @1", tmp))
|
||||
end
|
||||
-- Custom functions
|
||||
for s=1, #tt.registered_snippets do
|
||||
local str = tt.registered_snippets[s](itemstring)
|
||||
|
@ -6,3 +6,15 @@ Food item=
|
||||
+@1 satiation=
|
||||
@1 satiation=
|
||||
+@1 food points=
|
||||
Contact damage: @1 per second=
|
||||
Drowning damage: @1=
|
||||
Bouncy (@1%)=
|
||||
Luminance: @1=
|
||||
Slippery=
|
||||
Climbable=
|
||||
Climbable (only downwards)=
|
||||
No jumping=
|
||||
No swimming upwards=
|
||||
Fall damage: @1%=
|
||||
Fall damage: +@1%=
|
||||
No fall damage=
|
||||
|
@ -6,3 +6,15 @@ Food item=Lebensmittel
|
||||
+@1 satiation=+@1 Sättigung
|
||||
@1 satiation=@1 Sättigung
|
||||
+@1 food points=+@1 Nahrungspunkte
|
||||
Contact damage: @1 per second=Kontaktschaden: @1 pro Sekunde
|
||||
Drowning damage: @1=Ertrinkensschaden: @1
|
||||
Bouncy (@1%)=Sprunghaft (@1%)
|
||||
Luminance: @1=Lichtstärke: @1
|
||||
Slippery=Rutschig
|
||||
Climbable=Erkletterbar
|
||||
Climbable (only downwards)=Erkletterbar (nur nach unten)
|
||||
No jumping=Kein Springen
|
||||
No swimming upwards=Kein nach oben schwimmen
|
||||
Fall damage: @1%=Fallschaden: @1%
|
||||
Fall damage: +@1%=Fallschaden: +@1%
|
||||
No fall damage=Kein Fallschaden
|
||||
|
Loading…
Reference in New Issue
Block a user