ai世界aoi管理器调试
This commit is contained in:
1 parent
bd12f6a8b7
commit
2059af5304
5 files changed
+19
-9
No files matched your search
@@ -270,12 +270,18 @@ func (t *TickManager) onTick5Second(now int64) {
|
||||
GAME.ScenePlayerLocationNotify(world)
|
||||
}
|
||||
}
|
||||
iPlugin, err := PLUGIN_MANAGER.GetPlugin(&PluginPubg{})
|
||||
if err != nil {
|
||||
logger.Error("get plugin pubg error: %v", err)
|
||||
return
|
||||
}
|
||||
pluginPubg := iPlugin.(*PluginPubg)
|
||||
if pluginPubg.IsStartPubg() {
|
||||
return
|
||||
}
|
||||
aiWorld := WORLD_MANAGER.GetAiWorld()
|
||||
if WORLD_MANAGER.IsAiWorld(aiWorld) {
|
||||
// todo pubg允许超过100人
|
||||
if len(aiWorld.GetAllPlayer()) >= 100 {
|
||||
return
|
||||
}
|
||||
if aiWorld.GetWorldPlayerNum() >= 100 {
|
||||
return
|
||||
}
|
||||
for applyUid := range aiWorld.GetOwner().CoopApplyMap {
|
||||
GAME.PlayerDealEnterWorld(aiWorld.GetOwner(), applyUid, true)
|
||||
|
||||
@@ -431,6 +431,7 @@ func (g *Game) AiWorldAoiPlayerMove(player *model.Player, world *World, scene *S
|
||||
activeAvatarId := world.GetPlayerActiveAvatarId(player)
|
||||
activeWorldAvatar := world.GetPlayerWorldAvatar(player, activeAvatarId)
|
||||
// 老格子移除玩家
|
||||
logger.Debug("ai world aoi remove player, oldPos: %+v, uid: %v", oldPos, player.PlayerId)
|
||||
ok := aiWorldAoi.RemoveObjectFromGridByPos(int64(player.PlayerId), float32(oldPos.X), float32(oldPos.Y), float32(oldPos.Z))
|
||||
if !ok {
|
||||
logger.Error("ai world aoi remove player fail, uid: %v, pos: %+v", player.PlayerId, player.Pos)
|
||||
@@ -481,6 +482,7 @@ func (g *Game) AiWorldAoiPlayerMove(player *model.Player, world *World, scene *S
|
||||
}
|
||||
}
|
||||
// 新格子添加玩家
|
||||
logger.Debug("ai world aoi add player, newPos: %+v, uid: %v", newPos, player.PlayerId)
|
||||
ok = aiWorldAoi.AddObjectToGridByPos(int64(player.PlayerId), activeWorldAvatar, float32(newPos.X), float32(newPos.Y), float32(newPos.Z))
|
||||
if !ok {
|
||||
logger.Error("ai world aoi add player fail, uid: %v, pos: %+v", player.PlayerId, player.Pos)
|
||||
|
||||
@@ -450,6 +450,7 @@ func (g *Game) WorldRemovePlayer(world *World, player *model.Player) {
|
||||
|
||||
if WORLD_MANAGER.IsAiWorld(world) {
|
||||
aiWorldAoi := world.GetAiWorldAoi()
|
||||
logger.Debug("ai world aoi remove player, oldPos: %+v, uid: %v", player.Pos, player.PlayerId)
|
||||
ok := aiWorldAoi.RemoveObjectFromGridByPos(int64(player.PlayerId), float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
||||
if !ok {
|
||||
logger.Error("ai world aoi remove player fail, uid: %v, pos: %+v", player.PlayerId, player.Pos)
|
||||
|
||||
@@ -312,6 +312,7 @@ func (g *Game) EnterSceneDoneReq(player *model.Player, payloadMsg pb.Message) {
|
||||
|
||||
if WORLD_MANAGER.IsAiWorld(world) {
|
||||
aiWorldAoi := world.GetAiWorldAoi()
|
||||
logger.Debug("ai world aoi add player, newPos: %+v, uid: %v", player.Pos, player.PlayerId)
|
||||
ok := aiWorldAoi.AddObjectToGridByPos(int64(player.PlayerId), activeWorldAvatar, float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
||||
if !ok {
|
||||
logger.Error("ai world aoi add player fail, uid: %v, pos: %+v", player.PlayerId, player.Pos)
|
||||
|
||||
@@ -677,8 +677,7 @@ func (g *Game) TeleportPlayer(
|
||||
return
|
||||
}
|
||||
|
||||
if WORLD_MANAGER.IsAiWorld(world) && sceneId != 3 {
|
||||
logger.Error("ai world scene not support now, sceneId: %v, uid: %v", sceneId, player.PlayerId)
|
||||
if WORLD_MANAGER.IsAiWorld(world) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -697,9 +696,10 @@ func (g *Game) TeleportPlayer(
|
||||
|
||||
if WORLD_MANAGER.IsAiWorld(world) {
|
||||
aiWorldAoi := world.GetAiWorldAoi()
|
||||
ok := aiWorldAoi.RemoveObjectFromGridByPos(int64(player.PlayerId), float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
||||
logger.Debug("ai world aoi remove player, oldPos: %+v, uid: %v", oldPos, player.PlayerId)
|
||||
ok := aiWorldAoi.RemoveObjectFromGridByPos(int64(player.PlayerId), float32(oldPos.X), float32(oldPos.Y), float32(oldPos.Z))
|
||||
if !ok {
|
||||
logger.Error("ai world aoi remove player fail, uid: %v, pos: %+v", player.PlayerId, player.Pos)
|
||||
logger.Error("ai world aoi remove player fail, uid: %v, pos: %+v", player.PlayerId, oldPos)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user