Skip to content

Commit

Permalink
Add [locator] support (#22)
Browse files Browse the repository at this point in the history
Co-authored-by: Buckaroo Banzai <39065740+BuckarooBanzay@users.noreply.github.com>
  • Loading branch information
SwissalpS and BuckarooBanzay authored Dec 31, 2024
1 parent accb035 commit 9714875
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ read_globals = {
"ItemStack",
"barter",
"beacon",
"bones",
"christmas",
"digilines",
"drawers",
"jumpdrive",
"locator",
"mesecon",
"pipeworks",
"signs_lib",
"smartshop",
"spacecannon",
"xdecor",
"bones",
}

3 changes: 2 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ local mods = {
"digistuff",
"digtron",
"drawers",
"jumpdrive",
"easyvend",
"jumpdrive",
"locator",
"mesecons_commandblock",
"mesecons_detector",
"mesecons_luacontroller",
Expand Down
3 changes: 2 additions & 1 deletion mod.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ optional_depends = """
digiscreen,
digistuff,
drawers,
jumpdrive,
easyvend,
jumpdrive,
locator,
mesecons_commandblock,
mesecons_detector,
mesecons_luacontroller,
Expand Down
36 changes: 36 additions & 0 deletions nodes/locator.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

-- Register wrench support for locator mod

wrench.register_node("locator:radar", {
lists = {},
metas = {
formspec = wrench.META_TYPE_IGNORE,
range = wrench.META_TYPE_INT,
},
after_place = function(pos, player)
local node_def = core.registered_nodes["locator:radar"]
node_def.on_receive_fields(pos, nil, {}, player)
end,
})

for i = 1, 3 do
local node_name = "locator:beacon_" .. i
wrench.register_node(node_name, {
lists = {},
metas = {
active = wrench.META_TYPE_INT,
formspec = wrench.META_TYPE_IGNORE,
infotext = wrench.META_TYPE_IGNORE,
name = wrench.META_TYPE_STRING,
owner = wrench.META_TYPE_STRING,
range = wrench.META_TYPE_IGNORE,
},
after_pickup = function(pos)
locator.remove_beacon(pos)
end,
after_place = function(pos, player)
local node_def = core.registered_nodes[node_name]
node_def.on_receive_fields(pos, nil, {}, player)
end,
})
end

0 comments on commit 9714875

Please sign in to comment.