There are several bugs related to ships or stations responding to attacks. This record tracks all the situations that we want to handle.
See: https://ministry.kronosaur.com/record.hexm?id=56810
Attacks
These scenarios all involve an attack (usually by the player) on an enemy.
SCENARIO DESIRED RESULT STATUS
-------------------------------------------------------------------
Hit a station[1] Deter attack[5]
Hit a turret[2] Deter attack
Hit a guardian[3] Deter attack
Hit a bystander[4] Bystander leaves
Destroy a station Avenge attack[6]
Destroy a turret Deter attack
Destroy a guardian Deter attack
Destroy a bystander Deter attack
[1] A STATION is a non-immutable, non-abandoned station.
[2] We define a TURRET as any station subordinate of the main station.
[3] A GUARDIAN is a ship with the guard or patrol order.
[4] A BYSTANDER is any ship with a gateOnThreat order.
[5] The DETER ATTACK function triggers the following:
(a) All guardians deter the order giver (if close) or the attacker (if not).
(b) All bystanders leave
(c) All turrets deter (set angry, scramble subordinates)
(d) Station becomes angry, which means it uses its weapons at longer ranges.
(e) Chance that station alerts other stations (if alertWhenAttacked is set).
[6] The AVENGE ATTACK function is the same as deter except guardians
never return back to the station.
Friendly Fire
These scenarios all involve a non-blacklisted friend (usually the player) attacking a ship or station:
SCENARIO DESIRED RESULT STATUS
-------------------------------------------------------------------
Hit a station Friendly fire[7]
Hit a turret Friendly fire
Hit a guardian Ignore
Hit a bystander Bystander leaves
Destroy a station Avenge attack
Destroy a turret Blacklist[8]
Destroy a guardian Blacklist
Destroy a bystander Blacklist
[7] FRIENDLY FIRE triggers the following:
(a) If attacks appear accidental, then ignore.
(b) Otherwise, blacklist the player
(c) Deter attack (as above).
[8] We blacklist the player and deter attack (as above).
Implementation Notes
- The subordinates of a station include all guardians and all turrets, but not bystanders.
- Bystanders handle their own behavior. If attacked, they leave. They check (on a timer) if the station is angry. If so, they leave.
I believe the issue stems from the destruction of a guardian/turret(I know that destroying a turret can cause the glitch). The station retaliates/blacklists normally, but, after a certain amount of time, it orders guards to attack the entity that destroyed one of its guardians(or, in the case of enemy stations, the order giver, which is the enemy station).
Having some rules for autons and followers (eg. Zoanthrope minions)is also important. As I think I've ticketed elsewhere, currently the game tends to end retaliation against the player rather than the auton(s) that are sent to attack.
I like the idea of a maxDistance stat for guards and escorts, which causes them to immediately draw back if outside that distance, regardless of whether they're being attacked(though they should turn to retaliate if they're already moving in the right direction).