Skip to content

Commit ab7f207

Browse files
committed
common: add Player.TeamState field
closes #89
1 parent 8c642b5 commit ab7f207

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

common/player.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type Player struct {
3131
ViewDirectionY float32
3232
FlashDuration float32 // Blindness duration from the flashbang currently affecting the player (seconds)
3333
Team Team
34+
TeamState *TeamState // When keeping the reference make sure you notice when the player changes teams
3435
IsBot bool
3536
IsDucking bool
3637
IsDefusing bool

datatables.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ func (p *Parser) bindNewPlayer(playerEntity *st.Entity) {
203203
// General info
204204
playerEntity.FindProperty("m_iTeamNum").OnUpdate(func(val st.PropertyValue) {
205205
pl.Team = common.Team(val.IntVal) // Need to cast to team so we can't use BindProperty
206+
pl.TeamState = p.gameState.Team(pl.Team)
206207
})
207208
playerEntity.BindProperty("m_iHealth", &pl.Hp, st.ValTypeInt)
208209
playerEntity.BindProperty("m_ArmorValue", &pl.Armor, st.ValTypeInt)

0 commit comments

Comments
 (0)