From 6869c2388e152e45bb7a7e29aedaefd92c154d77 Mon Sep 17 00:00:00 2001 From: whateverusername0 Date: Sun, 23 Jun 2024 03:05:06 +1000 Subject: [PATCH] booo bugfix!!!! --- .../Cult/RuneCaster/RuneCasterComponent.cs | 10 +++++++--- .../Goobstation/Cult/RuneCaster/RuneCasterSystem.cs | 13 +++++++++++-- Content.Shared.Database/LogType.cs | 3 +++ .../Cult/RuneCaster/RuneCasterDoAfterEvent.cs | 10 ++++++++++ .../Cult/RuneCaster/SharedRuneCasterComponent.cs | 6 +++--- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/Content.Server/Goobstation/Cult/RuneCaster/RuneCasterComponent.cs b/Content.Server/Goobstation/Cult/RuneCaster/RuneCasterComponent.cs index e5eb51bad04..8606ea8b811 100644 --- a/Content.Server/Goobstation/Cult/RuneCaster/RuneCasterComponent.cs +++ b/Content.Server/Goobstation/Cult/RuneCaster/RuneCasterComponent.cs @@ -14,13 +14,17 @@ public sealed partial class RuneCasterComponent : SharedRuneCasterComponent [ViewVariables(VVAccess.ReadWrite)] [DataField("selectableColor")] - public bool SelectableColor { get; set; } + public bool SelectableColor; [ViewVariables(VVAccess.ReadWrite)] - public int Charges { get; set; } + public float Charges; [ViewVariables(VVAccess.ReadWrite)] [DataField("capacity")] - public int Capacity { get; set; } = 30; + public float Capacity = 30f; + + [ViewVariables(VVAccess.ReadWrite)] + [DataField("runeCastDuration")] + public float RuneCasterDoAfterDuration = 1f; } } diff --git a/Content.Server/Goobstation/Cult/RuneCaster/RuneCasterSystem.cs b/Content.Server/Goobstation/Cult/RuneCaster/RuneCasterSystem.cs index 4002fffa60e..ae9313e4605 100644 --- a/Content.Server/Goobstation/Cult/RuneCaster/RuneCasterSystem.cs +++ b/Content.Server/Goobstation/Cult/RuneCaster/RuneCasterSystem.cs @@ -82,10 +82,19 @@ private void OnRuneCasterAfterInteract(EntityUid uid, RuneCasterComponent compon // Wait, then cast the rune // TODO: RuneCasterDoAfterDuration needs to be added to component - _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.RuneCasterDoAfterDuration, new RuneCasterDoAfterEvent(), uid, target: target, used: uid) {}); + + var dargs = new DoAfterArgs(EntityManager, args.User, component.RuneCasterDoAfterDuration, new RuneCasterDoAfterEvent(args.ClickLocation), uid, used: uid) + { + BreakOnDamage = true, + BreakOnMove = true, + BreakOnHandChange = false, + BreakOnWeightlessMove = false, + }; + + _doAfter.TryStartDoAfter(dargs); } - private void OnDoAfter(EntityUid uid, RuneCasterComponent component, DoAfterEvent args) + private void OnDoAfter(EntityUid uid, RuneCasterComponent component, RuneCasterDoAfterEvent args) { // Make sure this do-after is still valid if (args.Cancelled || args.Handled || args.Args.Target == null) diff --git a/Content.Shared.Database/LogType.cs b/Content.Shared.Database/LogType.cs index 33a5d30c6a9..58857c66ff7 100644 --- a/Content.Shared.Database/LogType.cs +++ b/Content.Shared.Database/LogType.cs @@ -105,4 +105,7 @@ public enum LogType /// This is a default value used by PlayerRateLimitManager, though users can use different log types. /// RateLimited = 91, + + // GoobStation - cult + RuneCasterCast = 92, } diff --git a/Content.Shared/Goobstation/Cult/RuneCaster/RuneCasterDoAfterEvent.cs b/Content.Shared/Goobstation/Cult/RuneCaster/RuneCasterDoAfterEvent.cs index 0c406b79c64..1b4fe647a89 100644 --- a/Content.Shared/Goobstation/Cult/RuneCaster/RuneCasterDoAfterEvent.cs +++ b/Content.Shared/Goobstation/Cult/RuneCaster/RuneCasterDoAfterEvent.cs @@ -1,4 +1,5 @@ using Content.Shared.DoAfter; +using Robust.Shared.Map; using Robust.Shared.Serialization; namespace Content.Shared.Goobstation.Cult.RuneCaster; @@ -6,4 +7,13 @@ namespace Content.Shared.Goobstation.Cult.RuneCaster; [Serializable, NetSerializable] public sealed partial class RuneCasterDoAfterEvent : SimpleDoAfterEvent { + /// + /// Location that the user clicked outside of their interaction range. + /// + public EntityCoordinates ClickLocation { get; } + + public RuneCasterDoAfterEvent(EntityCoordinates clickLocation) : base() + { + ClickLocation = clickLocation; + } } diff --git a/Content.Shared/Goobstation/Cult/RuneCaster/SharedRuneCasterComponent.cs b/Content.Shared/Goobstation/Cult/RuneCaster/SharedRuneCasterComponent.cs index 78b2ee23099..cea4bc8f2f9 100644 --- a/Content.Shared/Goobstation/Cult/RuneCaster/SharedRuneCasterComponent.cs +++ b/Content.Shared/Goobstation/Cult/RuneCaster/SharedRuneCasterComponent.cs @@ -49,10 +49,10 @@ public sealed class RuneCasterComponentState : ComponentState { public readonly Color Color; public readonly string State; - public readonly int Charges; - public readonly int Capacity; + public readonly float Charges; + public readonly float Capacity; - public RuneCasterComponentState(Color color, string state, int charges, int capacity) + public RuneCasterComponentState(Color color, string state, float charges, float capacity) { Color = color; State = state;