diff --git a/Content.Shared/Polymorph/Systems/SharedChameleonProjectorSystem.cs b/Content.Shared/Polymorph/Systems/SharedChameleonProjectorSystem.cs index 9944c9ba32..fa62d68d5e 100644 --- a/Content.Shared/Polymorph/Systems/SharedChameleonProjectorSystem.cs +++ b/Content.Shared/Polymorph/Systems/SharedChameleonProjectorSystem.cs @@ -16,6 +16,7 @@ using Robust.Shared.Network; using Robust.Shared.Physics.Components; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.Manager; +using Robust.Shared.Timing; using System.Diagnostics.CodeAnalysis; namespace Content.Shared.Polymorph.Systems; @@ -36,7 +37,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem [Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly SharedTransformSystem _xform = default!; - + [Dependency] private readonly IGameTiming _gameTiming = default!; // WD public override void Initialize() { base.Initialize(); @@ -44,6 +45,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem SubscribeLocalEvent(OnDisguiseInteractHand, before: [typeof(SharedItemSystem)]); SubscribeLocalEvent(OnDisguiseDamaged); SubscribeLocalEvent(OnDisguiseShutdown); + SubscribeLocalEvent(OnPickup); // WD SubscribeLocalEvent(OnInteract); SubscribeLocalEvent>(OnGetVerbs); @@ -62,11 +64,19 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem args.Handled = true; } + /// + /// WD. Horrible fix, but functional. + /// + private void OnPickup(Entity ent, ref GotEquippedHandEvent args) + { + Timer.Spawn(100, () => TryReveal(ent.Comp.User)); + } + private void OnDisguiseDamaged(Entity ent, ref DamageChangedEvent args) { // anything that would damage both like an explosion gets doubled // feature? projector makes your atoms weaker or some bs - if (args.DamageDelta is {} damage) + if (args.DamageDelta is { } damage) _damageable.TryChangeDamage(ent.Comp.User, damage); } @@ -81,7 +91,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem private void OnInteract(Entity ent, ref AfterInteractEvent args) { - if (args.Handled || !args.CanReach || args.Target is not {} target) + if (args.Handled || !args.CanReach || args.Target is not { } target) return; args.Handled = true; @@ -126,7 +136,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem private void OnToggleNoRot(Entity ent, ref DisguiseToggleNoRotEvent args) { - if (ent.Comp.Disguised is not {} uid) + if (ent.Comp.Disguised is not { } uid) return; var xform = Transform(uid); @@ -137,7 +147,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem private void OnToggleAnchored(Entity ent, ref DisguiseToggleAnchoredEvent args) { - if (ent.Comp.Disguised is not {} uid) + if (ent.Comp.Disguised is not { } uid) return; var xform = Transform(uid); @@ -249,7 +259,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem /// public void RevealProjector(Entity ent) { - if (ent.Comp.Disguised is {} user) + if (ent.Comp.Disguised is { } user) TryReveal(user); } @@ -261,7 +271,7 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem /// /// This would probably be a good thing to add to engine in the future. /// - protected bool CopyComp(Entity ent) where T: Component, new() + protected bool CopyComp(Entity ent) where T : Component, new() { if (!GetSrcComp(ent.Comp, out var src)) return true; @@ -277,13 +287,13 @@ public abstract class SharedChameleonProjectorSystem : EntitySystem /// /// Try to get a single component from the source entity/prototype. /// - private bool GetSrcComp(ChameleonDisguiseComponent comp, [NotNullWhen(true)] out T? src) where T: Component + private bool GetSrcComp(ChameleonDisguiseComponent comp, [NotNullWhen(true)] out T? src) where T : Component { src = null; if (TryComp(comp.SourceEntity, out src)) return true; - if (comp.SourceProto is not {} protoId) + if (comp.SourceProto is not { } protoId) return false; if (!_proto.TryIndex(protoId, out var proto))