This will explain what most of the entries in this Cargo Station and how the paths are configured.
If there is no description next to an entry, it means I either don't know or it probably will not be changed.
filename = cargo_medium_old.mdl
filepath = Train Fever\res\models\model\station\road
local laneutil = require "laneutil"
function data()
return {
boundingInfo = { <---- This is the Bounding Box info. It defines the boundries of the Station for where it collides with other objects in the game.
bbMax = {
23, 17, 5.2159490585327, <---- This defines the positive values of the size for each axis of the Bounding Box from 0,0,0, X, Y, Z
},
bbMin = {
-23, -15, -0.013722999952734, <---- This defines the negative values of the size for each axis of the Bounding Box from 0,0,0, -X, -Y, -Z
},
},
collider = {
params = {
},
type = "MESH",
},
lods = {
{
animations = {
},
children = { <---- This is where you list all of the meshs' that make up the Station.
---- The paths to each part is relative to the Mesh folder - Train Fever\res\models\mesh
{
id = "station/road/cargo_medium_old_lod_0_floor.msh", <---- Station Floor
transf = {
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, <---- These numbers define the orientation of the part in meters.
^ ^ ^
X Y Z - These three numbers define the position of the part from 0,0,0
},
type = "MESH", <---- This means that the part is a MESH, .msh file.
---- This can also be a GROUP, .grp file
}, {
id = "station/road/cargo_medium_old_lod_0_lanes.msh", <---- Station Lanes
transf = {
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, <---- To mirror the part, change 1 to -1 on it's axis.
^ ^ ^
-1 = X axis, -1 = Y axis, -1 = Z axis
},
type = "MESH",
}, {
id = "station/road/cargo_medium_old_lod_0_station.msh", <---- Station Building and sidewalks
transf = {
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
},
type = "MESH",
}, {
id = "asset/industry/pallet_01_lod_0_pallet_01.msh", <---- Decoration
transf = {
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -2.8516, -4.5346, 0.2862, 1,
},
type = "MESH",
}, {
id = "asset/industry/pallet_01_lod_0_pallet_01.msh", <---- Decoration
transf = {
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1.6516, -4.5346, 0.2862, 1,
},
type = "MESH",
}, {
id = "asset/industry/pallet_01_lod_0_pallet_01.msh", <---- Decoration
transf = {
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1.6916, -4.5346, 0.432, 1,
},
type = "MESH",
}, {
id = "asset/industry/pallet_01_lod_0_pallet_01.msh", <---- Decoration
transf = {
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -0.5516, -4.5346, 0.4862, 1,
},
type = "MESH",
},
},
events = {
},
matConfigs = { <---- This defines how many parts are in the station. This has to have a 0 for each part.
---- There are 7 parts which means there should be 7 0s here. These can all be on 1 line.
{
0, 0, 0,
0, 0, 0,
0,
},
},
static = false,
visibleFrom = 0, <---- These next 2 lines are for the LODs, Level of Detail, of the Station.
---- It defines at what distance from the ground in the game the next LOD is loaded.
visibleTo = 5410, <---- There is only 1 LOD for this station so this number will be very high.
},
},
metadata = {
description = {
name = _("Truck station"), <---- This is the name of the station which is shown in the Stations menu.
--description = _("Description") <---- Here you would type a detailed description of the station.
},
availability = { <---- This defines in what years the station can be bought in game.
---- It is always available so this is empty.
},
streetTerminal = {
cargo = true
},
streetConnector = {
streetType = "old_medium.lua" <---- This defines which street is used for the entrance of the station.
---- The path to the streets is "Train Fever\res\config\street"
---- If you change this to a Small or Large raod, you will also need to
---- edit the paths below to match the street you chose.
},
transportNetworkProvider = {
laneLists = {
{
transportModes = { "TRUCK" }, <---- This defines which vehicle type is used for this station, ie Bus, Tram or Truck.
nodes = laneutil.makeLanes({
---- This next section defines all of the paths associated with this station. These can be very confusing.
---- The easiest way to understand this is to map out the paths in your modelling program using lines.
---- Lines have endpoints which can be moved into the position of the nodes because without actually seeing the path
---- it would be difficult to picture where the stops and cargo waiting areas are. For me anyways.
---- As you move each node into place, look at the numbers in SET #3 & #4 and see what direction it shows the segment should go in.
---- As your creating the path, you should be able to understand it better as you progress. That's how I leanred.
---- Each line below has 4 sets of numbers and a fifth single number that define 1 segment of the path.
---- Each segment is named as shown in parentheses below starting with (edge 0)
---- The first set of 3 numbers define the first node of the first segment, X, Y, Z
---- The name of the first node starts with (node 0) as shown in parentheses below. I've numbered each one to be itentified easily.
---- The second set of 3 numbers define the second node of the first segment (node 1).
---- The third set of 3 numbers define the direction the path takes starting at (node 0), X, Y, Z
---- The third set of 3 numbers also define the circumference of a curve in the path for a corner or bend in the path, X, Y, Z
---- The forth set of 3 numbers define the direction the path is going in before it stops at (node 1)
---- If the path is straight, SET #3 and SET #4 will be identical.
---- If the path curves, as it does from (node 0) to (node 1), they will be different as they are below.
---- The first segment, (edge 0), is a curve which starts out going in the positive direction on the Y axis
---- and ends going in the positive direction on the X axis and creates a curve with a circumference of 7.85.
---- This is hard to understand at first but as you follow the path using SET #3 & #4 of numbers, it should all come clear to you.
---- It took me a few tries to completely understand it but once you get it, it's easy.
---- The very last number is the width of the segment in meters. ALL LEGNTHS ARE IN METERS
---- The start of the second segment, (Node 2) is defined by the end of the first segment, (node 1).
---- (node 1) and (Node 2) should be identicle because it is the ending point of the first segment
---- AND the beginning point of the second segment or the game will crash.
---- (node 3) and (Node 4) should also be identicle and so on down the list.
---- Knowing how the path segments and nodes are named and numbered will be important below when figuring
---- where the vehicles stop and where the cargo waits at the station.
---- SET #1 SET #2 SET #3 SET #4
-- lane1
(edge 0) { { 2.0, -15.0, .0 }, (node 0) { 7.0, -10.0, .0 }, (node 1) { .0, 7.85, .0 }, { 7.85, .0, .0 }, 3.0 },
(edge 1) { { 7.0, -10.0, .0 }, (node 2) { 12.0, -5.0, .0 }, (node 3) { 7.85, .0, .0 }, { .0, 7.85, .0 }, 3.0 },
(edge 2) { { 12.0, -5.0, .0 }, (node 4) { 12.0, 1.0, .0 }, (node 5) { .0, 1.0, .0 }, { .0, 1.0, .0 }, 3.0 },
(edge 3) { { 12.0, 1.0, .0 }, (node 6) { 12.0, 7.0, .0 }, (node 7) { .0, 1.0, .0 }, { .0, 1.0, .0 }, 3.0 },
(edge 4) { { 12.0, 7.0, .0 }, (node 8) { 7.0, 12.0, .0 }, (node 9) { .0, 7.85, .0 }, { -7.85, .0, .0 }, 3.0 },
(edge 5) { { 7.0, 12.0, .0 }, (node 10) { 2.0, 12.0, .0 }, (node 11) { -1.0, .0, .0 }, { -1.0, .0, .0 }, 3.0 },
(edge 6) { { 2.0, 12.0, .0 }, (node 12) { -2.0, 12.0, .0 }, (node 13) { -1.0, .0, .0 }, { -1.0, .0, .0 }, 3.0 },
(edge 7) { { -2.0, 12.0, .0 }, (node 14) { -7.0, 12.0, .0 }, (node 15) { -1.0, .0, .0 }, { -1.0, .0, .0 }, 3.0 },
(edge 8) { { -7.0, 12.0, .0 }, (node 16) { -12.0, 7.0, .0 }, (node 17) { -7.85, .0, .0 }, { .0, -7.85, .0 }, 3.0 },
(edge 9) { { -12.0, 7.0, .0 }, (node 18) { -12.0, 1.0, .0 }, (node 19) { .0, -1.0, .0 }, { .0, -1.0, .0 }, 3.0 },
(edge 10) { { -12.0, 1.0, .0 }, (node 20) { -12.0, -5.0, .0 }, (node 21) { .0, -1.0, .0 }, { .0, -1.0, .0 }, 3.0 },
(edge 11) { { -12.0, -5.0, .0 }, (node 22) { -7.0, -10.0, .0 }, (node 23) { .0, -7.85, .0 }, { 7.85, .0, .0 }, 3.0 },
(edge 12) { { -7.0, -10.0, .0 }, (node 24) { -2.0, -15.0, .0 }, (node 25) { 7.85, .0, .0 }, { .0, -7.85, .0 }, 3.0 },
(edge 13) { { 2.0, -15.0, .0 }, (node 26) { 7.0, -5.0, .0 }, (node 27) { 0, 1, .0 }, { .0, 1, .0 }, 3.0 },
(edge 14) { { 7.0, -5.0, .0 }, (node 28) { 7.0, 7.0, .0 }, (node 29) { 0, 1, .0 }, { .0, 1, .0 }, 3.0 },
(edge 15) { { 7.0, 7.0, .0 }, (node 30) { 2.0, 12.0, .0 }, (node 31) { .0, 7.85, .0 }, { -7.85, .0, .0 }, 3.0 },
(edge 16) { { -2.0, 12.0, .0 }, (node 32) { -7.0, 7.0, .0 }, (node 33) { -7.85, .0, .0 }, { .0, -7.85, .0 }, 3.0 },
(edge 17) { { -7.0, 7.0, .0 }, (node 34) { -7.0, -5.0, .0 }, (node 35) { .0, -1, .0 }, { .0, -1, .0 }, 3.0 },
(edge 18) { { -7.0, -5.0, .0 }, (node 36) { -2.0, -15.0, .0 }, (node 37) { 0, -1, .0 }, { .0, -1, .0 }, 3.0 },
})
}, {
transportModes = { "CARGO" }, <---- This defines what cargo type this station is used for, ie CARGO or PERSON.
nodes = laneutil.makeLanes({ <---- This next section defines the cargo paths.
-- ped1
(edge 19) { { 6.5, -15.0, .3 }, (node 38) { 14.0, -13.0, .3 }, (node 39) { 7.5, 2, .0 }, { 7.5, 2, .0 }, 3.0 },
(edge 20) { { 14.0, -13.0, .3 }, (node 40) { 18, -13.0, 1.0 }, (node 41) { 4, 0, .7 }, { 4, 0, .7 }, 3.0 },
(edge 21) { { 18, -13.0, 1.0 }, (node 42) { 18.0, -9.0, 1.0 }, (node 43) { 0, 1, 0 }, { 0, 1, 0 }, 3.0 },
(edge 22) { { 18.0, -9.0, 1.0 }, (node 44) { 18, -1.0, 1.0 }, (node 45) { 0, 1, 0 }, { 0, 1, 0 }, 4.0 },
(edge 23) { { 18.0, -1.0, 1.0 }, (node 46) { 18, 7.0, 1.0 }, (node 47) { 0, 1, 0 }, { 0, 1, 0 }, 4.0 },
(edge 24) { { 18.0, 7.0, 1.0 }, (node 48) { 18, 9.0, 1.0 }, (node 49) { 0, 1, 0 }, { 0, 1, 0 }, 4.0 },
-- ped2
(edge 25) { { -6.5, -15.0, .3 }, (node 50) { -14.0, -13.0, .3 }, (node 51) { -7.5, 2, .0 }, { -7.5, 2, .0 }, 3.0 },
(edge 26) { { -14.0, -13.0, .3 }, (node 52) { -18, -13.0, 1.0 }, (node 53) { -4, 0, .7 }, { -4, 0, .7 }, 3.0 },
(edge 27) { { -18, -13.0, 1.0 }, (node 54) { -18.0, -9.0, 1.0 }, (node 55) { 0, 1, 0 }, { 0, 1, 0 }, 3.0 },
(edge 28) { { -18.0, -9.0, 1.0 }, (node 56) { -18, -1.0, 1.0 }, (node 57) { 0, 1, 0 }, { 0, 1, 0 }, 4.0 },
(edge 29) { { -18.0, -1.0, 1.0 }, (node 58) { -18, 7.0, 1.0 }, (node 59) { 0, 1, 0 }, { 0, 1, 0 }, 4.0 },
(edge 30) { { -18.0, 7.0, 1.0 }, (node 60) { -18, 9.0, 1.0 }, (node 61) { 0, 1, 0 }, { 0, 1, 0 }, 4.0 },
---- This next section defines the connection between the 2 cargo paths. This is here so the cargo can switch from one side to the other.
-- connection
(edge 31) { { -14.0, -13.0, .3 }, (node 62) { 14.0, -13.0, .3 }, (node 63) { 1, 0, 0 }, { 1, 0, 0 }, 3.0 },
})
}
},
terminals = { <---- This next section defines which nodes the vehicles stop at, which nodes the Cargo enters the station at and which Edges the cargo sits along to wait.
---- This is where, I said above, the names and numbers of the segments and nodes will be important to know.
---- If you mapped out the paths in a 3D program, you'd able to find each stop and waiting area easily with them being named & numbered as they are above.
---- The vehicleNode defines which NODE the Vehicle stops at.
---- The personNodes' define which NODE the Cargo enters the station to wait.
---- The personEdges' define which EDGES the Cargo sits along to wait.
---- The first line below defines which nodes and edges the vehicles and cargo use to stop, enter and wait on Lane #1.
---- " vehicleNode = 6 " = (node 6)
---- " personNodes = { 44 } " = (node 44)
---- " personEdges = { 22,23,24 } " = (edge 22),(edge 23),(edge 24)
---- The second line below defines which nodes and edges the vehicles and cargo use to stop, enter and wait on Lane #2.
---- " vehicleNode = 20 " = (node 20)
---- " personNodes = { 52 } " = (node 52)
---- " personEdges = { 28,29,30 } " = (edge 28),(edge 29),(edge 30)
{ vehicleNode = 6, personNodes = { 44 }, personEdges = { 22,23,24 } },
{ vehicleNode = 20, personNodes = { 52 }, personEdges = { 28,29,30 } },
}
},
cost = { <---- This defines the cost it is to build the station.
price = 7000
},
},
}
end
Display More
Each space above, between the segments, means the path is broken up into sections.
I asked Basil Weber why the paths were cut up into smaller sections and this is his responce;
Quote from Basil WeberDisplay More
The paths do not have to be cut up like this. The reason why we have it like this is that we wanted to
have "person edges" which have exactly 8 meter length and 4 meter width. Cargo items are actually waiting on
these edges, and cargo items are 2x2 meters. So in total, exactly 4x2 = 8 cargo items can wait on one edge,
and you can also see at run-time that then such 8 items are grouped visually into one large cargo item.
Also we wanted to have multiple "person edges" per terminal, because the internal logic of the game can only
place cargo items of one type on an edge. Therefore, we can support multiple cargo types at one terminal by
making multiple "person edges" per terminal.
Hope that is understandable.
If you look above at the personEdges, there are 3 sections for the cargo to wait along.
Since there are 3 sections, this station can hold more than one type of cargo.
If it was only one section or one Edge, it could only hold one type of Cargo.
Also, Basil tells us how much cargo an Edge will hold or let wait in that section.
By knowing this, we can figure out how much cargo can wait at this station.
Basil said cargo items are 2x2 meters. So if you look above at the Edges the Cargo sits along, 22,23,24,
Measure them in your 3D program and you will find that all 3 edge combined are 18 meters long.
Now if you look above at how wide Edges 22,23,24, are, the fifth single number, they are 4 meters wide.
So 18 meters long divided by 2 meters, the size of the cargo item, it will hold 9 cargo items down the length of the edges.
The Edges are 4 meters wide so it will fit 2 cargo items wide so 9 x 2 is 18 cargo itmes per side.
If you wanted the station to hold more cargo items, you would make the Edges longer and wider.
I hope I explained this well enough for you to understand so you can mod your own station.
Good luck
Tattoo