fix: correct cancelDeath logic in PlayerStageState for server ticks
This commit is contained in:
parent
b14020c1a1
commit
d71b7ae89d
1 changed files with 7 additions and 4 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue