Add 3-way turnouts and y-turnouts (both diverging)

master
Blockhead 2020-09-11 02:40:02 +10:00
parent 7879a0a215
commit 1d224d6b4c
24 changed files with 40090 additions and 1 deletions

View File

@ -98,6 +98,61 @@ advtrains.ap.t_30deg_flat={
}, },
rotation={"", "_30", "_45", "_60"}, rotation={"", "_30", "_45", "_60"},
} }
advtrains.ap.t_yturnout={
regstep=1,
variant={
l={
conns = conns3(0,7,9),
desc = "Y-turnout (left)",
switchalt = "r",
switchmc = "off",
switchst = "l",
},
r={
conns = conns3(0,9,7),
desc = "Y-turnout (right)",
switchalt = "l",
switchmc = "on",
switchst = "r",
}
},
regtp=true,
tpdefault="l",
rotation={"", "_30", "_45", "_60"},
}
advtrains.ap.t_s3way={
regstep=1,
variant={
l={
--conns = conns6(0,7,0,8,0,9),
conns = conns3(0,7,8),
desc = "3-way turnout (left)",
switchalt = "s",
--switchalt2 = ,
--switchmc = "off",
switchst="l",
},
s={
--conns = conns6(0,8,0,7,0,9),
conns = conns3(0,8,7),
desc = "3-way turnout (straight)",
switchalt ="r",
--switchmc = "on",
switchst = "s",
},
r={
--conns = conns6(0,9,0,8,0,7),
conns = conns3(0,9,8),
desc = "3-way turnout (right)",
switchalt = "l",
switchst="r"
--switchmc = "off",
}
},
regtp=true,
tpdefault="l",
rotation={"", "_30", "_45", "_60"},
}
advtrains.ap.t_30deg_slope={ advtrains.ap.t_30deg_slope={
regstep=1, regstep=1,
variant={ variant={
@ -450,10 +505,11 @@ function advtrains.register_tracks(tracktype, def, preset)
if var.switchalt and var.switchst then if var.switchalt and var.switchst then
local switchfunc=function(pos, node, newstate) local switchfunc=function(pos, node, newstate)
newstate = newstate or var.switchalt -- support for 3 (or more) state switches
-- this code is only called from the internal setstate function, which -- this code is only called from the internal setstate function, which
-- ensures that it is safe to switch the turnout -- ensures that it is safe to switch the turnout
if newstate~=var.switchst then if newstate~=var.switchst then
advtrains.ndb.swap_node(pos, {name=def.nodename_prefix.."_"..var.switchalt..rotation, param2=node.param2}) advtrains.ndb.swap_node(pos, {name=def.nodename_prefix.."_"..newstate..rotation, param2=node.param2})
advtrains.invalidate_all_paths(pos) advtrains.invalidate_all_paths(pos)
end end
end end

View File

@ -21,6 +21,43 @@ minetest.register_craft({
}, },
}) })
-- y-turnout
advtrains.register_tracks("default", {
nodename_prefix="advtrains:dtrack_sy",
texture_prefix="advtrains_dtrack_sy",
models_prefix="advtrains_dtrack_sy",
models_suffix=".obj",
shared_texture="advtrains_dtrack_shared.png",
description=attrans("Y-turnout"),
formats = {},
}, advtrains.ap.t_yturnout)
minetest.register_craft({
output = 'advtrains:dtrack_sy_placer 2',
recipe = {
{'advtrains:dtrack_placer', '', 'advtrains:dtrack_placer'},
{'', 'advtrains:dtrack_placer', ''},
{'', 'advtrains:dtrack_placer', ''},
},
})
--3-way turnout
advtrains.register_tracks("default", {
nodename_prefix="advtrains:dtrack_s3",
texture_prefix="advtrains_dtrack_s3",
models_prefix="advtrains_dtrack_s3",
models_suffix=".obj",
shared_texture="advtrains_dtrack_shared.png",
description=attrans("3-way turnout"),
formats = {},
}, advtrains.ap.t_s3way)
minetest.register_craft({
output = 'advtrains:dtrack_s3_placer 1',
recipe = {
{'advtrains:dtrack_placer', 'advtrains:dtrack_placer', 'advtrains:dtrack_placer'},
{'', 'advtrains:dtrack_placer', ''},
{'', '', ''},
},
})
-- Diamond Crossings -- Diamond Crossings
-- perpendicular -- perpendicular
advtrains.register_tracks("default", { advtrains.register_tracks("default", {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B