From 63c354eadb3ad31fb2fcc5c876b3cec52cd503b0 Mon Sep 17 00:00:00 2001 From: EnefFlow Date: Sat, 27 Jan 2024 16:02:34 +0300 Subject: [PATCH] quick fixes --- .../White/CheapSurgery/CheapSurgerySystem.cs | 1 + .../White/Radials/RadialUIController.cs | 1 + .../UserInterface/Controls/RadialButton.xaml | 18 -- .../Controls/RadialButton.xaml.cs | 40 --- .../Controls/RadialContainer.xaml | 19 -- .../Controls/RadialContainer.xaml.cs | 302 ------------------ .../_White/Cult/ShowCultHudSystem.cs | 1 + .../Systems/AdminVerbSystem.Antags.cs | 2 +- Content.Server/Chat/Commands/CultCommand.cs | 3 +- .../_White/Cult/GameRule/CultRuleComponent.cs | 3 +- .../_White/Cult/GameRule/CultRuleSystem.cs | 15 +- .../_White/Cult/HolyWater/HolyWaterSystem.cs | 31 +- .../Systems/TorchCultistsProviderSystem.cs | 1 + .../Cult/Items/Systems/VoidTeleportSystem.cs | 1 + .../_White/Cult/Pylon/PylonSystem.cs | 5 +- .../Cult/Runes/Systems/CultSystem.Actions.cs | 9 +- .../Runes/Systems/CultSystem.Constructs.cs | 1 + .../Systems/CultSystem.ConstructsAbilities.cs | 4 +- .../Cult/Runes/Systems/CultSystem.Rune.cs | 18 +- .../Structures/CultStructureCraftSystem.cs | 3 +- .../TimedProduction/CultistFactorySystem.cs | 2 + .../DragInsertContainerComponent.cs | 5 + .../ExitContainerOnMoveComponent.cs | 5 + .../Equipment/ArtifactCrusherComponent.cs | 5 + 24 files changed, 75 insertions(+), 420 deletions(-) delete mode 100644 Content.Client/White/UserInterface/Controls/RadialButton.xaml delete mode 100644 Content.Client/White/UserInterface/Controls/RadialButton.xaml.cs delete mode 100644 Content.Client/White/UserInterface/Controls/RadialContainer.xaml delete mode 100644 Content.Client/White/UserInterface/Controls/RadialContainer.xaml.cs diff --git a/Content.Client/White/CheapSurgery/CheapSurgerySystem.cs b/Content.Client/White/CheapSurgery/CheapSurgerySystem.cs index 7891242fa7..f0238a9f2e 100644 --- a/Content.Client/White/CheapSurgery/CheapSurgerySystem.cs +++ b/Content.Client/White/CheapSurgery/CheapSurgerySystem.cs @@ -1,3 +1,4 @@ +using Content.Client._White.UserInterface.Radial; using Content.Client.White.UserInterface.Controls; using Content.Shared.White.CheapSurgery; using Robust.Client.GameObjects; diff --git a/Content.Client/White/Radials/RadialUIController.cs b/Content.Client/White/Radials/RadialUIController.cs index 2f76b4c7d0..bb813b0c62 100644 --- a/Content.Client/White/Radials/RadialUIController.cs +++ b/Content.Client/White/Radials/RadialUIController.cs @@ -1,4 +1,5 @@ using System.Linq; +using Content.Client._White.UserInterface.Radial; using Content.Client.CombatMode; using Content.Client.ContextMenu.UI; using Content.Client.Gameplay; diff --git a/Content.Client/White/UserInterface/Controls/RadialButton.xaml b/Content.Client/White/UserInterface/Controls/RadialButton.xaml deleted file mode 100644 index f0eb1d079d..0000000000 --- a/Content.Client/White/UserInterface/Controls/RadialButton.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - diff --git a/Content.Client/White/UserInterface/Controls/RadialButton.xaml.cs b/Content.Client/White/UserInterface/Controls/RadialButton.xaml.cs deleted file mode 100644 index 62c86b1815..0000000000 --- a/Content.Client/White/UserInterface/Controls/RadialButton.xaml.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Numerics; -using JetBrains.Annotations; -using Robust.Client.AutoGenerated; -using Robust.Client.Graphics; -using Robust.Client.UserInterface; -using Robust.Client.UserInterface.XAML; -using Robust.Shared.Animations; -using Robust.Shared.Timing; - -namespace Content.Client.White.UserInterface.Controls; - -[GenerateTypedNameReferences, Virtual, PublicAPI] -public sealed partial class RadialButton : Control -{ - [Animatable] public Vector2 Offset { get; set; } - public string? Content { get; set; } - - public string Texture - { - set => Controller.TexturePath = value; - } - - [Animatable] - public Vector2 ButtonSize - { - get => this.Size; - set => this.SetSize = value; - } - - public RadialButton() - { - RobustXamlLoader.Load(this); - Offset = Vector2.Zero; - } - - protected override void FrameUpdate(FrameEventArgs args) - { - base.FrameUpdate(args); - } -} diff --git a/Content.Client/White/UserInterface/Controls/RadialContainer.xaml b/Content.Client/White/UserInterface/Controls/RadialContainer.xaml deleted file mode 100644 index f3897f34ea..0000000000 --- a/Content.Client/White/UserInterface/Controls/RadialContainer.xaml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - diff --git a/Content.Client/White/UserInterface/Controls/RadialContainer.xaml.cs b/Content.Client/White/UserInterface/Controls/RadialContainer.xaml.cs deleted file mode 100644 index 2cf2cafe5d..0000000000 --- a/Content.Client/White/UserInterface/Controls/RadialContainer.xaml.cs +++ /dev/null @@ -1,302 +0,0 @@ -using System.Linq; -using System.Numerics; -using Content.Client.Gameplay; -using Content.Client.Resources; -using Content.Client.Viewport; -using JetBrains.Annotations; -using Robust.Client.Animations; -using Robust.Client.AutoGenerated; -using Robust.Client.GameObjects; -using Robust.Client.Graphics; -using Robust.Client.Player; -using Robust.Client.ResourceManagement; -using Robust.Client.UserInterface; -using Robust.Client.UserInterface.Controls; -using Robust.Client.UserInterface.XAML; -using Robust.Client.Utility; -using Robust.Shared.Animations; -using Robust.Shared.Console; -using Robust.Shared.Prototypes; -using Robust.Shared.Timing; -using Robust.Shared.Utility; - -namespace Content.Client.White.UserInterface.Controls; - -public sealed class RadialContainerCommandTest : LocalizedCommands -{ - public override string Command => "radialtest"; - - public override void Execute(IConsoleShell shell, string argStr, string[] args) - { - var radial = new RadialContainer(); - for (int i = 0; i < 24; i++) - { - var testButton = radial.AddButton("Action " + i, "/Textures/Interface/emotions.svg.192dpi.png"); - testButton.Controller.OnPressed += _ => { Logger.Debug("Press gay"); }; - } - - radial.CloseButton.Controller.OnPressed += _ => - { - Logger.Debug("Close event for your own logic"); - }; - - radial.OpenCentered(); - } -} - -[GenerateTypedNameReferences, Virtual] -public partial class RadialContainer : Control -{ - private bool _isOpened; - - private Vector2 _focusSize = new(64, 64); - private Vector2 _normalSize = new(50, 50); - - private IResourceCache _resourceCache; - - private const int MaxButtons = 8; - - private const string BackgroundTexture = "/Textures/Interface/Default/SlotBackground.png"; - - public const string MoveAnimationKey = "move"; - public const string InSizeAnimationKey = "insize"; - public const string OutSizeAnimationKey = "outsize"; - - public float FocusSize - { - get => _focusSize.Y; - set => _focusSize = new Vector2(value, value); - } - - public float NormalSize - { - get => _normalSize.Y; - set => _normalSize = new Vector2(value, value); - } - - public float MoveAnimationTime { get; set; } = 0.3f; - - public float FocusAnimationTime { get; set; } = 0.25f; - - public bool IsAction = true; - - public RadialContainer() - { - RobustXamlLoader.Load(this); - IoCManager.InjectDependencies(this); - _resourceCache = IoCManager.Resolve(); - } - - public void Open(Vector2 position) - { - AddToRoot(); - LayoutContainer.SetPosition(this, position); - UpdateButtons(); - } - - public void OpenCentered() - { - AddToRoot(); - if (Parent != null) - LayoutContainer.SetPosition(this, Parent.Size / 2 - Size / 2); - else - LayoutContainer.SetPosition(this, UserInterfaceManager.MainViewport.Size / 2 - Size / 2); - - UpdateButtons(); - } - - public void OpenCenteredWithViewport() - { - if (UserInterfaceManager.ActiveScreen == null) - return; - - var ent = IoCManager.Resolve().LocalSession?.AttachedEntity; - if (ent == null) - return; - - if (!IoCManager.Resolve().TryGetComponent(ent, out TransformComponent? xform)) - return; - - AddToRoot(); - var position = IoCManager.Resolve().GetMapCoordinates(xform); - - LayoutContainer.SetPosition(this, - IoCManager.Resolve().MapToScreen(position).Position * 1.5f); - - UpdateButtons(); - } - - public void Close(bool canDispose = true) - { - Parent?.RemoveChild(this); - Visible = false; - _isOpened = false; - if (canDispose) - Dispose(); - } - - public RadialButton AddButton(string action, string? texture = null) - { - var button = new RadialButton(); - button.Content = action; - button.Controller.TextureNormal = _resourceCache.GetTexture(BackgroundTexture); - if (texture != null) - button.BackgroundTexture.Texture = _resourceCache.GetTexture(texture); - - Layout.AddChild(button); - - return button; - } - - public RadialButton AddButton(string action, Texture texture) - { - var button = new RadialButton(); - button.Content = action; - button.Controller.TextureNormal = _resourceCache.GetTexture(BackgroundTexture); - button.BackgroundTexture.Texture = texture; - Layout.AddChild(button); - - return button; - } - - private void AddToRoot() - { - if (_isOpened) - return; - - UserInterfaceManager.WindowRoot.AddChild(this); - _isOpened = !_isOpened; - } - - private void UpdateButtons() - { - Visible = true; - - var angleDegrees = 360 / Layout.ChildCount; - var stepAngle = -angleDegrees + -90; - var distance = FocusSize * 1.2; - if (Layout.Children.Count() > MaxButtons) - { - for (int i = 0; i < (Layout.Children.Count() - MaxButtons); i++) - { - distance += (NormalSize / 3); - } - } - - foreach (var child in Layout.Children) - { - var button = (RadialButton) child; - button.ButtonSize = _normalSize; - stepAngle += angleDegrees; - var pos = GetPointFromPolar(stepAngle, distance); - PlayRadialAnimation(button, pos, MoveAnimationKey); - - button.Controller.OnMouseEntered += _ => - { - PlaySizeAnimation(button, _focusSize, OutSizeAnimationKey, InSizeAnimationKey); - ActionLabel.Text = button.Content ?? string.Empty; - ActionLabel.Visible = IsAction; - }; - - button.Controller.OnMouseExited += _ => - { - PlaySizeAnimation(button, _normalSize, InSizeAnimationKey, OutSizeAnimationKey); - ActionLabel.Visible = false; - }; - } - - CloseButton.ButtonSize = _normalSize; - CloseButton.Controller.OnMouseEntered += _ => - { - PlaySizeAnimation(CloseButton, _focusSize, OutSizeAnimationKey, InSizeAnimationKey); - ActionLabel.Text = CloseButton.Content ?? string.Empty; - ActionLabel.Visible = true; - }; - - CloseButton.Controller.OnMouseExited += _ => - { - PlaySizeAnimation(CloseButton, _normalSize, InSizeAnimationKey, OutSizeAnimationKey); - ActionLabel.Visible = false; - }; - - CloseButton.Controller.OnPressed += _ => - { - Close(); - }; - } - - private void PlayRadialAnimation(Control button, Vector2 pos, string playKey) - { - var anim = new Animation - { - Length = TimeSpan.FromMilliseconds(MoveAnimationTime * 1000), - AnimationTracks = - { - new AnimationTrackControlProperty - { - Property = nameof(RadialButton.Offset), - InterpolationMode = AnimationInterpolationMode.Linear, - KeyFrames = - { - new AnimationTrackProperty.KeyFrame(new Vector2(0, 0), 0f), - new AnimationTrackProperty.KeyFrame(pos, MoveAnimationTime) - } - } - } - }; - - if (!button.HasRunningAnimation(playKey)) - button.PlayAnimation(anim, playKey); - } - - private void PlaySizeAnimation(Control button, Vector2 size, string playKey, string? stopKey) - { - var anim = new Animation - { - Length = TimeSpan.FromMilliseconds(FocusAnimationTime * 1000), - AnimationTracks = - { - new AnimationTrackControlProperty - { - Property = nameof(RadialButton.ButtonSize), - InterpolationMode = AnimationInterpolationMode.Linear, - KeyFrames = - { - new AnimationTrackProperty.KeyFrame(button.Size, 0f), - new AnimationTrackProperty.KeyFrame(size, FocusAnimationTime) - } - } - } - }; - - if (stopKey != null && button.HasRunningAnimation(stopKey)) - button.StopAnimation(stopKey); - - if (!button.HasRunningAnimation(playKey)) - button.PlayAnimation(anim, playKey); - } - - protected override void Draw(DrawingHandleScreen handle) - { - base.Draw(handle); - - foreach (var child in Layout.Children) - { - var button = (RadialButton) child; - LayoutContainer.SetPosition(child, button.Offset - (button.Size / 2)); - } - - LayoutContainer.SetPosition(CloseButton, CloseButton.Offset - (CloseButton.Size / 2)); - LayoutContainer.SetPosition(ActionBox, new Vector2(0 - (ActionLabel.Size.X), FocusSize * 1.5f)); - } - - private static Vector2 GetPointFromPolar(double angleDegrees, double distance) - { - var angleRadians = angleDegrees * (Math.PI / 180.0); - - var x = distance * Math.Cos(angleRadians); - var y = distance * Math.Sin(angleRadians); - - return new Vector2((int) Math.Round(x), (int) Math.Round(y)); - } -} diff --git a/Content.Client/_White/Cult/ShowCultHudSystem.cs b/Content.Client/_White/Cult/ShowCultHudSystem.cs index 6bc503f6c7..e22fea1352 100644 --- a/Content.Client/_White/Cult/ShowCultHudSystem.cs +++ b/Content.Client/_White/Cult/ShowCultHudSystem.cs @@ -2,6 +2,7 @@ using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Client.Player; +using Robust.Shared.Player; namespace Content.Client._White.Cult; diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs b/Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs index edc16324e2..dfb12d8cec 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs @@ -157,7 +157,7 @@ public sealed partial class AdminVerbSystem if (!_minds.TryGetSession(targetMindComp.Mind, out var session)) return; - var playerSession = session as ICommonSession; + var playerSession = session; _cultRule.MakeCultist(playerSession!); } }; diff --git a/Content.Server/Chat/Commands/CultCommand.cs b/Content.Server/Chat/Commands/CultCommand.cs index b78225cb8e..6d037e6f19 100644 --- a/Content.Server/Chat/Commands/CultCommand.cs +++ b/Content.Server/Chat/Commands/CultCommand.cs @@ -5,6 +5,7 @@ using Content.Shared.White.Cult; using Robust.Server.Player; using Robust.Shared.Console; using Robust.Shared.Enums; +using Robust.Shared.Player; namespace Content.Server.Chat.Commands { @@ -17,7 +18,7 @@ namespace Content.Server.Chat.Commands public void Execute(IConsoleShell shell, string argStr, string[] args) { - if (shell.Player is not IPlayerSession player) + if (shell.Player is not { } player) { shell.WriteError("This command cannot be run from the server."); return; diff --git a/Content.Server/_White/Cult/GameRule/CultRuleComponent.cs b/Content.Server/_White/Cult/GameRule/CultRuleComponent.cs index dd25d424fb..2a52c27c15 100644 --- a/Content.Server/_White/Cult/GameRule/CultRuleComponent.cs +++ b/Content.Server/_White/Cult/GameRule/CultRuleComponent.cs @@ -7,6 +7,7 @@ using Content.Shared.Roles; using Content.Shared.White.Cult; using Robust.Server.Player; using Robust.Shared.Audio; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; @@ -41,7 +42,7 @@ public sealed partial class CultRuleComponent : Component [DataField("pentagramThreshold")] public static int PentagramThreshold = 8; - public Dictionary StarCandidates = new(); + public Dictionary StarCandidates = new(); [DataField("cultistStartingItems", customTypeSerializer: typeof(PrototypeIdListSerializer))] public List StartingItems = new(); diff --git a/Content.Server/_White/Cult/GameRule/CultRuleSystem.cs b/Content.Server/_White/Cult/GameRule/CultRuleSystem.cs index c0768137ee..3724f2e87b 100644 --- a/Content.Server/_White/Cult/GameRule/CultRuleSystem.cs +++ b/Content.Server/_White/Cult/GameRule/CultRuleSystem.cs @@ -31,6 +31,7 @@ using Robust.Shared.Random; using Robust.Shared.Utility; using Content.Shared._White; using Content.Shared.Mind; +using Robust.Shared.Audio.Systems; namespace Content.Server.White.Cult.GameRule; @@ -308,7 +309,7 @@ public sealed class CultRuleSystem : GameRuleSystem } } - private List FindPotentialTargets(List exclude = null!) + private List FindPotentialTargets(List exclude = null!) { var querry = EntityManager.EntityQuery(); @@ -332,9 +333,9 @@ public sealed class CultRuleSystem : GameRuleSystem return potentialTargets; } - private List FindPotentialCultist(in Dictionary candidates) + private List FindPotentialCultist(in Dictionary candidates) { - var list = new List(); + var list = new List(); var pendingQuery = GetEntityQuery(); foreach (var player in candidates.Keys) @@ -349,7 +350,7 @@ public sealed class CultRuleSystem : GameRuleSystem list.Add(player); } - var prefList = new List(); + var prefList = new List(); foreach (var player in list) { @@ -388,9 +389,9 @@ public sealed class CultRuleSystem : GameRuleSystem return prefList; } - private List PickCultists(List prefList) + private List PickCultists(List prefList) { - var result = new List(); + var result = new List(); if (prefList.Count == 0) { _sawmill.Info("Insufficient ready players to fill up with cultists, stopping the selection."); @@ -410,7 +411,7 @@ public sealed class CultRuleSystem : GameRuleSystem return result; } - public bool MakeCultist(IPlayerSession cultist) + public bool MakeCultist(ICommonSession cultist) { var cultistRule = EntityQuery().FirstOrDefault(); diff --git a/Content.Server/_White/Cult/HolyWater/HolyWaterSystem.cs b/Content.Server/_White/Cult/HolyWater/HolyWaterSystem.cs index 73ab24258f..bc80eb3990 100644 --- a/Content.Server/_White/Cult/HolyWater/HolyWaterSystem.cs +++ b/Content.Server/_White/Cult/HolyWater/HolyWaterSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Chemistry.Components.SolutionManager; using Content.Shared.Interaction; using Content.Shared.Mobs.Components; using Content.Shared.Popups; +using Robust.Server.Audio; using Robust.Server.GameObjects; namespace Content.Server.White.Cult.HolyWater; @@ -29,25 +30,29 @@ public sealed class HolyWaterSystem : EntitySystem if (!TryComp(args.Target, out var container)) return; - foreach (var solution in container.Solutions.Values.Where(solution => solution.ContainsReagent(component.ConvertedId, null))) + if (container.Solutions != null) { - foreach (var reagent in solution.Contents) + foreach (var solution in container.Solutions.Values.Where(solution => + solution.ContainsReagent(component.ConvertedId, null))) { - if (reagent.Reagent.Prototype != component.ConvertedId) - continue; + foreach (var reagent in solution.Contents) + { + if (reagent.Reagent.Prototype != component.ConvertedId) + continue; - var amount = reagent.Quantity; + var amount = reagent.Quantity; - solution.RemoveReagent(reagent.Reagent.Prototype, reagent.Quantity); - solution.AddReagent(component.ConvertedToId, amount); + solution.RemoveReagent(reagent.Reagent.Prototype, reagent.Quantity); + solution.AddReagent(component.ConvertedToId, amount); + + if (args.Target == null) + return; + + _popup.PopupEntity(Loc.GetString("holy-water-converted"), args.Target.Value, args.User); + _audio.PlayPvs("/Audio/Effects/holy.ogg", args.Target.Value); - if (args.Target == null) return; - - _popup.PopupEntity(Loc.GetString("holy-water-converted"), args.Target.Value, args.User); - _audio.PlayPvs("/Audio/Effects/holy.ogg", args.Target.Value); - - return; + } } } } diff --git a/Content.Server/_White/Cult/Items/Systems/TorchCultistsProviderSystem.cs b/Content.Server/_White/Cult/Items/Systems/TorchCultistsProviderSystem.cs index f021ac775a..98d76adaef 100644 --- a/Content.Server/_White/Cult/Items/Systems/TorchCultistsProviderSystem.cs +++ b/Content.Server/_White/Cult/Items/Systems/TorchCultistsProviderSystem.cs @@ -15,6 +15,7 @@ using Robust.Server.GameObjects; using Robust.Shared.Map.Components; using Robust.Shared.Physics; using Robust.Shared.Physics.Components; +using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Timing; diff --git a/Content.Server/_White/Cult/Items/Systems/VoidTeleportSystem.cs b/Content.Server/_White/Cult/Items/Systems/VoidTeleportSystem.cs index 6bd84e9f47..5193804b78 100644 --- a/Content.Server/_White/Cult/Items/Systems/VoidTeleportSystem.cs +++ b/Content.Server/_White/Cult/Items/Systems/VoidTeleportSystem.cs @@ -9,6 +9,7 @@ using Content.Shared.Pulling.Components; using Content.Shared.White.Cult; using Content.Shared.White.Cult.Items; using Robust.Server.GameObjects; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Timing; using Timer = Robust.Shared.Timing.Timer; diff --git a/Content.Server/_White/Cult/Pylon/PylonSystem.cs b/Content.Server/_White/Cult/Pylon/PylonSystem.cs index 3695419421..a1735d7132 100644 --- a/Content.Server/_White/Cult/Pylon/PylonSystem.cs +++ b/Content.Server/_White/Cult/Pylon/PylonSystem.cs @@ -16,6 +16,7 @@ using Content.Shared.White.Cult.Pylon; using Robust.Server.GameObjects; using Robust.Server.Player; using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Player; using Robust.Shared.Timing; @@ -180,7 +181,7 @@ public sealed class PylonSystem : EntitySystem ? damageComp : null; - if (playerDamageComp == null || playerDamageComp.Damage.Total == 0) + if (playerDamageComp == null) continue; var uid = comp.Owner; @@ -234,7 +235,7 @@ public sealed class PylonSystem : EntitySystem var damage = comp.BurnDamageOnInteract; var burnMsg = Loc.GetString("powered-light-component-burn-hand"); - _audio.Play(comp.BurnHandSound, Filter.Pvs(pylon), pylon, true); + _audio.PlayEntity(comp.BurnHandSound, Filter.Pvs(pylon), pylon, true); _popupSystem.PopupEntity(burnMsg, pylon, user); _damageSystem.TryChangeDamage(user, damage, true); } diff --git a/Content.Server/_White/Cult/Runes/Systems/CultSystem.Actions.cs b/Content.Server/_White/Cult/Runes/Systems/CultSystem.Actions.cs index 7bd56c8c5f..8bbcb5d651 100644 --- a/Content.Server/_White/Cult/Runes/Systems/CultSystem.Actions.cs +++ b/Content.Server/_White/Cult/Runes/Systems/CultSystem.Actions.cs @@ -1,8 +1,10 @@ using System.Linq; using Content.Server.Body.Components; +using Content.Server.Chemistry.Containers.EntitySystems; using Content.Server.Emp; using Content.Server.EUI; using Content.Server.White.Cult.UI; +using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.EntitySystems; using Content.Shared.Damage; using Content.Shared.Damage.Prototypes; @@ -16,6 +18,7 @@ using Content.Shared.White.Cult; using Content.Shared.White.Cult.Actions; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Player; namespace Content.Server.White.Cult.Runes.Systems; @@ -89,7 +92,7 @@ public partial class CultSystem if (!_solutionSystem.TryGetSolution(solutionEntity, puddleComponent.SolutionName, out var solution)) continue; - foreach (var solutionContent in solution.Contents.ToList()) + foreach (var solutionContent in solution.Value.Comp.Solution.Contents.ToList()) { if (solutionContent.Reagent.Prototype != "Blood") continue; @@ -97,7 +100,7 @@ public partial class CultSystem totalBloodAmount += solutionContent.Quantity; _bloodstreamSystem.TryModifyBloodLevel(uid, solutionContent.Quantity / 6f); - _solutionSystem.RemoveReagent(solutionEntity, solution, "Blood", FixedPoint2.MaxValue); + _solutionSystem.RemoveReagent((Entity) solution, "Blood", FixedPoint2.MaxValue); if (GetMissingBloodValue(bloodstreamComponent) == 0) { @@ -120,7 +123,7 @@ public partial class CultSystem private static FixedPoint2 GetMissingBloodValue(BloodstreamComponent bloodstreamComponent) { - return bloodstreamComponent.BloodMaxVolume - bloodstreamComponent.BloodSolution.Volume; + return bloodstreamComponent.BloodMaxVolume - bloodstreamComponent.BloodSolution!.Value.Comp.Solution.Volume; } private void OnConcealPresence(EntityUid uid, CultistComponent component, CultConcealPresenceWorldActionEvent args) diff --git a/Content.Server/_White/Cult/Runes/Systems/CultSystem.Constructs.cs b/Content.Server/_White/Cult/Runes/Systems/CultSystem.Constructs.cs index 543e3b5827..a78cc819c7 100644 --- a/Content.Server/_White/Cult/Runes/Systems/CultSystem.Constructs.cs +++ b/Content.Server/_White/Cult/Runes/Systems/CultSystem.Constructs.cs @@ -6,6 +6,7 @@ using Content.Shared.White.Cult.UI; using Robust.Server.GameObjects; using Robust.Server.Player; using Robust.Shared.Containers; +using Robust.Shared.Player; using Robust.Shared.Prototypes; namespace Content.Server.White.Cult.Runes.Systems; diff --git a/Content.Server/_White/Cult/Runes/Systems/CultSystem.ConstructsAbilities.cs b/Content.Server/_White/Cult/Runes/Systems/CultSystem.ConstructsAbilities.cs index 596415b28c..9a9ca75f5e 100644 --- a/Content.Server/_White/Cult/Runes/Systems/CultSystem.ConstructsAbilities.cs +++ b/Content.Server/_White/Cult/Runes/Systems/CultSystem.ConstructsAbilities.cs @@ -183,8 +183,8 @@ public partial class CultSystem return false; } - // Check there are no mobs there - foreach (var entity in _lookupSystem.GetEntitiesIntersecting(tile.Value)) + // Check there are no mobs there; + foreach (var entity in tile.Value.GetEntitiesInTile()) { if (HasComp(entity) && entity != performer) { diff --git a/Content.Server/_White/Cult/Runes/Systems/CultSystem.Rune.cs b/Content.Server/_White/Cult/Runes/Systems/CultSystem.Rune.cs index 8490aa84f7..1094fa2b0f 100644 --- a/Content.Server/_White/Cult/Runes/Systems/CultSystem.Rune.cs +++ b/Content.Server/_White/Cult/Runes/Systems/CultSystem.Rune.cs @@ -34,6 +34,8 @@ using Content.Shared.White.Cult.Runes; using Content.Shared.White.Cult.UI; using Robust.Server.GameObjects; using Robust.Shared.Audio; +using Robust.Shared.Audio.Components; +using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Physics.Events; using Robust.Shared.Player; @@ -118,8 +120,6 @@ public sealed partial class CultSystem : EntitySystem private bool _doAfterAlreadyStarted; - private IPlayingAudioStream? _playingStream; - private readonly SoundPathSpecifier _teleportInSound = new("/Audio/White/Cult/veilin.ogg"); private readonly SoundPathSpecifier _teleportOutSound = new("/Audio/White/Cult/veilout.ogg"); @@ -310,11 +310,12 @@ public sealed partial class CultSystem : EntitySystem { return; } - - if (solution.Solutions.TryGetValue("vapor", out var vapor) && vapor.Contents.Any(x => x.Reagent.Prototype == "HolyWater")) +#pragma warning disable RA0002 + if (solution.Solutions!.TryGetValue("vapor", out var vapor) && vapor.Contents.Any(x => x.Reagent.Prototype == "HolyWater")) { Del(uid); } +#pragma warning restore RA0002 } //Erasing end @@ -414,7 +415,8 @@ public sealed partial class CultSystem : EntitySystem var canBeConverted = _entityManager.TryGetComponent(victim.Value, out var mind) && mind.HasMind; // Проверка, является ли жертва целью - var isTarget = mind != null && mind.Mind!.Value == target?.OwnedComponent?.Mind!.Value; + _entityManager.TryGetComponent(target?.CurrentEntity, out var targetMind); + var isTarget = mind != null && mind.Mind!.Value == targetMind?.Mind!.Value; var jobAllowConvert = true; if(_jobSystem.MindTryGetJob(mind!.Mind!.Value, out var _, out var prototype)) @@ -742,17 +744,13 @@ public sealed partial class CultSystem : EntitySystem _chat.DispatchGlobalAnnouncement(Loc.GetString("cult-ritual-started"), "CULT", false, colorOverride: Color.DarkRed); - _playingStream = _audio.PlayGlobal(_narsie40Sec, Filter.Broadcast(), false, - AudioParams.Default.WithLoop(true).WithVolume(0.15f)); + _audio.PlayGlobal(_narsie40Sec, Filter.Broadcast(), false, AudioParams.Default.WithLoop(true).WithVolume(0.15f)); return true; } private void NarsieSpawn(EntityUid uid, CultistComponent component, SummonNarsieDoAfterEvent args) { - if (_playingStream != null) - _playingStream.Stop(); - _doAfterAlreadyStarted = false; if (args.Cancelled) diff --git a/Content.Server/_White/Cult/Structures/CultStructureCraftSystem.cs b/Content.Server/_White/Cult/Structures/CultStructureCraftSystem.cs index a85c3a12d5..5134245eda 100644 --- a/Content.Server/_White/Cult/Structures/CultStructureCraftSystem.cs +++ b/Content.Server/_White/Cult/Structures/CultStructureCraftSystem.cs @@ -2,6 +2,7 @@ using Content.Shared.White.Cult; using Robust.Server.GameObjects; using Robust.Server.Player; +using Robust.Shared.Player; namespace Content.Server.White.Cult.Structures; @@ -22,7 +23,7 @@ public sealed class CultStructureCraftSystem : EntitySystem if (!HasComp(args.User)) return; - if (!_playerManager.TryGetSessionByEntity(args.User, out var session) || session is not IPlayerSession playerSession) + if (!_playerManager.TryGetSessionByEntity(args.User, out var session) || session is not { } playerSession) return; if (_uiSystem.TryGetUi(uid, component.UserInterfaceKey, out var bui)) diff --git a/Content.Server/_White/Cult/TimedProduction/CultistFactorySystem.cs b/Content.Server/_White/Cult/TimedProduction/CultistFactorySystem.cs index 1798992033..2c52d63909 100644 --- a/Content.Server/_White/Cult/TimedProduction/CultistFactorySystem.cs +++ b/Content.Server/_White/Cult/TimedProduction/CultistFactorySystem.cs @@ -7,6 +7,8 @@ using Content.Shared.White.Cult; using Content.Shared.White.Cult.Structures; using Content.Shared.White.Cult.UI; using Robust.Server.GameObjects; +using Robust.Shared.Audio.Systems; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Timing; diff --git a/Content.Shared/Containers/DragInsertContainerComponent.cs b/Content.Shared/Containers/DragInsertContainerComponent.cs index e4cae26fcb..37eb4f8ce7 100644 --- a/Content.Shared/Containers/DragInsertContainerComponent.cs +++ b/Content.Shared/Containers/DragInsertContainerComponent.cs @@ -17,4 +17,9 @@ public sealed partial class DragInsertContainerComponent : Component /// [DataField, ViewVariables(VVAccess.ReadWrite)] public bool UseVerbs = true; + + public DragInsertContainerComponent(string containerId) + { + ContainerId = containerId; + } } diff --git a/Content.Shared/Containers/ExitContainerOnMoveComponent.cs b/Content.Shared/Containers/ExitContainerOnMoveComponent.cs index aae4eec710..f6e166c5b7 100644 --- a/Content.Shared/Containers/ExitContainerOnMoveComponent.cs +++ b/Content.Shared/Containers/ExitContainerOnMoveComponent.cs @@ -11,4 +11,9 @@ public sealed partial class ExitContainerOnMoveComponent : Component { [DataField, ViewVariables(VVAccess.ReadWrite)] public string ContainerId; + + public ExitContainerOnMoveComponent(string containerId) + { + ContainerId = containerId; + } } diff --git a/Content.Shared/Xenoarchaeology/Equipment/ArtifactCrusherComponent.cs b/Content.Shared/Xenoarchaeology/Equipment/ArtifactCrusherComponent.cs index e21cedb6f9..0c79ef0035 100644 --- a/Content.Shared/Xenoarchaeology/Equipment/ArtifactCrusherComponent.cs +++ b/Content.Shared/Xenoarchaeology/Equipment/ArtifactCrusherComponent.cs @@ -107,6 +107,11 @@ public sealed partial class ArtifactCrusherComponent : Component /// [DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)] public bool AutoLock = false; + + public ArtifactCrusherComponent(Container outputContainer) + { + OutputContainer = outputContainer; + } } [Serializable, NetSerializable]