Add infrastructure as normal content

It will be developed as part of this mod now.
master
cheapie 2016-01-10 02:14:35 -06:00
parent f45815cbdc
commit 8b614bf836
170 changed files with 4604 additions and 0 deletions

14
infrastructure/README Normal file
View File

@ -0,0 +1,14 @@
This is my fork of the infrastructure mod. It's essentially aimed at servers running webdesigner97's streetsmod that want stuff from infrastructure too (dreambuilder_game in particular), and is intended to add on to streetsmod instead of replacing it.
Originally based on Streets by webdesigner97
Modified by Ragnarok/Vibender
Modified again by cheapie
Depends: default, moreblocks, mesecons, technic, streetsmod
Licenses:
Code: WTFPL
Line textures: WTFPL
Other Textures: CC BY-SA 3.0 Unported, http://creativecommons.org/licenses/by-sa/3.0/
Sounds: CC BY-SA 3.0 Unported, http://creativecommons.org/licenses/by-sa/3.0/

View File

@ -0,0 +1,119 @@
-- Aircraft warning light
minetest.register_abm( {
nodenames = {"infrastructure:aircraft_warning_light_bright", "infrastructure:aircraft_warning_light_dark"},
interval = 2,
chance = 1,
action = function(pos, node)
local node = minetest.env:get_node(pos)
if node.name == "infrastructure:aircraft_warning_light_bright" then
minetest.swap_node(pos, {name = "infrastructure:aircraft_warning_light_dark", param2 = node.param2})
elseif node.name == "infrastructure:aircraft_warning_light_dark" then
minetest.swap_node(pos, {name = "infrastructure:aircraft_warning_light_bright", param2 = node.param2})
end
end
})
minetest.register_node("infrastructure:aircraft_warning_light_bright", {
description = "Aircraft warning light",
tiles = {
"infrastructure_aircraft_warning_light_top_bright.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_aircraft_warning_light_side_bright.png",
"infrastructure_aircraft_warning_light_side_bright.png",
"infrastructure_aircraft_warning_light_side_bright.png",
"infrastructure_aircraft_warning_light_side_bright.png"
},
drawtype = "nodebox",
paramtype = "light",
groups = {cracky = 1},
light_source = AIRCRAFT_WARNING_LIGHT_LIGHT_RANGE,
node_box = {
type = "fixed",
fixed = {
{-1/128, 1/4, -1/128, 1/128, 3/8, 1/128},
{-1/4, -1/8, 0, 1/4, 1/4, 0},
{0, -1/8, -1/4, 0, 1/4, 1/4},
{-1/16, -1/8, -1/16, 1/16, 1/16, 1/16},
{-1/4, -1/4, -1/8, 1/4, -1/8, 1/8},
{-1/8, -1/4, -1/4, 1/8, -1/8, 1/4},
{-1/8, -3/8, -1/8, 1/8, -1/4, 1/8},
{-3/16, -1/2, -3/16, 3/16, -3/8, 3/16}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1/128, 1/4, -1/128, 1/128, 3/8, 1/128},
{-1/4, -1/8, 0, 1/4, 1/4, 0},
{0, -1/8, -1/4, 0, 1/4, 1/4},
{-1/16, -1/8, -1/16, 1/16, 1/16, 1/16},
{-1/4, -1/4, -1/8, 1/4, -1/8, 1/8},
{-1/8, -1/4, -1/4, 1/8, -1/8, 1/4},
{-1/8, -3/8, -1/8, 1/8, -1/4, 1/8},
{-3/16, -1/2, -3/16, 3/16, -3/8, 3/16}
}
}
})
minetest.register_node("infrastructure:aircraft_warning_light_dark", {
tiles = {
"infrastructure_aircraft_warning_light_top_dark.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_aircraft_warning_light_side_dark.png",
"infrastructure_aircraft_warning_light_side_dark.png",
"infrastructure_aircraft_warning_light_side_dark.png",
"infrastructure_aircraft_warning_light_side_dark.png"
},
drawtype = "nodebox",
paramtype = "light",
groups = {cracky = 1, not_in_creative_inventory = 1},
drop = "infrastructure:aircraft_warning_light_bright",
node_box = {
type = "fixed",
fixed = {
{-1/128, 1/4, -1/128, 1/128, 3/8, 1/128},
{-1/4, -1/8, 0, 1/4, 1/4, 0},
{0, -1/8, -1/4, 0, 1/4, 1/4},
{-1/16, -1/8, -1/16, 1/16, 1/16, 1/16},
{-1/4, -1/4, -1/8, 1/4, -1/8, 1/8},
{-1/8, -1/4, -1/4, 1/8, -1/8, 1/4},
{-1/8, -3/8, -1/8, 1/8, -1/4, 1/8},
{-3/16, -1/2, -3/16, 3/16, -3/8, 3/16}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1/128, 1/4, -1/128, 1/128, 3/8, 1/128},
{-1/4, -1/8, 0, 1/4, 1/4, 0},
{0, -1/8, -1/4, 0, 1/4, 1/4},
{-1/16, -1/8, -1/16, 1/16, 1/16, 1/16},
{-1/4, -1/4, -1/8, 1/4, -1/8, 1/8},
{-1/8, -1/4, -1/4, 1/8, -1/8, 1/4},
{-1/8, -3/8, -1/8, 1/8, -1/4, 1/8},
{-3/16, -1/2, -3/16, 3/16, -3/8, 3/16}
}
}
})
minetest.register_alias("infrastructure:aircraft_warning_light", "infrastructure:aircraft_warning_light_bright")

View File

@ -0,0 +1,410 @@
-- Automatic warning device
local sound_handles = {}
local function play_bell(pos)
local pos_hash = minetest.hash_node_position(pos)
sound_handles[pos_hash] = minetest.sound_play("infrastructure_ebell",
{pos = pos, gain = AUTOMATIC_WARNING_DEVICE_VOLUME, loop = true, max_hear_distance = 30,})
end
local function stop_bell(pos, node)
local pos_hash = minetest.hash_node_position(pos)
local sound_handle = sound_handles[pos_hash]
if sound_handle then
minetest.sound_stop(sound_handle)
sound_handles[pos_hash] = nil
end
end
function left_light_direction(pos, param2)
if param2 == 0 then
pos.x = pos.x - 1
elseif param2 == 1 then
pos.z = pos.z + 1
elseif param2 == 2 then
pos.x = pos.x + 1
elseif param2 == 3 then
pos.z = pos.z - 1
end
end
function right_light_direction(pos, param2)
if param2 == 0 then
pos.x = pos.x + 2
elseif param2 == 1 then
pos.z = pos.z - 2
elseif param2 == 2 then
pos.x = pos.x - 2
elseif param2 == 3 then
pos.z = pos.z + 2
end
end
function lights_enabled(pos, node)
local node = minetest.env:get_node(pos)
local param2 = node.param2
if (node.name == "infrastructure:automatic_warning_device_middle_center_3") then
minetest.swap_node(pos, {name = "infrastructure:automatic_warning_device_middle_center_2", param2 = node.param2})
left_light_direction(pos, param2)
minetest.swap_node(pos, {name = "infrastructure:automatic_warning_device_middle_left_2", param2 = node.param2})
right_light_direction(pos, param2)
minetest.swap_node(pos, {name = "infrastructure:automatic_warning_device_middle_right_1", param2 = node.param2})
elseif node.name == "infrastructure:automatic_warning_device_middle_center_2" then
minetest.swap_node(pos, {name = "infrastructure:automatic_warning_device_middle_center_3", param2 = node.param2})
left_light_direction(pos, param2)
minetest.swap_node(pos, {name = "infrastructure:automatic_warning_device_middle_left_1", param2 = node.param2})
right_light_direction(pos, param2)
minetest.swap_node(pos, {name = "infrastructure:automatic_warning_device_middle_right_2", param2 = node.param2})
end
end
function lights_disabled(pos, node)
local node = minetest.env:get_node(pos)
local param2 = node.param2
minetest.swap_node(pos, {name = "infrastructure:automatic_warning_device_middle_center_1", param2 = node.param2})
left_light_direction(pos, param2)
minetest.swap_node(pos, {name = "infrastructure:automatic_warning_device_middle_left_1", param2 = node.param2})
right_light_direction(pos, param2)
minetest.swap_node(pos, {name = "infrastructure:automatic_warning_device_middle_right_1", param2 = node.param2})
end
function activate_lights(pos, node)
pos.y = pos.y + 2
local node = minetest.env:get_node(pos)
if node.name == "infrastructure:automatic_warning_device_middle_center_1" then
play_bell(pos)
minetest.swap_node(pos, {name = "infrastructure:automatic_warning_device_middle_center_2", param2 = node.param2})
elseif (node.name == "infrastructure:automatic_warning_device_middle_center_2" or node.name == "infrastructure:automatic_warning_device_middle_center_3") then
stop_bell(pos,node)
lights_disabled(pos, node)
end
end
minetest.register_abm( {
nodenames = {"infrastructure:automatic_warning_device_middle_center_2", "infrastructure:automatic_warning_device_middle_center_3"},
interval = 1,
chance = 1,
action = function(pos, node)
lights_enabled(pos,node)
end
})
minetest.register_node("infrastructure:automatic_warning_device_top", {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_automatic_warning_device_top_side.png",
"infrastructure_automatic_warning_device_top_side.png",
"infrastructure_automatic_warning_device_top_side.png",
"infrastructure_automatic_warning_device_top.png"
},
on_destruct = stop_bell,
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3, not_in_creative_inventory = 1},
node_box = {
type = "fixed",
fixed = {
{-1/16, -1/2, -1/16, 1/16, 0, 1/16},
{-1/8, 0, -1/8, 1/8, 3/8, 1/8},
{-1/4, 1/8, -1/4, 1/4, 1/4, 1/4},
{-1/2, -1/2, -1/16, 1/2, 0, -1/16},
{-1/8, -1/2, -1/16, 1/8, -1/4, 1/8}
}
},
selection_box = {
type = "fixed",
fixed = {0, 0, 0, 0, 0, 0}
}
})
for i = 1, 2 do
local groups = {}
groups = {cracky = 3, not_in_creative_inventory = 1}
if (i == 1) then
LIGHT_SOURCE = 0
else
LIGHT_SOURCE = AUTOMATIC_WARNING_DEVICE_LIGHT_RANGE
end
minetest.register_node("infrastructure:automatic_warning_device_middle_right_"..tostring(i), {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_automatic_warning_device_middle_right_side.png",
"infrastructure_automatic_warning_device_middle_right_"..tostring(i)..".png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
light_source = LIGHT_SOURCE,
node_box = {
type = "fixed",
fixed = {
{-1/2, -1/2, -1/16, -1/4, 1/2, -1/16},
{-1/2, -5/16, -1/16, -7/16, 1/16, 3/16},
{-1/2, 1/32, -5/16, -15/32, 3/32, -1/16},
{-15/32, -1/8, -3/16, -13/32, 1/32, -1/16}
}
},
selection_box = {
type = "fixed",
fixed = {0, 0, 0, 0, 0, 0}
}
})
minetest.register_node("infrastructure:automatic_warning_device_middle_left_"..tostring(i), {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_automatic_warning_device_middle_left_side.png",
"infrastructure_automatic_warning_device_middle_left_"..tostring(i)..".png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
light_source = LIGHT_SOURCE,
node_box = {
type = "fixed",
fixed = {
{1/4, -1/2, -1/16, 1/2, 1/2, -1/16},
{7/16, -5/16, -1/16, 1/2, 1/16, 3/16},
{15/32, 1/32, -5/16, 1/2, 3/32, -1/16},
{13/32, -1/8, -3/16, 15/32, 1/32, -1/16}
}
},
selection_box = {
type = "fixed",
fixed = {0, 0, 0, 0, 0, 0}
}
})
end
for i = 1, 3 do
local groups = {}
groups = {cracky = 3, not_in_creative_inventory = 1}
if (i == 1) then
LIGHT_SOURCE = 0
else
LIGHT_SOURCE = AUTOMATIC_WARNING_DEVICE_LIGHT_RANGE
end
minetest.register_node("infrastructure:automatic_warning_device_middle_center_"..tostring(i), {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_automatic_warning_device_middle_center_side.png",
"infrastructure_automatic_warning_device_middle_center_side.png",
"infrastructure_automatic_warning_device_middle_center_side.png",
"infrastructure_automatic_warning_device_middle_center_"..tostring(i)..".png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
light_source = LIGHT_SOURCE,
node_box = {
type = "fixed",
fixed = {
{-1/16, -1/2, -1/16, 1/16, 1/2, 1/16},
{-1/2, -1/2, -1/16, 1/2, 1/2, -1/16},
{-1/2, -5/16, -1/16, -3/16, 1/16, 3/16},
{3/16, -5/16, -1/16, 1/2, 1/16, 3/16},
{-3/16, -3/16, -1/16, 3/16, -1/16, 1/8},
{-1/2, 1/32, -5/16, -7/32, 3/32, -1/16},
{-7/32, -1/8, -3/16, -5/32, 1/32, -1/16},
{7/32, 1/32, -5/16, 1/2, 3/32, -1/16},
{5/32, -1/8, -3/16, 7/32, 1/32, -1/16}
}
},
selection_box = {
type = "fixed",
fixed = {0, 0, 0, 0, 0, 0}
}
})
end
minetest.register_node("infrastructure:automatic_warning_device_middle", {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_automatic_warning_device_middle_side.png",
"infrastructure_automatic_warning_device_middle_side.png",
"infrastructure_automatic_warning_device_middle_side.png",
"infrastructure_automatic_warning_device_middle.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3, not_in_creative_inventory = 1},
node_box = {
type = "fixed",
fixed = {
{-1/16, -1/2, -1/16, 1/16, 1/2, 1/16},
{-3/8, -3/8, -1/8, 3/8, 3/8, -1/16},
{-1/8, -1/8, -1/16, 1/8, 1/8, 1/8}
}
},
selection_box = {
type = "fixed",
fixed = {0, 0, 0, 0, 0, 0}
}
})
minetest.register_node("infrastructure:automatic_warning_device_bottom", {
description = "Automatic warning device",
inventory_image = "infrastructure_automatic_warning_device.png",
wield_image = "infrastructure_automatic_warning_device.png",
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_automatic_warning_device_bottom.png",
"infrastructure_automatic_warning_device_bottom.png",
"infrastructure_automatic_warning_device_bottom.png",
"infrastructure_automatic_warning_device_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-1/16, 0, -1/16, 1/16, 1/2, 1/16},
{-1/2, -1/2, -1/4, 1/2, -3/8, 1/4},
{-1/4, -1/2, -1/2, 1/4, -3/8, 1/2},
{-1/8, -3/8, -1/8, 1/8, 0, 1/8}
}
},
selection_box = {
type = "fixed",
fixed = {
-- top
{-1/8, 0 + 3, -1/8, 1/8, 3/8 + 3, 1/8},
{-1/4, 1/8 + 3, -1/4, 1/4, 1/4 + 3, 1/4},
{-1/8, -1/2 + 3, -1/16 + 0.01, 1/8, -1/4 + 3, 1/8},
-- middle center, left and right
{-9/16, -5/16 + 2, -1/16, -3/16, 1/16 + 2, 3/16},
{3/16, -5/16 + 2, -1/16, 9/16, 1/16 + 2, 3/16},
{-3/16, -3/16 + 2, -1/16 + 0.01, 3/16, -1/16 + 2, 1/8},
{-1/2, 1/32 + 2, -5/16, -7/32, 3/32 + 2, -1/16 - 0.01},
{-7/32, -1/8 + 2, -3/16, -5/32, 1/32 + 2, -1/16 - 0.01},
{13/32 - 1, -1/8 + 2, -3/16, 15/32 - 1, 1/32 + 2, -1/16 - 0.01},
{7/32, 1/32 + 2, -5/16, 1/2, 3/32 + 2, -1/16 - 0.01},
{5/32, -1/8 + 2, -3/16, 7/32, 1/32 + 2, -1/16 - 0.01},
{-15/32 + 1, -1/8 + 2, -3/16, -13/32 + 1, 1/32 + 2, -1/16 - 0.01},
-- middle
{-3/8, -3/8 + 1, -1/8, 3/8, 3/8 + 1, -1/16},
{-1/8, -1/8 + 1, -1/16, 1/8, 1/8 + 1, 1/8},
-- bottom
{-1/2, -1/2, -1/4, 1/2, -3/8, 1/4},
{-1/4, -1/2, -1/2, 1/4, -3/8, 1/2},
{-1/8, -3/8, -1/8, 1/8, 0, 1/8},
-- post
{-1/16, 0, -1/16, 1/16, 3, 1/16}
}
},
on_construct = function(pos)
local node = minetest.env:get_node(pos)
local param2 = node.param2
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "field[channel;Channel;${channel}]")
pos.y = pos.y + 1
node.name = "infrastructure:automatic_warning_device_middle"
minetest.env:add_node(pos, node)
pos.y = pos.y + 2
node.name = "infrastructure:automatic_warning_device_top"
minetest.env:add_node(pos, node)
pos.y = pos.y - 1
node.name = "infrastructure:automatic_warning_device_middle_center_1"
minetest.env:add_node(pos, node)
left_light_direction(pos, param2)
node.name = "infrastructure:automatic_warning_device_middle_left_1"
minetest.env:add_node(pos, node)
right_light_direction(pos, param2)
node.name = "infrastructure:automatic_warning_device_middle_right_1"
minetest.env:add_node(pos, node)
end,
on_destruct = function(pos)
local node = minetest.env:get_node(pos)
local param2 = node.param2
pos.y=pos.y+2
stop_bell(pos, node)
pos.y=pos.y-2
for i = 1, 3 do
pos.y = pos.y + 1
minetest.env:remove_node(pos)
end
pos.y = pos.y - 1
left_light_direction(pos, param2)
minetest.env:remove_node(pos)
right_light_direction(pos, param2)
minetest.env:remove_node(pos)
end,
on_punch = function(pos, node)
activate_lights(pos, node)
end,
on_receive_fields = function(pos, formname, fields, sender)
if (fields.channel) then
minetest.get_meta(pos):set_string("channel", fields.channel)
minetest.get_meta(pos):set_string("state", "Off")
end
end,
digiline = {
receptor = {},
effector = {
action = function(pos, node, channel, msg)
local setchan = minetest.get_meta(pos):get_string("channel")
if setchan ~= channel then
return
end
if (msg=="bell_on") then
play_bell(pos)
elseif (msg=="bell_off") then
stop_bell(pos,node)
elseif (msg=="lights_on") then
pos.y = pos.y + 2
local node = minetest.env:get_node(pos)
if node.name == "infrastructure:automatic_warning_device_middle_center_1" then
minetest.swap_node(pos, {name = "infrastructure:automatic_warning_device_middle_center_2", param2 = node.param2})
end
elseif (msg=="lights_off") then
pos.y = pos.y + 2
local node = minetest.env:get_node(pos)
if (node.name == "infrastructure:automatic_warning_device_middle_center_2" or node.name == "infrastructure:automatic_warning_device_middle_center_3") then
lights_disabled(pos, node)
end
end
end
}
}
})
minetest.register_alias("infrastructure:automatic_warning_device", "infrastructure:automatic_warning_device_bottom")
minetest.register_alias("awd", "infrastructure:automatic_warning_device_bottom")

