StatsHelix / demoinfo

A library to analyze CS:GO demos in C#
MIT License
321 stars 78 forks source link

Inventory events #118

Closed econoraptor closed 6 years ago

econoraptor commented 7 years ago

Adds events for when players pick up and drop weapons, grenades, and bomb as proposed in issue #117 . This includes spawns and purchases for pickups and deaths and grenade throws for drops along with picking up and dropping weapons onto the ground or other players.

Implementation isn't as clean as I'd like. I wanted PickupWeapon to have the correct player and weapon data when it is raised, but these are added in two different steps, the order of which isn't consistent and it seems the weapon can be swapped out later on in the tick anyways. My solution was to create a separate container for new weapons and raise PickupWeapon at the end of ParseNextTick.

Raising an event on the second flashbang also required a new member variable, FlashHandle to track the flashbang. The alternative was to hardcode the AmmoType (15) or iterate over player.Weapons on every ammo update and double check that a match was in fact a flashbang rather than trickery.

moritzuehling commented 7 years ago

Wow, I overlooked that PR - sorry!

Thanks for your work, I'll look over it today or tomorrow.

master117 commented 7 years ago

Is this still going to get added?