Im not really good in explain somthing, so sry if it is really hard to understand.
You will find the pathfinding in the mdl data. form the cargo station. You will find the cargo tation in res\models\model\station\road\
You will now see the orginal code from the medium_old.mdl. I try to explain what is what with this code.
Code
local laneutil = require "laneutil"
function data()
return {
boundingInfo = {
bbMax = {of an object from the origin of positive values
23, 17, 5.2159490585327, /wide, deep, high/ of an object from the origin axis piont of positive values
},
bbMin = {
-23, -15, -0.013722999952734, /wide, deep, high/ of an object from the origin axis piont of negative values
the bbMin value of the deep number "-15" i the each to the street
},
},
collider = {
params = {
},
type = "MESH",
},
lods = {
{
animations = {
},
children = { /here you will find all path of the Mashdata /
{
id = "station/road/cargo_medium_old_lod_0_floor.msh", /Untergrund/
transf = {
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, /here you can change the position of the object all indications have to be in meters. At the moment I have no idea what is what. If you want to mirro your onject put on position 1 and 6 a minus before the number.
},
type = "MESH",
}, {
id = "station/road/cargo_medium_old_lod_0_lanes.msh", /Untergrund/
transf = {
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
},
type = "MESH",
}, {
id = "station/road/cargo_medium_old_lod_0_station.msh", /buildings/
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 = { /there has to be the same amount of zeros as above *.msh path or the game will crash/
{
0, 0, 0,
0, 0, 0,
0,
},
},
static = false,
visibleFrom = 0,
visibleTo = 5410,
},
},
metadata = {
description = {
name = _("Truck station"),
--description = _("Description")
},
availability = {
},
streetTerminal = {
cargo = true
},
streetConnector = {
streetType = "old_medium.lua" /depending on wich *.lua you put in you will change the max speed of this place/
},
transportNetworkProvider = {
laneLists = {
{
transportModes = { "TRUCK" },
nodes = laneutil.makeLanes({ /Now we coming to our main Topic/
-- lane1
{ { lateral offset of 0, deep offset of 0, high offset of 0 }, /the follwoing part conserns itself with the radii of the courves { 7.0, -10.0, .0 }, { .0, 7.85, .0 }, { 7.85, .0, .0 }, 3.0 },
/ Here I startet by taking the first tripleblock to show what I have done.
{ { S1, -T1, H1 }, { S2, -T2, H2 }, { KS1, KT1, KH1 }, { KS2, KT2, KH2 }, 3.0 },
{ { S2, -T2, H2 }, { S3, -T3, H3 }, { KS2, KT2, KH2 }, { KS3, KT3, KH3 }, 3.0 },
{ { S3, -T3, H3 }, { S4, -T4, H4 }, { KS3, KT3, KH3 }, { KS4, KT4, KH4 }, 3.0 },
/You have to think about it like this
{ S1, -T1, H1 } is the starting point of one line { S2, -T2, H2 } is the end
the starting point of the next line muss correspond to the end of the first line.
as far as I know the 3.0 at the end for the width of the line, it would be 3m wide/
/in realation to the original data
{ { 2.0, -15.0, .0 } this is the first piont of the line
it is shifted 2m lateral -15m in depth of the room is the position of the conection to street for the entrance therefore is found at
{ -2.0, -15.0, .0 }
entrance
{ { 2.0, -15.0, .0 }, { 7.0, -10.0, .0 }, { .0, 7.85, .0 }, { 7.85, .0, .0 }, 3.0 },
{ { 7.0, -10.0, .0 }, { 12.0, -5.0, .0 }, { 7.85, .0, .0 }, { .0, 7.85, .0 }, 3.0 },
{ { 12.0, -5.0, .0 }, { 12.0, 1.0, .0 }, { .0, 1.0, .0 }, { .0, 1.0, .0 }, 3.0 },
{ { 12.0, 1.0, .0 }, { 12.0, 7.0, .0 }, { .0, 1.0, .0 }, { .0, 1.0, .0 }, 3.0 },
{ { 12.0, 7.0, .0 }, { 7.0, 12.0, .0 }, { .0, 7.85, .0 }, { -7.85, .0, .0 }, 3.0 },
{ { 7.0, 12.0, .0 }, { 2.0, 12.0, .0 }, { -1.0, .0, .0 }, { -1.0, .0, .0 }, 3.0 },
{ { 2.0, 12.0, .0 }, { -2.0, 12.0, .0 }, { -1.0, .0, .0 }, { -1.0, .0, .0 }, 3.0 },
{ { -2.0, 12.0, .0 }, { -7.0, 12.0, .0 }, { -1.0, .0, .0 }, { -1.0, .0, .0 }, 3.0 },
{ { -7.0, 12.0, .0 }, { -12.0, 7.0, .0 }, { -7.85, .0, .0 }, { .0, -7.85, .0 }, 3.0 },
{ { -12.0, 7.0, .0 }, { -12.0, 1.0, .0 }, { .0, -1.0, .0 }, { .0, -1.0, .0 }, 3.0 },
{ { -12.0, 1.0, .0 }, { -12.0, -5.0, .0 }, { .0, -1.0, .0 }, { .0, -1.0, .0 }, 3.0 },
{ { -12.0, -5.0, .0 }, { -7.0, -10.0, .0 }, { .0, -7.85, .0 }, { 7.85, .0, .0 },3.0 },
{ { -7.0, -10.0, .0 }, { -2.0, -15.0, .0 }, { 7.85, .0, .0 }, { .0, -7.85, .0 }, 3.0 },
exit
everything inbetween these numbers is a line
Bei den folgenden angaben handelt es sich um die The following data concerns itself with the alternative route
Start point of the alternative route
{ { 2.0, -15.0, .0 }, { 7.0, -5.0, .0 }, { 0, 1, .0 }, { .0, 1, .0 }, 3.0 },
{ { 7.0, -5.0, .0 }, { 7.0, 7.0, .0 }, { 0, 1, .0 }, { .0, 1, .0 }, 3.0 },
{ { 7.0, 7.0, .0 }, { 2.0, 12.0, .0 }, { .0, 7.85, .0 }, { -7.85, .0, .0 }, 3.0 },
end of the alternative
{ 2.0, 12.0, .0 } this is the end of the alternative. This you can also find in the main line
The alternative will be used by going and returning from the stop to the street passing other stops.
Starting point of the alternative route
{ { -2.0, 12.0, .0 }, { -7.0, 7.0, .0 }, { -7.85, .0, .0 }, { .0, -7.85, .0 }, 3.0 },
{ { -7.0, 7.0, .0 }, { -7.0, -5.0, .0 }, { .0, -1, .0 }, { .0, -1, .0 }, 3.0 },
{ { -7.0, -5.0, .0 }, { -2.0, -15.0, .0 }, { 0, -1, .0 }, { .0, -1, .0 }, 3.0 },
end of the alternative route
according to this, as can be seen in the game, the little cargo station has one main line, which goes over both cargo bays and 2 alternative routes which results in 2 separate lines.
})
}, {
transportModes = { "CARGO" },
nodes = laneutil.makeLanes({ /this data concerns itself with the pathfinding
for Cargo Overlay and for daimentions of the cargo aspace
-- ped1
Street connection pevement
{ { 6.5, -15.0, .3 } , { 14.0, -13.0, .3 }, { 0, 1, .0 }, { 1, 1, .0 }, 3.0 },
{ { 14.0, -13.0, .3 }, { 18, -13.0, 1.0 } , { 1, 0, 1 }, { 1, 0, 1 }, 3.0 },
starting point cargo space /at this point is also the stop for all vehicle "you will see more about that on the end"
{ { 18, -13.0, 1.0 } , { 18.0, -7.0, 1.0 }, { 0, 1, 0 }, { 0, 1, 0 }, 3.0 },
{ { 18.0, -7.0, 1.0 }, { 18, 10.0, 1.0 } , { 0, 1, 0 }, { 0, 1, 0 }, 3.0 },
end cargo space
-- ped2
{ { -6.5, -15.0, .3 } , { -14.0, -13.0, .3 }, { 0, 1, .0 }, { -1, 1, .0 }, 3.0 },
{ { -14.0, -13.0, .3 }, { -18, -13.0, 1.0 } , { -1, 0, 1 }, { -1, 0, 1 }, 3.0 },
{ { -18, -13.0, 1.0 } , { -18.0, -7.0, 1.0 }, { 0, 1, 0 }, { 0, 1, 0 }, 3.0 },
{ { -18.0, -7.0, 1.0 }, { -18, 10.0, 1.0 } , { 0, 1, 0 }, { 0, 1, 0 }, 3.0 },
-- connection /it is a connection of both cargo spaces , so if the lines switch sides, the cargo can switch to the correct side too
{ { -14.0, -13.0, .3 }, { 14.0, -13.0, .3 } , { 1, 0, 0 }, { 1, 0, 0 }, 3.0 },
})
}
},
terminals = { /vehicleNodes are the stops for the vehicles and personNodes are the end of loading/
{ vehicleNode = 6, personNodes = { 44 }, personEdges = { 22 } },
{ vehicleNode = 20, personNodes = { 52 }, personEdges = { 26 } },
}
},
cost = {
price = 7000
},
},
}
end
Display More