Skip to content

Commit 99d885f

Browse files
committed
S2 fix team scores
1 parent 2c97ec8 commit 99d885f

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

pkg/demoinfocs/datatables.go

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,7 @@ func (p *parser) bindBomb() {
119119
func (p *parser) bindTeamStates() {
120120
p.stParser.ServerClasses().FindByName("CCSTeam").OnEntityCreated(func(entity st.Entity) {
121121
teamVal := entity.PropertyValueMust("m_szTeamname")
122-
team := teamVal.StringVal
123-
124-
// FIXME: S2 fix
125-
if team == "" {
126-
team = teamVal.Any.(string)
127-
}
122+
team := teamVal.String()
128123

129124
var s *common.TeamState
130125

@@ -146,22 +141,24 @@ func (p *parser) bindTeamStates() {
146141
s.Entity = entity
147142

148143
// Register updates
149-
var score int
150-
151-
scoreProp := entity.Property("m_scoreTotal")
144+
var (
145+
scoreProp st.Property
146+
score int
147+
)
152148

153-
// FIXME: S2 fix
154-
if scoreProp == nil {
149+
if p.isSource2() {
155150
scoreProp = entity.Property("m_iScore")
151+
} else {
152+
scoreProp = entity.Property("m_scoreTotal")
156153
}
157154

158155
scoreProp.OnUpdate(func(val st.PropertyValue) {
159156
oldScore := score
160-
score = val.IntVal // FIXME: fix for S2
157+
score = val.Int()
161158

162159
p.eventDispatcher.Dispatch(events.ScoreUpdated{
163160
OldScore: oldScore,
164-
NewScore: val.IntVal, // FIXME: fix for S2
161+
NewScore: val.Int(),
165162
TeamState: s,
166163
})
167164
})

0 commit comments

Comments
 (0)