diff --git a/Content.Server/Forensics/Systems/ScentTrackerSystem.cs b/Content.Server/Forensics/Systems/ScentTrackerSystem.cs index ecc0d181d1d..c7f34b58f32 100644 --- a/Content.Server/Forensics/Systems/ScentTrackerSystem.cs +++ b/Content.Server/Forensics/Systems/ScentTrackerSystem.cs @@ -1,3 +1,4 @@ +<<<<<<< HEAD //using Content.Server.Popups; //using Content.Shared.DoAfter; //using Content.Shared.Verbs; @@ -128,3 +129,135 @@ // #endregion // } //} +======= +using Content.Server.Popups; +using Content.Shared.DoAfter; +using Content.Shared.Verbs; +using Content.Shared.Forensics; +using Content.Shared.Examine; +using Robust.Shared.Utility; +using Content.Shared.IdentityManagement; + +namespace Content.Server.Forensics +{ + public sealed class ScentTrackerSystem : EntitySystem + { + [Dependency] private readonly PopupSystem _popupSystem = default!; + [Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!; + public override void Initialize() + { + SubscribeLocalEvent>(AddVerbs); + SubscribeLocalEvent(TrackScentDoAfter); + SubscribeLocalEvent((uid, _, args) => OnExamine(uid, args)); + } + + private void AddVerbs(EntityUid uid, ScentTrackerComponent component, GetVerbsEvent args) + { + TrackScentVerb(uid, component, args); + StopTrackScentVerb(uid, component, args); + } + + private void TrackScentVerb(EntityUid uid, ScentTrackerComponent component, GetVerbsEvent args) + { + if (!args.CanInteract + || !args.CanAccess + || args.User == args.Target) + return; + + InnateVerb verbTrackScent = new() + { + Act = () => AttemptTrackScent(uid, args.Target, component), + Text = Loc.GetString("track-scent"), + Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/psionic_invisibility.png")), + Priority = 1 + }; + args.Verbs.Add(verbTrackScent); + } + + private void AttemptTrackScent(EntityUid user, EntityUid target, ScentTrackerComponent component) + { + if (!HasComp(user)) + return; + + var doAfterEventArgs = new DoAfterArgs(EntityManager, user, component.SniffDelay, new ScentTrackerDoAfterEvent(), user, target: target) + { + BreakOnUserMove = true, + BreakOnDamage = true, + BreakOnTargetMove = true + }; + + _popupSystem.PopupEntity(Loc.GetString("start-tracking-scent", ("user", Identity.Name(user, EntityManager)), ("target", Identity.Name(target, EntityManager))), user); + _doAfterSystem.TryStartDoAfter(doAfterEventArgs); + } + + private void TrackScentDoAfter(Entity entity, ref ScentTrackerDoAfterEvent args) + { + if (args.Handled + || args.Cancelled + || args.Args.Target == null) + return; + + TrackScent(args.Args.User, args.Args.Target.Value); + + args.Handled = true; + } + + private void StopTrackScentVerb(EntityUid uid, ScentTrackerComponent component, GetVerbsEvent args) + { + if (args.User != args.Target + || component.Scent == string.Empty) + return; + + InnateVerb verbStopTrackScent = new() + { + Act = () => StopTrackScent(uid, component), + Text = Loc.GetString("stop-track-scent"), + Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/psionic_invisibility.png")), + Priority = 2 + }; + args.Verbs.Add(verbStopTrackScent); + } + + private void OnExamine(EntityUid uid, ExaminedEvent args) + { + if (!TryComp(args.Examiner, out var component) + || !TryComp(args.Examined, out var forcomp)) + return; + + if (forcomp.Scent != string.Empty && component.Scent == forcomp.Scent) + args.PushMarkup(Loc.GetString("examined-scent"), -1); + } + + #region Utilities + public void TrackScent(EntityUid uid, EntityUid target) + { + if (!TryComp(uid, out var component) + || !TryComp(target, out var forcomp)) + return; + + if (forcomp.Scent != string.Empty) + { + component.Scent = forcomp.Scent; + _popupSystem.PopupEntity(Loc.GetString("tracking-scent", ("target", Identity.Name(target, EntityManager))), uid, uid); + } + else + _popupSystem.PopupEntity(Loc.GetString("no-scent"), uid, uid); + + Dirty(uid, component); + } + + public void StopTrackScent(EntityUid uid, ScentTrackerComponent component) + { + if (!HasComp(uid)) + return; + + component.Scent = string.Empty; + _popupSystem.PopupEntity(Loc.GetString("stopped-tracking-scent"), uid, uid); + + Dirty(uid, component); + } + + #endregion + } +} +>>>>>>> d9a04690a4 (Vulpkanin Update (#715)) diff --git a/Content.Shared/Flash/FlashableComponent.cs b/Content.Shared/Flash/FlashableComponent.cs index 538f02215d7..5f56f649897 100644 --- a/Content.Shared/Flash/FlashableComponent.cs +++ b/Content.Shared/Flash/FlashableComponent.cs @@ -12,6 +12,9 @@ public sealed partial class FlashableComponent : Component // <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> d9a04690a4 (Vulpkanin Update (#715)) // Chance to get EyeDamage on flash // [DataField] @@ -23,8 +26,11 @@ public sealed partial class FlashableComponent : Component [DataField] public int EyeDamage; +<<<<<<< HEAD ======= >>>>>>> a9280bb920 (Vulpkanin Rework: Number Changes (#713)) +======= +>>>>>>> d9a04690a4 (Vulpkanin Update (#715)) // How much to modify the duration of flashes against this entity. // [DataField] @@ -43,6 +49,7 @@ public sealed class FlashableComponentState : ComponentState public TimeSpan Time { get; } public float EyeDamageChance { get; } public int EyeDamage { get; } +<<<<<<< HEAD public float DurationMultiplier { get; } <<<<<<< HEAD @@ -56,13 +63,20 @@ public FlashableComponentState(float duration, TimeSpan time, float eyeDamageCha // // How much to modify the duration of flashes against this entity. // +======= +>>>>>>> d9a04690a4 (Vulpkanin Update (#715)) public float DurationMultiplier { get; } - public FlashableComponentState(float duration, TimeSpan time, float durationMultiplier) + public FlashableComponentState(float duration, TimeSpan time, float eyeDamageChance, int eyeDamage, float durationMultiplier) { Duration = duration; Time = time; +<<<<<<< HEAD >>>>>>> a9280bb920 (Vulpkanin Rework: Number Changes (#713)) +======= + EyeDamageChance = eyeDamageChance; + EyeDamage = eyeDamage; +>>>>>>> d9a04690a4 (Vulpkanin Update (#715)) DurationMultiplier = durationMultiplier; } } diff --git a/Content.Shared/Flash/SharedFlashSystem.cs b/Content.Shared/Flash/SharedFlashSystem.cs index c9381d3e627..5e2c4aa217c 100644 --- a/Content.Shared/Flash/SharedFlashSystem.cs +++ b/Content.Shared/Flash/SharedFlashSystem.cs @@ -13,11 +13,15 @@ public override void Initialize() private static void OnFlashableGetState(EntityUid uid, FlashableComponent component, ref ComponentGetState args) { +<<<<<<< HEAD <<<<<<< HEAD args.State = new FlashableComponentState(component.Duration, component.LastFlash, component.EyeDamageChance, component.EyeDamage, component.DurationMultiplier); ======= args.State = new FlashableComponentState(component.Duration, component.LastFlash, component.DurationMultiplier); >>>>>>> a9280bb920 (Vulpkanin Rework: Number Changes (#713)) +======= + args.State = new FlashableComponentState(component.Duration, component.LastFlash, component.EyeDamageChance, component.EyeDamage, component.DurationMultiplier); +>>>>>>> d9a04690a4 (Vulpkanin Update (#715)) } } } diff --git a/Resources/Prototypes/DeltaV/Entities/Mobs/Species/vulpkanin.yml b/Resources/Prototypes/DeltaV/Entities/Mobs/Species/vulpkanin.yml index 3a43a331537..86a1f7982ab 100644 --- a/Resources/Prototypes/DeltaV/Entities/Mobs/Species/vulpkanin.yml +++ b/Resources/Prototypes/DeltaV/Entities/Mobs/Species/vulpkanin.yml @@ -117,10 +117,13 @@ - type: Flammable fireStackIncreaseMultiplier: 1.25 <<<<<<< HEAD +<<<<<<< HEAD ======= - type: Flashable durationMultiplier: 1.5 >>>>>>> a9280bb920 (Vulpkanin Rework: Number Changes (#713)) +======= +>>>>>>> d9a04690a4 (Vulpkanin Update (#715)) - type: entity save: false