Add 3d_armor_light mod...
ContentDB: https://content.minetest.net/packages/AntumDeluge/3d_armor_light/ Release: https://github.com/AntumMT/mod-3d_armor_light/releases/tag/v1.0master
parent
bae8fab1ed
commit
019c8b171d
|
@ -61,6 +61,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
|||
* [mobs_redo][] ([MIT][lic.mobs_redo] / [CC BY][lic.ccby3.0] / [CC0][lic.cc0]) -- version: [db3831d Git][ver.mobs_redo] *2021-07-14*
|
||||
* [signs_lib][] ([LGPL][lic.lgpl3.0] / [CC BY-SA][lic.ccbysa4.0]) -- version: [2021-03-04-2][ver.signs_lib]
|
||||
* lighting/
|
||||
* [3d_armor_light][] ([MIT][lic.3d_armor_light]) -- version: [1.0][ver.3d_armor_light] *2021-07-17*
|
||||
* [glow][] ([GPL][lic.gpl2.0]) -- version: [4c015a0 Git][ver.glow] *2019-02-05*
|
||||
* [ilights][] ([LGPL][lic.lgpl3.0]) -- version: [2021-02-25-01][ver.ilights] ([patched][patch.ilights])
|
||||
* [wielded_light][] ([GPL][lic.gpl3.0]) -- version: [d1f310c Git][ver.wielded_light] *2021-07-16*
|
||||
|
@ -283,6 +284,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
|||
|
||||
[3d_armor]: https://forum.minetest.net/viewtopic.php?t=4654
|
||||
[3d_armor_gloves]: https://forum.minetest.net/viewtopic.php?t=25665
|
||||
[3d_armor_light]: https://content.minetest.net/packages/AntumDeluge/3d_armor_light/
|
||||
[airtanks]: https://forum.minetest.net/viewtopic.php?t=17102
|
||||
[alternode]: https://forum.minetest.net/viewtopic.php?t=26667
|
||||
[amber]: https://forum.minetest.net/viewtopic.php?t=18186
|
||||
|
@ -429,6 +431,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
|||
[xtraarmor]: https://forum.minetest.net/viewtopic.php?t=16645
|
||||
|
||||
[lic.3d_armor]: mods/modpacks/3d_armor/LICENSE.md
|
||||
[lic.3d_armor_light]: mods/lighting/3d_armor_light/LICENSE.txt
|
||||
[lic.airtanks]: mods/equipment/airtanks/LICENSE.txt
|
||||
[lic.alternode]: mods/admin/alternode/LICENSE.txt
|
||||
[lic.ambience]: mods/sound/ambience/README.md
|
||||
|
@ -539,6 +542,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
|||
|
||||
[ver.3d_armor]: https://github.com/minetest-mods/3d_armor/tree/ac76152
|
||||
[ver.3d_armor_gloves]: https://github.com/sirrobzeroone/3d_armor_gloves/tree/f099d76
|
||||
[ver.3d_armor_light]: https://github.com/AntumMT/mod-3d_armor_light/releases/tag/v1.0
|
||||
[ver.airtanks]: https://github.com/minetest-mods/airtanks/tree/b686694
|
||||
[ver.alternode]: https://github.com/AntumMT/mod-alternode/releases/tag/v1.3
|
||||
[ver.amber]: https://github.com/theraven262/amber/tree/56627fa
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License
|
||||
|
||||
Copyright © 2021 Jordan Irwin (AntumDeluge)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,32 @@
|
|||
## Wielded Light for 3d_armor
|
||||
|
||||
### Description:
|
||||
|
||||
A library for [3d_armor](https://content.minetest.net/packages/stu/3d_armor/) that adds [wielded_light](https://content.minetest.net/packages/bell07/wielded_light/) support.
|
||||
|
||||
### Licensing:
|
||||
|
||||
- Code: [MIT](LICENSE.txt)
|
||||
|
||||
### Usage:
|
||||
|
||||
Methods:
|
||||
```
|
||||
armor_light.register(item, lvalue)
|
||||
- Register an item to emit light when equipped in the armor inventory.
|
||||
- params:
|
||||
- item: Item name or ItemStack.
|
||||
- lvalue: Light value (optional) (default: 10).
|
||||
|
||||
armor_light.is_lighted(item)
|
||||
- Checks if an item is registered as light-emitting from armor inventory.
|
||||
- params:
|
||||
- item: Item name or ItemStack.
|
||||
- returns: `true` if the item is registered.
|
||||
```
|
||||
|
||||
### Links:
|
||||
|
||||
- [Forum](https://forum.minetest.net/viewtopic.php?t=27034)
|
||||
- [Git repo](https://github.com/AntumMT/mod-3d_armor_light)
|
||||
- [Changelog](changelog.txt)
|
|
@ -0,0 +1,36 @@
|
|||
|
||||
|
||||
local light_armors = {}
|
||||
|
||||
--- Register an item to emit light when equipped in the armor inventory.
|
||||
--
|
||||
-- @param item Item name or `ItemStack`.
|
||||
-- @tparam[opt] int lvalue Light value (default: 10).
|
||||
function armor_light.register(item, lvalue)
|
||||
lvalue = lvalue or 10
|
||||
|
||||
local item_name = item
|
||||
if not type(item_name) == "string" then
|
||||
item_name = item_name:get_name()
|
||||
end
|
||||
|
||||
wielded_light.register_item_light(item_name, lvalue)
|
||||
light_armors[item_name] = true
|
||||
end
|
||||
|
||||
--- Checks if an item is registered as light-emitting from armor inventory.
|
||||
--
|
||||
-- @param item Item name or `ItemStack`.
|
||||
-- @treturn bool
|
||||
function armor_light.is_lighted(item)
|
||||
local item_name = item
|
||||
if not type(item_name) == "string" then
|
||||
item_name = item_name:get_name()
|
||||
end
|
||||
|
||||
if light_armors[item_name] then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
v1.0
|
||||
----
|
||||
- initial release
|
||||
- added method to register item to emit light when equipped to armor inventory
|
||||
- added method to check if an item should emit light in armor inventory
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
armor_light = {}
|
||||
armor_light.modname = core.get_current_modname()
|
||||
armor_light.path = core.get_modpath(armor_light.modname)
|
||||
|
||||
|
||||
dofile(armor_light.path .. "/api.lua")
|
||||
|
||||
|
||||
wielded_light.register_player_lightstep(function(player)
|
||||
local armor_inv = minetest.get_inventory({
|
||||
type = "detached",
|
||||
name = player:get_player_name() .. "_armor",
|
||||
})
|
||||
|
||||
local lighted = {}
|
||||
if armor_inv then
|
||||
for idx, stack in ipairs(armor_inv:get_list("armor")) do
|
||||
local item_name = stack:get_name()
|
||||
if item_name:trim() == "" then
|
||||
item_name = nil
|
||||
end
|
||||
|
||||
wielded_light.track_user_entity(player, "armor" .. idx, item_name)
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,7 @@
|
|||
name = 3d_armor_light
|
||||
title = 3D Armor Light
|
||||
description = Wielded Light for 3d_armor
|
||||
version = 1.0
|
||||
author = Jordan Irwin (AntumDeluge)
|
||||
depends = wielded_light
|
||||
min_minetest_version = 0.4
|
Loading…
Reference in New Issue