fix: correct player state checks in game loop functions
This commit is contained in:
parent
17ff5ddc39
commit
0945e220e3
1 changed files with 3 additions and 1 deletions
|
|
@ -48,6 +48,8 @@ func RespondToInput(lobbyState *MatchState, messages []runtime.MatchData, logger
|
||||||
for t := update.Tick; t < tick; t++ {
|
for t := update.Tick; t < tick; t++ {
|
||||||
if lobbyState.presences[msg.GetSessionId()].stageState.CheckCollisionState(t) == PLAYER_DEAD {
|
if lobbyState.presences[msg.GetSessionId()].stageState.CheckCollisionState(t) == PLAYER_DEAD {
|
||||||
playerSurvives = false
|
playerSurvives = false
|
||||||
|
}
|
||||||
|
}
|
||||||
// Set a flag to cancel death if the player survives all ticks
|
// Set a flag to cancel death if the player survives all ticks
|
||||||
if playerSurvives {
|
if playerSurvives {
|
||||||
lobbyState.presences[msg.GetSessionId()].stageState.cancelDeath = true
|
lobbyState.presences[msg.GetSessionId()].stageState.cancelDeath = true
|
||||||
|
|
@ -96,7 +98,7 @@ func BroadcastToPresences(tick int64, lobbyState *MatchState, logger *runtime.Lo
|
||||||
v.stageState.DeleteBulletsBeyondKillBoundary(tick)
|
v.stageState.DeleteBulletsBeyondKillBoundary(tick)
|
||||||
|
|
||||||
var newBulletsToBroadcast = []map[string]any{}
|
var newBulletsToBroadcast = []map[string]any{}
|
||||||
if v.stageState.CheckDeathState(tick) == PLAYER_ALIVE {
|
if v.stageState.CheckCollisionState(tick) == PLAYER_ALIVE {
|
||||||
newBullets := TestFireBullets(tick)
|
newBullets := TestFireBullets(tick)
|
||||||
|
|
||||||
for _, bullet := range newBullets {
|
for _, bullet := range newBullets {
|
||||||
|
|
|
||||||
Reference in a new issue