Log inGet started
Package

turretsKit.package

README.md

turretsKit.testSuite

Tests for turretsKit: targeting (all five modes, ties, range, minimum range and turn limits), aiming (rate and limit clamps), the data (twelve types, three styles, every tier's numbers read back), live swapping of type, targeting, tier and style on a turret that is already picking targets, upgrades through an economy hook (cost, refusal, max tier), selling (value, refund, event, removal), and pooled damage reaching SecondWind health.

Running

In edit mode:

tools.use("tests", "run", { suites = { "turretsKit" } })

What it checks

turretsKit targeting modes

  • Each of the five modes picks the right candidate; out-of-range candidates are never picked.
  • Equal values break ties on progress, then on id, so every peer picks the same one.
  • A minimum range (mortar) skips anything too close, and inArc names why a point is refused.
  • A game can add its own targeting mode by name.

turretsKit turn limits

  • Turning is rate limited and never passes the limits.
  • A full-circle turret takes the short way round.
  • A real turret with a narrow arc never picks a target behind it, picks it once it is inside the arc, and the arc turns with the entity.

turretsKit data

  • The kit ships twelve turret types and three styles, all read from data.
  • Every attacking type gets better with each tier: fire rate or damage up, range not down, and its special number changes.
  • The special numbers read back per tier.
  • Costs: build, spent so far, next upgrade and sell value (70% of spent, rounded).

turretsKit live swapping

  • Changing targeting by name on a turret that is already picking changes its very next pick, with no other code.
  • Changing the type by name swaps the model, the brain and every number while it runs.
  • Tier and style swap live and visibly; unknown names are refused with the known ones listed.

turretsKit upgrades and selling

  • Upgrades pay each tier's cost through the economy hook, are refused when it says no, and stop at the top tier; every number changes and the event fires.
  • Selling refunds the sell value through the hook, fires sold with the value, and removes the turret.
  • place() builds from code, paying the build cost, and refuses when the hook says no.

turretsKit damage

  • Hits are pooled per target and reach SecondWind together on flush: many small hits, one SecondWind call, the full amount.
  • Slows take the strongest fraction and report it to games through speedMultiplier.