I think you want something like this:
local constructionutil = require "constructionutil"
local labelOptions = { "1 Geen Dienst", "1 Garage", "1 Centraal Station"}
function data()
return {
type = "ASSET_DEFAULT",
description = {
name = _("Trolleybus 101"),
description = _("Museum trolleybus 101 from Arnhem (The Netherlands)"),
},
availability = {yearFrom = 1944, yearTo = 1959},
buildMode = "MULTI",
categories = { "Trolleybus" },
order = 31368,
skipCollision = true,
autoRemovable = false,
params = {
{
key = "Pantographs",
name = _("Type"),
values = { _("Pantographs up"), _("Pantographs down") }
},
{
key = "Line",
name = _("Line Indicator"),
values = labelOptions
},
},
updateFn = function(params)
local result = { }
result.models = { }
if params.Pantographs == 0 then
result.models[#result.models+1] = {id = "asset/bus/Trolleybus 101 asset.mdl", transf = constructionutil.rotateTransf(params, {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, }), }
elseif params.Pantographs == 1 then
result.models[#result.models+1] = {id = "asset/bus/Trolleybus 101 asset low.mdl", transf = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, }, }
end
result.terrainAlignmentLists = { {
type = "EQUAL",
faces = { }
} }
result.labelText = {
[1] = {labelOptions[params.Line+1]}
}
return result
end
}
end
Alles anzeigen
I deleted some of the extra line breaks so the changes I made would stand out a little:
I put your line choices in a table at the top.
I added a menu option to allow the user to choose which one they want.
At the bottom, I pass the chosen value in the label.Text table. You only have one model in the construction, so the index needs to be 1
In the labelList in the model file, you will then change the label type to 'CUSTOM' to retrieve the value that you have passed in from the construction.