Adjacency
How [[adjacency]] entries tell the computer opponent which buildings earn a bonus beside partners.
Some mods give a resource building more output while partners stand close.
[[adjacency]] entries declare those pairings so the computer opponent
builds such buildings beside a partner. You need them only when your mod's
scripts give an adjacency bonus.
The worked example
[[adjacency]]
units = ["ARMFUS"]
partners = ["ARMFUS"]
distance = 86.25
max_partners = 1
[[adjacency]]
units = ["ARMFORGE", "CORVAULT"]
partners = ["ARMFORGE", "CORVAULT"]
distance = 232
max_partners = 1
How it works
Escalation's fusions and storages decide the bonus in their COB Detect
scripts, which AEX runs as they are. The scripts are not read for their
rules, so a mod declares them for the computer opponent: each
[[adjacency]] entry names buildings and how they pair. A building with a
rule is built beside an own partner that still has room for one, where that
site passes every other placement check
(skirmish-opponent.md).
A mod that declares none gets no adjacency placement. The entries only steer
placement; the bonus itself is whatever the mod's scripts give.
| Key | Type | Description |
|---|---|---|
units |
array of strings | The unit names (any letter case) the rule is for. |
partners |
array of strings | The unit names that count as a partner. A unit may be its own partner. |
distance |
number | How close a partner must stand, in world units from centre to centre (a partner exactly this far counts). |
max_partners |
integer | How many partners add to one building's bonus. A partner that already has this many under its own rule has no room. |
- All four keys are required. An entry missing one, with an empty or
non-string name list, a
distancethat is not a positive number or amax_partnersthat is not a whole number of at least 1 is skipped with a warning. - An unknown key in an entry is ignored with a warning; the entry is kept.
- A unit an earlier entry already names keeps that entry's rule; the later naming warns and is ignored.
adjacencywritten as a single[adjacency]table is ignored with a warning.
What goes wrong
The computer opponent places the building without the rule, and aex.log
says why. Entries are counted from 0 in file order:
[mods] <mod folder>: 'adjacency[0]' names no 'max_partners'; the entry is ignored
[mods] <mod folder>: 'adjacency[1]' field 'distance' must be a positive number of world units; the entry is ignored
[mods] <mod folder>: 'adjacency[1]' field 'units' must be a non-empty array of unit names; the entry is ignored
[mods] <mod folder>: 'adjacency[0]' field 'max_partners' must be a whole number of at least 1; the entry is ignored
[mods] <mod folder>: unknown field 'adjacency[0].range'; ignored
[mods] <mod folder>: 'adjacency[1]' names ARMFUS, which an earlier entry already has; ignored for it
[mods] <mod folder>: field 'adjacency' must be [[adjacency]] entries; ignored
Next
- AI director.
- Production progression for how the computer opponent places buildings.