Skip to content

Gamestate.Weapons() has rifles on pistol round and uniqueID2 somehow has duplicates #591

@maddenbjames

Description

@maddenbjames

Describe the bug
Getting weapon info via gamestate.Weapons() and there are many incorrect weapons within.

To Reproduce
Download this demo and run the code below. It will log all of the weapons within the gameticks of a certain time that I confirmed are within the pistol round. When looking at the log there are many rifles and impossible weapons to be in the game state at that point.

Also sorry for having to use file.io, i cant find this anywhere as it was uploaded to our website. Can give direct link from refrag if needed.

https://limewire.com/d/FOUuM#t6BwY2TEtt

Code:

func main() {
	f, err := os.Open("../demos/223.dem")
	if err != nil {
		log.Panic("failed to open demo file: ", err)
	}
	defer f.Close()

	p := dem.NewParser(f)
	defer p.Close()

	// Register handler on kill events
	p.RegisterEventHandler(func(e events.FrameDone) {
		gs := p.GameState()

		for _, weapon := range gs.Weapons() {
			if gs.IngameTick() > 27800 && gs.IngameTick() < 27900 && weapon.String() != "UNKNOWN" {
				fmt.Println(weapon.String())
			}
		}
	})

	// Parse to end
	err = p.ParseToEnd()
	if err != nil {
		log.Panic("failed to parse demo: ", err)
	}
}

Expected behavior
I expect that all of the weapons within these ticks would be only pistols and knives and grenades. What actually happens is there are awps and rifles in the log.

What we have tried doing is storing warmupweapons in order to see if a warmup weapon has made its way into the wrong tick, while this works for most "ghost" weapons, it breaks down when a weapon has the same ID. I have switched over to using all UniqueID2 for the weapons and this still happens where a warmup weapon will have the same uniqueID2 as a round2 weapon and therefore break the check (even sometimes being completely different weapons).

Library version
v4.3.3

Additional context
Esportal match, this is just due to the text that prints in chat when watching the demo back

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions