From 944369b05e849c8cfb2da13ecb0dadeca5c8cb0b Mon Sep 17 00:00:00 2001 From: UnKownOwO <80520429@qq.com> Date: Wed, 18 Oct 2023 23:26:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E8=83=BD=E4=BF=AE=E5=A4=8D=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6=E4=BD=8D=E7=BD=AE=E5=90=8C=E6=AD=A5=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8Dai=E4=B8=96=E7=95=8C=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E6=9B=B4=E6=96=B0=E5=A4=A9=E6=B0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gs/game/game_world_scene.go | 18 +++++++++++++----- gs/game/player_fight_sync.go | 4 ++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gs/game/game_world_scene.go b/gs/game/game_world_scene.go index 3945c94c..3b1d7588 100644 --- a/gs/game/game_world_scene.go +++ b/gs/game/game_world_scene.go @@ -96,11 +96,19 @@ func (s *Scene) CreateEntityAvatar(player *model.Player, avatarId uint32) uint32 return 0 } entity := &Entity{ - id: entityId, - scene: s, - lifeState: avatar.LifeState, - pos: player.Pos, // 所有角色实体暂时公用玩家的位置信息 - rot: player.Rot, + id: entityId, + scene: s, + lifeState: avatar.LifeState, + pos: &model.Vector{ + X: player.Pos.X, + Y: player.Pos.Y, + Z: player.Pos.Z, + }, // 所有角色实体暂时公用玩家的位置信息 + rot: &model.Vector{ + X: player.Rot.X, + Y: player.Rot.Y, + Z: player.Rot.Z, + }, moveState: uint16(proto.MotionState_MOTION_NONE), lastMoveSceneTimeMs: 0, lastMoveReliableSeq: 0, diff --git a/gs/game/player_fight_sync.go b/gs/game/player_fight_sync.go index 4d59a947..db2f527e 100644 --- a/gs/game/player_fight_sync.go +++ b/gs/game/player_fight_sync.go @@ -244,6 +244,8 @@ func (g *Game) handleEntityMove(player *model.Player, world *World, scene *Scene } else { g.AiWorldAoiPlayerMove(player, world, scene, player.Pos, pos) } + // 场景天气区域变更检测 + g.SceneWeatherAreaCheck(player, player.Pos, pos) // 更新玩家的位置信息 player.Pos.X, player.Pos.Y, player.Pos.Z = pos.X, pos.Y, pos.Z player.Rot.X, player.Rot.Y, player.Rot.Z = rot.X, rot.Y, rot.Z @@ -382,8 +384,6 @@ func (g *Game) SceneBlockAoiPlayerMove(player *model.Player, world *World, scene } // 场景区域触发器检测 g.SceneRegionTriggerCheck(player, oldPos, newPos, avatarEntityId) - // 场景天气区域变更检测 - g.SceneWeatherAreaCheck(player, oldPos, newPos) } func (g *Game) AiWorldAoiPlayerMove(player *model.Player, world *World, scene *Scene, oldPos *model.Vector, newPos *model.Vector) {