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
deathTimer int
cancelDeath bool
}
func NewPlayerStage() *PlayerStageState {
return &PlayerStageState{
@ -26,9 +27,6 @@ func NewPlayerStage() *PlayerStageState {
updatePlayerPos: true,
health: 3,
deathTimer: -1,
if s.cancelDeath {
tickData.CancelDeath = true
s.cancelDeath = false
}
}
@ -117,6 +115,11 @@ func (s *PlayerStageState) MakeServerTick(tick int64, serializedNewBullets []map
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
s.updatePlayerPos = false