Edge Addons
Edge addons can be used by the player to decorate streets or tracks with functional addons, e.g. noise insulation walls.
Configuration
Edge addons are configured in a .edge.lua file. It's basic definition is:
function data() return { desc = { icon = "alley_old.tga", previewIcon = "alley_old_preview.tga", name = _("INFRA_EDGE_ADDON_ALLEY_NAME"), description = _("INFRA_EDGE_ADDON_ALLEY_DESCRIPTION"), }, availability = { yearFrom = 1900, yearTo = 1940, }, menuCategory = { categories = { { category = "roads_tools", order = 500, }, } }, cost = { price = 100, priceScale = 1, }, maintenance = { runningCosts = 10, }, builderAudioRes = "::/gui/construction/sound/tool_edge_alley.builder_audio", } end
The desc struct contains:
nameis the name of the edge addon type. It can be translated in a strings.json file.descriptionis the description text in the construction menu. It can be translated in a strings.json file.iconis a reference to a ui@2x.tgaicon which has a resolution of 240×150 pixels shown in the menu.previewIconis reference to a.tgaimage that is used as background image for the info box. It has a resolution of 720×405 pixels.
The availability range is set with:
yearFromis the year from when the edge addon should be available. Unset or values below 1901 mean from start.yearTois the year until when the edge addon should be available. Unset or value 0 means unlimited availability, values below 1900 result in a never available railroad crossing.
The menuCategory is used to define the filter categories and order. See the construction menu for more details about them.
cost
maintenance
The builderAudioRes reference points to a sound configuration for the construction sound of the edge addon.
The following functional properties are also part of the .edge.lua:
requiredTags = {"withSidewalk"}, incompatibleTags = {"track", "tunnel", "decorated", "bridge"}, categoryList = { categories = { "alley" } }, snapMode = "Side", -- "Side", "Center" preventParcels = false, modifiers = { noiseModifier = -0.10, pollutionModifier = -0.50, maxSpeedModifier = -0.25, },
To be able to place this addon on an edge, the edge must provide the requiredTags and may not have any of the tags from incompatibleTags. The following tags are available by default:
trackis set for any track typestreetis set for any street typedecoratedis set for any edge with at least one addonbridgeis set for any edge that is a bridgetunnelis set for any edge that is a tunnel
The categoryList.categories is a list of tags that are added when this addon is active on an edge.
The snapMode defines whether the addon can be placed on each Side individually or is applied to the Center of the edge.
With preventParcels set to true, the addon prevents town buildings from spawning (on this side).
The modifiers list is a list of modification factors to attributes of the edge:
noiseModifieraffects the noise generated by vehicles on the edgepollutionModifieraffects the pollution generated by vehicles on the edgemaxSpeedModifieraffects the maximum speed allowed on the edge.
The following properties in the .edge.lua define the visual representation:
length = 10.0, repModel = "::/assets/vegetation/trees/mt_mpl_01/mt_mpl_01.mdl", offset = -2.0, modelRotation = "RandomXY", skipSameInParallelStrip = false,
Along the edge, there are segments with an interval defined by length. The repModel is the reference to the model that is placed in the center of each of these segments. Its orthogonal offset from the axis of the edge is defined by offset and the rotation of the models is either None or RandomXY which is a random rotation in the XY plane around the z axis.
skipSameInParallelStrip