Add a traffic barrier and a blinking light. (#68)

* Add a traffic barrier.
Requires #67 for crafting recipe.
Closes #61

* Add a blinking light.
fork-master
Thomas--S 2016-05-30 22:11:39 +02:00 committed by cheapie
parent 2f8bf5644c
commit 8b79e4a713
6 changed files with 104 additions and 0 deletions

View File

@ -40,6 +40,7 @@ streets.load_submod("streets_rrxing")
streets.load_submod("streets_signs")
streets.load_submod("streets_signworkshop")
streets.load_submod("streets_steelsupport")
streets.load_submod("streets_roadwork")
if minetest.get_modpath("digilines") then
streets.load_submod("streets_trafficlight")

103
streets_roadwork/init.lua Normal file
View File

@ -0,0 +1,103 @@
--[[
## StreetsMod 2.0 ##
Submod: roadwork
Optional: true
]]
minetest.register_node("streets:roadwork_traffic_barrier", {
description = "Traffic Barrier",
paramtype = "light",
drawtype = "nodebox",
tiles = {"streets_concrete.png", "streets_concrete.png", "streets_concrete.png^streets_roadwork_traffic_barrier.png"},
sunlight_propagates = true,
groups = {cracky = 1, level = 2, wall = 1},
node_box = {
type = "connected",
fixed = {{-0.3, -0.5, -0.3, 0.3, -0.4, 0.3}, {-0.1, -0.5, -0.1, 0.1, 0.5, 0.1}},
connect_front = {{-0.3, -0.5, -0.5, 0.3, -0.4, 0.3}, {-0.1, -0.5, -0.5, 0.1, 0.5, 0.1}}, -- z-
connect_back = {{-0.3, -0.5, -0.3, 0.3, -0.4, 0.5}, {-0.1, -0.5, -0.1, 0.1, 0.5, 0.5}}, -- z+
connect_left = {{-0.5, -0.5, -0.3, 0.3, -0.4, 0.3}, {-0.5, -0.5, -0.1, 0.1, 0.5, 0.1}}, -- x-
connect_right = {{-0.3, -0.5, -0.3, 0.5, -0.4, 0.3}, {-0.1, -0.5, -0.1, 0.5, 0.5, 0.1}}, -- x+
},
connects_to = {"group:wall", "group:stone", "group:wood", "group:tree", "group:sign", "group:concrete"},
sound = default.node_sound_stone_defaults()
})
minetest.register_craft({
output = "streets:roadwork_traffic_barrier 3",
recipe = {
{"dye:red", "dye:white", "dye:red"},
{"streets:concrete_wall", "streets:concrete_wall", "streets:concrete_wall"},
}
})
minetest.register_node("streets:roadwork_blinking_light_off", {
description = "Blinking Light",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
tiles = {"streets_roadwork_blinking_light_top.png", "streets_roadwork_blinking_light_top.png", "streets_roadwork_blinking_light_off.png"},
sunlight_propagates = true,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5, -0.125, 0.1875, -0.3125, 0.125}, -- Base
{-0.1875, -0.3125, 0, 0.1875, 0.0625, 0}, -- Light
}
},
on_timer = function(pos, elapsed)
minetest.set_node(pos, {name = "streets:roadwork_blinking_light_on", param2 = minetest.get_node(pos).param2 })
end,
on_construct = function(pos)
timer = minetest.get_node_timer(pos)
timer:start(1)
end,
})
minetest.register_node("streets:roadwork_blinking_light_on", {
description = "Blinking Light",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
tiles = {"streets_roadwork_blinking_light_top.png", "streets_roadwork_blinking_light_top.png", "streets_roadwork_blinking_light_on.png"},
sunlight_propagates = true,
groups = {cracky = 1, not_in_creative_inventory = 1},
node_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5, -0.125, 0.1875, -0.3125, 0.125}, -- Base
{-0.1875, -0.3125, 0, 0.1875, 0.0625, 0}, -- Light
}
},
light_source = 12,
on_timer = function(pos, elapsed)
minetest.set_node(pos, {name = "streets:roadwork_blinking_light_off", param2 = minetest.get_node(pos).param2 })
end,
on_construct = function(pos)
timer = minetest.get_node_timer(pos)
timer:start(1)
end,
drop = "streets:roadwork_blinking_light_off",
})
minetest.register_craft({
output = "streets:roadwork_blinking_light_off 2",
recipe = {
{"dye:red", "default:torch", "dye:red"},
{"dye:yellow", "default:steel_ingot", "dye:yellow"},
}
})
minetest.register_abm({
nodenames = {"streets:roadwork_blinking_light_on", "streets:roadwork_blinking_light_off"},
interval = 10,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
timer = minetest.get_node_timer(pos)
if not timer:is_started() then
timer:start(1)
end
end,
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B