diff --git a/gs/game/game_manager.go b/gs/game/game_manager.go index b23f9fd9..ac68b8b1 100644 --- a/gs/game/game_manager.go +++ b/gs/game/game_manager.go @@ -158,7 +158,7 @@ func (g *GameManager) run() { } func (g *GameManager) gameMainLoopD() { - for times := 1; times <= 1000; times++ { + for times := 1; times <= 100000; times++ { logger.Warn("start game main loop, times: %v", times) g.gameMainLoop() logger.Warn("game main loop stop") diff --git a/gs/game/player_stamina.go b/gs/game/player_stamina.go index 3947d140..d37a8d9b 100644 --- a/gs/game/player_stamina.go +++ b/gs/game/player_stamina.go @@ -325,17 +325,20 @@ func (g *GameManager) VehicleRestoreStaminaHandler(player *model.Player) { func (g *GameManager) SustainStaminaHandler(player *model.Player) { world := WORLD_MANAGER.GetWorldByID(player.WorldId) scene := world.GetSceneById(player.SceneId) - // 玩家暂停状态不更新耐力 if player.Pause { return } - // 获取玩家处于的载具实体 entity := scene.GetEntity(player.VehicleInfo.InVehicleEntityId) + if entity == nil { + // 更新玩家耐力 + g.UpdatePlayerStamina(player, player.StaminaInfo.CostStamina) + return + } // 确保实体类型是否为载具 且 根据玩家是否处于载具中更新耐力 gadgetEntity := entity.GetGadgetEntity() - if entity != nil && (gadgetEntity != nil && gadgetEntity.GetGadgetVehicleEntity() != nil) && g.IsPlayerInVehicle(player, gadgetEntity.GetGadgetVehicleEntity()) { + if gadgetEntity != nil && gadgetEntity.GetGadgetVehicleEntity() != nil && g.IsPlayerInVehicle(player, gadgetEntity.GetGadgetVehicleEntity()) { // 更新载具耐力 g.UpdateVehicleStamina(player, entity, player.StaminaInfo.CostStamina) } else { diff --git a/gs/game/tick_manager.go b/gs/game/tick_manager.go index 022957bc..1677ec74 100644 --- a/gs/game/tick_manager.go +++ b/gs/game/tick_manager.go @@ -346,10 +346,10 @@ func (t *TickManager) onTickSecond(now int64) { } } } - // GCG游戏Tick - for _, game := range GCG_MANAGER.gameMap { - game.onTick() - } + // // GCG游戏Tick + // for _, game := range GCG_MANAGER.gameMap { + // game.onTick() + // } } func (t *TickManager) onTick200MilliSecond(now int64) {