2025-05-14 12:43:43 +03:00
using Content.Shared._CP14.ResearchTable ;
2025-03-27 17:20:20 +03:00
using Content.Shared._CP14.Skill.Prototypes ;
using Content.Shared.FixedPoint ;
using Robust.Shared.GameStates ;
using Robust.Shared.Prototypes ;
using Robust.Shared.Serialization ;
namespace Content.Shared._CP14.Skill.Components ;
/// <summary>
/// Component that stores the skills learned by a player and their progress in the skill trees.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
2025-05-14 12:43:43 +03:00
[Access(typeof(CP14SharedSkillSystem), typeof(CP14SharedResearchSystem))]
2025-03-27 17:20:20 +03:00
public sealed partial class CP14SkillStorageComponent : Component
{
2025-05-18 00:37:04 +03:00
/// <summary>
/// Tracks skills that are learned without spending memory points.
/// the skills that are here are DUBLED in the LearnedSkills,
/// </summary>
[DataField, AutoNetworkedField]
public List < ProtoId < CP14SkillPrototype > > FreeLearnedSkills = new ( ) ;
2025-03-27 17:20:20 +03:00
[DataField, AutoNetworkedField]
public List < ProtoId < CP14SkillPrototype > > LearnedSkills = new ( ) ;
/// <summary>
2025-05-14 12:43:43 +03:00
/// skills that the player has learned on the research table, but has not yet learned in the skill tree.
2025-03-27 17:20:20 +03:00
/// </summary>
[DataField, AutoNetworkedField]
2025-05-14 12:43:43 +03:00
public List < ProtoId < CP14SkillPrototype > > ResearchedSkills = new ( ) ;
2025-03-27 17:20:20 +03:00
/// <summary>
2025-05-14 12:43:43 +03:00
/// The number of experience points spent on skills. Technically this could be calculated via LearnedSkills, but this is a cached value for optimization.
2025-03-27 17:20:20 +03:00
/// </summary>
[DataField, AutoNetworkedField]
2025-05-14 12:43:43 +03:00
public FixedPoint2 SkillsSumExperience = 0 ;
2025-03-27 17:20:20 +03:00
/// <summary>
/// The maximum ceiling of experience points that can be spent on learning skills. Not tied to a category.
/// </summary>
[DataField, AutoNetworkedField]
2025-05-14 12:43:43 +03:00
public FixedPoint2 ExperienceMaxCap = 5 ;
2025-03-27 17:20:20 +03:00
}
/// <summary>
/// Raised when a player attempts to learn a skill. This is sent from the client to the server.
/// </summary>
[Serializable, NetSerializable]
public sealed class CP14TryLearnSkillMessage ( NetEntity entity , ProtoId < CP14SkillPrototype > skill ) : EntityEventArgs
{
public readonly NetEntity Entity = entity ;
public readonly ProtoId < CP14SkillPrototype > Skill = skill ;
}