diff --git a/Content.Server/Clothing/MagbootsSystem.cs b/Content.Server/Clothing/MagbootsSystem.cs index 412b0f5909..a965c2c69d 100644 --- a/Content.Server/Clothing/MagbootsSystem.cs +++ b/Content.Server/Clothing/MagbootsSystem.cs @@ -1,13 +1,8 @@ -using Content.Server.Alert; using Content.Server.Atmos.Components; using Content.Server.Clothing.Components; -using Content.Shared.Actions; using Content.Shared.Alert; using Content.Shared.Clothing; using Content.Shared.Inventory.Events; -using Content.Shared.Movement.EntitySystems; -using Content.Shared.Slippery; -using Content.Shared.Verbs; namespace Content.Server.Clothing { @@ -19,8 +14,6 @@ namespace Content.Server.Clothing { base.Initialize(); - SubscribeLocalEvent>(AddToggleVerb); - SubscribeLocalEvent(OnSlipAttempt); SubscribeLocalEvent(OnGotEquipped); SubscribeLocalEvent(OnGotUnequipped); } @@ -61,25 +54,5 @@ namespace Content.Server.Clothing UpdateMagbootEffects(args.Equipee, uid, true, component); } } - - private void AddToggleVerb(EntityUid uid, MagbootsComponent component, GetVerbsEvent args) - { - if (!args.CanAccess || !args.CanInteract) - return; - - ActivationVerb verb = new(); - verb.Text = Loc.GetString("toggle-magboots-verb-get-data-text"); - verb.Act = () => component.On = !component.On; - // TODO VERB ICON add toggle icon? maybe a computer on/off symbol? - args.Verbs.Add(verb); - } - - private void OnSlipAttempt(EntityUid uid, MagbootsComponent component, SlipAttemptEvent args) - { - if (component.On) - { - args.Cancel(); - } - } } } diff --git a/Content.Shared/Clothing/SharedMagbootsSystem.cs b/Content.Shared/Clothing/SharedMagbootsSystem.cs index 21e132d1ff..e19fb2858d 100644 --- a/Content.Shared/Clothing/SharedMagbootsSystem.cs +++ b/Content.Shared/Clothing/SharedMagbootsSystem.cs @@ -1,5 +1,7 @@ using Content.Shared.Actions; +using Content.Shared.Slippery; using Content.Shared.Toggleable; +using Content.Shared.Verbs; namespace Content.Shared.Clothing; @@ -9,10 +11,30 @@ public abstract class SharedMagbootsSystem : EntitySystem { base.Initialize(); + SubscribeLocalEvent>(AddToggleVerb); + SubscribeLocalEvent(OnSlipAttempt); SubscribeLocalEvent(OnGetActions); SubscribeLocalEvent(OnToggleAction); } + private void AddToggleVerb(EntityUid uid, SharedMagbootsComponent component, GetVerbsEvent args) + { + if (!args.CanAccess || !args.CanInteract) + return; + + ActivationVerb verb = new(); + verb.Text = Loc.GetString("toggle-magboots-verb-get-data-text"); + verb.Act = () => component.On = !component.On; + // TODO VERB ICON add toggle icon? maybe a computer on/off symbol? + args.Verbs.Add(verb); + } + + private void OnSlipAttempt(EntityUid uid, SharedMagbootsComponent component, SlipAttemptEvent args) + { + if (component.On) + args.Cancel(); + } + private void OnGetActions(EntityUid uid, SharedMagbootsComponent component, GetActionsEvent args) { args.Actions.Add(component.ToggleAction); diff --git a/Content.Shared/StatusEffect/StatusEffectsSystem.cs b/Content.Shared/StatusEffect/StatusEffectsSystem.cs index 3345507015..469f04eb9f 100644 --- a/Content.Shared/StatusEffect/StatusEffectsSystem.cs +++ b/Content.Shared/StatusEffect/StatusEffectsSystem.cs @@ -48,7 +48,9 @@ namespace Content.Shared.StatusEffect private void OnGetState(EntityUid uid, StatusEffectsComponent component, ref ComponentGetState args) { - args.State = new StatusEffectsComponentState(component.ActiveEffects, component.AllowedEffects); + // Using new(...) To avoid mispredictions due to MergeImplicitData. This will mean the server-side code is + // slightly slower, and really this function should just be overridden by the client... + args.State = new StatusEffectsComponentState(new(component.ActiveEffects), new(component.AllowedEffects)); } private void OnHandleState(EntityUid uid, StatusEffectsComponent component, ref ComponentHandleState args) @@ -77,8 +79,8 @@ namespace Content.Shared.StatusEffect } var time = effect.Value.Cooldown.Item2 - effect.Value.Cooldown.Item1; - //TODO: Not sure how to handle refresh here. - TryAddStatusEffect(uid, effect.Key, time, true); + + TryAddStatusEffect(uid, effect.Key, time, true, component); } }