Add support for all rechargeble items from technic (#42)

* Add support for all rechargeble items from technic

* Changed comment about batteries

* Changed second comment about batteries
This commit is contained in:
disba1ancer 2019-07-20 02:42:47 +03:00 committed by FaceDeer
parent 8b1c63f067
commit b394214ffa

@ -63,13 +63,13 @@ minetest.register_node("digtron:battery_holder", {
inv:set_size("batteries", 8*4)
end,
-- Only allow RE batteries to be placed in the inventory
-- Allow all items with energy storage to be placed in the inventory
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if listname == "batteries" then
local node_name = stack:get_name()
-- Only allow RE batteries from technic mod
if node_name == "technic:battery" then
-- Allow all items with energy storage from technic mod
if technic.power_tools[node_name] ~= nil then
local meta = stack:get_metadata()
local md = minetest.deserialize(meta)
-- And specifically if they hold any charge
@ -122,4 +122,4 @@ minetest.register_node("digtron:battery_holder", {
after_place_node = (function() if minetest.get_modpath("pipeworks") then return pipeworks.after_place end end)(),
after_dig_node = (function() if minetest.get_modpath("pipeworks")then return pipeworks.after_dig end end)()
})
})