diff --git a/Content.Client/DeltaV/VendingMachines/UI/ShopVendorWindow.xaml.cs b/Content.Client/DeltaV/VendingMachines/UI/ShopVendorWindow.xaml.cs index 2b9c4df87a..e8bf52ba53 100644 --- a/Content.Client/DeltaV/VendingMachines/UI/ShopVendorWindow.xaml.cs +++ b/Content.Client/DeltaV/VendingMachines/UI/ShopVendorWindow.xaml.cs @@ -7,6 +7,7 @@ using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.XAML; +using Robust.Shared.Input; using Robust.Shared.Prototypes; using Robust.Shared.Timing; using System.Numerics; @@ -43,7 +44,11 @@ public ShopVendorWindow() VendingContents.SearchBar = SearchBar; VendingContents.DataFilterCondition += DataFilterCondition; VendingContents.GenerateItem += GenerateButton; - VendingContents.ItemKeyBindDown += (args, data) => OnItemSelected?.Invoke(((ShopVendorListingData) data).Index); + VendingContents.ItemKeyBindDown += (args, data) => + { + if (args.Function == EngineKeyFunctions.UIClick) + OnItemSelected?.Invoke(((ShopVendorListingData) data).Index); + }; } public void SetEntity(EntityUid owner) diff --git a/Content.Client/Effects/ColorFlashEffectSystem.cs b/Content.Client/Effects/ColorFlashEffectSystem.cs index bc08607410..cb361e7310 100644 --- a/Content.Client/Effects/ColorFlashEffectSystem.cs +++ b/Content.Client/Effects/ColorFlashEffectSystem.cs @@ -87,13 +87,7 @@ private void OnColorFlashEffect(ColorFlashEffectEvent ev) continue; } - if (!TryComp(ent, out AnimationPlayerComponent? player)) - { - player = (AnimationPlayerComponent) _factory.GetComponent(typeof(AnimationPlayerComponent)); - player.Owner = ent; - player.NetSyncEnabled = false; - AddComp(ent, player); - } + var player = EnsureComp(ent); // Need to stop the existing animation first to ensure the sprite color is fixed. // Otherwise we might lerp to a red colour instead. @@ -107,23 +101,20 @@ private void OnColorFlashEffect(ColorFlashEffectEvent ev) continue; } - if (TryComp(ent, out var effect)) + // having to check lifestage because trycomp is special needs and may return a component which was shut down via RemCompDeferred. + // EnsureComp isn't, but we want to get the Color value stored in the component, and EnsureComp would overwrite it with the default value. + if (TryComp(ent, out var effect) && effect.LifeStage <= ComponentLifeStage.Running) { sprite.Color = effect.Color; } + var animation = GetDamageAnimation(ent, color, sprite, ev.AnimationLength); - if (animation == null) + if (animation == null) continue; - if (!TryComp(ent, out ColorFlashEffectComponent? comp)) - { - comp = (ColorFlashEffectComponent) _factory.GetComponent(typeof(ColorFlashEffectComponent)); - comp.Owner = ent; - comp.NetSyncEnabled = false; - AddComp(ent, comp); - } + var comp = EnsureComp(ent); comp.Color = sprite.Color; _animation.Play((ent, player), animation, AnimationKey); diff --git a/Content.Client/Options/UI/Tabs/GraphicsTab.xaml b/Content.Client/Options/UI/Tabs/GraphicsTab.xaml index ec1b9aa002..e4b31fd218 100644 --- a/Content.Client/Options/UI/Tabs/GraphicsTab.xaml +++ b/Content.Client/Options/UI/Tabs/GraphicsTab.xaml @@ -42,6 +42,7 @@ +