Skip to content

Commit

Permalink
Allows vehicles to cross at train crossings (#79476)
Browse files Browse the repository at this point in the history
* allows vehicles to cross at train crossings

Adds a new recessed rail tile with the NOCOLLIDE flag, and replaces the rail which cross the road with recessed rails.

* reverting change used to debug

* fix road crossing edge case

Rarely, a road and railroad can take the same path, resulting to multiple crossings end to end. By removing all normal rails & ties on a crossing, this allows vehicles to drive in the same direction as the tracks, if there are multiple in a row.
  • Loading branch information
mx-moonling authored Feb 1, 2025
1 parent 0a9e421 commit 128e933
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 25 deletions.
31 changes: 31 additions & 0 deletions data/json/furniture_and_terrain/terrain-railroads.json
Original file line number Diff line number Diff line change
Expand Up @@ -639,5 +639,36 @@
"connect_groups": "RAIL",
"connects_to": "RAIL",
"flags": [ "RAIL", "TRANSPARENT" ]
},
{
"id": "t_railroad_track_recessed",
"type": "terrain",
"name": "recessed railroad track",
"description": "Trains used to chug along on these. These rail tracks sit flush with the road. You could probably reclaim lengths of the track itself with a metalcutting tool like a hacksaw.",
"symbol": "X",
"color": "cyan",
"looks_like": "t_railroad_track",
"move_cost": 3,
"bash": {
"str_min": 60,
"str_max": 210,
"sound": "metal screeching!",
"sound_fail": "clang!",
"ter_set": "t_rock_floor",
"items": [
{ "item": "mc_steel_lump", "count": [ 10, 20 ] },
{ "item": "mc_steel_chunk", "count": [ 20, 40 ] },
{ "item": "splinter", "count": [ 5, 15 ] }
]
},
"hacksaw": {
"result": "t_rock_floor",
"duration": "30 minutes",
"message": "You finish cutting the metal.",
"byproducts": [ { "item": "railroad_track_item", "count": 2 }, { "item": "spike", "count": 6 }, { "item": "2x4", "count": 3 } ]
},
"connect_groups": "RAIL",
"connects_to": "RAIL",
"flags": [ "RAIL", "TRANSPARENT", "NOCOLLIDE" ]
}
]
48 changes: 24 additions & 24 deletions data/mods/railroads/mapgen/railroad/railroad_level_crossing.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
"object": {
"fill_ter": "t_dirt",
"rows": [
"^^X^^^X^^ ^^X^^^X^^",
"^-x---x-^ ^-x---x-1",
"^^X^^^X^^ ^^X^^^X^2",
"^^X^^^X^^]]]]]]^^X^^^X^^",
"..X...X..........X...X..",
"..X...X..........X...X..",
"..X...X..........X...X..",
"..X...X..........X...X..",
"..X...X..........X...X..",
"..X...X..........X...X..",
"..X...X..........X...X..",
":.X:::X.:::..:::.X:::X.:",
":.X:::X.:::..:::.X:::X.:",
"..X...X..........X...X..",
"..X...X..........X...X..",
"..X...X..........X...X..",
"..X...X..........X...X..",
"..X...X..........X...X..",
"..X...X..........X...X..",
"..X...X..........X...X..",
"^^X^^^X^^]]]]]]^^X^^^X^^",
"2^X^^^X^^ ^^X^^^X^^",
"1-x---x-^ ^-x---x-^",
"^^X^^^X^^ ^^X^^^X^^"
" .3...3. .3...3. ",
" .3...3. .3...3.1",
" .3...3. .3...3.2",
"]]3]]]3]]]]]]]]]]3]]]3]]",
"..3...3..........3...3..",
"..3...3..........3...3..",
"..3...3..........3...3..",
"..3...3..........3...3..",
"..3...3..........3...3..",
"..3...3..........3...3..",
"..3...3..........3...3..",
":.3:::3.:::..:::.3:::3.:",
":.3:::3.:::..:::.3:::3.:",
"..3...3..........3...3..",
"..3...3..........3...3..",
"..3...3..........3...3..",
"..3...3..........3...3..",
"..3...3..........3...3..",
"..3...3..........3...3..",
"..3...3..........3...3..",
"]]3]]]3]]]]]]]]]]3]]]3]]",
"2.3...3. .3...3. ",
"1.3...3. .3...3. ",
" .3...3. .3...3. "
],
"palettes": [ "railroad" ]
}
Expand Down
3 changes: 2 additions & 1 deletion data/mods/railroads/mapgen_palettes/railroad.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"1": "t_railroad_crossing_signal",
"2": [ "t_crossbuck_wood", "t_crossbuck_metal" ],
"S": "t_buffer_stop",
"r": "t_railing"
"r": "t_railing",
"3": "t_railroad_track_recessed"
}
},
{
Expand Down

0 comments on commit 128e933

Please sign in to comment.