diff --git a/Content.Client/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwapped.cs b/Content.Client/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwapped.cs index 0c038c0ba1..9544b3a4b2 100644 --- a/Content.Client/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwapped.cs +++ b/Content.Client/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwapped.cs @@ -49,12 +49,12 @@ private void OnShutdown(EntityUid uid, ShadowkinDarkSwappedComponent component, RemoveOverlay(); } - private void OnPlayerAttached(EntityUid uid, ShadowkinDarkSwappedComponent component, PlayerAttachedEvent args) + private void OnPlayerAttached(EntityUid uid, ShadowkinDarkSwappedComponent component)//, PlayerAttachedEvent args) { AddOverlay(); } - private void OnPlayerDetached(EntityUid uid, ShadowkinDarkSwappedComponent component, PlayerDetachedEvent args) + private void OnPlayerDetached(EntityUid uid, ShadowkinDarkSwappedComponent component)//, PlayerDetachedEvent args) { RemoveOverlay(); } diff --git a/Content.Client/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Blackeye.cs b/Content.Client/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Blackeye.cs index 9af16385e5..5a4db8f392 100644 --- a/Content.Client/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Blackeye.cs +++ b/Content.Client/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Blackeye.cs @@ -22,7 +22,8 @@ public override void Initialize() private void OnBlackeye(ShadowkinBlackeyeEvent ev) { - SetColor(ev.Uid, Color.Black); + var uid = _entity.GetEntity(ev.Ent); + SetColor(uid, Color.Black); } @@ -36,8 +37,9 @@ private void OnInit(EntityUid uid, ShadowkinComponent component, ComponentInit a // Blackeye if none of the RGB values are greater than 75 if (layer.Color.R * 255 < 75 && layer.Color.G * 255 < 75 && layer.Color.B * 255 < 75) { - // TODO Need to move this to server somehow, can't trust the client with this - RaiseNetworkEvent(new ShadowkinBlackeyeEvent(uid, false)); + // TODO Need to move this to server somehow, can't trust the client with this + var ent = _entity.GetNetEntity(uid); + RaiseNetworkEvent(new ShadowkinBlackeyeEvent(ent, false)); } } diff --git a/Content.Client/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Tint.cs b/Content.Client/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Tint.cs index 1e97a501c6..74613d28bf 100644 --- a/Content.Client/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Tint.cs +++ b/Content.Client/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Tint.cs @@ -53,12 +53,12 @@ private void OnShutdown(EntityUid uid, ShadowkinComponent component, ComponentSh _overlay.RemoveOverlay(_tintOverlay); } - private void OnPlayerAttached(EntityUid uid, ShadowkinComponent component, PlayerAttachedEvent args) + private void OnPlayerAttached(EntityUid uid, ShadowkinComponent component)// , PlayerAttachedEvent args) { _overlay.AddOverlay(_tintOverlay); } - private void OnPlayerDetached(EntityUid uid, ShadowkinComponent component, PlayerDetachedEvent args) + private void OnPlayerDetached(EntityUid uid, ShadowkinComponent component)// , PlayerDetachedEvent args) { _overlay.RemoveOverlay(_tintOverlay); } diff --git a/Content.Server/SimpleStation14/Chat/ESayCommand.cs b/Content.Server/SimpleStation14/Chat/ESayCommand.cs index d8c3eb3fcc..b9743c622a 100644 --- a/Content.Server/SimpleStation14/Chat/ESayCommand.cs +++ b/Content.Server/SimpleStation14/Chat/ESayCommand.cs @@ -18,7 +18,7 @@ internal sealed class ESayCommand : IConsoleCommand public void Execute(IConsoleShell shell, string argStr, string[] args) { - if (shell.Player is not IPlayerSession player) + /*if (shell.Player is not IPlayerSession player) { shell.WriteError("This command cannot be run from the server."); return; @@ -31,7 +31,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args) { shell.WriteError("You don't have an entity!"); return; - } + }*/ if (args.Length < 1) return; @@ -40,6 +40,6 @@ public void Execute(IConsoleShell shell, string argStr, string[] args) if (string.IsNullOrEmpty(message)) return; - EntitySystem.Get().TrySendInGameICMessage(playerEntity, message, InGameICChatType.Empathy, false, false, shell, player, checkRadioPrefix: false); + // EntitySystem.Get().TrySendInGameICMessage(playerEntity, message, InGameICChatType.Empathy, false, false, shell, player, checkRadioPrefix: false); } } diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs index e9488978a1..8522a1bfec 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs @@ -4,7 +4,6 @@ using Content.Server.NPC.Systems; using Content.Server.SimpleStation14.Species.Shadowkin.Components; using Content.Server.SimpleStation14.Species.Shadowkin.Events; -using Content.Server.Visible; using Content.Shared.Actions; using Content.Shared.CombatMode.Pacification; using Content.Shared.Cuffs.Components; @@ -64,6 +63,8 @@ private void Shutdown(EntityUid uid, ShadowkinDarkSwapPowerComponent component, private void DarkSwap(EntityUid uid, ShadowkinDarkSwapPowerComponent component, ShadowkinDarkSwapEvent args) { + var performer = _entity.GetNetEntity(args.Performer); + // Need power to drain power if (!_entity.HasComponent(args.Performer)) return; @@ -77,7 +78,7 @@ private void DarkSwap(EntityUid uid, ShadowkinDarkSwapPowerComponent component, var hasComp = _entity.HasComponent(args.Performer); SetDarkened( - args.Performer, + performer, !hasComp, !hasComp, !hasComp, @@ -98,7 +99,7 @@ private void DarkSwap(EntityUid uid, ShadowkinDarkSwapPowerComponent component, public void SetDarkened( - EntityUid performer, + NetEntity performer, bool addComp, bool invisible, bool pacify, @@ -114,34 +115,36 @@ public void SetDarkened( ShadowkinDarkSwapEvent? args ) { - var ev = new ShadowkinDarkSwapAttemptEvent(performer); + var performerUid = _entity.GetEntity(performer); + + var ev = new ShadowkinDarkSwapAttemptEvent(performerUid); RaiseLocalEvent(ev); if (ev.Cancelled) return; if (addComp) { - var comp = _entity.EnsureComponent(performer); + var comp = _entity.EnsureComponent(performerUid); comp.Invisible = invisible; comp.Pacify = pacify; comp.Darken = darken; RaiseNetworkEvent(new ShadowkinDarkSwappedEvent(performer, true)); - _audio.PlayPvs(soundOn, performer, AudioParams.Default.WithVolume(volumeOn)); + _audio.PlayPvs(soundOn, performerUid, AudioParams.Default.WithVolume(volumeOn)); - _power.TryAddPowerLevel(performer, -powerCostOn); - _stamina.TakeStaminaDamage(performer, staminaCostOn); + _power.TryAddPowerLevel(performerUid, -powerCostOn); + _stamina.TakeStaminaDamage(performerUid, staminaCostOn); } else { - _entity.RemoveComponent(performer); + _entity.RemoveComponent(performerUid); RaiseNetworkEvent(new ShadowkinDarkSwappedEvent(performer, false)); - _audio.PlayPvs(soundOff, performer, AudioParams.Default.WithVolume(volumeOff)); + _audio.PlayPvs(soundOff, performerUid, AudioParams.Default.WithVolume(volumeOff)); - _power.TryAddPowerLevel(performer, -powerCostOff); - _stamina.TakeStaminaDamage(performer, staminaCostOff); + _power.TryAddPowerLevel(performerUid, -powerCostOff); + _stamina.TakeStaminaDamage(performerUid, staminaCostOff); } if (args != null) @@ -198,8 +201,8 @@ public void SetVisibility(EntityUid uid, bool set) eye.VisibilityMask |= (uint) VisibilityFlags.DarkSwapInvisibility;*/ // Make other entities unable to see the entity unless also DarkSwapped - _visibility.AddLayer(uid, visibility, (int) VisibilityFlags.DarkSwapInvisibility, false); - _visibility.RemoveLayer(uid, visibility, (int) VisibilityFlags.Normal, false); + // _visibility.AddLayer(uid, visibility, (int) VisibilityFlags.DarkSwapInvisibility, false); + // _visibility.RemoveLayer(uid, visibility, (int) VisibilityFlags.Normal, false); _visibility.RefreshVisibility(uid); // If not a ghost, add a stealth shader to the entity @@ -213,8 +216,8 @@ public void SetVisibility(EntityUid uid, bool set) eye.VisibilityMask &= ~(uint) VisibilityFlags.DarkSwapInvisibility;*/ // Make other entities able to see the entity again - _visibility.RemoveLayer(uid, visibility, (int) VisibilityFlags.DarkSwapInvisibility, false); - _visibility.AddLayer(uid, visibility, (int) VisibilityFlags.Normal, false); + // _visibility.RemoveLayer(uid, visibility, (int) VisibilityFlags.DarkSwapInvisibility, false); + // _visibility.AddLayer(uid, visibility, (int) VisibilityFlags.Normal, false); _visibility.RefreshVisibility(uid); // Remove the stealth shader from the entity diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs index 593d451dda..60d59e4528 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs @@ -40,13 +40,13 @@ private void Startup(EntityUid uid, ShadowkinTeleportPowerComponent component, C { var componentActionShadowkinTeleport = component.ActionShadowkinTeleport; _actions.AddAction(uid, ref componentActionShadowkinTeleport, "ActionShadowkinTeleport"); - // _actions.AddAction(uid, new WorldTargetAction(_prototype.Index("ShadowkinTeleport")), null); + // // _actions.AddAction(uid, new WorldTargetAction(_prototype.Index("ShadowkinTeleport")), null); } private void Shutdown(EntityUid uid, ShadowkinTeleportPowerComponent component, ComponentShutdown args) { _actions.RemoveAction(uid, component.ActionShadowkinTeleport); - // _actions.RemoveAction(uid, new WorldTargetAction(_prototype.Index("ShadowkinTeleport"))); + // // _actions.RemoveAction(uid, new WorldTargetAction(_prototype.Index("ShadowkinTeleport"))); } diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.cs index 3613b7d1d5..e5218a030e 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.cs @@ -200,8 +200,9 @@ public void SetPowerLevel(EntityUid uid, float newPowerLevel) /// public bool TryBlackeye(EntityUid uid) { + var ent = _entity.GetNetEntity(uid); // Raise an attempted blackeye event - var ev = new ShadowkinBlackeyeAttemptEvent(uid); + var ev = new ShadowkinBlackeyeAttemptEvent(ent); RaiseLocalEvent(ev); if (ev.Cancelled) return false; @@ -215,6 +216,8 @@ public bool TryBlackeye(EntityUid uid) /// public void Blackeye(EntityUid uid) { + var ent = _entity.GetNetEntity(uid); + // Get shadowkin component if (!_entity.TryGetComponent(uid, out var component)) { @@ -223,8 +226,8 @@ public void Blackeye(EntityUid uid) } component.Blackeye = true; - RaiseNetworkEvent(new ShadowkinBlackeyeEvent(uid)); - RaiseLocalEvent(new ShadowkinBlackeyeEvent(uid)); + RaiseNetworkEvent(new ShadowkinBlackeyeEvent(ent)); + RaiseLocalEvent(new ShadowkinBlackeyeEvent(ent)); } diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Blackeye.Trait.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Blackeye.Trait.cs index dff2aece9b..ca14d1e2d1 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Blackeye.Trait.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Blackeye.Trait.cs @@ -5,6 +5,8 @@ namespace Content.Server.SimpleStation14.Species.Shadowkin.Systems; public sealed class ShadowkinBlackeyeTraitSystem : EntitySystem { + [Dependency] private readonly IEntityManager _entity = default!; + public override void Initialize() { base.Initialize(); @@ -15,7 +17,8 @@ public override void Initialize() private void OnStartup(EntityUid uid, ShadowkinBlackeyeTraitComponent _, ComponentStartup args) { - RaiseLocalEvent(uid, new ShadowkinBlackeyeEvent(uid, false)); - RaiseNetworkEvent(new ShadowkinBlackeyeEvent(uid, false)); + var ent = _entity.GetNetEntity(uid); + RaiseLocalEvent(uid, new ShadowkinBlackeyeEvent(ent, false)); + RaiseNetworkEvent(new ShadowkinBlackeyeEvent(ent, false)); } } diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Blackeye.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Blackeye.cs index 79de5f4d7a..01fe6cbc63 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Blackeye.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.Blackeye.cs @@ -34,7 +34,8 @@ public override void Initialize() private void OnBlackeyeAttempt(ShadowkinBlackeyeAttemptEvent ev) { - if (!_entity.TryGetComponent(ev.Uid, out var component) || + var uid = _entity.GetEntity(ev.Ent); + if (!_entity.TryGetComponent(uid, out var component) || component.Blackeye || !(component.PowerLevel <= ShadowkinComponent.PowerThresholds[ShadowkinPowerThreshold.Min] + 5)) ev.Cancel(); @@ -42,46 +43,48 @@ private void OnBlackeyeAttempt(ShadowkinBlackeyeAttemptEvent ev) private void OnBlackeye(ShadowkinBlackeyeEvent ev) { + var uid = _entity.GetEntity(ev.Ent); + // Check if the entity is a shadowkin - if (!_entity.TryGetComponent(ev.Uid, out var component)) + if (!_entity.TryGetComponent(uid, out var component)) return; // Stop gaining power component.Blackeye = true; component.PowerLevelGainEnabled = false; - _power.SetPowerLevel(ev.Uid, ShadowkinComponent.PowerThresholds[ShadowkinPowerThreshold.Min]); + _power.SetPowerLevel(uid, ShadowkinComponent.PowerThresholds[ShadowkinPowerThreshold.Min]); // Update client state Dirty(component); // Remove powers - _entity.RemoveComponent(ev.Uid); - _entity.RemoveComponent(ev.Uid); - _entity.RemoveComponent(ev.Uid); - _entity.RemoveComponent(ev.Uid); + _entity.RemoveComponent(uid); + _entity.RemoveComponent(uid); + _entity.RemoveComponent(uid); + _entity.RemoveComponent(uid); if (!ev.Damage) return; // Popup - _popup.PopupEntity(Loc.GetString("shadowkin-blackeye"), ev.Uid, ev.Uid, PopupType.Large); + _popup.PopupEntity(Loc.GetString("shadowkin-blackeye"), uid, uid, PopupType.Large); // Stamina crit - if (_entity.TryGetComponent(ev.Uid, out var stamina)) + if (_entity.TryGetComponent(uid, out var stamina)) { - _stamina.TakeStaminaDamage(ev.Uid, stamina.CritThreshold, null, ev.Uid); + _stamina.TakeStaminaDamage(uid, stamina.CritThreshold, null, uid); } // Nearly crit with cellular damage // If already 5 damage off of crit, don't do anything - if (!_entity.TryGetComponent(ev.Uid, out var damageable) || - !_mobThreshold.TryGetThresholdForState(ev.Uid, MobState.Critical, out var key)) + if (!_entity.TryGetComponent(uid, out var damageable) || + !_mobThreshold.TryGetThresholdForState(uid, MobState.Critical, out var key)) return; var minus = damageable.TotalDamage; - _damageable.TryChangeDamage(ev.Uid, + _damageable.TryChangeDamage(uid, new DamageSpecifier(_prototype.Index("Cellular"), Math.Max((double) (key.Value - minus - 5), 0)), true, diff --git a/Content.Shared/SimpleStation14/Species/Shadowkin/Events/ShadowkinEvents.Blackeye.cs b/Content.Shared/SimpleStation14/Species/Shadowkin/Events/ShadowkinEvents.Blackeye.cs index 353313b2b3..b7109bd7af 100644 --- a/Content.Shared/SimpleStation14/Species/Shadowkin/Events/ShadowkinEvents.Blackeye.cs +++ b/Content.Shared/SimpleStation14/Species/Shadowkin/Events/ShadowkinEvents.Blackeye.cs @@ -7,11 +7,11 @@ namespace Content.Shared.SimpleStation14.Species.Shadowkin.Events; /// public sealed class ShadowkinBlackeyeAttemptEvent : CancellableEntityEventArgs { - public readonly EntityUid Uid; + public readonly NetEntity Ent; - public ShadowkinBlackeyeAttemptEvent(EntityUid uid) + public ShadowkinBlackeyeAttemptEvent(NetEntity ent) { - Uid = uid; + Ent = ent; } } @@ -21,12 +21,12 @@ public ShadowkinBlackeyeAttemptEvent(EntityUid uid) [Serializable, NetSerializable] public sealed class ShadowkinBlackeyeEvent : EntityEventArgs { - public readonly EntityUid Uid; + public readonly NetEntity Ent; public readonly bool Damage; - public ShadowkinBlackeyeEvent(EntityUid uid, bool damage = true) + public ShadowkinBlackeyeEvent(NetEntity ent, bool damage = true) { - Uid = uid; + Ent = ent; Damage = damage; } } diff --git a/Content.Shared/SimpleStation14/Species/Shadowkin/Events/ShadowkinEvents.Powers.cs b/Content.Shared/SimpleStation14/Species/Shadowkin/Events/ShadowkinEvents.Powers.cs index d0d3c67ddf..83385e205e 100644 --- a/Content.Shared/SimpleStation14/Species/Shadowkin/Events/ShadowkinEvents.Powers.cs +++ b/Content.Shared/SimpleStation14/Species/Shadowkin/Events/ShadowkinEvents.Powers.cs @@ -8,10 +8,10 @@ namespace Content.Shared.SimpleStation14.Species.Shadowkin.Events; [Serializable, NetSerializable] public sealed class ShadowkinDarkSwappedEvent : EntityEventArgs { - public EntityUid Performer { get; } + public NetEntity Performer { get; } public bool DarkSwapped { get; } - public ShadowkinDarkSwappedEvent(EntityUid performer, bool darkSwapped) + public ShadowkinDarkSwappedEvent(NetEntity performer, bool darkSwapped) { Performer = performer; DarkSwapped = darkSwapped;