Skip to content

Commit

Permalink
Add [mapserver] support (#23)
Browse files Browse the repository at this point in the history
Co-authored-by: Buckaroo Banzai <[email protected]>
  • Loading branch information
SwissalpS and BuckarooBanzay authored Dec 31, 2024
1 parent c02568e commit 2f4f3b7
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
1 change: 1 addition & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ local mods = {
"easyvend",
"jumpdrive",
"locator",
"mapserver",
"mesecons_commandblock",
"mesecons_detector",
"mesecons_luacontroller",
Expand Down
1 change: 1 addition & 0 deletions mod.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ optional_depends = """
easyvend,
jumpdrive,
locator,
mapserver,
mesecons_commandblock,
mesecons_detector,
mesecons_luacontroller,
Expand Down
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 2f4f3b7

Please sign in to comment.