Skip to content

Commit

Permalink
Merge branch 'master' into ehlphabetSupport
Browse files Browse the repository at this point in the history
  • Loading branch information
SwissalpS authored Dec 31, 2024
2 parents c71b264 + 2f4f3b7 commit 9856f46
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ read_globals = {
"ItemStack",
"barter",
"beacon",
"bones",
"christmas",
"digilines",
"drawers",
"fancy_vend",
"jumpdrive",
"locator",
"mesecon",
"pipeworks",
"signs_lib",
"smartshop",
"spacecannon",
"xdecor",
"bones",
}

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

-- Register wrench support for the fancy_vend mod

for _, vendor in ipairs({
"fancy_vend:player_vendor",
"fancy_vend:player_depo",
"fancy_vend:admin_vendor",
"fancy_vend:admin_depo",
}) do
wrench.register_node(vendor, {
lists = { "given_item", "main", "wanted_item" },
metas = {
alerted = wrench.META_TYPE_STRING,
configured = wrench.META_TYPE_STRING,
infotext = wrench.META_TYPE_IGNORE,
item = wrench.META_TYPE_STRING,
log = wrench.META_TYPE_STRING,
message = wrench.META_TYPE_STRING,
owner = wrench.META_TYPE_STRING,
settings = wrench.META_TYPE_STRING,
},
after_pickup = function(pos, node, meta_table, player)
local above_node_pos = table.copy(pos)
above_node_pos.y = above_node_pos.y + 1
core.remove_node(above_node_pos)
fancy_vend.remove_item(above_node_pos)
end,
after_place = function(pos)
-- This happens during vendor's on_place function is being run!
-- So we need to hack around that race condition.
-- At this time wrench has already set the meta, so we can stash
-- it from the node with fancy_vend function
local settings = fancy_vend.get_vendor_settings(pos)
core.after(0, function(p, s)
-- Use fancy_vend's own function to apply the stashed settings
fancy_vend.set_vendor_settings(p, s)
fancy_vend.refresh_vendor(p)
end, pos, settings)
end,
})
end

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
81 changes: 81 additions & 0 deletions nodes/mapserver.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@

-- Register wrench support for mapserver mod

wrench.register_node("mapserver:border", {
lists = {},
metas = {
color = wrench.META_TYPE_STRING,
formspec = wrench.META_TYPE_IGNORE,
index = wrench.META_TYPE_INT,
infotext = wrench.META_TYPE_IGNORE,
name = wrench.META_TYPE_STRING,
owner = wrench.META_TYPE_STRING,
},
owned = true,
after_place = function(pos, player)
local node_def = core.registered_nodes["mapserver:border"]
node_def.on_receive_fields(pos, nil, {}, player)
end,
})


wrench.register_node("mapserver:label", {
lists = {},
metas = {
color = wrench.META_TYPE_STRING,
direction = wrench.META_TYPE_STRING,
formspec = wrench.META_TYPE_IGNORE,
infotext = wrench.META_TYPE_IGNORE,
owner = wrench.META_TYPE_STRING,
size = wrench.META_TYPE_STRING,
text = wrench.META_TYPE_STRING,
},
owned = true,
after_place = function(pos, player)
local node_def = core.registered_nodes["mapserver:label"]
node_def.on_receive_fields(pos, nil, {}, player)
end,
})


wrench.register_node("mapserver:train", {
lists = {},
metas = {
color = wrench.META_TYPE_STRING,
formspec = wrench.META_TYPE_IGNORE,
index = wrench.META_TYPE_INT,
infotext = wrench.META_TYPE_IGNORE,
line = wrench.META_TYPE_STRING,
owner = wrench.META_TYPE_STRING,
station = wrench.META_TYPE_STRING,
},
owned = true,
after_place = function(pos, player)
local node_def = core.registered_nodes["mapserver:train"]
node_def.on_receive_fields(pos, nil, {}, player)
end,
})


for _, colour in ipairs({ "blue", "green", "orange", "red", "purple" }) do
local node_name = "mapserver:poi_" .. colour
wrench.register_node(node_name, {
lists = {},
metas = {
addr = wrench.META_TYPE_STRING,
formspec = wrench.META_TYPE_IGNORE,
icon = wrench.META_TYPE_STRING,
image = wrench.META_TYPE_STRING,
infotext = wrench.META_TYPE_STRING,
name = wrench.META_TYPE_STRING,
owner = wrench.META_TYPE_STRING,
url = wrench.META_TYPE_STRING,
},
owned = true,
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 9856f46

Please sign in to comment.