Skip to content

Commit

Permalink
Add [powerbanks] support
Browse files Browse the repository at this point in the history
  • Loading branch information
SwissalpS committed Dec 27, 2024
1 parent 4e62ddb commit ba80407
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ globals = {
}

read_globals = {
"core",
"table.copy",
"table.indexof",
"minetest",
Expand Down
1 change: 1 addition & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ local mods = {
"mobs",
"more_chests",
"pipeworks",
"powerbanks",
"protector",
"signs_lib",
"technic",
Expand Down
1 change: 1 addition & 0 deletions mod.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ optional_depends = """
mobs,
more_chests,
pipeworks,
powerbanks,
protector,
signs_lib,
technic,
Expand Down
23 changes: 23 additions & 0 deletions nodes/powerbanks.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

-- Register wrench support for the powerbanks mod

for i = 1, 3 do
wrench.register_node("powerbanks:powerbank_mk" .. i .. "_node", {
lists = { "main" },
metas = {
charge = wrench.META_TYPE_INT,
formspec = wrench.META_TYPE_IGNORE,
infotext = wrench.META_TYPE_IGNORE,
owner = wrench.META_TYPE_STRING,
},
timer = true,
after_place = function(pos)
local timer = core.get_node_timer(pos)
if not timer:is_started() then
-- Just to re-create infotext and formspec.
timer:start(0)
end
end,
})
end

0 comments on commit ba80407

Please sign in to comment.