View File

@ -0,0 +1,470 @@
-- Boom barrier
function move_arm(pos, node)
local node = minetest.env:get_node(pos)
local param2 = node.param2
if param2 == 0 then
dir = "z-"
elseif param2 == 1 then
dir = "x-"
elseif param2 == 2 then
dir = "z+"
elseif param2 == 3 then
dir = "x+"
end
minetest.sound_play("infrastructure_boom_barrier", {
pos = pos,
gain = BOOM_BARRIER_VOLUME,
max_hear_distance = 50
})
if node.name == "infrastructure:boom_barrier_top_h" then
minetest.swap_node(pos, {name = "infrastructure:boom_barrier_top_v", param2 = node.param2})
if dir == "x+" then
for i = 1, 10 do
pos.x = pos.x + 1
if (string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_bright")
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_dark")) == nil then
break
end
minetest.env:remove_node(pos)
node.name = "infrastructure:boom_barrier_arm_v"
minetest.env:add_node({x=pos.x-i, y=pos.y+i, z=pos.z}, node)
end
elseif dir == "x-" then
for i = 1, 10 do
pos.x = pos.x - 1
if (string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_bright")
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_dark")) == nil then
break
end
minetest.env:remove_node(pos)
node.name = "infrastructure:boom_barrier_arm_v"
minetest.env:add_node({x=pos.x+i, y=pos.y+i, z=pos.z}, node)
end
elseif dir == "z+" then
for i = 1, 10 do
pos.z = pos.z + 1
if (string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_bright")
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_dark")) == nil then
break
end
minetest.env:remove_node(pos)
node.name = "infrastructure:boom_barrier_arm_v"
minetest.env:add_node({x=pos.x, y=pos.y+i, z=pos.z-i}, node)
end
elseif dir == "z-" then
for i = 1, 10 do
pos.z = pos.z - 1
if (string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_bright")
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_dark")) == nil then
break
end
minetest.env:remove_node(pos)
node.name = "infrastructure:boom_barrier_arm_v"
minetest.env:add_node({x=pos.x, y=pos.y+i, z=pos.z+i}, node)
end
end
elseif node.name == "infrastructure:boom_barrier_top_v" then
minetest.swap_node(pos, {name = "infrastructure:boom_barrier_top_h", param2 = node.param2})
if dir == "x+" then
for i = 1, 10 do
pos.y = pos.y + 1
if string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_v") == nil then
break
end
minetest.env:remove_node(pos)
if i % 2 == 1 then
node.name = "infrastructure:boom_barrier_arm_h_bright"
else
node.name = "infrastructure:boom_barrier_arm_h_dark"
end
minetest.env:add_node({x=pos.x+i, y=pos.y-i, z=pos.z}, node)
end
elseif dir == "x-" then
for i = 1, 10 do
pos.y = pos.y + 1
if string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_v") == nil then
break
end
minetest.env:remove_node(pos)
if i % 2 == 1 then
node.name = "infrastructure:boom_barrier_arm_h_bright"
else
node.name = "infrastructure:boom_barrier_arm_h_dark"
end
minetest.env:add_node({x=pos.x-i, y=pos.y-i, z=pos.z}, node)
end
elseif dir == "z+" then
for i = 1, 10 do
pos.y = pos.y + 1
if string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_v") == nil then
break
end
minetest.env:remove_node(pos)
if i % 2 == 1 then
node.name = "infrastructure:boom_barrier_arm_h_bright"
else
node.name = "infrastructure:boom_barrier_arm_h_dark"
end
minetest.env:add_node({x=pos.x, y=pos.y-i, z=pos.z+i}, node)
end
elseif dir == "z-" then
for i = 1, 10 do
pos.y = pos.y + 1
if string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_v") == nil then
break
end
minetest.env:remove_node(pos)
if i % 2 == 1 then
node.name = "infrastructure:boom_barrier_arm_h_bright"
else
node.name = "infrastructure:boom_barrier_arm_h_dark"
end
minetest.env:add_node({x=pos.x, y=pos.y-i, z=pos.z-i}, node)
end
end
end
end
minetest.register_abm( {
nodenames = {"infrastructure:boom_barrier_arm_h_bright", "infrastructure:boom_barrier_arm_h_dark"},
interval = 1,
chance = 1,
action = function(pos, node)
local node = minetest.env:get_node(pos)
if node.name == "infrastructure:boom_barrier_arm_h_bright" then
minetest.swap_node(pos, {name = "infrastructure:boom_barrier_arm_h_dark", param2 = node.param2})
elseif node.name == "infrastructure:boom_barrier_arm_h_dark" then
minetest.swap_node(pos, {name = "infrastructure:boom_barrier_arm_h_bright", param2 = node.param2})
end
end
})
minetest.register_node("infrastructure:boom_barrier_top_h", {
description = "Boom barrier mechanism",
tiles = {
"infrastructure_boom_barrier_h_top.png",
"infrastructure_boom_barrier_h_bottom.png",
"infrastructure_boom_barrier_h_right.png",
"infrastructure_boom_barrier_h_left.png",
"infrastructure_boom_barrier_h_front_back.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-1/4, -1/4, -1/4, 1/4, 1/4, 1/4},
{-1/8, -1/2, -1/8, 1/8, -1/4, 1/8},
{-3/8, -1/2, -1/2, -1/4, -1/4, 1/8},
{-3/8, -1/2, -1/8, -1/4, 1/8, 1/8},
{-3/8, -1/8, -1/8, -1/4, 1/8, 1/2},
{-1/2, -3/16, 1/4, -3/8, 3/16, 1/2},
{-1/2, -1/8, 3/16, -3/8, 1/8, 1/2},
{-1/2, -1/16, 1/8, -3/8, 1/16, 1/2},
{1/4, -1/2, -1/2, 3/8, -1/4, 1/8},
{1/4, -1/2, -1/8, 3/8, 1/8, 1/8},
{1/4, -1/8, -1/8, 3/8, 1/8, 1/2},
{3/8, -3/16, 1/4, 1/2, 3/16, 1/2},
{3/8, -1/8, 3/16, 1/2, 1/8, 1/2},
{3/8, -1/16, 1/8, 1/2, 1/16, 1/2},
{-3/8, -1/2, -1/2, 3/8, -1/4, -3/8},
{-7/16, -1/16, -1/16, 7/16, 1/16, 1/16}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1/4, -1/4, -1/4, 1/4, 1/4, 1/4},
{-1/8, -1/2, -1/8, 1/8, -1/4, 1/8},
{-3/8, -1/2, -1/2, -1/4, -1/4, 1/8},
{-3/8, -1/2, -1/8, -1/4, 1/8, 1/8},
{-3/8, -1/8, -1/8, -1/4, 1/8, 1/2},
{-1/2, -3/16, 1/4, -3/8, 3/16, 1/2},
{-1/2, -1/8, 3/16, -3/8, 1/8, 1/2},
{-1/2, -1/16, 1/8, -3/8, 1/16, 1/2},
{1/4, -1/2, -1/2, 3/8, -1/4, 1/8},
{1/4, -1/2, -1/8, 3/8, 1/8, 1/8},
{1/4, -1/8, -1/8, 3/8, 1/8, 1/2},
{3/8, -3/16, 1/4, 1/2, 3/16, 1/2},
{3/8, -1/8, 3/16, 1/2, 1/8, 1/2},
{3/8, -1/16, 1/8, 1/2, 1/16, 1/2},
{-3/8, -1/2, -1/2, 3/8, -1/4, -3/8},
{-7/16, -1/16, -1/16, 7/16, 1/16, 1/16}
}
},
after_place_node = function(pos)
local node = minetest.env:get_node(pos)
node.name = "infrastructure:boom_barrier_bottom"
minetest.env:add_node(pos, node)
pos.y = pos.y + 1
node.name = "infrastructure:boom_barrier_top_h"
minetest.env:add_node(pos, node)
end,
after_dig_node = function(pos)
pos.y = pos.y - 1
minetest.env:remove_node(pos)
end,
on_punch = function(pos, node)
move_arm(pos, node)
end
})
minetest.register_node("infrastructure:boom_barrier_top_v", {
tiles = {
"infrastructure_boom_barrier_h_front_back.png",
"infrastructure_boom_barrier_v_bottom.png",
"infrastructure_boom_barrier_v_right.png",
"infrastructure_boom_barrier_v_left.png",
"infrastructure_boom_barrier_v_front_back.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
drop = "infrastructure:boom_barrier_top_h",
node_box = {
type = "fixed",
fixed = {
{-1/4, -1/4, -1/4, 1/4, 1/4, 1/4},
{-1/8, -1/2, -1/8, 1/8, -1/4, 1/8},
{-3/8, -1/8, -1/2, -1/4, 1/2, -1/4},
{-3/8, -1/8, -1/2, -1/4, 1/8, 1/8},
{-3/8, -1/2, -1/8, -1/4, 1/8, 1/8},
{-1/2, -1/2, -3/16, -3/8, -1/4, 3/16},
{-1/2, -1/2, -1/8, -3/8, -3/16, 1/8},
{-1/2, -1/2, -1/16, -3/8, -1/8, 1/16},
{1/4, -1/8, -1/2, 3/8, 1/2, -1/4},
{1/4, -1/8, -1/2, 3/8, 1/8, 1/8},
{1/4, -1/2, -1/8, 3/8, 1/8, 1/8},
{3/8, -1/2, -3/16, 1/2, -1/4, 3/16},
{3/8, -1/2, -1/8, 1/2, -3/16, 1/8},
{3/8, -1/2, -1/16, 1/2, -1/8, 1/16},
{-3/8, 3/8, -1/2, 3/8, 1/2, -1/4},
{-7/16, -1/16, -1/16, 7/16, 1/16, 1/16}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1/4, -1/4, -1/4, 1/4, 1/4, 1/4},
{-1/8, -1/2, -1/8, 1/8, -1/4, 1/8},
{-3/8, -1/8, -1/2, -1/4, 1/2, -1/4},
{-3/8, -1/8, -1/2, -1/4, 1/8, 1/8},
{-3/8, -1/2, -1/8, -1/4, 1/8, 1/8},
{-1/2, -1/2, -3/16, -3/8, -1/4, 3/16},
{-1/2, -1/2, -1/8, -3/8, -3/16, 1/8},
{-1/2, -1/2, -1/16, -3/8, -1/8, 1/16},
{1/4, -1/8, -1/2, 3/8, 1/2, -1/4},
{1/4, -1/8, -1/2, 3/8, 1/8, 1/8},
{1/4, -1/2, -1/8, 3/8, 1/8, 1/8},
{3/8, -1/2, -3/16, 1/2, -1/4, 3/16},
{3/8, -1/2, -1/8, 1/2, -3/16, 1/8},
{3/8, -1/2, -1/16, 1/2, -1/8, 1/16},
{-3/8, 3/8, -1/2, 3/8, 1/2, -1/4},
{-7/16, -1/16, -1/16, 7/16, 1/16, 1/16}
}
},
after_dig_node = function(pos)
pos.y = pos.y - 1
minetest.env:remove_node(pos)
end,
on_punch = function(pos, node)
move_arm(pos, node)
end
})
minetest.register_node("infrastructure:boom_barrier_bottom", {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_automatic_warning_device_bottom.png",
"infrastructure_automatic_warning_device_bottom.png",
"infrastructure_automatic_warning_device_bottom.png",
"infrastructure_automatic_warning_device_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
drop = "infrastructure:boom_barrier_top_h",
node_box = {
type = "fixed",
fixed = {
{-1/16, -1/2, -1/16, 1/16, 1/2, 1/16},
{-1/2, -1/2, -1/4, 1/2, -3/8, 1/4},
{-1/4, -1/2, -1/2, 1/4, -3/8, 1/2},
{-1/8, -1/2, -1/8, 1/8, 0, 1/8}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1/16, -1/2, -1/16, 1/16, 1/2, 1/16},
{-1/2, -1/2, -1/4, 1/2, -3/8, 1/4},
{-1/4, -1/2, -1/2, 1/4, -3/8, 1/2},
{-1/8, -1/2, -1/8, 1/8, 0, 1/8}
}
},
after_dig_node = function(pos)
pos.y = pos.y + 1
minetest.env:remove_node(pos)
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "field[channel;Channel;${channel}]")
end,
on_receive_fields = function(pos, formname, fields, sender)
if (fields.channel) then
minetest.get_meta(pos):set_string("channel", fields.channel)
minetest.get_meta(pos):set_string("state", "Off")
end
end,
digiline = {
receptor = {},
effector = {
action = function(pos, node, channel, msg)
local setchan = minetest.get_meta(pos):get_string("channel")
if setchan ~= channel then
return
end
pos.y = pos.y + 1
local mechnode = minetest.env:get_node(pos)
if ((msg == "up" and mechnode.name=="infrastructure:boom_barrier_top_h") or (msg == "down" and mechnode.name=="infrastructure:boom_barrier_top_v")) then
move_arm(pos, mechnode)
end
end
}
},
})
minetest.register_node("infrastructure:boom_barrier_arm_h_bright", {
description = "Boom barrier arm",
tiles = {
"infrastructure_boom_barrier_arm_h_top.png",
"infrastructure_boom_barrier_arm_h_bottom_front_back.png",
"infrastructure_boom_barrier_arm_h_left_right_bright.png",
"infrastructure_boom_barrier_arm_h_left_right_bright.png",
"infrastructure_boom_barrier_arm_h_bottom_front_back.png",
"infrastructure_boom_barrier_arm_h_bottom_front_back.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
light_source = BOOM_BARRIER_LIGHT_RANGE,
node_box = {
type = "fixed",
fixed = {
{-1/8, -1/2, -1/2, 1/8, -7/16, 1/2},
{-1/8, -5/16, -1/2, 1/8, -1/4, 1/2},
{-1/8, -1/2, -1/2, -1/16, -1/4, 1/2},
{1/16, -1/2, -1/2, 1/8, -1/4, 1/2},
{0, -1/4, -1/8, 0, 0, 1/8}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1/8, -1/2, -1/2, 1/8, -1/4, 1/2}
}
}
})
minetest.register_node("infrastructure:boom_barrier_arm_h_dark", {
tiles = {
"infrastructure_boom_barrier_arm_h_top.png",
"infrastructure_boom_barrier_arm_h_bottom_front_back.png",
"infrastructure_boom_barrier_arm_h_left_right_dark.png",
"infrastructure_boom_barrier_arm_h_left_right_dark.png",
"infrastructure_boom_barrier_arm_h_bottom_front_back.png",
"infrastructure_boom_barrier_arm_h_bottom_front_back.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
drop = "infrastructure:boom_barrier_arm_h_bright",
node_box = {
type = "fixed",
fixed = {
{-1/8, -1/2, -1/2, 1/8, -7/16, 1/2},
{-1/8, -5/16, -1/2, 1/8, -1/4, 1/2},
{-1/8, -1/2, -1/2, -1/16, -1/4, 1/2},
{1/16, -1/2, -1/2, 1/8, -1/4, 1/2},
{0, -1/4, -1/8, 0, 0, 1/8}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1/8, -1/2, -1/2, 1/8, -1/4, 1/2}
}
}
})
minetest.register_node("infrastructure:boom_barrier_arm_v", {
tiles = {
"infrastructure_boom_barrier_arm_h_bottom_front_back.png",
"infrastructure_boom_barrier_arm_h_bottom_front_back.png",
"infrastructure_boom_barrier_arm_v_left.png",
"infrastructure_boom_barrier_arm_v_right.png",
"infrastructure_boom_barrier_arm_h_top.png",
"infrastructure_boom_barrier_arm_h_bottom_front_back.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
drop = "infrastructure:boom_barrier_arm_h_bright",
node_box = {
type = "fixed",
fixed = {
{-1/8, -1/2, -1/2, 1/8, 1/2, -7/16},
{-1/8, -1/2, -5/16, 1/8, 1/2, -1/4},
{-1/8, -1/2, -1/2, -1/16, 1/2, -1/4},
{1/16, -1/2, -1/2, 1/8, 1/2, -1/4},
{0, -1/8, -1/4, 0, 1/8, 0}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1/8, -1/2, -1/2, 1/8, 1/2, -1/4}
}
}
})
minetest.register_alias("infrastructure:boom_barrier_mechanism", "infrastructure:boom_barrier_top_h")
minetest.register_alias("infrastructure:boom_barrier_arm", "infrastructure:boom_barrier_arm_h_bright")

