Team-Silver-Sphere / SquadJS

Squad Server Script Framework
Boost Software License 1.0
163 stars 123 forks source link

PLAYER_DIED not producing TEAMKILL event #373

Closed romanvoloboev closed 1 month ago

romanvoloboev commented 1 month ago

I faced with isse when some teamkils are not being logged. Digging in the code I found that you missed part of code which is producing teamkill event in case it's happens. You only do it for PLAYER_WOUNDED.

image

I attached some server log bellow, where player has been temkilled by player with ID 76561198974176776 And it's parsed as PLAYER_DIED event, but as I said before there is no check for teamkill, and SQJS just swallowed that incident.

[2024.08.03-15.19.09:524][217]LogSquadTrace: [DedicatedServer]Die(): Player: Darkleusa KillingDamage=-300.000000 from BP_PlayerController_C_2146191099 (Online IDs: EOS: 0002b882785244f583e703a2fa773a15 steam: 76561198974176776 | Contoller ID: BP_PlayerController_C_2146191099) caused by BP_Soldier_USA_Engineer_C_2145967262

Thomas-Smyth commented 1 month ago

This is somewhat intended behavior. If you wish to do something on a teamkill induced wound or death, listen to the relevant events and then dismiss the events where data.teamkill is false. The teamkill event was added to make it easier for plugins to do something when someone was teamkill wounded as that's when it is usually most relevant. It is redundant really.

lbzepoqo commented 1 month ago

@romanvoloboev I also discovered the same thing with discord-killfeed plugin where players were reporting for months that their kills were not being recorded so I just blamed the game.

Then we installed the knife-broadcast plugin but I got frustrated one time when I saw 2 players - one is trying to heal the other one so I waited for the wounded player to be revived. When the player got revived, I went for the kill but the kill that only got announced was the reviver but not the revived player.

But I digress, after digging a lot some of the kills do not produce Wound() log line in Squad logs and just straight up produce Die() logs. Examples of this are the newly revived player state, heli crashes/kills, or TOW or similar kills with explosions.

You can find the whole discussion of what I found here on Discord and after that I've added the PLAYER_DIED event on the killfeed with some exceptions when the weapon starts "BP_SOLDIER".

So yeah, I'm not surprised that this got missed with teamkill events as well.

lbzepoqo commented 1 month ago

Seeing your example log, this can be reproduced by damaging a teammate then they bled out or jump from a high place over your teammate. I forgot the other scenarios.

But I also think this gets produced when the player gives up since the weapon starts with "BP_SOLDIER", thereby emitting 2 team kill events when you wound kill a player + when they gave up. If you want to emit the teamkill event for PLAYER_DIED, make sure to exclude when the weapon starts with "BP_SOLDIER"

Thomas-Smyth commented 1 month ago

But I digress, after digging a lot some of the kills do not produce Wound() log line in Squad logs and just straight up produce Die() logs. Examples of this are the newly revived player state, heli crashes/kills, or TOW or similar kills with explosions.

If I recall correctly, SquadJS's handling of wounds and deaths pre-dates the change to the revive system. It might be this is something that needs further analysis now. Though, it does not relate to what is documented within this issue to my understanding.

werewolfboy13 commented 1 month ago

Fixing tag