From 3840b65a627b69e5714122ab0374d61353c6ea7a Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 19 Jul 2021 13:44:28 -0700 Subject: [PATCH] Add 3d_armor_light support --- README.md | 1 + changelog.txt | 1 + formspec.lua | 26 ++++++++++++++++++-------- mod.conf | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7f1da65..f9f696c 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Right-click the equipment examiner node & place an item into its inventory slot - [![wielded_light](https://img.shields.io/static/v1?label=ContentDB&message=wielded_light&color=%23375a7f&logo=minetest)](https://content.minetest.net/packages/bell07/wielded_light/) - [![workbench](https://img.shields.io/static/v1?label=GitHub&message=workbench&color=%23375a7f&logo=minetest)](https://github.com/AntumMT/mod-workbench) - [![xdecor](https://img.shields.io/static/v1?label=ContentDB&message=xdecor&color=%23375a7f&logo=minetest)](https://content.minetest.net/packages/jp/xdecor/) + - [![3d_armor_light](https://img.shields.io/static/v1?label=ContentDB&message=3d_armor_light&color=%23375a7f&logo=minetest)](https://content.minetest.net/packages/AntumDeluge/3d_armor_light/) #### Other Mod Support: diff --git a/changelog.txt b/changelog.txt index 58200dc..ebed055 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,6 +6,7 @@ v1.6 - xdecor (Git commit 0dbf92e) - wielded_light v2021-07-15 - removed abandoned wlight support +- added 3d_armor_light support v1.5 ---- diff --git a/formspec.lua b/formspec.lua index d8dd4c4..e79542b 100644 --- a/formspec.lua +++ b/formspec.lua @@ -3,14 +3,17 @@ local S = core.get_translator(equip_exam.name) -- wielded_light support -local function get_light_def(id) - return -end - +local function get_light_def(id) end if core.global_exists("wielded_light") and wielded_light.get_light_def then get_light_def = wielded_light.get_light_def end +-- 3d_armor_light support +local function is_lighted_armor(id) end +if core.global_exists("armor_light") and armor_light.is_lighted then + is_lighted_armor = armor_light.is_lighted +end + -- workbench support local workbench_repairable if core.global_exists("workbench") and workbench.repairable then @@ -346,12 +349,19 @@ local function get_item_specs(item, technical) local light_level = get_light_def(id) if light_level and light_level > 0 then - item_types.tool = true - if not technical then - table.insert(specs_tool, S("emits light: @1", S("yes"))) + local spec_list, type_list = specs_tool, tool_types + if is_lighted_armor(id) then + item_types.armor = true + spec_list, type_list = specs_armor, armor_types + else + item_types.tool = true end - table.insert(specs_tool, format_spec(tool_types, "light level", light_level, technical)) + if not technical then + table.insert(spec_list, S("emits light: @1", S("yes"))) + end + + table.insert(spec_list, format_spec(type_list, "light level", light_level, technical)) end local colorable = groups.ud_param2_colorable ~= nil diff --git a/mod.conf b/mod.conf index 9a6fccf..9a4a6fd 100644 --- a/mod.conf +++ b/mod.conf @@ -5,4 +5,4 @@ author = Jordan Irwin (AntumDeluge) version = 1.5 license = MIT min_minetest_version = 5.0 -optional_depends = default, basic_materials, wielded_light, workbench, xdecor +optional_depends = default, basic_materials, wielded_light, workbench, xdecor, 3d_armor_light