View File

@ -0,0 +1,85 @@
-- Crosswalk lighting
minetest.register_node("infrastructure:crosswalk_lighting_dark", {
description = "Crosswalk lighting",
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_crosswalk_lighting_bottom.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_crosswalk_lighting_back.png",
"infrastructure_crosswalk_lighting_front.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-3/8, -1/2, -1/4, 3/8, 1/2, -3/16},
{-3/8, -1/2, 3/16, 3/8, 1/2, 1/4},
{-1/4, 1/4, -3/16, -1/8, 3/8, 3/16},
{1/8, 1/4, -3/16, 1/4, 3/8, 3/16},
{-1/8, -1/2, -3/16, 1/8, -1/4, 3/16},
{-1/2, -1/2, -1/8, 1/2, -3/8, 1/8},
}
},
selection_box = {
type = "fixed",
fixed = {-3/8, -1/2, -1/4, 3/8, 1/2, 1/4}
},
on_punch = function(pos, node)
minetest.swap_node(pos, {name = "infrastructure:crosswalk_lighting_bright", param2 = node.param2})
end,
mesecons = {effector = {
action_on = function (pos, node)
minetest.swap_node(pos, {name = "infrastructure:crosswalk_lighting_bright", param2 = node.param2})
end,
}}
})
minetest.register_node("infrastructure:crosswalk_lighting_bright", {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_crosswalk_lighting_bottom.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_crosswalk_lighting_back.png",
"infrastructure_crosswalk_lighting_front.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3, not_in_creative_inventory = 1},
light_source = CROSSWALK_LIGHTING_LIGHT_RANGE,
drop = "infrastructure:crosswalk_lighting_dark",
node_box = {
type = "fixed",
fixed = {
{-3/8, -1/2, -1/4, 3/8, 1/2, -3/16},
{-3/8, -1/2, 3/16, 3/8, 1/2, 1/4},
{-1/4, 1/4, -3/16, -1/8, 3/8, 3/16},
{1/8, 1/4, -3/16, 1/4, 3/8, 3/16},
{-1/8, -1/2, -3/16, 1/8, -1/4, 3/16},
{-1/2, -1/2, -1/8, 1/2, -3/8, 1/8},
}
},
selection_box = {
type = "fixed",
fixed = {-3/8, -1/2, -1/4, 3/8, 1/2, 1/4}
},
on_punch = function(pos, node)
minetest.swap_node(pos, {name = "infrastructure:crosswalk_lighting_dark", param2 = node.param2})
end,
mesecons = {effector = {
action_off = function (pos, node)
minetest.swap_node(pos, {name = "infrastructure:crosswalk_lighting_dark", param2 = node.param2})
end,
}}
})
minetest.register_alias("infrastructure:crosswalk_lighting", "infrastructure:crosswalk_lighting_dark")

