Files
crystall-punk-14/Content.Shared/_CP14/Skill/Effects/AddAction.cs
Ed be495f274c Skill progression system (#1263)
* delete skill trees

* Revert "delete skill trees"

This reverts commit 9d7fae73c4.

* learning refactor

* UI tweaks

* sword mastery skill

* telegraphy

* rapier mastery

* research table ui

* finish studing

* polish UI researching

* pyrokinetic

* more skill tree working

* heat adapt

* alchemist and metamagic update

* skill multiple effects support + metamagic bugg manapool

* impossible 😢

* skimitar gaming

* skimidi

* blacksmithing branch

* remove research restrictions

* remove species magic buff

* fix loc

* Update thaumaturgy.yml

* pip

* Delete skill_tree.yml
2025-05-14 12:43:43 +03:00

48 lines
1.5 KiB
C#

using Content.Shared._CP14.Skill.Prototypes;
using Content.Shared.Actions;
using Robust.Shared.Prototypes;
namespace Content.Shared._CP14.Skill.Effects;
public sealed partial class AddAction : CP14SkillEffect
{
[DataField(required: true)]
public EntProtoId Action;
public override void AddSkill(IEntityManager entManager, EntityUid target)
{
var actionsSystem = entManager.System<SharedActionsSystem>();
actionsSystem.AddAction(target, Action);
}
public override void RemoveSkill(IEntityManager entManager, EntityUid target)
{
var actionsSystem = entManager.System<SharedActionsSystem>();
foreach (var (uid, _) in actionsSystem.GetActions(target))
{
if (!entManager.TryGetComponent<MetaDataComponent>(uid, out var metaData))
continue;
if (metaData.EntityPrototype == null)
continue;
if (metaData.EntityPrototype != Action)
continue;
actionsSystem.RemoveAction(target, uid);
}
}
public override string? GetName(IEntityManager entMagager, IPrototypeManager protoManager)
{
return !protoManager.TryIndex(Action, out var indexedAction) ? string.Empty : indexedAction.Name;
}
public override string? GetDescription(IEntityManager entMagager, IPrototypeManager protoManager, ProtoId<CP14SkillPrototype> skill)
{
return !protoManager.TryIndex(Action, out var indexedAction) ? string.Empty : indexedAction.Description;
}
}