Table of Contents

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:

The availability range is set with:

The menuCategory is used to define the filter categories and order. See the construction menu for more details about them.

cost FIXME maintenance FIXME

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:

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:

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 FIXME