From c4a26de487091b95a891d739a89656cacba109d4 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Tue, 13 Sep 2016 18:05:59 +0200 Subject: various improvements on signals and bumpers --- models/advtrains_retrosignal_off_30.b3d | Bin 0 -> 13093 bytes models/advtrains_retrosignal_off_45.b3d | Bin 0 -> 13093 bytes models/advtrains_retrosignal_off_60.b3d | Bin 0 -> 13093 bytes models/advtrains_retrosignal_on_30.b3d | Bin 0 -> 13093 bytes models/advtrains_retrosignal_on_45.b3d | Bin 0 -> 13093 bytes models/advtrains_retrosignal_on_60.b3d | Bin 0 -> 13093 bytes models/advtrains_signal_30.b3d | Bin 0 -> 61544 bytes models/advtrains_signal_45.b3d | Bin 0 -> 61544 bytes models/advtrains_signal_60.b3d | Bin 0 -> 61544 bytes models/blender/mbb/signal.blend | Bin 570336 -> 570336 bytes models/blender/mbb/signal.blend1 | Bin 572304 -> 570336 bytes models/blender/mbb/signal.xcf | Bin 841524 -> 881142 bytes signals.lua | 128 ++++++++++++++++++-------------- textures/advtrains_retrosignal_inv.png | Bin 0 -> 2242 bytes textures/advtrains_signal_inv.png | Bin 0 -> 856 bytes textures/advtrains_signal_off.png | Bin 139883 -> 5882 bytes textures/advtrains_signal_on.png | Bin 139426 -> 5884 bytes trackplacer.lua | 8 +- tracks.lua | 7 +- 19 files changed, 83 insertions(+), 60 deletions(-) create mode 100644 models/advtrains_retrosignal_off_30.b3d create mode 100644 models/advtrains_retrosignal_off_45.b3d create mode 100644 models/advtrains_retrosignal_off_60.b3d create mode 100644 models/advtrains_retrosignal_on_30.b3d create mode 100644 models/advtrains_retrosignal_on_45.b3d create mode 100644 models/advtrains_retrosignal_on_60.b3d create mode 100644 models/advtrains_signal_30.b3d create mode 100644 models/advtrains_signal_45.b3d create mode 100644 models/advtrains_signal_60.b3d create mode 100644 textures/advtrains_retrosignal_inv.png create mode 100644 textures/advtrains_signal_inv.png diff --git a/models/advtrains_retrosignal_off_30.b3d b/models/advtrains_retrosignal_off_30.b3d new file mode 100644 index 0000000..da258e1 Binary files /dev/null and b/models/advtrains_retrosignal_off_30.b3d differ diff --git a/models/advtrains_retrosignal_off_45.b3d b/models/advtrains_retrosignal_off_45.b3d new file mode 100644 index 0000000..338224a Binary files /dev/null and b/models/advtrains_retrosignal_off_45.b3d differ diff --git a/models/advtrains_retrosignal_off_60.b3d b/models/advtrains_retrosignal_off_60.b3d new file mode 100644 index 0000000..c560ca1 Binary files /dev/null and b/models/advtrains_retrosignal_off_60.b3d differ diff --git a/models/advtrains_retrosignal_on_30.b3d b/models/advtrains_retrosignal_on_30.b3d new file mode 100644 index 0000000..98f8a92 Binary files /dev/null and b/models/advtrains_retrosignal_on_30.b3d differ diff --git a/models/advtrains_retrosignal_on_45.b3d b/models/advtrains_retrosignal_on_45.b3d new file mode 100644 index 0000000..414e121 Binary files /dev/null and b/models/advtrains_retrosignal_on_45.b3d differ diff --git a/models/advtrains_retrosignal_on_60.b3d b/models/advtrains_retrosignal_on_60.b3d new file mode 100644 index 0000000..a51529a Binary files /dev/null and b/models/advtrains_retrosignal_on_60.b3d differ diff --git a/models/advtrains_signal_30.b3d b/models/advtrains_signal_30.b3d new file mode 100644 index 0000000..0b949a7 Binary files /dev/null and b/models/advtrains_signal_30.b3d differ diff --git a/models/advtrains_signal_45.b3d b/models/advtrains_signal_45.b3d new file mode 100644 index 0000000..ccaebf4 Binary files /dev/null and b/models/advtrains_signal_45.b3d differ diff --git a/models/advtrains_signal_60.b3d b/models/advtrains_signal_60.b3d new file mode 100644 index 0000000..cf41e6d Binary files /dev/null and b/models/advtrains_signal_60.b3d differ diff --git a/models/blender/mbb/signal.blend b/models/blender/mbb/signal.blend index 63a8c99..135c7b4 100644 Binary files a/models/blender/mbb/signal.blend and b/models/blender/mbb/signal.blend differ diff --git a/models/blender/mbb/signal.blend1 b/models/blender/mbb/signal.blend1 index ed59b39..63a8c99 100644 Binary files a/models/blender/mbb/signal.blend1 and b/models/blender/mbb/signal.blend1 differ diff --git a/models/blender/mbb/signal.xcf b/models/blender/mbb/signal.xcf index 1af67fa..f667739 100644 Binary files a/models/blender/mbb/signal.xcf and b/models/blender/mbb/signal.xcf 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 Binary files /dev/null and b/textures/advtrains_retrosignal_inv.png differ diff --git a/textures/advtrains_signal_inv.png b/textures/advtrains_signal_inv.png new file mode 100644 index 0000000..ed64ed9 Binary files /dev/null and b/textures/advtrains_signal_inv.png differ diff --git a/textures/advtrains_signal_off.png b/textures/advtrains_signal_off.png index b5b8d9c..8046e52 100644 Binary files a/textures/advtrains_signal_off.png and b/textures/advtrains_signal_off.png differ diff --git a/textures/advtrains_signal_on.png b/textures/advtrains_signal_on.png index fe3d391..5228bb3 100644 Binary files a/textures/advtrains_signal_on.png and b/textures/advtrains_signal_on.png 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 -- cgit v1.2.3