local transf = require "transf" function data() return { type = "RAIL_STATION_CARGO", description = { name = _("Debug Silo mit Gleis"), description = _("Ein Silo mit einem funktionalen Gleis und optionalen Durchfahrtsgleisen"), }, availability = { yearFrom = 1950, yearTo = 0, }, params = { { key = "additionalTracks", name = _("Zusätzliche Durchfahrtsgleise"), uiType = "COMBOBOX", values = { _("0"), _("1"), _("2"), _("3") }, defaultIndex = 0, }, { key = "trackLength", name = _("Gleislänge"), uiType = "COMBOBOX", values = { "40", "60", "80", "100", "120", "140", "160" }, defaultIndex = 2, }, { key = "trackSpacing", name = _("Gleisabstand"), uiType = "COMBOBOX", values = { "4.0", "5.0", "6.0", "7.5", "10.0" }, defaultIndex = 1, } }, updateFn = function(params) local result = { models = {}, edgeLists = {}, terminalGroups = {}, stations = {}, cost = 800000, maintenanceCost = 800000 / 6, } -- Parameter local lengths = { 40, 60, 80, 100, 120, 140, 160 } local length = lengths[(params.trackLength or 2) + 1] or 80 local tangent = { length, 0, 0 } local spacings = { 4.0, 5.0, 6.0, 7.5, 10.0 } local spacing = spacings[(params.trackSpacing or 1) + 1] or 5.0 -- Modell mit 2 Terminals table.insert(result.models, { id = "asset/jay_silo/jay_silo.mdl", transf = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 } }) -- 1. Straße (edgeList 0) table.insert(result.edgeLists, { type = "STREET", params = { type = "standard/country_small_new.lua", tramTrackType = "NO" }, edges = { { { -20, 13, 0 }, { 20, 0, 0 } }, -- node 0 { { 20, 13, 0 }, { 20, 0, 0 } }, -- node 1 }, snapNodes = { 0, 1 } }) -- 2. Hauptgleis (edgeList 1) table.insert(result.edgeLists, { type = "TRACK", params = { type = "standard.lua", catenary = false }, edges = { { { -length / 2, -11.4, 0 }, tangent }, -- node 2 { { length / 2, -11.4, 0 }, tangent }, -- node 3 }, snapNodes = { 0, 1 } }) -- 3. bis n. zusätzliche Gleise (edgeList 2..n) local numTracks = tonumber(params.additionalTracks) or 0 for i = 1, numTracks do local yOffset = -11.4 - (i * spacing) table.insert(result.edgeLists, { type = "TRACK", params = { type = "standard.lua", catenary = false }, edges = { { { -length / 2, yOffset, 0 }, tangent }, --4 { { length / 2, yOffset, 0 }, tangent }, --5 }, snapNodes = {} }) end -- Terminals result.terminalGroups = { { terminals = { { 0, 0 } }, -- Modell 0, Terminal 0 (Truck) }, { terminals = { { 0, 1 } }, -- Modell 0, Terminal 1 (Rail) vehicleNodeOverride = 2 } } -- Stationen result.stations = { { terminals = { 0, }, tag = 0 -- Road }, { terminals = { 1, }, tag = 1 -- Rail } } return result end } end