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-07-05 20:44:38 +03:00
|
|
|
[Access(typeof(CP14SharedSkillSystem))]
|
2025-03-27 17:20:20 +03:00
|
|
|
public sealed partial class CP14SkillStorageComponent : Component
|
|
|
|
|
{
|
2025-06-13 14:15:48 +03:00
|
|
|
/// <summary>
|
|
|
|
|
/// Skill trees displayed in the skill tree interface. Only skills from these trees can be learned by this player.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public HashSet<ProtoId<CP14SkillTreePrototype>> AvailableSkillTrees = new();
|
|
|
|
|
|
2025-05-18 00:37:04 +03:00
|
|
|
/// <summary>
|
|
|
|
|
/// Tracks skills that are learned without spending memory points.
|
2025-06-13 14:15:48 +03:00
|
|
|
/// the skills that are here are DOUBLED in the LearnedSkills,
|
2025-05-18 00:37:04 +03:00
|
|
|
/// </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();
|
|
|
|
|
|
|
|
|
|
[DataField, AutoNetworkedField]
|
2025-07-27 13:47:05 +03:00
|
|
|
public Dictionary<ProtoId<CP14SkillPointPrototype>, CP14SkillPointContainerEntry> SkillPoints = new();
|
|
|
|
|
}
|
2025-03-27 17:20:20 +03:00
|
|
|
|
2025-07-27 13:47:05 +03:00
|
|
|
[DataDefinition, Serializable, NetSerializable]
|
|
|
|
|
public sealed partial class CP14SkillPointContainerEntry
|
|
|
|
|
{
|
2025-03-27 17:20:20 +03:00
|
|
|
/// <summary>
|
2025-07-27 13:47:05 +03:00
|
|
|
/// The number of experience points spent on skills.
|
2025-03-27 17:20:20 +03:00
|
|
|
/// </summary>
|
2025-07-27 13:47:05 +03:00
|
|
|
[DataField]
|
|
|
|
|
public FixedPoint2 Sum = 0;
|
2025-03-27 17:20:20 +03:00
|
|
|
|
|
|
|
|
/// <summary>
|
2025-07-27 13:47:05 +03:00
|
|
|
/// The maximum of experience points that can be spent on learning skills.
|
2025-03-27 17:20:20 +03:00
|
|
|
/// </summary>
|
2025-07-27 13:47:05 +03:00
|
|
|
[DataField]
|
|
|
|
|
public FixedPoint2 Max = 0;
|
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;
|
|
|
|
|
}
|