Code: Select all
if (attacker.scanClass == "CLASS_POLICE") return; // ignored
And perhaps more broadly, the logic in both functions that reverses the role of attacker and victim should perhaps be skipped if the player is the victim, because the player is never in the oolite-police-like category and it is confusing and non-intuitive for the player to be given a bounty when they are the one being attacked.
Background:
While experimenting with Broadcast Comms' surrender feature, I experienced a bounty increase that I don't understand / can't explain. What I did: I launched from the station, found a nearby viper interceptor, shot it once, then sent a surrender message and turned off my weapons. After that, as expected, Broadcast Comms cleared my bounty (15 at the time). From that point onwards, I never enabled my weapons. However, I received another bounty increase of 7 for reason "seen by police" almost a minute later.
I believe it was caused by oolite-priorityai.js, which has some code in (1) responseComponent_standard_offenceCommittedNearby and (2) responseComponent_station_offenceCommittedNearby that reverses the position of attacker and victim if both are clean and the attacker's role is in the oolite-police-like role-category (see role-categories.plist) and the victim's role is not. Function (1) includes a check for police as attacker and excludes them, but function (2) does not. The player doesn't have a role in the oolite-police-like category, but police do, so it seems that if you are being shot by police, near a station (I was), and if you have a hostile ship (such as the one attacking you) targeted (I did), it could lead to you being given a bounty... unless I'm reading it wrong?[/color]
Excerpt of log, omitting many laser attacks from police to me:
19:38:44.057 [LogEvents] GlobalLog: launched from Torus Station 9291
19:39:17.407 [LogEvents] GlobalLog: weapons systems toggled to 1
19:39:18.706 [LogEvents] GlobalLog: bounty is changed by 7 to 7 due to seen by police
19:39:18.707 [LogEvents] GlobalLog: bounty is changed by 8 to 15 due to attacked police
19:39:18.708 [LogEvents] GlobalLog: attacked GalCop Viper Interceptor: OZI650-ON1 7 23302 who has 308 energy <-- the only shot I fired
19:39:18.780 [LogEvents] GlobalLog: alert condition changed from 2 to 3
19:39:19.657 [LogEvents] GlobalLog: got message from Torus Station 9291 : All ships, clearance is cancelled for emergency launch!
19:39:21.658 [LogEvents] GlobalLog: attacked unsuccessfully by GalCop Viper Interceptor: KAI563-ON1 9 32363
19:39:21.659 [LogEvents] GlobalLog: attacked unsuccessfully by GalCop Viper Interceptor: YPF024-ON1 1 4937
19:39:21.852 [LogEvents] GlobalLog: attacked unsuccessfully by GalCop Viper Interceptor: OZI650-ON1 7 23302
19:39:23.887 [LogEvents] GlobalLog: got message from Kirin Sport 32256 : Wait! I'm surrendering!
19:39:25.888 [LogEvents] GlobalLog: got message from GalCop Viper Interceptor: OZI650-ON1 7 23302 : Stand down Milo! Disable your weapons now!
19:39:26.789 [LogEvents] GlobalLog: weapons systems toggled to 0
19:39:30.903 [LogEvents] GlobalLog: got message from GalCop Viper Interceptor: HVG151-ON1 7 24577 : Dock with the main station quickly, before I change my mind!
19:39:30.904 [LogEvents] GlobalLog: bounty is changed by -15 to 0 due to scripted
19:39:36.132 [LogEvents] GlobalLog: GalCop Manta Ray: SGG263-ON1 1 3050 from Torus Station 9291 spawned at 3 km <-- this one never attacked
19:39:36.968 [LogEvents] GlobalLog: attacked unsuccessfully by GalCop Viper Interceptor: OZI650-ON1 7 23302
19:39:37.037 [LogEvents] GlobalLog: attacked unsuccessfully by GalCop Viper Interceptor: KAI563-ON1 9 32363
19:39:39.185 [LogEvents] GlobalLog: got message from GalCop Manta Ray: SGG263-ON1 1 3050 : Run while you can, Kirin Sport…
19:39:43.572 [LogEvents] GlobalLog: got message from Kirin Sport 32256 : All right! I give up!
19:39:51.122 [LogEvents] GlobalLog: GalCop Sheriff: OAF733-ON1 8 28461 from Torus Station 9291 spawned at 3 km <-- this one never attacked
19:39:53.060 [LogEvents] GlobalLog: got message from GalCop Sheriff: OAF733-ON1 8 28461 : Weapons online!
19:40:03.893 [LogEvents] GlobalLog: got message from Torus Station 9291 : All ships, clear the launch corridor immediately!
19:40:07.881 [LogEvents] GlobalLog: attacked by GalCop Viper Interceptor: YPF024-ON1 1 4937 472+256 shield and 831 energy left
19:40:07.884 [LogEvents] GlobalLog: bounty is changed by 7 to 7 due to seen by police <-- what caused this?