diff options
19 files changed, 83 insertions, 60 deletions
diff --git a/models/advtrains_retrosignal_off_30.b3d b/models/advtrains_retrosignal_off_30.b3d Binary files differnew file mode 100644 index 0000000..da258e1 --- /dev/null +++ b/models/advtrains_retrosignal_off_30.b3d diff --git a/models/advtrains_retrosignal_off_45.b3d b/models/advtrains_retrosignal_off_45.b3d Binary files differnew file mode 100644 index 0000000..338224a --- /dev/null +++ b/models/advtrains_retrosignal_off_45.b3d diff --git a/models/advtrains_retrosignal_off_60.b3d b/models/advtrains_retrosignal_off_60.b3d Binary files differnew file mode 100644 index 0000000..c560ca1 --- /dev/null +++ b/models/advtrains_retrosignal_off_60.b3d diff --git a/models/advtrains_retrosignal_on_30.b3d b/models/advtrains_retrosignal_on_30.b3d Binary files differnew file mode 100644 index 0000000..98f8a92 --- /dev/null +++ b/models/advtrains_retrosignal_on_30.b3d diff --git a/models/advtrains_retrosignal_on_45.b3d b/models/advtrains_retrosignal_on_45.b3d Binary files differnew file mode 100644 index 0000000..414e121 --- /dev/null +++ b/models/advtrains_retrosignal_on_45.b3d diff --git a/models/advtrains_retrosignal_on_60.b3d b/models/advtrains_retrosignal_on_60.b3d Binary files differnew file mode 100644 index 0000000..a51529a --- /dev/null +++ b/models/advtrains_retrosignal_on_60.b3d diff --git a/models/advtrains_signal_30.b3d b/models/advtrains_signal_30.b3d Binary files differnew file mode 100644 index 0000000..0b949a7 --- /dev/null +++ b/models/advtrains_signal_30.b3d diff --git a/models/advtrains_signal_45.b3d b/models/advtrains_signal_45.b3d Binary files differnew file mode 100644 index 0000000..ccaebf4 --- /dev/null +++ b/models/advtrains_signal_45.b3d diff --git a/models/advtrains_signal_60.b3d b/models/advtrains_signal_60.b3d Binary files differnew file mode 100644 index 0000000..cf41e6d --- /dev/null +++ b/models/advtrains_signal_60.b3d diff --git a/models/blender/mbb/signal.blend b/models/blender/mbb/signal.blend Binary files differindex 63a8c99..135c7b4 100644 --- a/models/blender/mbb/signal.blend +++ b/models/blender/mbb/signal.blend diff --git a/models/blender/mbb/signal.blend1 b/models/blender/mbb/signal.blend1 Binary files differindex ed59b39..63a8c99 100644 --- a/models/blender/mbb/signal.blend1 +++ b/models/blender/mbb/signal.blend1 diff --git a/models/blender/mbb/signal.xcf b/models/blender/mbb/signal.xcf Binary files differindex 1af67fa..f667739 100644 --- a/models/blender/mbb/signal.xcf +++ b/models/blender/mbb/signal.xcf 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 Binary files differnew file mode 100644 index 0000000..1036594 --- /dev/null +++ b/textures/advtrains_retrosignal_inv.png diff --git a/textures/advtrains_signal_inv.png b/textures/advtrains_signal_inv.png Binary files differnew file mode 100644 index 0000000..ed64ed9 --- /dev/null +++ b/textures/advtrains_signal_inv.png diff --git a/textures/advtrains_signal_off.png b/textures/advtrains_signal_off.png Binary files differindex b5b8d9c..8046e52 100644 --- a/textures/advtrains_signal_off.png +++ b/textures/advtrains_signal_off.png diff --git a/textures/advtrains_signal_on.png b/textures/advtrains_signal_on.png Binary files differindex fe3d391..5228bb3 100644 --- a/textures/advtrains_signal_on.png +++ b/textures/advtrains_signal_on.png 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, }) @@ -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
|