turretsKit.package
- ..
- .metadata345 B
- README.md5.7 KB
- schema.yaml4.2 KB
README.md
turretsKit.turretType
The data contract every turret .data file is checked against. One data file is one
turret type; a turretsKit.Turret component is set to it by its id. The catalog
(turretsKit.catalog) reads every instance of this contract anywhere in the world.
Adding a turret
Add a .data folder with contract: turretsKit.turretType and a values: block: no
code needed. The twelve shipped turrets are in turretsKit.package/turrets/*.data
(machineGun, cannon, mortar, laser, tesla, frost, poison, missile, sniper, flame,
support, wall); copy the closest one. From code, turretsKit.api.define(id, def, base)
does the same at runtime.
contract: turretsKit.turretType
values:
id: machineGun
label: Machine Gun
delivery: bullet
special: burst
tiers:
- { name: "Mk I", cost: 100, fireRate: 5, range: 11, damage: 5, burst: 1, barrels: 1 }
- { name: "Mk II", cost: 120, fireRate: 6, range: 12, damage: 6, burst: 2, barrels: 2 }
- { name: "Mk III",cost: 180, fireRate: 7, range: 13.5, damage: 7, burst: 3, barrels: 4 }
Top-level fields
| Field | Type | Default | Meaning |
|---|---|---|---|
id | string | required | Name the Turret component's def field uses. |
label | string | required | Display name (floating label, UI). |
description | string | "" | One-paragraph description. |
tags | list of strings | [] | Tags for filtering and picking: listed with the type by TK.types() and TK.info, and TK.types(tag) filters by one. |
role | attack | support | wall | attack | Attack turrets target and fire; support and wall are passive. |
delivery | bullet shell missile beam arc spray cloud hitscan aura none | bullet | How it delivers damage (see below). |
damageType | physical fire ice electric poison explosion | physical | SecondWind damage type of its hits. |
shot | bullet shell mortar missile beam arc frost poison sniper flame none | bullet | Which projectile look slot of the style it draws with. |
shape | string | "" (= id) | Which head model turretsKit.looks builds. |
color | color | #ffcc44 | The turret's own colour (glow, range ring, styles that tint by turret). |
special | string | "" | Name of the tier stat shown as its headline number (info().specialValue). |
specialLabel | string | "" | Human label for that stat. |
indirect | boolean | false | Lobbed fire: ignores the pitch limits when checking a target, sweeps at mid pitch. |
needsSight | boolean | true | Needs a clear line to the target (ignored when indirect). |
lead | boolean | true | Aims ahead of moving targets (bullets, shells, clouds). |
aimHeight | number | 0.9 | Metres above a target's position it aims at. |
hits | list of ground / air | [] | Target layers it shoots; empty = both. |
detects | boolean | false | Can see and shoot hidden (stealthed) targets. |
detectRange | number | 0 | How far it sees hidden targets, in metres; 0 = its whole range. |
fireCone | number 0..180 | 8 | Degrees of aim error within which it fires. |
coneAngle | number 0..180 | 30 | Spray cone width in degrees (flame). |
sellRate | number 0..1 | 0.7 | Fraction of money spent refunded on sale. |
defaultTargeting | first last nearest strongest weakest | first | Targeting mode when none is given. |
turn (struct): yawSpeed (180 °/s), pitchSpeed (90 °/s), yawMin / yawMax
(-180 / 180, degrees from its facing), pitchMin / pitchMax (-10 / 60).
projectile (struct): speed (40 m/s), arc (0, peak height of shells), gravity
(18), turnRate (180 °/s, missiles), radius (0.7, contact distance), size (1, look
scale).
Tiers
tiers (required) is a list of tier structs, normally three (tier 1..3; the
catalog's MAX_TIER is 3, and a turret's tier is clamped to the list's length). Every
tier field is optional; an absent one takes the default in catalog.STAT_DEFAULTS.
Common to all: name ("" → "Tier n"), cost (100; tier 1 = build cost, later tiers =
upgrade cost), fireRate (1 shot/s, or ticks/s for beam and spray), range (10 m),
minRange (0), damage (10), turnBoost (0, extra turn speed fraction), barrels
(1, model barrel count), scale (1, model size).
Which fields each delivery reads:
| Turret (delivery) | Tier fields |
|---|---|
Machine gun (bullet) | burst: bullets per trigger pull (≥1) |
Cannon, mortar (shell), frost (bullet), missile | splash: blast radius in metres (falls off to half at the edge) |
Tesla (arc) | chains: extra jumps; chainRange (4): jump distance; chainFalloff (0.8): damage multiplier per jump |
| Frost | slow: fraction of speed taken (0..1); slowTime: seconds |
Poison (cloud) | cloudRadius, cloudTime, cloudDps: the cloud left where the shell lands |
| Missile | salvo: missiles per volley (≥1) |
Sniper (hitscan) | pierce (1): targets hit along the line, each 25% weaker |
Flame (spray) | burnDps, burnTime: burn applied to everything in the cone |
Laser (beam) | rampMax (1): damage multiplier reached after rampTime (2) s on one target |
Support (aura) | auraRange; boostFireRate, boostDamage, boostRange: fractions given to same-team turrets in reach (strongest beacon counts, no stacking) |
Wall (none) | health: SecondWind max health; thorns: dps dealt to enemies touching it; blockRadius (1.4): how far in front it holds enemies |
burnDps/burnTime and slow/slowTime also apply to any shot that hits, if set.