aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2016-09-13 18:05:59 +0200
committerorwell96 <mono96.mml@gmail.com>2016-09-13 18:05:59 +0200
commitc4a26de487091b95a891d739a89656cacba109d4 (patch)
treef3c567fc0beb51aec7a003a9f4077a782f3bd9bf
parenta93fb4345e084a0fc67656b85084d9841a3c5ec9 (diff)
downloadadvtrains-c4a26de487091b95a891d739a89656cacba109d4.tar.gz
advtrains-c4a26de487091b95a891d739a89656cacba109d4.tar.bz2
advtrains-c4a26de487091b95a891d739a89656cacba109d4.zip
various improvements on signals and bumpers
-rw-r--r--models/advtrains_retrosignal_off_30.b3dbin0 -> 13093 bytes
-rw-r--r--models/advtrains_retrosignal_off_45.b3dbin0 -> 13093 bytes
-rw-r--r--models/advtrains_retrosignal_off_60.b3dbin0 -> 13093 bytes
-rw-r--r--models/advtrains_retrosignal_on_30.b3dbin0 -> 13093 bytes
-rw-r--r--models/advtrains_retrosignal_on_45.b3dbin0 -> 13093 bytes
-rw-r--r--models/advtrains_retrosignal_on_60.b3dbin0 -> 13093 bytes
-rw-r--r--models/advtrains_signal_30.b3dbin0 -> 61544 bytes
-rw-r--r--models/advtrains_signal_45.b3dbin0 -> 61544 bytes
-rw-r--r--models/advtrains_signal_60.b3dbin0 -> 61544 bytes
-rw-r--r--models/blender/mbb/signal.blendbin570336 -> 570336 bytes
-rw-r--r--models/blender/mbb/signal.blend1bin572304 -> 570336 bytes
-rw-r--r--models/blender/mbb/signal.xcfbin841524 -> 881142 bytes
-rw-r--r--signals.lua128
-rw-r--r--textures/advtrains_retrosignal_inv.pngbin0 -> 2242 bytes
-rw-r--r--textures/advtrains_signal_inv.pngbin0 -> 856 bytes
-rw-r--r--textures/advtrains_signal_off.pngbin139883 -> 5882 bytes
-rw-r--r--textures/advtrains_signal_on.pngbin139426 -> 5884 bytes
-rw-r--r--trackplacer.lua8
-rw-r--r--tracks.lua7
19 files changed, 83 insertions, 60 deletions
diff --git a/models/advtrains_retrosignal_off_30.b3d b/models/advtrains_retrosignal_off_30.b3d
new file mode 100644
index 0000000..da258e1
--- /dev/null
+++ b/models/advtrains_retrosignal_off_30.b3d
Binary files differ
diff --git a/models/advtrains_retrosignal_off_45.b3d b/models/advtrains_retrosignal_off_45.b3d
new file mode 100644
index 0000000..338224a
--- /dev/null
+++ b/models/advtrains_retrosignal_off_45.b3d
Binary files differ
diff --git a/models/advtrains_retrosignal_off_60.b3d b/models/advtrains_retrosignal_off_60.b3d
new file mode 100644
index 0000000..c560ca1
--- /dev/null
+++ b/models/advtrains_retrosignal_off_60.b3d
Binary files differ
diff --git a/models/advtrains_retrosignal_on_30.b3d b/models/advtrains_retrosignal_on_30.b3d
new file mode 100644
index 0000000..98f8a92
--- /dev/null
+++ b/models/advtrains_retrosignal_on_30.b3d
Binary files differ
diff --git a/models/advtrains_retrosignal_on_45.b3d b/models/advtrains_retrosignal_on_45.b3d
new file mode 100644
index 0000000..414e121
--- /dev/null
+++ b/models/advtrains_retrosignal_on_45.b3d
Binary files differ
diff --git a/models/advtrains_retrosignal_on_60.b3d b/models/advtrains_retrosignal_on_60.b3d
new file mode 100644
index 0000000..a51529a
--- /dev/null
+++ b/models/advtrains_retrosignal_on_60.b3d
Binary files differ
diff --git a/models/advtrains_signal_30.b3d b/models/advtrains_signal_30.b3d
new file mode 100644
index 0000000..0b949a7
--- /dev/null
+++ b/models/advtrains_signal_30.b3d
Binary files differ
diff --git a/models/advtrains_signal_45.b3d b/models/advtrains_signal_45.b3d
new file mode 100644
index 0000000..ccaebf4
--- /dev/null
+++ b/models/advtrains_signal_45.b3d
Binary files differ
diff --git a/models/advtrains_signal_60.b3d b/models/advtrains_signal_60.b3d
new file mode 100644
index 0000000..cf41e6d
--- /dev/null
+++ b/models/advtrains_signal_60.b3d
Binary files differ
diff --git a/models/blender/mbb/signal.blend b/models/blender/mbb/signal.blend
index 63a8c99..135c7b4 100644
--- a/models/blender/mbb/signal.blend
+++ b/models/blender/mbb/signal.blend
Binary files differ
diff --git a/models/blender/mbb/signal.blend1 b/models/blender/mbb/signal.blend1
index ed59b39..63a8c99 100644
--- a/models/blender/mbb/signal.blend1
+++ b/models/blender/mbb/signal.blend1
Binary files differ
diff --git a/models/blender/mbb/signal.xcf b/models/blender/mbb/signal.xcf
index 1af67fa..f667739 100644
--- a/models/blender/mbb/signal.xcf
+++ b/models/blender/mbb/signal.xcf
Binary files differ
diff --git a/signals.lua b/signals.lua
index 803b1a7..8be65e0 100644
--- a/signals.lua
+++ b/signals.lua
@@ -1,60 +1,76 @@
--advtrains by orwell96
--signals.lua
-
for r,f in pairs({on="off", off="on"}) do
- minetest.register_node("advtrains:retrosignal_"..r, {
- drawtype = "mesh",
- paramtype="light",
- paramtype2="facedir",
- walkable = false,
- selection_box = {
- type = "fixed",
- fixed = {-1/4, -1/2, -1/4, 1/4, 2, 1/4},
- },
- mesh = "advtrains_retrosignal_"..r..".b3d",
- tiles = {"advtrains_retrosignal.png"},
- description="Lampless Signal ("..r..")",
- on_rightclick=switchfunc,
- sunlight_propagates=true,
- groups = {
- choppy=3,
- not_blocking_trains=1
- },
- mesecons = {effector = {
- ["action_"..f] = function (pos, node)
- minetest.swap_node(pos, {name = "advtrains:retrosignal_"..f, param2 = node.param2})
- end
- }},
- on_rightclick=function(pos, node, clicker)
- minetest.swap_node(pos, {name = "advtrains:retrosignal_"..f, param2 = node.param2})
- end,
- })
- minetest.register_node("advtrains:signal_"..r, {
- drawtype = "mesh",
- paramtype="light",
- paramtype2="facedir",
- walkable = false,
- selection_box = {
- type = "fixed",
- fixed = {-1/4, -1/2, -1/4, 1/4, 2, 1/4},
- },
- mesh = "advtrains_signal.b3d",
- tiles = {"advtrains_signal_"..r..".png"},
- description="Signal ("..r..")",
- on_rightclick=switchfunc,
- groups = {
- choppy=3,
- not_blocking_trains=1
- },
- light_source = 1,
- sunlight_propagates=true,
- mesecons = {effector = {
- ["action_"..f] = function (pos, node)
- minetest.swap_node(pos, {name = "advtrains:signal_"..f, param2 = node.param2})
- end
- }},
- on_rightclick=function(pos, node, clicker)
- minetest.swap_node(pos, {name = "advtrains:signal_"..f, param2 = node.param2})
- end,
- })
+
+ advtrains.trackplacer.register_tracktype("advtrains:retrosignal", "")
+ advtrains.trackplacer.register_tracktype("advtrains:signal", "")
+
+ for rotid, rotation in ipairs({"", "_30", "_45", "_60"}) do
+ local crea=1
+ if rotid==1 and r=="off" then crea=0 end
+
+ minetest.register_node("advtrains:retrosignal_"..r..rotation, {
+ drawtype = "mesh",
+ paramtype="light",
+ paramtype2="facedir",
+ walkable = false,
+ selection_box = {
+ type = "fixed",
+ fixed = {-1/4, -1/2, -1/4, 1/4, 2, 1/4},
+ },
+ mesh = "advtrains_retrosignal_"..r..rotation..".b3d",
+ tiles = {"advtrains_retrosignal.png"},
+ inventory_image="advtrains_retrosignal_inv.png",
+ drop="advtrains:retrosignal_off",
+ description="Lampless Signal ("..r..rotation..")",
+ on_rightclick=switchfunc,
+ sunlight_propagates=true,
+ groups = {
+ choppy=3,
+ not_blocking_trains=1,
+ not_in_creative_inventory=crea,
+ },
+ mesecons = {effector = {
+ ["action_"..f] = function (pos, node)
+ minetest.swap_node(pos, {name = "advtrains:retrosignal_"..f..rotation, param2 = node.param2})
+ end
+ }},
+ on_rightclick=function(pos, node, clicker)
+ minetest.swap_node(pos, {name = "advtrains:retrosignal_"..f..rotation, param2 = node.param2})
+ end,
+ })
+ advtrains.trackplacer.add_worked("advtrains:retrosignal", r, rotation, nil)
+ minetest.register_node("advtrains:signal_"..r..rotation, {
+ drawtype = "mesh",
+ paramtype="light",
+ paramtype2="facedir",
+ walkable = false,
+ selection_box = {
+ type = "fixed",
+ fixed = {-1/4, -1/2, -1/4, 1/4, 2, 1/4},
+ },
+ mesh = "advtrains_signal"..rotation..".b3d",
+ tiles = {"advtrains_signal_"..r..".png"},
+ inventory_image="advtrains_signal_inv.png",
+ drop="advtrains:signal_off",
+ description="Signal ("..r..rotation..")",
+ on_rightclick=switchfunc,
+ groups = {
+ choppy=3,
+ not_blocking_trains=1,
+ not_in_creative_inventory=crea,
+ },
+ light_source = 1,
+ sunlight_propagates=true,
+ mesecons = {effector = {
+ ["action_"..f] = function (pos, node)
+ minetest.swap_node(pos, {name = "advtrains:signal_"..f..rotation, param2 = node.param2})
+ end
+ }},
+ on_rightclick=function(pos, node, clicker)
+ minetest.swap_node(pos, {name = "advtrains:signal_"..f..rotation, param2 = node.param2})
+ end,
+ })
+ advtrains.trackplacer.add_worked("advtrains:signal", r, rotation, nil)
+ end
end
diff --git a/textures/advtrains_retrosignal_inv.png b/textures/advtrains_retrosignal_inv.png
new file mode 100644
index 0000000..1036594
--- /dev/null
+++ b/textures/advtrains_retrosignal_inv.png
Binary files differ
diff --git a/textures/advtrains_signal_inv.png b/textures/advtrains_signal_inv.png
new file mode 100644
index 0000000..ed64ed9
--- /dev/null
+++ b/textures/advtrains_signal_inv.png
Binary files differ
diff --git a/textures/advtrains_signal_off.png b/textures/advtrains_signal_off.png
index b5b8d9c..8046e52 100644
--- a/textures/advtrains_signal_off.png
+++ b/textures/advtrains_signal_off.png
Binary files differ
diff --git a/textures/advtrains_signal_on.png b/textures/advtrains_signal_on.png
index fe3d391..5228bb3 100644
--- a/textures/advtrains_signal_on.png
+++ b/textures/advtrains_signal_on.png
Binary files differ
diff --git a/trackplacer.lua b/trackplacer.lua
index 21d40f0..1dbdffa 100644
--- a/trackplacer.lua
+++ b/trackplacer.lua
@@ -192,7 +192,7 @@ end
minetest.register_craftitem("advtrains:trackworker",{
- description = "Track Worker Tool\n\nLeft-click: change rail type (straight/curve/switch)\nRight-click: rotate rail",
+ description = "Track Worker Tool\n\nLeft-click: change rail type (straight/curve/switch)\nRight-click: rotate rail/bumper/signal/etc.",
groups = {cracky=1}, -- key=name, value=rating; rating=1..3.
inventory_image = "advtrains_trackworker.png",
wield_image = "advtrains_trackworker.png",
@@ -202,7 +202,7 @@ minetest.register_craftitem("advtrains:trackworker",{
local pos=pointed_thing.under
local node=minetest.get_node(pos)
- if not advtrains.is_track_and_drives_on(minetest.get_node(pos).name, advtrains.all_tracktypes) then return end
+ --if not advtrains.is_track_and_drives_on(minetest.get_node(pos).name, advtrains.all_tracktypes) then return end
if advtrains.is_train_at_pos(pos) then return end
local nnprefix, suffix, rotation=string.match(node.name, "^([^_]+)_([^_]+)(_?.*)$")
@@ -233,7 +233,7 @@ minetest.register_craftitem("advtrains:trackworker",{
local pos=pointed_thing.under
local node=minetest.get_node(pos)
- if not advtrains.is_track_and_drives_on(minetest.get_node(pos).name, advtrains.all_tracktypes) then return end
+ --if not advtrains.is_track_and_drives_on(minetest.get_node(pos).name, advtrains.all_tracktypes) then return end
if advtrains.is_train_at_pos(pos) then return end
local nnprefix, suffix, rotation=string.match(node.name, "^([^_]+)_([^_]+)(_?.*)$")
@@ -245,6 +245,8 @@ minetest.register_craftitem("advtrains:trackworker",{
minetest.set_node(pos, {name=nnprefix.."_"..nextsuffix..rotation, param2=node.param2})
--invalidate trains
advtrains.invalidate_all_paths()
+ else
+ print(dump(tp.tracks))
end
end,
})
diff --git a/tracks.lua b/tracks.lua
index e22954d..6153658 100644
--- a/tracks.lua
+++ b/tracks.lua
@@ -357,8 +357,13 @@ function advtrains.register_bumpers(tracktype, def, preset)
railheight=conns.railheight or 0,
}
end
+
for rotid, rotation in ipairs(preset.rotation) do
local img_suffix="bumper"..rotation
+
+ local crea=1
+ if rotid==1 then crea=0 end
+
minetest.register_node(def.nodename_prefix.."_".."bumper"..rotation, advtrains.merge_tables(
common_def,
{
@@ -377,7 +382,7 @@ function advtrains.register_bumpers(tracktype, def, preset)
))
--advtrains.trackplacer.add_single_conn(def.nodename_prefix, "bumper", rotation, cycle_conns({conn1=0, conn2=8}, rotid))
- --advtrains.trackplacer.add_worked(def.nodename_prefix, "bumper", rotation, preset.trackworker[suffix])
+ advtrains.trackplacer.add_worked(def.nodename_prefix, "bumper", rotation, nil)
end
end