View File

@ -0,0 +1,85 @@
-- Crosswalk safety sign
minetest.register_node("infrastructure:crosswalk_safety_sign_top", {
tiles = {
"infrastructure_crosswalk_safety_sign_top.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_crosswalk_safety_sign_top_side.png",
"infrastructure_crosswalk_safety_sign_top_side.png",
"infrastructure_crosswalk_safety_sign_top_front_back.png",
"infrastructure_crosswalk_safety_sign_top_front_back.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1, not_in_creative_inventory = 1},
light_source = CROSSWALK_SAFETY_SIGN_LIGHT_RANGE,
node_box = {
type = "fixed",
fixed = {
{-1/4, -1/2, -1/16, 1/4, 0, -1/16},
{-1/4, -1/2, 1/16, 1/4, 0, 1/16},
{-1/16, -1/2, -1/16, 1/16, -1/4, 1/16}
}
},
selection_box = {
type = "fixed",
fixed = {0, 0, 0, 0, 0, 0}
}
})
minetest.register_node("infrastructure:crosswalk_safety_sign_bottom", {
description = "Crosswalk safety sign",
inventory_image = "infrastructure_crosswalk_safety_sign.png",
wield_image = "infrastructure_crosswalk_safety_sign.png",
tiles = {
"infrastructure_crosswalk_safety_sign_top.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_crosswalk_safety_sign_bottom_side.png",
"infrastructure_crosswalk_safety_sign_bottom_side.png",
"infrastructure_crosswalk_safety_sign_bottom_front_back.png",
"infrastructure_crosswalk_safety_sign_bottom_front_back.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
light_source = CROSSWALK_SAFETY_SIGN_LIGHT_RANGE,
node_box = {
type = "fixed",
fixed = {
{-1/4, -7/32, -1/16, 1/4, 1/2, -1/16},
{-1/4, -7/32, 1/16, 1/4, 1/2, 1/16},
{-1/16, -5/16, -1/16, 1/16, 1/2, 1/16},
{-1/8, -3/8, -1/8, 1/8, -5/16, 1/8},
{-1/4, -1/2, -1/2, 1/4, -3/8, 1/2}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1/4, -7/32, -1/16, 1/4, 1, -1/16},
{-1/4, -7/32, 1/16, 1/4, 1, 1/16},
{-1/16, -5/16, -1/16 + 0.01, 1/16, 3/4, 1/16 - 0.01},
{-1/8, -3/8, -1/8, 1/8, -5/16, 1/8},
{-1/4, -1/2, -1/2, 1/4, -3/8, 1/2}
}
},
after_place_node = function(pos)
local node = minetest.env:get_node(pos)
node.name = "infrastructure:crosswalk_safety_sign_bottom"
minetest.env:add_node(pos, node)
pos.y = pos.y + 1
node.name = "infrastructure:crosswalk_safety_sign_top"
minetest.env:add_node(pos, node)
end,
after_dig_node = function(pos)
pos.y = pos.y + 1
minetest.env:remove_node(pos)
end,
})
minetest.register_alias("infrastructure:crosswalk_safety_sign", "infrastructure:crosswalk_safety_sign_bottom")

View File

@ -0,0 +1,193 @@
-- Crosswalk warning light
minetest.register_abm( {
nodenames = {"infrastructure:crosswalk_warning_light_bright", "infrastructure:crosswalk_warning_light_dark"},
interval = 1,
chance = 1,
action = function(pos, node)
local node = minetest.env:get_node(pos)
if node.name == "infrastructure:crosswalk_warning_light_bright" then
minetest.swap_node(pos, {name = "infrastructure:crosswalk_warning_light_dark", param2 = node.param2})
elseif node.name == "infrastructure:crosswalk_warning_light_dark" then
minetest.swap_node(pos, {name = "infrastructure:crosswalk_warning_light_bright", param2 = node.param2})
end
end
})
function on_off_light(pos, node)
local node = minetest.env:get_node(pos)
if node.name == "infrastructure:crosswalk_warning_light_off" then
minetest.swap_node(pos, {name = "infrastructure:crosswalk_warning_light_bright", param2 = node.param2})
elseif (node.name == "infrastructure:crosswalk_warning_light_dark" or node.name == "infrastructure:crosswalk_warning_light_bright") then
minetest.swap_node(pos, {name = "infrastructure:crosswalk_warning_light_off", param2 = node.param2})
end
end
minetest.register_node("infrastructure:crosswalk_warning_light_off", {
description = "Crosswalk warning light",
inventory_image = "infrastructure_crosswalk_warning_light_front_bright.png",
wield_image = "infrastructure_crosswalk_warning_light_front_bright.png",
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_crosswalk_warning_light_back.png",
"infrastructure_crosswalk_warning_light_front_dark.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3, not_in_creative_inventory = 0},
node_box = {
type = "fixed",
fixed = {
{-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
{-1/2, -1/2, -1/8, 1/2, 1/2, -1/8},
{-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
{-5/16, 0, -1/4, -1/4, 1/4, -1/8},
{1/4, 0, -1/4, 5/16, 1/4, -1/8},
{-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
{-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
{-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.001}
}
},
selection_box = {
type = "fixed",
fixed = {
{-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
{-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
{-5/16, 0, -1/4, -1/4, 1/4, -1/8},
{1/4, 0, -1/4, 5/16, 1/4, -1/8},
{-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
{-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
{-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.01}
}
},
on_punch = function(pos, node)
on_off_light(pos, node)
end,
mesecons = {effector = {
action_on = function(pos, node)
on_off_light(pos, node)
end,
}}
})
minetest.register_node("infrastructure:crosswalk_warning_light_dark", {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_crosswalk_warning_light_back.png",
"infrastructure_crosswalk_warning_light_front_dark.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3, not_in_creative_inventory = 1},
drop = "infrastructure:crosswalk_warning_light_off",
node_box = {
type = "fixed",
fixed = {
{-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
{-1/2, -1/2, -1/8, 1/2, 1/2, -1/8},
{-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
{-5/16, 0, -1/4, -1/4, 1/4, -1/8},
{1/4, 0, -1/4, 5/16, 1/4, -1/8},
{-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
{-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
{-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.001}
}
},
selection_box = {
type = "fixed",
fixed = {
{-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
{-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
{-5/16, 0, -1/4, -1/4, 1/4, -1/8},
{1/4, 0, -1/4, 5/16, 1/4, -1/8},
{-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
{-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
{-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.01}
}
},
on_punch = function(pos, node)
on_off_light(pos, node)
end,
mesecons = {effector = {
action_on = function(pos, node)
on_off_light(pos, node)
end,
}}
})
minetest.register_node("infrastructure:crosswalk_warning_light_bright", {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_crosswalk_warning_light_back.png",
"infrastructure_crosswalk_warning_light_front_bright.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3, not_in_creative_inventory = 1},
light_source = TRAFFIC_LIGHTS_LIGHT_RANGE,
drop = "infrastructure:crosswalk_warning_light_off",
node_box = {
type = "fixed",
fixed = {
{-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
{-1/2, -1/2, -1/8, 1/2, 1/2, -1/8},
{-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
{-5/16, 0, -1/4, -1/4, 1/4, -1/8},
{1/4, 0, -1/4, 5/16, 1/4, -1/8},
{-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
{-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
{-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.001}
}
},
selection_box = {
type = "fixed",
fixed = {
{-5/16, -5/16, -1/8, 5/16, 3/8, 1/8},
{-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
{-5/16, 0, -1/4, -1/4, 1/4, -1/8},
{1/4, 0, -1/4, 5/16, 1/4, -1/8},
{-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
{-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
{-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.01}
}
},
on_punch = function(pos, node)
on_off_light(pos, node)
end,
mesecons = {effector = {
action_on = function(pos, node)
on_off_light(pos, node)
end,
}}
})
minetest.register_alias("infrastructure:crosswalk_warning_light", "infrastructure:crosswalk_warning_light_off")

View File

@ -0,0 +1,85 @@
-- Curve chevron
minetest.register_node("infrastructure:curve_chevron_dark", {
description = "Flashing curve chevron",
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_curve_chevron_left_dark.png",
"infrastructure_curve_chevron_right_dark.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-1/2, -1/2, -1/8, 1/2, 1/2, -1/16},
{-1/2, -1/2, 1/16, 1/2, 1/2, 1/8},
{-3/8, 1/4, -1/16, -1/4, 3/8, 1/16},
{1/4, 1/4, -1/16, 3/8, 3/8, 1/16},
{-3/8, -3/8, -1/16, -1/4, -1/4, 1/16},
{1/4, -3/8, -1/16, 3/8, -1/4, 1/16}
}
},
selection_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/8, 1/2, 1/2, 1/8}
},
on_punch = function(pos, node)
minetest.swap_node(pos, {name = "infrastructure:curve_chevron_bright", param2 = node.param2})
end,
mesecons = {effector = {
action_on = function (pos, node)
minetest.swap_node(pos, {name = "infrastructure:curve_chevron_bright", param2 = node.param2})
end,
}}
})
minetest.register_node("infrastructure:curve_chevron_bright", {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_curve_chevron_left_bright.png",
"infrastructure_curve_chevron_right_bright.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3, not_in_creative_inventory = 1},
light_source = CURVE_CHEVRON_LIGHT_RANGE,
drop = "infrastructure:curve_chevron_dark",
node_box = {
type = "fixed",
fixed = {
{-1/2, -1/2, -1/8, 1/2, 1/2, -1/16},
{-1/2, -1/2, 1/16, 1/2, 1/2, 1/8},
{-3/8, 1/4, -1/16, -1/4, 3/8, 1/16},
{1/4, 1/4, -1/16, 3/8, 3/8, 1/16},
{-3/8, -3/8, -1/16, -1/4, -1/4, 1/16},
{1/4, -3/8, -1/16, 3/8, -1/4, 1/16}
}
},
selection_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/8, 1/2, 1/2, 1/8}
},
on_punch = function(pos, node)
minetest.swap_node(pos, {name = "infrastructure:curve_chevron_dark", param2 = node.param2})
end,
mesecons = {effector = {
action_off = function (pos, node)
minetest.swap_node(pos, {name = "infrastructure:curve_chevron_dark", param2 = node.param2})
end
}}
})
minetest.register_alias("infrastructure:curve_chevron", "infrastructure:curve_chevron_dark")

View File

@ -0,0 +1,107 @@
-- Emergency phone (only if enabled)
if ENABLE_EMERGENCY_PHONE then
minetest.register_node("infrastructure:emergency_phone_top", {
description = "Emergency phone",
tiles = {
"infrastructure_emergency_phone_top.png",
"infrastructure_emergency_phone_bottom.png",
"infrastructure_emergency_phone_side.png",
"infrastructure_emergency_phone_side.png",
"infrastructure_emergency_phone_side.png",
"infrastructure_emergency_phone_front.png"
},
drawtype = "nodebox",
drop = "streets:emergencyphone",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky=1,not_in_creative_inventory=1},
light_source = EMERGENCY_PHONE_LIGHT_RANGE,
node_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.25, 0.25, 0.5, 0.25},
{-0.25, -0.5, -0.3125, -0.1875, 0.5, -0.25},
{0.1875, -0.5, -0.3125, 0.25, 0.5, -0.25},
{-0.1875, 0.4375, -0.3125, 0.1875, 0.5, -0.25}
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.25, 0.25, 0.5, 0.25},
{-0.25, -0.5, -0.3125, -0.1875, 0.5, -0.25},
{0.1875, -0.5, -0.3125, 0.25, 0.5, -0.25},
{-0.1875, 0.4375, -0.3125, 0.1875, 0.5, -0.25},
}
},
after_dig_node = function(pos)
pos.y = pos.y - 1
if minetest.get_node(pos).name == "infrastructure:emergency_phone_bottom" then
minetest.remove_node(pos)
end
end,
on_punch = function(pos, node, puncher)
if dial_handler ~= nil then
minetest.sound_stop(dial_handler)
dial_handler = nil
end
dial_handler = minetest.sound_play("infrastructure_emergency_phone", {
pos = pos,
gain = EMERGENCY_PHONE_VOLUME,
max_hear_distance = 50
})
if (puncher:is_player() and puncher:get_hp() < HEALTH_TO_RESTORING and puncher:get_hp() <= HEALTH_TO_TRIGGER) then
puncher:set_hp(HEALTH_TO_RESTORING)
minetest.chat_send_player(puncher:get_player_name(), "You got healed!")
minetest.chat_send_all("Server: -!- "..puncher:get_player_name().." used an emergency phone at "..pos.x..","..pos.y..","..pos.z);
end
end
})
minetest.register_node("infrastructure:emergency_phone_bottom", {
tiles = {"infrastructure_emergency_phone_bottom.png"},
drawtype = "nodebox",
drop = "streets:emergencyphone",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky=1,not_in_creative_inventory=1},
node_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.5, 0.25}
},
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.5, 0.25}
},
after_dig_node = function(pos)
pos.y = pos.y+1
if minetest.get_node(pos).name == "infrastructure:emergency_phone_top" then
minetest.remove_node(pos)
end
end,
})
minetest.register_alias("infrastructure:emergency_phone", "infrastructure:emergency_phone_top")
minetest.register_abm({
nodenames = {"streets:emergencyphone"},
interval = 1,
chance = 1,
action = function(pos, node)
local node = minetest.get_node(pos)
local node_above = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
if node_above.name == "air" then
node.name = "infrastructure:emergency_phone_bottom"
minetest.set_node(pos, node)
pos.y = pos.y+1
end
node.name = "infrastructure:emergency_phone_top"
minetest.set_node(pos, node)
end,
})
else
print("Infrastructure mod: -!- Emergency-Phone is disabled!")
end

View File

@ -0,0 +1,79 @@
-- Lane control lights
function lane_control_change(pos, node)
local node = minetest.env:get_node(pos)
if node.name == "infrastructure:lane_control_lights_1" then
minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_2", param2 = node.param2})
elseif node.name == "infrastructure:lane_control_lights_2" then
minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_3", param2 = node.param2})
elseif node.name == "infrastructure:lane_control_lights_3" then
minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_4", param2 = node.param2})
elseif node.name == "infrastructure:lane_control_lights_4" then
minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_5", param2 = node.param2})
elseif node.name == "infrastructure:lane_control_lights_5" then
minetest.swap_node(pos, {name = "infrastructure:lane_control_lights_1", param2 = node.param2})
end
end
for i = 1, 5 do
local groups = {}
if i == 1 then
groups = {cracky = 3}
else
groups = {cracky = 3, not_in_creative_inventory = 1}
end
minetest.register_node("infrastructure:lane_control_lights_"..tostring(i), {
description = "Lane control lights",
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_lane_control_lights_"..tostring(i)..".png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3, not_in_creative_inventory = 1},
light_source = TRAFFIC_LIGHTS_LIGHT_RANGE,
drop = "infrastructure:lane_control_lights_1",
node_box = {
type = "fixed",
fixed = {
{-7/16, -7/16, -1/8, 7/16, 7/16, 1/8},
{-7/16, 0, -1/4, -3/8, 7/16, -1/8},
{3/8, 0, -1/4, 7/16, 7/16, -1/8},
{-7/16, 3/8, -5/16, 7/16, 7/16, -1/8},
{-1/16, -1/4, 0, 1/16, 1/4, 1/2 - 0.001},
{-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.001},
{-1/4, -1/16, 0, 1/4, 1/16, 1/2 - 0.001}
}
},
selection_box = {
type = "fixed",
fixed = {
{-7/16, -7/16, -1/8, 7/16, 7/16, 1/8},
{-7/16, 0, -1/4, -3/8, 7/16, -1/8},
{3/8, 0, -1/4, 7/16, 7/16, -1/8},
{-7/16, 3/8, -5/16, 7/16, 7/16, -1/8},
{-1/16, -1/4, 0, 1/16, 1/4, 1/2 - 0.001},
{-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.001},
{-1/4, -1/16, 0, 1/4, 1/16, 1/2 - 0.001}
}
},
on_punch = function(pos, node)
lane_control_change(pos, node)
end,
mesecons = {effector = {
action_on = function (pos, node)
lane_control_change(pos, node)
end,
}}
})
end
minetest.register_alias("infrastructure:lane_control_lights", "infrastructure:lane_control_lights_1")

View File

@ -0,0 +1,237 @@
-- Road signs
local signs = {"stop", "yield", "right_of_way"}
for i, sign_name in ipairs(signs) do
minetest.register_node("infrastructure:road_sign_"..sign_name, {
description = "Road sign "..sign_name,
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_road_sign_"..sign_name.."_back.png",
"infrastructure_road_sign_"..sign_name.."_front.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 2},
node_box = {
type = "fixed",
fixed = {
{-1/2, -1/2, 7/16, 1/2, 1/2, 7/16},
{-3/16, -1/8, 7/16, 3/16, 1/8, 1/2 - 0.001}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1/2, -1/2, 7/16, 1/2, 1/2, 7/16},
{-3/16, -1/8, 7/16 + 0.01, 3/16, 1/8, 1/2 - 0.01}
}
},
after_place_node = function(pos, node)
local node = minetest.env:get_node(pos)
local param2 = node.param2
local sign_pos = {x=pos.x, y=pos.y, z=pos.z}
if param2 == 0 then
pos.z = pos.z + 1
elseif param2 == 1 then
pos.x = pos.x + 1
elseif param2 == 2 then
pos.z = pos.z - 1
elseif param2 == 3 then
pos.x = pos.x - 1
end
local node = minetest.env:get_node(pos)
if minetest.registered_nodes[node.name].drawtype == "fencelike" then
minetest.set_node(sign_pos, {name="infrastructure:road_sign_"..sign_name.."_on_post", param2=param2})
end
end
})
minetest.register_node("infrastructure:road_sign_"..sign_name.."_on_post", {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_road_sign_"..sign_name.."_back.png",
"infrastructure_road_sign_"..sign_name.."_front.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 2, not_in_creative_inventory = 1},
drop = "infrastructure:road_sign_"..sign_name,
node_box = {
type = "fixed",
fixed = {
{-1/2, -1/2, 7/16 + 3/8, 1/2, 1/2, 7/16 + 3/8},
{-3/16, 1/16, 7/16 + 3/8, 3/16, 1/8, 13/16 + 3/8 - 0.001},
{-3/16, -1/8, 7/16 + 3/8, 3/16, -1/16, 13/16 + 3/8 - 0.001}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1/2, -1/2, 7/16 + 3/8, 1/2, 1/2, 7/16 + 3/8},
{-3/16, 1/16, 7/16 + 3/8 + 0.01, 3/16, 1/8, 13/16 + 3/8 - 0.01},
{-3/16, -1/8, 7/16 + 3/8 + 0.01, 3/16, -1/16, 13/16 + 3/8 - 0.01}
}
}
})
end
-- Road sign crosswalk
minetest.register_node("infrastructure:road_sign_crosswalk", {
description = "Road sign crosswalk",
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_road_sign_crosswalk_back.png",
"infrastructure_road_sign_crosswalk_front.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 2},
node_box = {
type = "fixed",
fixed = {
{-1/2, -1/2, 7/16, 1/2, 1/2, 7/16},
{-3/16, -1/8, 7/16, 3/16, 1/8, 1/2 - 0.001}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1/2, -1/2, 7/16, 1/2, 1/2, 7/16},
{-3/16, -1/8, 7/16, 3/16, 1/8, 1/2 - 0.001}
}
},
after_place_node = function(pos, node)
local node = minetest.env:get_node(pos)
local param2 = node.param2
local sign_pos = {x=pos.x, y=pos.y, z=pos.z}
if param2 == 0 then
pos.z = pos.z + 1
elseif param2 == 1 then
pos.x = pos.x + 1
elseif param2 == 2 then
pos.z = pos.z - 1
elseif param2 == 3 then
pos.x = pos.x - 1
end
local node = minetest.env:get_node(pos)
if param2 == 0 then
pos.z = pos.z - 2
elseif param2 == 1 then
pos.x = pos.x - 2
elseif param2 == 2 then
pos.z = pos.z + 2
elseif param2 == 3 then
pos.x = pos.x + 2
end
if minetest.registered_nodes[node.name].drawtype == "fencelike" then
minetest.set_node(sign_pos, {name="infrastructure:road_sign_crosswalk_on_post", param2=param2})
minetest.env:add_node(pos, {name="infrastructure:road_sign_retroreflective_surface_on_post", param2=param2})
else
minetest.env:add_node(pos, {name="infrastructure:road_sign_retroreflective_surface", param2=param2})
end
end
})
minetest.register_node("infrastructure:road_sign_crosswalk_on_post", {
description = "Road sign crosswalk",
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_road_sign_crosswalk_back.png",
"infrastructure_road_sign_crosswalk_front.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 2, not_in_creative_inventory = 1},
drop = "infrastructure:road_sign_crosswalk",
node_box = {
type = "fixed",
fixed = {
{-1/2, -1/2, 7/16 + 3/8, 1/2, 1/2, 7/16 + 3/8},
{-3/16, 1/16, 7/16 + 3/8, 3/16, 1/8, 13/16 + 3/8 - 0.001},
{-3/16, -1/8, 7/16 + 3/8, 3/16, -1/16, 13/16 + 3/8 - 0.001}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1/2, -1/2, 7/16 + 3/8, 1/2, 1/2, 7/16 + 3/8},
{-3/16, 1/16, 7/16 + 3/8 + 0.01, 3/16, 1/8, 13/16 + 3/8 - 0.01},
{-3/16, -1/8, 7/16 + 3/8 + 0.01, 3/16, -1/16, 13/16 + 3/8 - 0.01}
}
}
})
minetest.register_node("infrastructure:road_sign_retroreflective_surface", {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_road_sign_retroreflective_surface.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 2, not_in_creative_inventory = 1},
light_source = RETROREFLECTIVE_SURFACE_LIGHT_RANGE,
drop = "",
node_box = {
type = "fixed",
fixed = {-3/4, -3/4, 7/16 + 1 + 0.01, 3/4, 3/4, 7/16 + 1 + 0.01}
},
selection_box = {
type = "fixed",
fixed = {-3/4, -3/4, 7/16 + 1 + 0.01, 3/4, 3/4, 7/16 + 1 + 0.01}
}
})
minetest.register_node("infrastructure:road_sign_retroreflective_surface_on_post", {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_road_sign_retroreflective_surface.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 2, not_in_creative_inventory = 1},
light_source = RETROREFLECTIVE_SURFACE_LIGHT_RANGE,
drop = "",
node_box = {
type = "fixed",
fixed = {-3/4, -3/4, 7/16 + 3/8 + 1 + 0.01, 3/4, 3/4, 7/16 + 3/8 + 1 + 0.01}
},
selection_box = {
type = "fixed",
fixed = {-3/4, -3/4, 7/16 + 3/8 + 1 + 0.01, 3/4, 3/4, 7/16 + 3/8 + 1 + 0.01}
}
})

View File

@ -0,0 +1,252 @@
-- Traffic lights for pedestrians
beep_handler = {}
function semaphores_pedestrians(pos, node)
local p = minetest.hash_node_position(pos)
if node.name == "infrastructure:traffic_lights_pedestrians_bottom_1" then
minetest.swap_node(pos, {name = "infrastructure:traffic_lights_pedestrians_bottom_2", param2 = node.param2})
pos.y = pos.y + 1
minetest.swap_node(pos, {name = "infrastructure:traffic_lights_pedestrians_top_2", param2 = node.param2})
elseif node.name == "infrastructure:traffic_lights_pedestrians_bottom_2" then
minetest.swap_node(pos, {name = "infrastructure:traffic_lights_pedestrians_bottom_3", param2 = node.param2})
pos.y = pos.y + 1
minetest.swap_node(pos, {name = "infrastructure:traffic_lights_pedestrians_top_3", param2 = node.param2})
beep_handler[p] = minetest.sound_play("infrastructure_traffic_lights_1", {
loop = true,
pos = pos,
gain = TRAFFIC_LIGHTS_VOLUME,
max_hear_distance = 50
})
elseif node.name == "infrastructure:traffic_lights_pedestrians_bottom_3" then
minetest.swap_node(pos, {name = "infrastructure:traffic_lights_pedestrians_bottom_4", param2 = node.param2})
if beep_handler[p] ~= nil then
minetest.sound_stop(beep_handler[p])
beep_handler[p] = nil
end
pos.y = pos.y + 1
minetest.swap_node(pos, {name = "infrastructure:traffic_lights_pedestrians_top_4", param2 = node.param2})
beep_handler[p] = minetest.sound_play("infrastructure_traffic_lights_2", {
loop = true,
pos = pos,
gain = TRAFFIC_LIGHTS_VOLUME,
max_hear_distance = 50
})
elseif node.name == "infrastructure:traffic_lights_pedestrians_bottom_4" then
minetest.swap_node(pos, {name = "infrastructure:traffic_lights_pedestrians_bottom_1", param2 = node.param2})
pos.y = pos.y + 1
minetest.swap_node(pos, {name = "infrastructure:traffic_lights_pedestrians_top_1", param2 = node.param2})
if beep_handler[p] ~= nil then
minetest.sound_stop(beep_handler[p])
beep_handler[p] = nil
end
end
end
function quiet(pos)
local p = minetest.hash_node_position(pos)
if beep_handler[p] ~= nil then
minetest.sound_stop(beep_handler[p])
beep_handler[p] = nil
end
end
for i = 1, 4 do
minetest.register_node("infrastructure:traffic_lights_pedestrians_top_"..tostring(i), {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_pedestrians_top_back.png",
"infrastructure_traffic_lights_pedestrians_top_front_"..tostring(i)..".png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky=3, not_in_creative_inventory = 1},
light_source = TRAFFIC_LIGHTS_LIGHT_RANGE,
node_box = {
type = "fixed",
fixed = {
{-5/16, -1/2, -1/8, 5/16, 0, 1/8},
{-1/2, -1/2, -1/8, 1/2, 1/2, -1/8},
{-5/16, -1/8, -5/16, 5/16, -1/16, -1/8},
{-5/16, -3/8, -1/4, -1/4, -1/8, -1/8},
{1/4, -3/8, -1/4, 5/16, -1/8, -1/8},
{-1/8, 1/16, -1/8, 1/8, 5/16, 0},
{-1/16, 1/8, 0, 1/16, 1/4, 1/8},
{-1/16, 0, -1/16, 1/16, 1/8, 1/16}
}
},
selection_box = {
type = "fixed",
fixed = {0, 0, 0, 0, 0, 0}
}
})
minetest.register_node("infrastructure:traffic_lights_pedestrians_bottom_"..tostring(i), {
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_pedestrians_bottom_back.png",
"infrastructure_traffic_lights_pedestrians_bottom_front_"..tostring(i)..".png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3, not_in_creative_inventory = 1},
light_source = TRAFFIC_LIGHTS_LIGHT_RANGE,
drop = "infrastructure:traffic_lights_pedestrians_bottom_1",
node_box = {
type = "fixed",
fixed = {
{-5/16, -5/16, -1/8, 5/16, 1/2, 1/8},
{-1/2, -1/2, -1/8, 1/2, 1/2, -1/8},
{-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
{-5/16, 0, -1/4, -1/4, 1/4, -1/8},
{1/4, 0, -1/4, 5/16, 1/4, -1/8},
{-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
{-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
{-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.001}
}
},
selection_box = {
type = "fixed",
fixed = {
-- box
{-5/16, -5/16, -1/8, 5/16, 1, 1/8},
-- top
{-5/16, -1/8 + 1, -5/16, 5/16, -1/16 + 1, -1/8},
{-5/16, -3/8 + 1, -1/4, -1/4, -1/8 + 1, -1/8},
{1/4, -3/8 + 1, -1/4, 5/16, -1/8 + 1, -1/8},
{-1/8, 1/16 + 1, -1/8, 1/8, 5/16 + 1, 0},
{-1/16, 1/8 + 1, 0, 1/16, 1/4 + 1, 1/8},
{-1/16, 0 + 1, -1/16, 1/16, 1/4 + 1, 1/16},
-- bottom
{-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
{-5/16, 0, -1/4, -1/4, 1/4, -1/8},
{1/4, 0, -1/4, 5/16, 1/4, -1/8},
{-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
{-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
{-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.01}
}
},
after_place_node = function(pos)
local node = minetest.env:get_node(pos)
pos.y = pos.y + 1
node.name = "infrastructure:traffic_lights_pedestrians_top_"..tostring(i)
minetest.env:add_node(pos, node)
end,
after_dig_node = function(pos)
local node = minetest.env:get_node(pos)
quiet(pos)
pos.y = pos.y + 1
node.name = "infrastructure:traffic_lights_pedestrians_top_"..tostring(i)
minetest.env:remove_node(pos)
end,
on_punch = function(pos, node)
semaphores_pedestrians(pos, node)
end,
mesecons = {effector = {
action_on = function(pos, node)
semaphores_pedestrians(pos, node)
end
}}
})
end
minetest.register_node("infrastructure:traffic_lights_pedestrians_bottom_1", {
description = "Traffic lights for pedestrians",
inventory_image = "infrastructure_traffic_lights_pedestrians.png",
wield_image = "infrastructure_traffic_lights_pedestrians.png",
tiles = {
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_side.png",
"infrastructure_traffic_lights_pedestrians_bottom_back.png",
"infrastructure_traffic_lights_pedestrians_bottom_front_1.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3, not_in_creative_inventory = 0},
light_source = TRAFFIC_LIGHTS_LIGHT_RANGE,
node_box = {
type = "fixed",
fixed = {
{-5/16, -5/16, -1/8, 5/16, 1/2, 1/8},
{-1/2, -1/2, -1/8, 1/2, 1/2, -1/8},
{-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
{-5/16, 0, -1/4, -1/4, 1/4, -1/8},
{1/4, 0, -1/4, 5/16, 1/4, -1/8},
{-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
{-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
{-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.001}
}
},
selection_box = {
type = "fixed",
fixed = {
-- box
{-5/16, -5/16, -1/8, 5/16, 1, 1/8},
-- top
{-5/16, -1/8 + 1, -5/16, 5/16, -1/16 + 1, -1/8},
{-5/16, -3/8 + 1, -1/4, -1/4, -1/8 + 1, -1/8},
{1/4, -3/8 + 1, -1/4, 5/16, -1/8 + 1, -1/8},
{-1/8, 1/16 + 1, -1/8, 1/8, 5/16 + 1, 0},
{-1/16, 1/8 + 1, 0, 1/16, 1/4 + 1, 1/8},
{-1/16, 0 + 1, -1/16, 1/16, 1/8 + 1, 1/16},
-- bottom
{-5/16, 1/4, -5/16, 5/16, 5/16, -1/8},
{-5/16, 0, -1/4, -1/4, 1/4, -1/8},
{1/4, 0, -1/4, 5/16, 1/4, -1/8},
{-1/16, -1/4, 1/8, 1/16, 1/4, 3/8},
{-1/4, -1/16, 1/8, 1/4, 1/16, 3/8},
{-1/4, -1/4, 3/8, 1/4, 1/4, 1/2 - 0.01}
}
},
after_place_node = function(pos)
local node = minetest.env:get_node(pos)
pos.y = pos.y + 1
node.name = "infrastructure:traffic_lights_pedestrians_top_1"
minetest.env:add_node(pos, node)
end,
after_dig_node = function(pos)
local node = minetest.env:get_node(pos)
quiet(pos)
pos.y = pos.y + 1
node.name = "infrastructure:traffic_lights_pedestrians_top_1"
minetest.env:remove_node(pos)
end,
on_punch = function(pos, node)
semaphores_pedestrians(pos, node)
end,
mesecons = {effector = {
action_on = function(pos, node)
semaphores_pedestrians(pos, node)
end
}}
})
minetest.register_alias("infrastructure:traffic_lights_pedestrians", "infrastructure:traffic_lights_pedestrians_bottom_1")

View File

@ -0,0 +1,97 @@
-- Warning light
minetest.register_abm( {
nodenames = {"infrastructure:warning_light_bright", "infrastructure:warning_light_dark"},
interval = 2,
chance = 1,
action = function(pos, node)
local node = minetest.env:get_node(pos)
if node.name == "infrastructure:warning_light_bright" then
minetest.swap_node(pos, {name = "infrastructure:warning_light_dark", param2 = node.param2})
elseif node.name == "infrastructure:warning_light_dark" then
minetest.swap_node(pos, {name = "infrastructure:warning_light_bright", param2 = node.param2})
end
end
})
minetest.register_node("infrastructure:warning_light_bright", {
description = "Warning light",
tiles = {
"infrastructure_warning_light_top.png",
"infrastructure_warning_light_bottom.png",
"infrastructure_warning_light_right.png",
"infrastructure_warning_light_left.png",
"infrastructure_warning_light_back.png",
"infrastructure_warning_light_front_bright.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
light_source = WARNING_LIGHT_LIGHT_RANGE,
node_box = {
type = "fixed",
fixed = {
{-5/16, -3/8, 0, 5/16, 0, 0},
{-1/4, -5/16, 0, 0, -1/16, 1/8},
{1/16, -1/2, -1/8, 5/16, -1/4, 1/8},
{-1/16, -1/2, -1/16, 1/16, -3/8, 1/16}
}
},
selection_box = {
type = "fixed",
fixed = {
{-5/16, -3/8, 0, 5/16, 0, 0},
{-1/4, -5/16, 0 + 0.01, 0, -1/16, 1/8},
{1/16, -1/2, -1/8, 5/16, -1/4, 1/8},
{-1/16, -1/2, -1/16, 1/16, -3/8, 1/16}
}
}
})
minetest.register_node("infrastructure:warning_light_dark", {
tiles = {
"infrastructure_warning_light_top.png",
"infrastructure_warning_light_bottom.png",
"infrastructure_warning_light_right.png",
"infrastructure_warning_light_left.png",
"infrastructure_warning_light_back.png",
"infrastructure_warning_light_front_dark.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1, not_in_creative_inventory = 1},
drop = "infrastructure:warning_light_bright",
node_box = {
type = "fixed",
fixed = {
{-5/16, -3/8, 0, 5/16, 0, 0},
{-1/4, -5/16, 0, 0, -1/16, 1/8},
{1/16, -1/2, -1/8, 5/16, -1/4, 1/8},
{-1/16, -1/2, -1/16, 1/16, -3/8, 1/16}
}
},
selection_box = {
type = "fixed",
fixed = {
{-5/16, -3/8, 0, 5/16, 0, 0},
{-1/4, -5/16, 0 + 0.01, 0, -1/16, 1/8},
{1/16, -1/2, -1/8, 5/16, -1/4, 1/8},
{-1/16, -1/2, -1/16, 1/16, -3/8, 1/16}
}
}
})
minetest.register_alias("infrastructure:warning_light", "infrastructure:warning_light_bright")

549
infrastructure/crafts.lua Normal file
View File

@ -0,0 +1,549 @@
-- **************************************************************************************************** MATERIALS
-- Galvanized steel
if minetest.get_modpath("technic") then
technic.register_alloy_recipe({input = {"default:steel_ingot 6", "technic:zinc_ingot 1"}, output = "infrastructure:galvanized_steel 6", time = 4})
else
minetest.register_craft({
output = '"infrastructure:galvanized_steel" 6',
recipe = {
{'', 'default:copper_ingot', ''},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}
}
})
end
-- Galvanized steel fence
minetest.register_craft({
output = '"infrastructure:fence_galvanized_steel" 6',
recipe = {
{'infrastructure:galvanized_steel', 'infrastructure:galvanized_steel', 'infrastructure:galvanized_steel'},
{'infrastructure:galvanized_steel', 'infrastructure:galvanized_steel', 'infrastructure:galvanized_steel'}
}
})
-- **************************************************************************************************** CENTER LINES
-- Asphalt block with center dashed line
minetest.register_craft({
output = '"infrastructure:asphalt_center_dashed" 9',
recipe = {
{'infrastructure:asphalt', 'wool:yellow', 'infrastructure:asphalt'},
{'infrastructure:asphalt', 'infrastructure:asphalt', 'infrastructure:asphalt'},
{'infrastructure:asphalt', 'wool:yellow', 'infrastructure:asphalt'}
}
})
-- Asphalt block with center solid line
minetest.register_craft({
output = '"infrastructure:asphalt_center_solid_line" 9',
recipe = {
{'infrastructure:asphalt', 'wool:yellow', 'infrastructure:asphalt'},
{'infrastructure:asphalt', 'wool:yellow', 'infrastructure:asphalt'},
{'infrastructure:asphalt', 'wool:yellow', 'infrastructure:asphalt'}
}
})
-- Asphalt block with center solid line on one side
minetest.register_craft({
output = '"infrastructure:asphalt_center_solid_one_side" 9',
recipe = {
{'wool:yellow', 'infrastructure:asphalt', 'infrastructure:asphalt'},
{'wool:yellow', 'infrastructure:asphalt', 'infrastructure:asphalt'},
{'wool:yellow', 'infrastructure:asphalt', 'infrastructure:asphalt'}
}
})
-- Asphalt block with center solid double line
minetest.register_craft({
output = '"infrastructure:asphalt_center_solid_double" 9',
recipe = {
{'wool:yellow', 'infrastructure:asphalt', 'wool:yellow'},
{'wool:yellow', 'infrastructure:asphalt', 'wool:yellow'},
{'wool:yellow', 'infrastructure:asphalt', 'wool:yellow'}
}
})
-- Asphalt block with center corner single line
minetest.register_craft({
output = '"infrastructure:asphalt_center_corner_single" 9',
recipe = {
{'infrastructure:asphalt', 'infrastructure:asphalt', 'infrastructure:asphalt'},
{'infrastructure:asphalt', 'wool:yellow', 'wool:yellow'},
{'infrastructure:asphalt', 'wool:yellow', 'infrastructure:asphalt'}
}
})
-- Asphalt block with center corner double line
minetest.register_craft({
output = '"infrastructure:asphalt_center_corner_double" 9',
recipe = {
{'wool:yellow', 'wool:yellow', 'wool:yellow'},
{'wool:yellow', 'infrastructure:asphalt', 'infrastructure:asphalt'},
{'wool:yellow', 'infrastructure:asphalt', 'wool:yellow'}
}
})
-- **************************************************************************************************** BORDER LINES
-- Asphalt block with side dashed line
minetest.register_craft({
output = '"infrastructure:asphalt_side_dashed" 9',
recipe = {
{'wool:white', 'infrastructure:asphalt', 'infrastructure:asphalt'},
{'infrastructure:asphalt', 'infrastructure:asphalt', 'infrastructure:asphalt'},
{'wool:white', 'infrastructure:asphalt', 'infrastructure:asphalt'}
}
})
-- Asphalt block with side solid line
minetest.register_craft({
output = '"infrastructure:asphalt_side_solid" 9',
recipe = {
{'wool:white', 'infrastructure:asphalt', 'infrastructure:asphalt'},
{'wool:white', 'infrastructure:asphalt', 'infrastructure:asphalt'},
{'wool:white', 'infrastructure:asphalt', 'infrastructure:asphalt'}
}
})
-- Asphalt block with lines for inner edge
minetest.register_craft({
output = '"infrastructure:asphalt_inner_edge" 9',
recipe = {
{'wool:white', 'wool:white', 'wool:white'},
{'wool:white', 'infrastructure:asphalt', 'infrastructure:asphalt'},
{'wool:white', 'infrastructure:asphalt', 'infrastructure:asphalt'}
}
})
-- Asphalt block with lines for outer edge
minetest.register_craft({
output = '"infrastructure:asphalt_outer_edge" 9',
recipe = {
{'infrastructure:asphalt', 'infrastructure:asphalt', 'infrastructure:asphalt'},
{'infrastructure:asphalt', 'infrastructure:asphalt', 'infrastructure:asphalt'},
{'wool:white', 'infrastructure:asphalt', 'infrastructure:asphalt'}
}
})
-- **************************************************************************************************** PRECAST CONCRETE
-- Concrete seperating wall
minetest.register_craft({
output = '"infrastructure:precast_concrete_seperating_wall" 5',
recipe = {
{'', 'infrastructure:concrete', ''},
{'', 'infrastructure:concrete', ''},
{'infrastructure:concrete', 'infrastructure:concrete', 'infrastructure:concrete'}
}
})
-- Concrete cylinder
minetest.register_craft({
output = '"infrastructure:precast_concrete_cylinder" 8',
recipe = {
{'infrastructure:concrete', 'infrastructure:concrete', 'infrastructure:concrete'},
{'infrastructure:concrete', '', 'infrastructure:concrete'},
{'infrastructure:concrete', 'infrastructure:concrete', 'infrastructure:concrete'}
}
})
-- Concrete grid paver
minetest.register_craft({
output = '"infrastructure:precast_concrete_grid_paver" 5',
recipe = {
{'infrastructure:concrete', '', 'infrastructure:concrete'},
{'', 'infrastructure:concrete', ''},
{'infrastructure:concrete', '', 'infrastructure:concrete'}
}
})
-- **************************************************************************************************** STEEL STRUCTURES
-- Truss
minetest.register_craft({
output = '"infrastructure:truss" 5',
recipe = {
{'infrastructure:galvanized_steel', '', 'infrastructure:galvanized_steel'},
{'', 'infrastructure:galvanized_steel', ''},
{'infrastructure:galvanized_steel', '', 'infrastructure:galvanized_steel'}
}
})
-- Wire netting
minetest.register_craft({
output = '"infrastructure:wire_netting" 10',
recipe = {
{'', 'infrastructure:galvanized_steel', ''},
{'infrastructure:galvanized_steel', '', 'infrastructure:galvanized_steel'},
{'', 'infrastructure:galvanized_steel', ''}
}
})
-- Razor wire
minetest.register_craft({
output = '"infrastructure:razor_wire" 5',
recipe = {
{'infrastructure:galvanized_steel'},
{'default:cactus'},
{'infrastructure:galvanized_steel'}
}
})
-- Drainage channel grating
minetest.register_craft({
output = '"infrastructure:drainage_channel_grating" 2',
recipe = {
{'infrastructure:galvanized_steel', '', 'infrastructure:galvanized_steel'}
}
})
-- Louver
minetest.register_craft({
output = '"infrastructure:drainage_channel_grating" 2',
recipe = {
{'infrastructure:galvanized_steel'},
{''},
{'infrastructure:galvanized_steel'}
}
})
-- Riffled sheet
minetest.register_craft({
output = '"infrastructure:riffled_sheet" 4',
recipe = {
{'infrastructure:galvanized_steel', 'infrastructure:fence_galvanized_steel'},
{'infrastructure:fence_galvanized_steel', 'infrastructure:galvanized_steel'}
}
})
-- Corrugated sheet
minetest.register_craft({
output = '"infrastructure:corrugated_sheet" 4',
recipe = {
{"","infrastructure:galvanized_steel",""},
{"infrastructure:galvanized_steel","","infrastructure:galvanized_steel"}
}
})
-- Louvers
minetest.register_craft({
output = "infrastructure:louver_opened",
recipe = {
{"infrastructure:fence_galvanized_steel","infrastructure:galvanized_steel","infrastructure:fence_galvanized_steel"},
{"","",""},
{"infrastructure:fence_galvanized_steel","infrastructure:galvanized_steel","infrastructure:fence_galvanized_steel"}
}
})
-- **************************************************************************************************** ADVANCED ITEMS
-- Raised pavement marker yellow/yellow
minetest.register_craft({
output = '"infrastructure:marker_yellow_yellow" 1',
recipe = {
{'wool:yellow', 'infrastructure:asphalt', 'wool:yellow'},
{'infrastructure:asphalt', 'infrastructure:asphalt', 'infrastructure:asphalt'}
}
})
-- Raised pavement marker red/yellow
minetest.register_craft({
output = '"infrastructure:marker_red_yellow" 1',
recipe = {
{'wool:yellow', 'infrastructure:asphalt', 'wool:red'},
{'infrastructure:asphalt', 'infrastructure:asphalt', 'infrastructure:asphalt'}
}
})
-- Retroreflective delineators
minetest.register_craft({
output = '"infrastructure:delineator" 1',
recipe = {
{'wool:yellow', 'infrastructure:concrete', 'wool:red'},
{'', 'infrastructure:concrete', ''},
{'', 'infrastructure:concrete', ''}
}
})
minetest.register_craft({
output = '"infrastructure:delineator_guardrail" 1',
recipe = {
{'wool:yellow', 'infrastructure:concrete', 'wool:red'},
{'', 'infrastructure:concrete', ''}
}
})
-- Wire rope safety barrier
minetest.register_craft({
output = '"infrastructure:wire_rope_safety_barrier" 1',
recipe = {
{'default:steel_ingot', '', 'default:steel_ingot'},
{'', 'default:steel_ingot', ''},
{'', 'default:steel_ingot', ''}
}
})
-- Cable barrier terminal
minetest.register_craft({
output = '"infrastructure:cable_barrier_terminal" 1',
recipe = {
{'default:steel_ingot', '', ''},
{'', 'default:steel_ingot', ''},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}
}
})
-- Corrugated guide rail
minetest.register_craft({
output = '"infrastructure:corrugated_guide_rail" 1',
recipe = {
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'', 'default:steel_ingot', ''},
{'', 'default:steel_ingot', ''}
}
})
-- Energy absorbing terminal
minetest.register_craft({
output = '"infrastructure:energy_absorbing_terminal" 1',
recipe = {
{'', 'default:steel_ingot', ''},
{'default:steel_ingot', 'default:steel_ingot', ''},
{'', 'default:steel_ingot', ''}
}
})
minetest.register_craft({
output = '"infrastructure:energy_absorbing_terminal" 1',
recipe = {
{'infrastructure:energy_absorbing_terminal_inversed'}
}
})
minetest.register_craft({
output = '"infrastructure:energy_absorbing_terminal_inversed" 1',
recipe = {
{'infrastructure:energy_absorbing_terminal'}
}
})
-- Fitch barrel
minetest.register_craft({
output = '"infrastructure:fitch_barrel" 1',
recipe = {
{'wool:black', 'wool:black', 'wool:black'},
{'wool:yellow', 'default:sand', 'wool:yellow'},
{'wool:yellow', 'wool:yellow', 'wool:yellow'}
}
})
-- Crowd control barricade
minetest.register_craft({
output = '"infrastructure:crowd_control_barricade" 1',
recipe = {
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:steel_ingot', '', 'default:steel_ingot'}
}
})
if ENABLE_EMERGENCY_PHONE then
-- Emergency phone
minetest.register_craft({
output = '"infrastructure:emergency_phone" 1',
recipe = {
{'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'},
{'default:mese_crystal', 'default:apple', 'default:mese_crystal'},
{'default:mese_crystal', 'default:stick', 'default:mese_crystal'}
}
})
minetest.register_craft({
output = '"infrastructure:emergency_phone" 1',
recipe = {
{'default:mese', 'default:mese', 'default:mese'},
{'default:mese', 'default:apple', 'default:mese'},
{'default:mese', 'default:stick', 'default:mese'}
}
})
end
-- Manhole cover
minetest.register_craft({
output = '"infrastructure:manhole_cover_closed" 1',
recipe = {
{'infrastructure:concrete', 'infrastructure:concrete', 'infrastructure:concrete'},
{'infrastructure:concrete', 'default:steel_ingot', 'infrastructure:concrete'},
{'infrastructure:concrete', 'infrastructure:concrete', 'infrastructure:concrete'}
}
})
-- Traffic lights for pedestrians
minetest.register_craft({
output = '"infrastructure:traffic_lights_pedestrians" 1',
recipe = {
{'', 'default:steel_ingot', ''},
{'default:steel_ingot', 'wool:red', 'default:steel_ingot'},
{'default:steel_ingot', 'wool:green', 'default:steel_ingot'}
}
})
-- Crosswalk warning light
minetest.register_craft({
output = '"infrastructure:crosswalk_warning_light" 1',
recipe = {
{'', 'default:steel_ingot', ''},
{'default:steel_ingot', 'wool:yellow', 'default:steel_ingot'},
{'', 'wool:green', ''}
}
})
-- Curve chevron
minetest.register_craft({
output = '"infrastructure:curve_chevron" 1',
recipe = {
{'wool:yellow', 'wool:black', 'wool:yellow'},
{'wool:black', 'wool:yellow', 'wool:yellow'},
{'wool:yellow', 'wool:black', 'wool:yellow'}
}
})
-- Crosswalk lighting
minetest.register_craft({
output = '"infrastructure:crosswalk_lighting" 1',
recipe = {
{'wool:white', 'wool:white', 'wool:white'},
{'', 'mesecons_torch:mesecon_torch_on', ''},
{'wool:white', 'wool:white', 'wool:white'}
}
})
-- Crosswalk safety sign
minetest.register_craft({
output = '"infrastructure:crosswalk_safety_sign" 1',
recipe = {
{'', 'wool:green', ''},
{'', 'wool:green', ''},
{'infrastructure:concrete', 'infrastructure:concrete', 'infrastructure:concrete'}
}
})
-- Road sign crosswalk
minetest.register_craft({
output = '"infrastructure:road_sign_crosswalk" 1',
recipe = {
{'wool:green', 'wool:green', 'wool:green'},
{'wool:green', 'wool:blue', 'wool:green'},
{'wool:green', 'wool:green', 'wool:green'}
}
})
-- Road sign right_of_way
minetest.register_craft({
output = '"infrastructure:road_sign_right_of_way" 1',
recipe = {
{"", 'wool:white', ""},
{'wool:white', 'wool:yellow', 'wool:white'},
{"", 'wool:white', ""}
}
})
-- Road sign stop
minetest.register_craft({
output = '"infrastructure:road_sign_stop" 1',
recipe = {
{'wool:red', 'wool:red', 'wool:red'},
{'wool:red', 'wool:white', 'wool:red'},
{'wool:red', 'wool:red', 'wool:red'}
}
})
-- Road sign yield
minetest.register_craft({
output = '"infrastructure:road_sign_yield" 1',
recipe = {
{'wool:orange', 'wool:orange', 'wool:orange'},
{'wool:red', 'wool:orange', 'wool:red'},
{'', 'wool:red', ''}
}
})
-- Automatic warning device
minetest.register_craft({
output = '"infrastructure:automatic_warning_device" 1',
recipe = {
{'wool:red', 'default:steel_ingot', 'wool:red'},
{'', 'default:steel_ingot', ''},
{'infrastructure:concrete', 'infrastructure:concrete', 'infrastructure:concrete'}
}
})
-- Boom barrier
minetest.register_craft({
output = '"infrastructure:boom_barrier_mechanism" 1',
recipe = {
{'default:steel_ingot', 'default:steel_ingot', ''},
{'', 'default:steel_ingot', ''},
{'infrastructure:concrete', 'infrastructure:concrete', 'infrastructure:concrete'}
}
})
minetest.register_craft({
output = '"infrastructure:boom_barrier_arm" 1',
recipe = {
{'', 'wool:red', ''},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}
}
})
-- Aircraft warning light
minetest.register_craft({
output = '"infrastructure:aircraft_warning_light" 1',
recipe = {
{'', 'wool:red', ''},
{'wool:red', 'default:torch', 'wool:red'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}
}
})
-- Warning light
minetest.register_craft({
output = '"infrastructure:warning_light" 1',
recipe = {
{'wool:yellow', 'wool:yellow', ''},
{'wool:yellow', 'default:torch', ''},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}
}
})
-- Anti-dazzling panel
minetest.register_craft({
output = '"infrastructure:anti_dazzling_panel" 1',
recipe = {
{'wool:grey', 'wool:grey'},
{'wool:grey', 'wool:yellow'},
{'wool:grey', 'wool:grey'}
}
})
-- Traffic cone
minetest.register_craft({
output = '"infrastructure:traffic_cone" 1',
recipe = {
{'', 'wool:orange', ''},
{'wool:orange', '', 'wool:orange'},
}
})
-- Noise barrier
minetest.register_craft({
output = '"infrastructure:noise_barrier" 1',
recipe = {
{'default:steel_ingot', 'wool:green', 'default:steel_ingot'},
{'wool:green', 'default:steel_ingot', 'wool:green'},
{'default:steel_ingot', 'wool:green', 'default:steel_ingot'}
}
})

View File

@ -0,0 +1,8 @@
default
moreblocks
mesecons
wool
streetsmod
prefab
digilines
technic?

24
infrastructure/init.lua Normal file
View File

@ -0,0 +1,24 @@
-- Load settings
dofile(minetest.get_modpath("infrastructure").."/settings.lua")
-- Register nodes
dofile(minetest.get_modpath("infrastructure").."/nodes.lua")
-- Register special nodes
dofile(minetest.get_modpath("infrastructure").."/nodes_extension.lua")
-- Register advanced devices
dofile(minetest.get_modpath("infrastructure").."/advanced_road_signs.lua")
dofile(minetest.get_modpath("infrastructure").."/advanced_emergency_phone.lua")
dofile(minetest.get_modpath("infrastructure").."/advanced_traffic_lights_pedestrians.lua")
dofile(minetest.get_modpath("infrastructure").."/advanced_crosswalk_warning_light.lua")
dofile(minetest.get_modpath("infrastructure").."/advanced_lane_control_lights.lua")
dofile(minetest.get_modpath("infrastructure").."/advanced_curve_chevron.lua")
dofile(minetest.get_modpath("infrastructure").."/advanced_crosswalk_lighting.lua")
dofile(minetest.get_modpath("infrastructure").."/advanced_crosswalk_safety_sign.lua")
dofile(minetest.get_modpath("infrastructure").."/advanced_automatic_warning_device.lua")
dofile(minetest.get_modpath("infrastructure").."/advanced_boom_barrier.lua")
dofile(minetest.get_modpath("infrastructure").."/advanced_aircraft_warning_light.lua")
dofile(minetest.get_modpath("infrastructure").."/advanced_warning_light.lua")
-- Register crafting recipes
dofile(minetest.get_modpath("infrastructure").."/crafts.lua")
print("Infrastructure mod loaded succesfully!")

1579
infrastructure/nodes.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,162 @@
-- **************************************************************************************************** MATERIALS
-- Galvanized steel stair, slab, panel and microblock
register_stair_slab_panel_micro("infrastructure", "galvanized_steel", "infrastructure:galvanized_steel",
{not_in_creative_inventory=NOT_IN_CREATIVE_INVENTORY, cracky=2},
{"infrastructure_galvanized_steel.png"},
"Galvanized steel",
"galvanized_steel",
0)
-- **************************************************************************************************** CENTER LINES
-- Asphalt stair, slab, panel and microblock with center solid line
register_stair_slab_panel_micro("infrastructure", "asphalt_center_solid_line", "infrastructure:asphalt_center_solid_line",
{not_in_creative_inventory=NOT_IN_CREATIVE_INVENTORY, cracky=1},
{
"streets_asphalt.png^infrastructure_single_yellow_line.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png"
},
"Asphalt with center solid line",
"asphalt_center_solid_line",
0)
-- Asphalt stair, slab, panel and microblock with center solid line on one side
register_stair_slab_panel_micro("infrastructure", "asphalt_center_solid_one_side", "infrastructure:asphalt_center_solid_one_side",
{not_in_creative_inventory=NOT_IN_CREATIVE_INVENTORY, cracky=1},
{
"streets_asphalt.png^infrastructure_solid_yellow_line_one_side.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png"
},
"Asphalt with center solid line on one side",
"asphalt_center_solid_one_side",
0)
-- Asphalt stair, slab, panel and microblock with center solid double line
register_stair_slab_panel_micro("infrastructure", "asphalt_center_solid_double", "infrastructure:asphalt_center_solid_double",
{not_in_creative_inventory=NOT_IN_CREATIVE_INVENTORY, cracky=1},
{
"streets_asphalt.png^infrastructure_double_yellow_line.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png"
},
"Asphalt with center solid double line",
"asphalt_center_solid_double",
0)
-- Asphalt block with center corner single line
register_stair_slab_panel_micro("infrastructure", "asphalt_center_corner_single", "infrastructure:asphalt_center_corner_single",
{not_in_creative_inventory=NOT_IN_CREATIVE_INVENTORY, cracky=1},
{
"streets_asphalt.png^infrastructure_single_yellow_line_corner.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png"
},
"Asphalt with center corner single line",
"asphalt_center_corner_single",
0)
-- Asphalt block with center corner double line
register_stair_slab_panel_micro("infrastructure", "asphalt_center_corner_double", "infrastructure:asphalt_center_corner_double",
{not_in_creative_inventory=NOT_IN_CREATIVE_INVENTORY, cracky=1},
{
"streets_asphalt.png^infrastructure_solid_double_yellow_line_corner.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png",
"streets_asphalt.png"
},
"Asphalt with center corner double line",
"asphalt_center_corner_double",
0)
-- **************************************************************************************************** TRAFFIC MARKS
-- Asphalt stair, slab, panel and microblock with arrow straight
register_stair_slab_panel_micro("infrastructure", "asphalt_arrow_straight", "infrastructure:asphalt_arrow_straight",
{not_in_creative_inventory=NOT_IN_CREATIVE_INVENTORY, cracky=1},
{"streets_arrow_straight.png", "infrastructure_asphalt.png"},
"Asphalt with arrow straight",
"asphalt_arrow_straight",
0)
-- Asphalt stair, slab, panel and microblock with arrow straight + left
register_stair_slab_panel_micro("infrastructure", "asphalt_arrow_straight_left", "infrastructure:asphalt_arrow_straight_left",
{not_in_creative_inventory=NOT_IN_CREATIVE_INVENTORY, cracky=1},
{"streets_asphalt.png^streets_arrow_straight_left.png", "infrastructure_asphalt.png"},
"Asphalt with arrow straight + left",
"asphalt_arrow_straight_left",
0)
-- Asphalt stair, slab, panel and microblock with arrow straight + right
register_stair_slab_panel_micro("infrastructure", "asphalt_arrow_straight_right", "infrastructure:asphalt_arrow_straight_right",
{not_in_creative_inventory=NOT_IN_CREATIVE_INVENTORY, cracky=1},
{"streets_asphalt.png^streets_arrow_straight_right.png", "infrastructure_asphalt.png"},
"Asphalt with arrow straight + right",
"asphalt_arrow_straight_right",
0)
-- Asphalt stair, slab, panel and microblock with arrow left
register_stair_slab_panel_micro("infrastructure", "asphalt_arrow_left", "infrastructure:asphalt_arrow_left",
{not_in_creative_inventory=NOT_IN_CREATIVE_INVENTORY, cracky=1},
{"streets_asphalt.png^streets_arrow_left.png", "infrastructure_asphalt.png"},
"Asphalt with arrow left",
"asphalt_arrow_left",
0)
-- Asphalt stair, slab, panel and microblock with arrow right
register_stair_slab_panel_micro("infrastructure", "asphalt_arrow_right", "infrastructure:asphalt_arrow_right",
{not_in_creative_inventory=NOT_IN_CREATIVE_INVENTORY, cracky=1},
{"streets_asphalt.png^streets_arrow_right.png", "infrastructure_asphalt.png"},
"Asphalt with arrow right",
"asphalt_arrow_right",
0)
-- Asphalt stair, slab, panel and microblock with "P"-sign
register_stair_slab_panel_micro("infrastructure", "asphalt_parking", "infrastructure:asphalt_parking",
{not_in_creative_inventory=NOT_IN_CREATIVE_INVENTORY, cracky=1},
{"streets_asphalt.png^streets_parking.png", "infrastructure_asphalt.png"},
"Asphalt with a parking sign",
"asphalt_parking",
0)
-- Register known infrastructure nodes in circular saw if avaiable
if circular_saw then
for i,v in ipairs({
-- Materials
"asphalt",
"concrete",
"galvanized_steel",
-- Center lines
"asphalt_center_dashed",
"asphalt_center_solid",
"asphalt_center_solid_one_side",
"asphalt_center_solid_double",
"asphalt_center_corner_single",
"asphalt_center_corner_double",
-- Traffic marks
"asphalt_arrow_straight",
"asphalt_arrow_straight_left",
"asphalt_arrow_straight_right",
"asphalt_arrow_left",
"asphalt_arrow_right",
"asphalt_parking"
}) do
table.insert(circular_saw.known_stairs, "infrastructure:"..v);
end
end

View File

@ -0,0 +1,49 @@
-- This file stores all settings for the "Infrastructure mod"
-- Stairs, slabs, panels and microblocks
NOT_IN_CREATIVE_INVENTORY = 1 -- an integer 0 or 1 -> default = 1 | Do you want it to be hide in your creative inventory?
-- Raised pavement marker
MARKER_LIGHT_RANGE = 4 -- an integer -> default = 4 | How much light do you want it to give?
-- Retroreflective delineator
DELINEATOR_LIGHT_RANGE = 8 -- an integer -> default = 8 | How much light do you want it to give?
-- Energy absorbing terminal
ENERGY_ABSORBING_TERMINAL_LIGHT_RANGE = 8 -- an integer -> default = 8 | How much light do you want it to give?
-- Emergency phone
ENABLE_EMERGENCY_PHONE = true -- true or false -> default = true | Do you want it to be enabled in your game?
HEALTH_TO_TRIGGER = 5 -- an integer -> default = 5 | When will the player be healed? How low must his health be?
HEALTH_TO_RESTORING = 10 -- an integer -> default = 10 | To what will the health be set?
EMERGENCY_PHONE_LIGHT_RANGE = 12 -- an integer -> default = 12 | How much light do you want it to give?
EMERGENCY_PHONE_VOLUME = 0.1 -- a float -> default = 0.1 | How noisy should be the dialing sound?
-- Traffic lights
TRAFFIC_LIGHTS_LIGHT_RANGE = 12 -- an integer -> default = 12 | How much light do you want it to give?
TRAFFIC_LIGHTS_VOLUME = 0 -- a float -> default = 0.1 | How noisy should be the beep sound?
-- Automatic warning device
AUTOMATIC_WARNING_DEVICE_LIGHT_RANGE = 12 -- an integer -> default = 12 | How much light do you want it to give?
AUTOMATIC_WARNING_DEVICE_VOLUME = 0.5 -- a float -> default = 0.5 | How noisy should be the bell sound?
-- Boom barrier
BOOM_BARRIER_LIGHT_RANGE = 6 -- an integer -> default = 6 | How much light do you want it to give?
BOOM_BARRIER_VOLUME = 0.4 -- a float -> default = 0.1 | How noisy should be the mechanism sound?
-- Curve chevron
CURVE_CHEVRON_LIGHT_RANGE = 12 -- an integer -> default = 12 | How much light do you want it to give?
-- Crosswalk lighting
CROSSWALK_LIGHTING_LIGHT_RANGE = 15 -- an integer -> default = 15 | How much light do you want it to give?
-- Crosswalk safety sign
CROSSWALK_SAFETY_SIGN_LIGHT_RANGE = 8 -- an integer -> default = 8 | How much light do you want it to give?
-- Crosswalk safety sign
RETROREFLECTIVE_SURFACE_LIGHT_RANGE = 8 -- an integer -> default = 8 | How much light do you want it to give?
-- Aircraft warning light
AIRCRAFT_WARNING_LIGHT_LIGHT_RANGE = 15 -- an integer -> default = 15 | How much light do you want it to give?
-- Warning light
WARNING_LIGHT_LIGHT_RANGE = 15 -- an integer -> default = 15 | How much light do you want it to give?

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1019 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1021 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

Some files were not shown because too many files have changed in this diff Show More