Archived
1
0
Fork 0

fix: correct cancelDeath logic in PlayerStageState for server ticks

This commit is contained in:
Sebastian Benjamin 2025-06-03 18:41:49 -07:00 committed by Sebastian Benjamin (aider)
parent b14020c1a1
commit d71b7ae89d

View file

@ -17,6 +17,7 @@ type PlayerStageState struct {
score int score int
deathTimer int deathTimer int
cancelDeath bool cancelDeath bool
}
func NewPlayerStage() *PlayerStageState { func NewPlayerStage() *PlayerStageState {
return &PlayerStageState{ return &PlayerStageState{
@ -26,10 +27,7 @@ func NewPlayerStage() *PlayerStageState {
updatePlayerPos: true, updatePlayerPos: true,
health: 3, health: 3,
deathTimer: -1, deathTimer: -1,
if s.cancelDeath { }
tickData.CancelDeath = true
s.cancelDeath = false
}
} }
func (s *PlayerStageState) Delete() { func (s *PlayerStageState) Delete() {
@ -117,6 +115,11 @@ func (s *PlayerStageState) MakeServerTick(tick int64, serializedNewBullets []map
UTCTime: float64(time.Now().UnixMilli()) / 1000.0, UTCTime: float64(time.Now().UnixMilli()) / 1000.0,
} }
if s.cancelDeath {
tickData.CancelDeath = true
s.cancelDeath = false
}
// When this is called, we want to transmit updatePlayerPos if it's true once and then reset // When this is called, we want to transmit updatePlayerPos if it's true once and then reset
s.updatePlayerPos = false s.updatePlayerPos = false