Fix gunpoint lock-on being logged against the victim instead of the aimer (#6023)

## About The Pull Request

Closes #5986.

`/datum/gunpoint/lock_on()` called:

```dm
log_combat(target, source, "locked onto with aiming")
```

`log_combat()`'s signature is `(atom/user, atom/target, what_done,
atom/object, addition)` — the first argument is the actor and the second
is who it was done to. These were passed the other way round, so every
successful lock-on wrote `locked onto with aiming <aimer>` into the
**target's** attack log, and handed the person actually holding the gun
the `LOG_VICTIM` line `was locked onto with aiming by <victim>`.

This is easy to miss when reading the file, because every *other* use of
`source`/`target` in the datum is correct — the `visible_message()`
calls all render the right way round, so chat reads correctly and only
the logs are inverted. It only becomes obvious in the situation from the
issue report, where one person was aimed at by several others and the
logs read as though that person had gunpointed the entire room.

The fix swaps the two arguments. It also passes `aimed_gun` as the
`object` param, which the call was leaving empty — chat already tells
everyone which gun is being aimed, and the log now records it too.

## Why It's Good For The Game

Gunpointing is an escalation step, so its logs are evidence admins act
on. As written, the logs named the victim as the aggressor, which is
worse than having no log at all — it points admin attention at exactly
the wrong player. Recording the gun as well saves a cross-reference
against the chat log when working out what someone was actually being
held at gunpoint with.

## Proof Of Testing

Tested on a local server (Delta Station), aiming a foam force crossbow
at a mothroach and at a human, and reading back both the in-round
Individual Logs panel and `attack.log` on disk.

`attack.log` after the fix — the actor is the mob holding the crossbow,
the target is named as the object of the sentence, and the weapon now
appears:

```
[2026-07-28 12:57:43.747] ATTACK: '(centralsmith)'/(Mackenzie Hooker) (mob_3144) locked onto with aiming *no key*/(Mr. Fluff) with the foam force crossbow (NEWHP: 25)  (Recreation Area (214,97,2))
[2026-07-28 13:00:31.909] ATTACK: '(centralsmith)'/(Mackenzie Hooker) (mob_3144) locked onto with aiming *no key*/(Izabella Compton) with the foam force crossbow (NEWHP: 100)  (Recreation Area (213,100,2))
```

Before this PR, those lines were filed against Mr. Fluff and Izabella
Compton — the ones being aimed at. Mr. Fluff is a mothroach, which makes
the old attribution particularly clear: the log claimed the mothroach
was the one locking on with a crossbow.

Note that only the actor's line reaches disk; the matching `was locked
onto with aiming by ...` victim line is written with `log_globally =
FALSE`, so it appears in the Individual Logs panel only.

<details>
<summary>Screenshots/Videos</summary>


https://github.com/user-attachments/assets/0d619ecf-0ba8-4045-b9ea-09b65ec2b696


</details>

## Changelog

🆑
admin: Aiming a gun at someone is now logged against the person doing
the aiming, rather than against the person being aimed at. The gun used
is included in the log.
/🆑

Co-authored-by: Centrsmith <centrsmith@example.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Tempest
2026-08-14 19:42:34 +02:00
committed by Maia
co-authored by Centrsmith Claude Opus 5
parent 553e0ccbb3
commit fdedc69bc7
@@ -57,7 +57,7 @@
qdel(src)
return
locked = TRUE
log_combat(target, source, "locked onto with aiming")
log_combat(source, target, "locked onto with aiming", aimed_gun)
playsound(get_turf(source), 'modular_skyrat/modules/gunpoint/sound/targeton.ogg', 50,1)
to_chat(source, span_notice("<b>You lock onto [target.name]!</b>"))
target.visible_message(span_warning("<b>[source.name] holds [target.name] at gunpoint with the [aimed_gun.name]!</b>"), span_userdanger("[source.name] holds you at gunpoint with the [aimed_gun.name]!"))