using Content.Shared.Ninja.Components; using Content.Shared.Weapons.Melee.Events; using Robust.Shared.GameStates; using Robust.Shared.Network; namespace Content.Shared.Ninja.Systems; public abstract class SharedNinjaSystem : EntitySystem { [Dependency] protected readonly SharedNinjaSuitSystem _suit = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnNinjaAttacked); } /// /// Sets the station grid entity that the ninja was spawned near. /// public void SetStationGrid(NinjaComponent comp, EntityUid? grid) { comp.StationGrid = grid; } /// /// Set the ninja's worn suit entity /// public void AssignSuit(NinjaComponent comp, EntityUid? suit) { comp.Suit = suit; } /// /// Set the ninja's worn gloves entity /// public void AssignGloves(NinjaComponent comp, EntityUid? gloves) { comp.Gloves = gloves; } /// /// Bind a katana entity to a ninja, letting it be recalled and dash. /// public void BindKatana(NinjaComponent comp, EntityUid? katana) { comp.Katana = katana; } // TODO: remove when objective stuff moved into objectives somehow public void DetonateSpiderCharge(NinjaComponent comp) { comp.SpiderChargeDetonated = true; } /// /// Marks the objective as complete. /// On server, makes announcement and adds rule of random threat. /// public virtual void CallInThreat(NinjaComponent comp) { comp.CalledInThreat = true; } /// /// Drain power from a target battery into the ninja's suit battery. /// Serverside only. /// public virtual void TryDrainPower(EntityUid user, NinjaDrainComponent drain, EntityUid target) { } /// /// Download the given set of nodes, returning how many new nodes were downloaded.' /// public int Download(NinjaComponent ninja, List ids) { var oldCount = ninja.DownloadedNodes.Count; ninja.DownloadedNodes.UnionWith(ids); var newCount = ninja.DownloadedNodes.Count; return newCount - oldCount; } /// /// Gets the user's battery and tries to use some charge from it, returning true if successful. /// Serverside only. /// public virtual bool TryUseCharge(EntityUid user, float charge) { return false; } private void OnNinjaAttacked(EntityUid uid, NinjaComponent comp, AttackedEvent args) { if (comp.Suit != null && TryComp(comp.Suit, out var suit) && suit.Cloaked) { _suit.RevealNinja(comp.Suit.Value, suit, uid, true); } } }