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,