mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-04 14:22:26 +08:00
优化
This commit is contained in:
@@ -260,7 +260,7 @@ func (g *Game) SceneBlockAoiPlayerMove(player *model.Player, world *World, scene
|
||||
if !world.GetMultiplayer() {
|
||||
// 单人世界直接卸载group
|
||||
g.RemoveSceneGroup(player, scene, groupConfig)
|
||||
} else {
|
||||
} else if !WORLD_MANAGER.IsBigWorld(world) {
|
||||
// 多人世界group附近没有任何玩家则卸载
|
||||
remove := true
|
||||
for _, otherPlayer := range scene.GetAllPlayer() {
|
||||
@@ -418,6 +418,10 @@ func (g *Game) BigWorldAoiPlayerMove(player *model.Player, world *World, scene *
|
||||
}
|
||||
// 新格子添加玩家
|
||||
bigWorldAoi.AddObjectToGrid(int64(player.PlayerID), activeWorldAvatar, newGid)
|
||||
// aoi区域玩家数量限制
|
||||
if len(bigWorldAoi.GetObjectListByGid(newGid)) > 8 {
|
||||
g.LogoutPlayer(player.PlayerID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ func (g *Game) EnterSceneReadyReq(player *model.Player, payloadMsg pb.Message) {
|
||||
if !world.GetMultiplayer() {
|
||||
// 单人世界直接卸载group
|
||||
g.RemoveSceneGroup(player, oldScene, groupConfig)
|
||||
} else {
|
||||
} else if !WORLD_MANAGER.IsBigWorld(world) {
|
||||
// 多人世界group附近没有任何玩家则卸载
|
||||
remove := true
|
||||
for _, otherPlayer := range oldScene.GetAllPlayer() {
|
||||
@@ -343,6 +343,14 @@ func (g *Game) EnterSceneDoneReq(player *model.Player, payloadMsg pb.Message) {
|
||||
}
|
||||
g.JoinOtherWorld(otherPlayer, player)
|
||||
}
|
||||
|
||||
if WORLD_MANAGER.IsBigWorld(world) {
|
||||
// aoi区域玩家数量限制
|
||||
bigWorldAoi := world.GetBigWorldAoi()
|
||||
if len(bigWorldAoi.GetObjectListByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))) > 8 {
|
||||
g.LogoutPlayer(player.PlayerID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (g *Game) PostEnterSceneReq(player *model.Player, payloadMsg pb.Message) {
|
||||
|
||||
Reference in New Issue
Block a user