[feat] Change Head Lamp to can be charged by a battery from this mod components.

This commit is contained in:
Lunovox 2023-10-02 04:29:17 -03:00
parent 95e13962d5
commit 0c4176ac8b
4 changed files with 27 additions and 1 deletions

View file

@ -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

View file

@ -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!")

View file

@ -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

23
modify_headlamp.lua Normal file
View file

@ -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