-
Notifications
You must be signed in to change notification settings - Fork 118
Description
When tracking grenades via GrenadeProjectileThrow event, or GrenadeProjectileDestroy (maybe even PlayerHurt)
To Reproduce
Happens in every demo but we can take this one for example:
https://www.hltv.org/matches/2383573/3dmax-vs-lynn-vision-fissure-playground-1
Maka throws 2 flashes in round 1. Both have the same uniqueID2.
Code:
parser.RegisterEventHandler(func(e events.GrenadeProjectileThrow) { // Handle grenade throw events
if e.Projectile == nil || e.Projectile.WeaponInstance == nil || e.Projectile.Thrower == nil {
return
}
event := structs.GrenadeEvent{
DemoID: demo.ID,
Tick: parser.CurrentFrame(),
Type: "throw",
ThrowerID: e.Projectile.Thrower.SteamID64,
GrenadeType: e.Projectile.WeaponInstance.Type.String(),
GrenadeID: e.Projectile.WeaponInstance.UniqueID2().String(),
Jumpthrow: e.Projectile.Thrower.IsAirborne(),
ThrowerX: e.Projectile.Position().X,
ThrowerY: e.Projectile.Position().Y,
ThrowerZ: e.Projectile.Position().Z,
StartingX: e.Projectile.Trajectory2[0].Position.X,
StartingY: e.Projectile.Trajectory2[0].Position.Y,
StartingZ: e.Projectile.Trajectory2[0].Position.Z,
LandingX: e.Projectile.Position().X,
LandingY: e.Projectile.Position().Y,
LandingZ: e.Projectile.Position().Z,
Round: currentRound,
}
dal.InsertGrenadeEvent(&event)
})func InsertGrenadeEvent(e *structs.GrenadeEvent) {
_, err := db.NamedExec(`
INSERT INTO grenade_events (
demo_id, tick, type, thrower_id, grenade_type, grenade_id, jumpthrow, thrower_X, thrower_Y, thrower_Z, starting_X, starting_Y, starting_Z, landing_X, landing_Y, landing_Z, round
) VALUES (
:demo_id, :tick, :type, :thrower_id, :grenade_type, :grenade_id,:jumpthrow, :thrower_X, :thrower_Y, :thrower_Z, :starting_X, :starting_Y, :starting_Z, :landing_X, :landing_Y, :landing_Z, :round
)
`, e)
if err != nil {
log.Printf("Erreur insertion grenade event: %v", err)
}
}Expected behavior
I expect grenades to have unique IDs, even if they come from the same slot of inventory (2 flashbangs from the same player).
I expect to be able to track grenades through all events with this ID.
example: taking a grenade UniqueID2 in playerhurt event and track it back to my GrenadeProjectileThrow event registering list.
Edit: I think the issue is broader than the events, it's the way UniqueID2() considers grenade entities the same when they are in the same slot of inventory. Could also happen with dropped nades.
Library version
v4.3.4
Additional context
Examples of duplicates:

Example of duplicate from DIFFERENT players within the same demo file.
