@@ -108,6 +108,8 @@ type Equipment struct {
108108 AmmoType int
109109 Owner * Player
110110 ReserveAmmo int
111+
112+ uniqueID int64
111113}
112114
113115// GrenadeProjectile is a grenade thrown intentionally by a player. It is used to track grenade projectile
@@ -130,12 +132,21 @@ func (e Equipment) Class() EquipmentClass {
130132 return e .Weapon .Class ()
131133}
132134
135+ // UniqueID returns the unique id of the equipment element.
136+ // The unique id is a random int generated internally by this library and can be used to differentiate
137+ // equipment from each other. This is needed because demo-files reuse entity ids.
138+ func (e Equipment ) UniqueID () int64 {
139+ return e .uniqueID
140+ }
141+
133142// NewGrenadeProjectile creates a grenade projectile and sets.
134143func NewGrenadeProjectile () * GrenadeProjectile {
135144 return & GrenadeProjectile {uniqueID : rand .Int63 ()}
136145}
137146
138- // UniqueID returns the internal id of the grenade, which is used to distinguish grenades that reuse another entity's entity id.
147+ // UniqueID returns the unique id of the grenade.
148+ // The unique id is a random int generated internally by this library and can be used to differentiate
149+ // grenades from each other. This is needed because demo-files reuse entity ids.
139150func (g GrenadeProjectile ) UniqueID () int64 {
140151 return g .uniqueID
141152}
@@ -153,7 +164,7 @@ func NewSkinEquipment(eqName string, skinID string) Equipment {
153164 } else {
154165 wep = EqUnknown
155166 }
156- return Equipment {Weapon : wep , SkinID : skinID }
167+ return Equipment {Weapon : wep , SkinID : skinID , uniqueID : rand . Int63 () }
157168}
158169
159170// NewPlayer creates a *Player with an initialized equipment map.
0 commit comments