可能修复玩家位置同步异常,修复ai世界动态更新天气
This commit is contained in:
1 parent
e08e9579bd
commit
944369b05e
2 files changed
+15
-7
No files matched your search
@@ -96,11 +96,19 @@ func (s *Scene) CreateEntityAvatar(player *model.Player, avatarId uint32) uint32
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
entity := &Entity{
|
entity := &Entity{
|
||||||
id: entityId,
|
id: entityId,
|
||||||
scene: s,
|
scene: s,
|
||||||
lifeState: avatar.LifeState,
|
lifeState: avatar.LifeState,
|
||||||
pos: player.Pos, // 所有角色实体暂时公用玩家的位置信息
|
pos: &model.Vector{
|
||||||
rot: player.Rot,
|
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),
|
moveState: uint16(proto.MotionState_MOTION_NONE),
|
||||||
lastMoveSceneTimeMs: 0,
|
lastMoveSceneTimeMs: 0,
|
||||||
lastMoveReliableSeq: 0,
|
lastMoveReliableSeq: 0,
|
||||||
|
|||||||
@@ -244,6 +244,8 @@ func (g *Game) handleEntityMove(player *model.Player, world *World, scene *Scene
|
|||||||
} else {
|
} else {
|
||||||
g.AiWorldAoiPlayerMove(player, world, scene, player.Pos, pos)
|
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.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
|
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.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) {
|
func (g *Game) AiWorldAoiPlayerMove(player *model.Player, world *World, scene *Scene, oldPos *model.Vector, newPos *model.Vector) {
|
||||||
|
|||||||
Reference in new issue
Block a user