Add workbench support to check if items are repairable
parent
de25d4ba1a
commit
fbb1cbdee8
2
TODO.txt
2
TODO.txt
|
@ -5,6 +5,6 @@ TODO:
|
|||
- show tooltip when text is longer than list width (or show in separate widget)
|
||||
- add food attributes
|
||||
- separate "emits light" values between nodes, tools, & armor
|
||||
- fix extra backslash ("\") caused by formspec escape when separating item types
|
||||
- add support mods/items:
|
||||
- xdecor:workbench
|
||||
- workbench
|
||||
|
|
|
@ -5,6 +5,7 @@ v1.5
|
|||
- supports unifieddyes node coloring
|
||||
- non-real attributes are hidden in technical view
|
||||
- displays ID (technical name) of unknown items
|
||||
- added workbench support to check if items are repairable
|
||||
|
||||
v1.4
|
||||
----
|
||||
|
|
15
formspec.lua
15
formspec.lua
|
@ -44,6 +44,15 @@ end
|
|||
-- END: wlight & wielded_light support
|
||||
|
||||
|
||||
-- workbench support
|
||||
local workbench_repairable
|
||||
if core.global_exists("workbench") and workbench.repairable then
|
||||
workbench_repairable = function(iname)
|
||||
return workbench:repairable(iname) or false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local general_types = {
|
||||
["description"] = "Description",
|
||||
["short_description"] = "Short Description",
|
||||
|
@ -171,7 +180,6 @@ local function format_spec(grp, name, value, technical)
|
|||
nname = name:gsub("_", " "):trim()
|
||||
end
|
||||
|
||||
-- FIXME: name may need formspec_escape as well
|
||||
return S(nname .. ": @1", value)
|
||||
end
|
||||
|
||||
|
@ -395,6 +403,11 @@ local function get_item_specs(item, technical)
|
|||
end
|
||||
end
|
||||
|
||||
if not technical and workbench_repairable then
|
||||
table.insert(specs_other, format_spec(other_types, "workbench repairable",
|
||||
workbench_repairable(id), false))
|
||||
end
|
||||
|
||||
if name then
|
||||
table.insert(specs, S("Name: @1", name))
|
||||
end
|
||||
|
|
|
@ -114,3 +114,4 @@ palette index: @1=
|
|||
durability: @1=
|
||||
wear: @1=
|
||||
emits light: @1=
|
||||
workbench repairable: @1=
|
||||
|
|
Loading…
Reference in New Issue