Namespacing pt. 2
@@ -0,0 +1 @@
|
||||
streetsmod
|
||||
@@ -0,0 +1,58 @@
|
||||
--[[
|
||||
StreetsMod: Convert old trafficlights
|
||||
]]
|
||||
minetest.register_node(":streets:trafficlight_bottom", {
|
||||
diggable = false,
|
||||
pointable = false,
|
||||
drawtype = "airlike",
|
||||
description = "I'm an old node, please drop me",
|
||||
groups = {not_in_creative_inventory = 1}
|
||||
})
|
||||
minetest.register_abm({
|
||||
nodenames = {"streets:trafficlight_bottom"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
minetest.log("action", "Converting trafficlight at position " .. minetest.pos_to_string(pos))
|
||||
-- Replace controller with distributor
|
||||
pos.y = pos.y - 2
|
||||
minetest.set_node(pos, {name = "streets:digiline_distributor"})
|
||||
-- Change bottom pole
|
||||
pos.y = pos.y + 2
|
||||
minetest.set_node(pos, {name = "streets:bigpole", param2 = 2})
|
||||
-- Change middle pole
|
||||
pos.y = pos.y + 1
|
||||
minetest.set_node(pos, {name = "streets:bigpole", param2 = 2})
|
||||
-- Change the top
|
||||
pos.y = pos.y + 1
|
||||
local fd = minetest.get_node(pos).param2
|
||||
local ch = minetest.get_meta(pos):get_string("channel")
|
||||
minetest.set_node(pos, {name = "streets:bigpole", param2 = 2})
|
||||
-- Place new top
|
||||
if fd == 1 then
|
||||
minetest.set_node({x = pos.x - 1, y = pos.y, z = pos.z}, {name = "streets:trafficlight_top_warn", param2 = fd})
|
||||
local meta = minetest.get_meta({x = pos.x - 1, y = pos.y, z = pos.z})
|
||||
meta:set_string("channel", ch)
|
||||
meta:set_string("state", "warn")
|
||||
meta:set_string("formspec", "field[channel;Channel;${channel}]")
|
||||
elseif fd == 2 then
|
||||
minetest.set_node({x = pos.x, y = pos.y, z = pos.z + 1}, {name = "streets:trafficlight_top_warn", param2 = fd})
|
||||
local meta = minetest.get_meta({x = pos.x, y = pos.y, z = pos.z + 1})
|
||||
meta:set_string("channel", ch)
|
||||
meta:set_string("state", "warn")
|
||||
meta:set_string("formspec", "field[channel;Channel;${channel}]")
|
||||
elseif fd == 3 then
|
||||
minetest.set_node({x = pos.x + 1, y = pos.y, z = pos.z}, {name = "streets:trafficlight_top_warn", param2 = fd})
|
||||
local meta = minetest.get_meta({x = pos.x + 1, y = pos.y, z = pos.z})
|
||||
meta:set_string("channel", ch)
|
||||
meta:set_string("state", "warn")
|
||||
meta:set_string("formspec", "field[channel;Channel;${channel}]")
|
||||
elseif fd == 0 then
|
||||
minetest.set_node({x = pos.x, y = pos.y, z = pos.z - 1}, {name = "streets:trafficlight_top_warn", param2 = fd})
|
||||
local meta = minetest.get_meta({x = pos.x, y = pos.y, z = pos.z - 1})
|
||||
meta:set_string("channel", ch)
|
||||
meta:set_string("state", "warn")
|
||||
meta:set_string("formspec", "field[channel;Channel;${channel}]")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 847 B |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 941 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 631 B |
|
After Width: | Height: | Size: 798 B |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 572 B |
|
After Width: | Height: | Size: 615 B |
|
After Width: | Height: | Size: 601 B |
|
After Width: | Height: | Size: 602 B |
|
After Width: | Height: | Size: 610 B |
|
After Width: | Height: | Size: 610 B |
|
After Width: | Height: | Size: 606 B |
|
After Width: | Height: | Size: 610 B |
|
After Width: | Height: | Size: 614 B |
|
After Width: | Height: | Size: 620 B |
|
After Width: | Height: | Size: 603 B |
|
After Width: | Height: | Size: 621 B |
|
After Width: | Height: | Size: 608 B |
|
After Width: | Height: | Size: 618 B |
|
After Width: | Height: | Size: 607 B |
|
After Width: | Height: | Size: 620 B |
|
After Width: | Height: | Size: 608 B |
|
After Width: | Height: | Size: 611 B |
|
After Width: | Height: | Size: 605 B |
|
After Width: | Height: | Size: 613 B |
|
After Width: | Height: | Size: 669 B |
|
After Width: | Height: | Size: 571 B |
|
After Width: | Height: | Size: 630 B |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 627 B |
|
After Width: | Height: | Size: 762 B |
|
After Width: | Height: | Size: 750 B |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 954 B |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 977 B |
|
After Width: | Height: | Size: 908 B |
|
After Width: | Height: | Size: 937 B |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 985 B |
|
After Width: | Height: | Size: 843 B |
|
After Width: | Height: | Size: 942 B |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 963 B |
|
After Width: | Height: | Size: 906 B |
|
After Width: | Height: | Size: 949 B |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 978 B |
|
After Width: | Height: | Size: 938 B |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1003 B |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 950 B |
|
After Width: | Height: | Size: 953 B |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 930 B |
|
After Width: | Height: | Size: 980 B |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 320 B |