diff --git a/README.md b/README.md index 1c9c2ab..633827e 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Other Screenshots: [02] [03] [04] [05] | keys | Mandatory | [Minetest Game] Included. | | wool | Mandatory | [Minetest Game] Included. | | [Unified Inventory] | Optional | Replaces the default inventory and adds a number of features, such as a crafting guide. | +| [Head Lamp] | Optional | Adds a Head Lamp that can be charged by a battery from mod components. | ## **License:** @@ -56,6 +57,7 @@ See more details in file: [locale/README.md] [05]:https://gitlab.com/lunovox/components/-/raw/main/screenshot.5.png [correio]:https://gitlab.com/lunovox/correio [Git Repository]:https://gitlab.com/lunovox/components +[Head Lamp]:https://content.minetest.net/packages/OgelGames/headlamp/ [intllib]:https://github.com/minetest-mods/intllib [license_icon]:https://img.shields.io/static/v1?label=GNU%20AGPL%20v3.0&message=Download&color=yellow [license_link]:https://gitlab.com/lunovox/components/-/raw/main/LICENSE diff --git a/init.lua b/init.lua index aedf5ce..41a879d 100644 --- a/init.lua +++ b/init.lua @@ -6,5 +6,6 @@ dofile(modComponents.modpath.."/translate.lua") dofile(modComponents.modpath.."/components_objects.lua") dofile(modComponents.modpath.."/components_recipes.lua") dofile(modComponents.modpath.."/components_digs.lua") +dofile(modComponents.modpath.."/modify_headlamp.lua") minetest.log('action',"["..modComponents.modname:upper().."] Loaded!") diff --git a/mod.conf b/mod.conf index fb6ea02..6aca928 100644 --- a/mod.conf +++ b/mod.conf @@ -7,7 +7,7 @@ languages = en,pt,pt_BR author = Lunovox Heavenfinder license = GNU AGPL-3.0 depends = default,dye,flowers,keys,wool -optional_depends = unified_inventory +optional_depends = unified_inventory, headlamp min_minetest_version = 5.7 max_minetest_version = created = GMT-03 2023-09-15 12:43 diff --git a/modify_headlamp.lua b/modify_headlamp.lua new file mode 100644 index 0000000..b88af44 --- /dev/null +++ b/modify_headlamp.lua @@ -0,0 +1,23 @@ + + +if minetest.get_modpath("headlamp") then + + local headlamp_on = minetest.registered_items["headlamp:headlamp_on"] + if not headlamp_on.groups.headlamp then + headlamp_on.groups.headlamp = 1 + minetest.override_item("headlamp:headlamp_on" , { groups = headlamp_on.groups }) + end + + local headlamp_off = minetest.registered_items["headlamp:headlamp_off"] + if not headlamp_off.groups.headlamp then + headlamp_off.groups.headlamp = 1 + minetest.override_item("headlamp:headlamp_off" , { groups = headlamp_off.groups }) + end + + minetest.register_craft{ + type = "shapeless", + output = "headlamp:headlamp_off", + recipe = {"group:headlamp", "components:batery"}, + } + +end \ No newline at end of file