1 local S
= minetest
.get_translator("hades_tt")
3 local function get_min_digtime(caps
)
6 local maxlevel
= caps
.maxlevel
15 local time
= caps
.times
[r
]
16 if time
and maxlevel
> 1 then
17 time
= time
/ maxlevel
19 if time
and ((not mintime
) or (time
< mintime
)) then
20 if mintime
and (time
< mintime
) then
27 return mintime
, unique
30 local function newline(str
)
37 -- Tool information (digging times, weapon stats)
38 tt
.register_snippet(function(itemstring
)
39 local def
= minetest
.registered_items
[itemstring
]
41 if def
.tool_capabilities
then
43 if def
.tool_capabilities
.damage_groups
then
44 for group
, damage
in pairs(def
.tool_capabilities
.damage_groups
) do
46 if group
== "fleshy" then
48 msg
= S("Damage: @1", damage
)
50 msg
= S("Healing: @1", math
.abs(damage
))
54 msg
= S("Damage (@1): @2", group
, damage
)
56 msg
= S("Healing (@1): @2", group
, math
.abs(damage
))
62 local full_punch_interval
= def
.tool_capabilities
.full_punch_interval
63 if not full_punch_interval
then
64 full_punch_interval
= 1
67 desc
= desc
.. S("Full punch interval: @1s", string.format("%.2f", full_punch_interval
))
77 tt
.register_snippet(function(itemstring
)
78 local def
= minetest
.registered_items
[itemstring
]
81 -- Health-related node facts
82 if def
.damage_per_second
then
83 if def
.damage_per_second
> 0 then
85 desc
= desc
.. minetest
.colorize(tt
.COLOR_DANGER
, S("Contact damage: @1 per second", def
.damage_per_second
))
86 elseif def
.damage_per_second
< 0 then
88 desc
= desc
.. minetest
.colorize(tt
.COLOR_GOOD
, S("Contact healing: @1 per second", math
.abs(def
.damage_per_second
)))
91 if def
.drowning
and def
.drowning
~= 0 then
93 desc
= desc
.. minetest
.colorize(tt
.COLOR_DANGER
, S("Drowning damage: @1", def
.drowning
))
95 local tmp
= minetest
.get_item_group(itemstring
, "fall_damage_add_percent")
98 desc
= desc
.. minetest
.colorize(tt
.COLOR_DANGER
, S("Fall damage: +@1%", tmp
))
99 elseif tmp
== -100 then
101 desc
= desc
.. minetest
.colorize(tt
.COLOR_GOOD
, S("No fall damage"))
104 desc
= desc
.. minetest
.colorize(tt
.COLOR_DEFAULT
, S("Fall damage: @1%", tmp
))
107 -- Movement-related node facts
108 if minetest
.get_item_group(itemstring
, "disable_jump") == 1 and not def
.climbable
then
109 if def
.liquidtype
== "none" then
111 desc
= desc
.. minetest
.colorize(tt
.COLOR_DEFAULT
, S("No jumping"))
112 elseif minetest
.get_item_group(itemstring
, "fake_liquid") == 0 then
114 desc
= desc
.. minetest
.colorize(tt
.COLOR_DEFAULT
, S("No swimming upwards"))
117 desc
= desc
.. minetest
.colorize(tt
.COLOR_DEFAULT
, S("No rising"))
120 if def
.climbable
then
121 if minetest
.get_item_group(itemstring
, "disable_jump") == 1 then
123 desc
= desc
.. minetest
.colorize(tt
.COLOR_DEFAULT
, S("Climbable (only downwards)"))
126 desc
= desc
.. minetest
.colorize(tt
.COLOR_DEFAULT
, S("Climbable"))
129 if minetest
.get_item_group(itemstring
, "slippery") >= 1 then
131 desc
= desc
.. minetest
.colorize(tt
.COLOR_DEFAULT
, S("Slippery"))
133 local tmp
= minetest
.get_item_group(itemstring
, "bouncy")
136 desc
= desc
.. minetest
.colorize(tt
.COLOR_DEFAULT
, S("Bouncy (@1%)", tmp
))
140 tmp
= def
.light_source
141 if tmp
and tmp
>= 1 then
143 desc
= desc
.. minetest
.colorize(tt
.COLOR_DEFAULT
, S("Luminance: @1", tmp
))
154 tt
.register_snippet(function(itemstring
)
155 local is_food
= minetest
.get_item_group(itemstring
, "food") ~= 0
156 local sate
= minetest
.get_item_group(itemstring
, "eatable")
157 if is_food
and sate
>= 0 then
158 return S("Food points: +@1", sate
)
163 tt
.register_snippet(function(itemstring
)
164 local flora
= minetest
.get_item_group(itemstring
, "flora")
166 return S("Spreads on Dirt with Grass")