summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asphaltstairs/init.lua2
-rw-r--r--streetsmod/init.lua2
-rw-r--r--trafficlight/init.lua95
-rw-r--r--trafficlight/textures/streets_lampcontroller_bottom.pngbin0 -> 532 bytes
-rw-r--r--trafficlight/textures/streets_lampcontroller_sides.pngbin0 -> 651 bytes
-rw-r--r--trafficlight/textures/streets_lampcontroller_top.pngbin0 -> 583 bytes
6 files changed, 53 insertions, 46 deletions
diff --git a/asphaltstairs/init.lua b/asphaltstairs/init.lua
index e8e9343..7c1c181 100644
--- a/asphaltstairs/init.lua
+++ b/asphaltstairs/init.lua
@@ -1,7 +1,7 @@
--[[
StreetsMod: Asphalt stairs
]]
-if streets.extendedBy.moreblocks then
+if streets.extendedBy.moreblocks == true then
-- Asphalt
register_stair_slab_panel_micro("streets", "asphalt", "streets:asphalt", {cracky=3}, {"streets_asphalt.png"}, "Asphalt", "asphalt", nil)
minetest.register_alias("streets:asphalt_stair","stairs:stair_asphalt")
diff --git a/streetsmod/init.lua b/streetsmod/init.lua
index 63b7155..ed044bd 100644
--- a/streetsmod/init.lua
+++ b/streetsmod/init.lua
@@ -28,7 +28,7 @@
print("'Technic' not installed \n\t => StreetsMod will register its own concrete block")
streets.extendedBy.technic = false
end
- if minetest.get_modpath("stairs") then
+ if minetest.get_modpath("moreblocks") then
print("'Moreblocks' is installed \n\t => There will be stairs and slabs'")
streets.extendedBy.moreblocks = true
else
diff --git a/trafficlight/init.lua b/trafficlight/init.lua
index 4f3f201..768c26a 100644
--- a/trafficlight/init.lua
+++ b/trafficlight/init.lua
@@ -3,8 +3,8 @@
]]
if streets.extendedBy.mesecons and streets.extendedBy.digilines then
minetest.register_node(":streets:trafficlight_bottom",{
- description = "Trafficlight",
- groups = {cracky = 1},
+ description = "Cheater",
+ groups = {not_in_creative_inventory = 1},
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
@@ -20,34 +20,57 @@ minetest.register_node(":streets:trafficlight_bottom",{
selection_box = {
type = "fixed",
fixed = {
- {-0.25,-0.5,-0.25,0.25,2.5,0.25}
+ {-0.25,-0.5,-0.25,0.25,2.5,0.25},
+ }
+ }
+})
+
+minetest.register_node(":streets:trafficlight_middle",{
+ description = "Cheater!",
+ groups = {cracky = 1, not_in_creative_inventory = 1},
+ paramtype = "light",
+ drawtype = "nodebox",
+ sunlight_propagates = true,
+ tiles = {"streets_pole.png"},
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.1,-0.5,-0.1,0.1,0.5,0.1},
}
},
- after_place_node = function(pos,placer,itemstack)
- local facedir = minetest.get_node(pos).param2
- if minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name == "air" and minetest.get_node({x = pos.x, y = pos.y + 2, z = pos.z}).name == "air" then
- pos.y = pos.y + 1
- minetest.set_node(pos,{name="streets:trafficlight_middle"})
- pos.y = pos.y + 1
- minetest.set_node(pos,{name="streets:trafficlight_top_off",param2=facedir})
- else
- minetest.chat_send_player(placer:get_player_name(),"Not enough vertical space! The traffic light has a height of 3 blocks.")
- minetest.remove_node(pos)
- end
- --
- pos.y = pos.y - 2
- local meta = minetest.get_meta(pos)
- meta:set_string("formspec", "field[channel;Channel;${channel}]")
- meta:set_string("infotext", "Off")
+ pointable = false,
+})
+
+minetest.register_node(":streets:trafficlight_controller",{
+ description = "Trafficlight",
+ tiles = {"streets_lampcontroller_top.png","streets_lampcontroller_bottom.png","streets_lampcontroller_sides.png"},
+ groups = {cracky = 1},
+ drawtype = "nodebox",
+ paramtype = "light",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5,-0.5,-0.5,0.5,0.5,0.5},
+ {-0.05,0.5,-0.05,0.05,1.6,0.05}
+ }
+ },
+ on_receive_fields = function(pos, formname, fields, sender)
+ minetest.get_meta(pos):set_string("channel", fields.channel)
end,
- after_dig_node = function(pos, oldnode, oldmetadata, digger)
- pos.y = pos.y + 1
- minetest.remove_node(pos)
- pos.y = pos.y + 1
- minetest.remove_node(pos)
+ after_place_node = function(pos,placer,itemstack)
+ minetest.set_node({x = pos.x, y = pos.y - 2, z = pos.z},{name = "streets:trafficlight_controller"})
+ minetest.set_node({x = pos.x, y = pos.y + 0, z = pos.z},{name = "streets:trafficlight_bottom"})
+ minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},{name = "streets:trafficlight_middle"})
+ minetest.set_node({x = pos.x, y = pos.y + 2, z = pos.z},{name = "streets:trafficlight_top_off",param2 = minetest.dir_to_facedir(placer:get_look_dir())})
+ local meta = minetest.get_meta({x = pos.x, y = pos.y - 2, z = pos.z})
+ meta:set_string("channel","")
+ meta:set_string("infotext","Off")
+ meta:set_string("formspec","field[channel;Channel;${channel}]")
end,
- on_receive_fields = function(pos, formname, fields, sender)
- minetest.env:get_meta(pos):set_string("channel", fields.channel)
+ after_dig_node = function(pos)
+ minetest.remove_node({x = pos.x, y = pos.y + 2, z = pos.z})
+ minetest.remove_node({x = pos.x, y = pos.y + 3, z = pos.z})
+ minetest.remove_node({x = pos.x, y = pos.y + 4, z = pos.z})
end,
digiline = {
receptor = {},
@@ -60,9 +83,9 @@ minetest.register_node(":streets:trafficlight_bottom",{
local state = meta:get_string("infotext")
if msg == "green" or msg == "red" or msg == "warn" or msg == "off" then
meta:set_string("infotext",msg)
- local facedir = minetest.get_node(pos).param2
+ local facedir = minetest.get_node({x = pos.x, y = pos.y + 4, z = pos.z}).param2
-- Modify <pos> to the top node of the trafficlight
- pos.y = pos.y + 2
+ pos.y = pos.y + 4
--
if msg == "red" and state ~= "red" then
minetest.set_node(pos,{name = "streets:trafficlight_top_yellow",param2=facedir})
@@ -92,22 +115,6 @@ minetest.register_node(":streets:trafficlight_bottom",{
}
})
-minetest.register_node(":streets:trafficlight_middle",{
- description = "U cheater U",
- groups = {cracky = 1, not_in_creative_inventory = 1},
- paramtype = "light",
- drawtype = "nodebox",
- sunlight_propagates = true,
- tiles = {"streets_pole.png"},
- node_box = {
- type = "fixed",
- fixed = {
- {-0.1,-0.5,-0.1,0.1,0.5,0.1},
- }
- },
- pointable = false,
-})
-
minetest.register_node(":streets:trafficlight_top_off",{
description = "U cheater U",
groups = {cracky = 1, not_in_creative_inventory = 1},
diff --git a/trafficlight/textures/streets_lampcontroller_bottom.png b/trafficlight/textures/streets_lampcontroller_bottom.png
new file mode 100644
index 0000000..cdd5b40
--- /dev/null
+++ b/trafficlight/textures/streets_lampcontroller_bottom.png
Binary files differ
diff --git a/trafficlight/textures/streets_lampcontroller_sides.png b/trafficlight/textures/streets_lampcontroller_sides.png
new file mode 100644
index 0000000..39e9960
--- /dev/null
+++ b/trafficlight/textures/streets_lampcontroller_sides.png
Binary files differ
diff --git a/trafficlight/textures/streets_lampcontroller_top.png b/trafficlight/textures/streets_lampcontroller_top.png
new file mode 100644
index 0000000..cee87b3
--- /dev/null
+++ b/trafficlight/textures/streets_lampcontroller_top.png
Binary files differ