From 67821ba780946d9d338b163e6d89e5abce3315a5 Mon Sep 17 00:00:00 2001 From: UnKownOwO <80520429@qq.com> Date: Sat, 4 Feb 2023 18:07:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=98=E6=96=97=E5=B1=9E=E6=80=A7=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E8=A7=92=E8=89=B2=E7=BB=93=E6=9E=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gs/game/player_scene.go | 4 ++-- gs/game/world_manager.go | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gs/game/player_scene.go b/gs/game/player_scene.go index d5c5e996..4e66e474 100644 --- a/gs/game/player_scene.go +++ b/gs/game/player_scene.go @@ -709,8 +709,8 @@ func (g *GameManager) PacketSceneEntityInfoAvatar(scene *Scene, player *model.Pl Val: int64(avatar.SatiationPenalty)}, }, }, - FightPropList: g.PacketFightPropMapToPbFightPropList(entity.fightProp), - LifeState: uint32(entity.lifeState), + FightPropList: g.PacketFightPropMapToPbFightPropList(avatar.FightPropMap), + LifeState: uint32(avatar.LifeState), AnimatorParaList: make([]*proto.AnimatorParameterValueInfoPair, 0), Entity: &proto.SceneEntityInfo_Avatar{ Avatar: g.PacketSceneAvatarInfo(scene, player, avatarId), diff --git a/gs/game/world_manager.go b/gs/game/world_manager.go index db89958e..2dced467 100644 --- a/gs/game/world_manager.go +++ b/gs/game/world_manager.go @@ -851,18 +851,23 @@ func (s *Scene) SetEntityLifeState(entity *Entity, lifeState uint16, dieType pro func (s *Scene) CreateEntityAvatar(player *model.Player, avatarId uint32) uint32 { entityId := s.world.GetNextWorldEntityId(constant.EntityIdTypeConst.AVATAR) + avatar, ok := player.AvatarMap[avatarId] + if !ok { + logger.Error("avatar error, avatarId: %v", avatar) + return 0 + } entity := &Entity{ id: entityId, scene: s, - lifeState: constant.LifeStateConst.LIFE_ALIVE, + lifeState: avatar.LifeState, pos: player.Pos, rot: player.Rot, moveState: uint16(proto.MotionState_MOTION_NONE), lastMoveSceneTimeMs: 0, lastMoveReliableSeq: 0, - fightProp: player.AvatarMap[avatarId].FightPropMap, - entityType: uint32(proto.ProtEntityType_PROT_ENTITY_AVATAR), - level: 0, // 角色等级直接读取角色对象 + // fightProp: player.AvatarMap[avatarId].FightPropMap, // 使用角色结构的数据 + entityType: uint32(proto.ProtEntityType_PROT_ENTITY_AVATAR), + // level: 0, // 使用角色结构的数据 avatarEntity: &AvatarEntity{ uid: player.PlayerID, avatarId: avatarId,