From 8c9c17e6def4d0be49f4644a014a2642691a4957 Mon Sep 17 00:00:00 2001 From: EnefFlow Date: Wed, 15 Nov 2023 23:31:43 +0300 Subject: [PATCH] kinda fixes --- .../_White/Cult/GameRule/CultRuleSystem.cs | 7 ++----- .../Components/TorchCultistsProviderComponent.cs | 2 +- .../Items/Systems/TorchCultistsProviderSystem.cs | 8 +++++--- .../Cult/Items/Systems/VoidTeleportSystem.cs | 6 ++++++ Content.Server/_White/Cult/Pylon/PylonSystem.cs | 2 ++ .../Runes/Comps/RuneDrawerProviderComponent.cs | 2 +- .../Cult/Runes/Systems/CultSystem.Constructs.cs | 16 ++++++++++------ .../_White/Cult/Runes/Systems/CultSystem.Rune.cs | 2 +- .../Cult/Structures/CultStructureCraftSystem.cs | 6 +++--- .../Cult/Structures/RunicMetalComponent.cs | 2 +- .../TimedProduction/CultistFactoryComponent.cs | 2 +- .../Cult/TimedProduction/CultistFactorySystem.cs | 4 ++-- .../Prototypes/Objectives/cultObjectives.yml | 14 ++++++++++---- 13 files changed, 45 insertions(+), 28 deletions(-) diff --git a/Content.Server/_White/Cult/GameRule/CultRuleSystem.cs b/Content.Server/_White/Cult/GameRule/CultRuleSystem.cs index 2c0a0045ca..c0768137ee 100644 --- a/Content.Server/_White/Cult/GameRule/CultRuleSystem.cs +++ b/Content.Server/_White/Cult/GameRule/CultRuleSystem.cs @@ -452,7 +452,7 @@ public sealed class CultRuleSystem : GameRuleSystem if (backPack != null) { - _storageSystem.Insert(backPack.Value, itemEntity); + _storageSystem.Insert(backPack.Value, itemEntity, out _); } } } @@ -462,10 +462,7 @@ public sealed class CultRuleSystem : GameRuleSystem _chatManager.DispatchServerMessage(cultist, Loc.GetString("cult-role-greeting")); - if (_prototypeManager.TryIndex("CultistKillObjective", out var cultistObjective)) - { - _mindSystem.TryAddObjective(mind.Value, mindComponent,cultistObjective); - } + _mindSystem.TryAddObjective(mind.Value, mindComponent, "CultistKillObjective"); return true; } diff --git a/Content.Server/_White/Cult/Items/Components/TorchCultistsProviderComponent.cs b/Content.Server/_White/Cult/Items/Components/TorchCultistsProviderComponent.cs index 6b21d50fb2..0bb43d8d8e 100644 --- a/Content.Server/_White/Cult/Items/Components/TorchCultistsProviderComponent.cs +++ b/Content.Server/_White/Cult/Items/Components/TorchCultistsProviderComponent.cs @@ -8,7 +8,7 @@ namespace Content.Server.White.Cult.Items.Components; public sealed partial class TorchCultistsProviderComponent : Component { [ViewVariables(VVAccess.ReadOnly)] - public BoundUserInterface? UserInterface => Owner.GetUIOrNull(CultTeleporterUiKey.Key); + public Enum UserInterfaceKey = CultTeleporterUiKey.Key; [ViewVariables(VVAccess.ReadOnly)] public EntityUid? ItemSelected; diff --git a/Content.Server/_White/Cult/Items/Systems/TorchCultistsProviderSystem.cs b/Content.Server/_White/Cult/Items/Systems/TorchCultistsProviderSystem.cs index 1561b55f16..f021ac775a 100644 --- a/Content.Server/_White/Cult/Items/Systems/TorchCultistsProviderSystem.cs +++ b/Content.Server/_White/Cult/Items/Systems/TorchCultistsProviderSystem.cs @@ -95,7 +95,9 @@ public sealed class TorchCultistsProviderSystem : EntitySystem return; } - if (provider.UserInterface == null) + var ui = _ui.GetUiOrNull(uid, comp.UserInterfaceKey); + + if (ui == null) return; provider.ItemSelected = args.Target; @@ -120,12 +122,12 @@ public sealed class TorchCultistsProviderSystem : EntitySystem return; } - UserInterfaceSystem.SetUiState(provider.UserInterface, new TorchWindowBUIState(list)); + _ui.SetUiState(ui, new TorchWindowBUIState(list)); if (!TryComp(args.User, out var actorComponent)) return; - _ui.ToggleUi(provider.UserInterface, actorComponent.PlayerSession); + _ui.ToggleUi(ui, actorComponent.PlayerSession); } private void OnCultistSelected( diff --git a/Content.Server/_White/Cult/Items/Systems/VoidTeleportSystem.cs b/Content.Server/_White/Cult/Items/Systems/VoidTeleportSystem.cs index 28bf0c606b..6bd84e9f47 100644 --- a/Content.Server/_White/Cult/Items/Systems/VoidTeleportSystem.cs +++ b/Content.Server/_White/Cult/Items/Systems/VoidTeleportSystem.cs @@ -135,7 +135,9 @@ public sealed class VoidTeleportSystem : EntitySystem private void CreatePulse(EntityUid uid, VoidTeleportComponent component) { if (TryComp(uid, out var light)) +#pragma warning disable RA0002 light.Energy = 5f; +#pragma warning restore RA0002 Timer.Spawn(component.TimerDelay, () => TurnOffPulse(uid, component), component.Token.Token); } @@ -145,7 +147,9 @@ public sealed class VoidTeleportSystem : EntitySystem if (!TryComp(uid, out var light)) return; +#pragma warning disable RA0002 light.Energy = 1f; +#pragma warning restore RA0002 comp.Token = new CancellationTokenSource(); @@ -154,7 +158,9 @@ public sealed class VoidTeleportSystem : EntitySystem comp.Active = false; UpdateAppearance(uid, comp); +#pragma warning disable RA0002 light.Enabled = false; +#pragma warning restore RA0002 } } } diff --git a/Content.Server/_White/Cult/Pylon/PylonSystem.cs b/Content.Server/_White/Cult/Pylon/PylonSystem.cs index 76e14ffa23..3695419421 100644 --- a/Content.Server/_White/Cult/Pylon/PylonSystem.cs +++ b/Content.Server/_White/Cult/Pylon/PylonSystem.cs @@ -222,7 +222,9 @@ public sealed class PylonSystem : EntitySystem if (!TryComp(uid, out var light)) return; +#pragma warning disable RA0002 light.Enabled = comp.Activated; +#pragma warning restore RA0002 var toggleMsg = Loc.GetString(comp.Activated ? "pylon-toggle-on" : "pylon-toggle-off"); _popupSystem.PopupEntity(toggleMsg, uid); diff --git a/Content.Server/_White/Cult/Runes/Comps/RuneDrawerProviderComponent.cs b/Content.Server/_White/Cult/Runes/Comps/RuneDrawerProviderComponent.cs index d2098d7986..19f8b4441c 100644 --- a/Content.Server/_White/Cult/Runes/Comps/RuneDrawerProviderComponent.cs +++ b/Content.Server/_White/Cult/Runes/Comps/RuneDrawerProviderComponent.cs @@ -8,7 +8,7 @@ namespace Content.Shared.White.Cult; public sealed partial class RuneDrawerProviderComponent : Component { [ViewVariables] - public BoundUserInterface? UserInterface => Owner.GetUIOrNull(ListViewSelectorUiKey.Key); + public Enum UserInterfaceKey = ListViewSelectorUiKey.Key; [DataField("runePrototypes")] public List RunePrototypes = new(); diff --git a/Content.Server/_White/Cult/Runes/Systems/CultSystem.Constructs.cs b/Content.Server/_White/Cult/Runes/Systems/CultSystem.Constructs.cs index 1174c2c10a..543e3b5827 100644 --- a/Content.Server/_White/Cult/Runes/Systems/CultSystem.Constructs.cs +++ b/Content.Server/_White/Cult/Runes/Systems/CultSystem.Constructs.cs @@ -25,14 +25,18 @@ public partial class CultSystem private void OnShellSelected(EntityUid uid, ConstructShellComponent component, ConstructFormSelectedEvent args) { - var construct = Spawn(args.SelectedForm, Transform(args.Entity).MapPosition); - var mind = Comp(args.Session.AttachedEntity!.Value); + if (args.Session.AttachedEntity != null) + { + var construct = Spawn(args.SelectedForm, Transform(args.Session.AttachedEntity.Value).MapPosition); + var mind = Comp(args.Session.AttachedEntity!.Value); - if(!mind.HasMind) - return; + if(!mind.HasMind) + return; - _mindSystem.TransferTo(mind.Mind.Value, construct); - Del(args.Entity); + _mindSystem.TransferTo(mind.Mind.Value, construct); + } + + Del(args.Session.AttachedEntity); } private void OnShellInit(EntityUid uid, ConstructShellComponent component, ComponentInit args) diff --git a/Content.Server/_White/Cult/Runes/Systems/CultSystem.Rune.cs b/Content.Server/_White/Cult/Runes/Systems/CultSystem.Rune.cs index 1c5971fc06..93bec744c6 100644 --- a/Content.Server/_White/Cult/Runes/Systems/CultSystem.Rune.cs +++ b/Content.Server/_White/Cult/Runes/Systems/CultSystem.Rune.cs @@ -135,7 +135,7 @@ public sealed partial class CultSystem : EntitySystem private void OnRuneDrawerUseInHand(EntityUid uid, RuneDrawerProviderComponent component, UseInHandEvent args) { - if (component.UserInterface == null) + if (!_ui.TryGetUi(uid, component.UserInterfaceKey, out _)) return; if (!TryComp(args.User, out var actorComponent)) diff --git a/Content.Server/_White/Cult/Structures/CultStructureCraftSystem.cs b/Content.Server/_White/Cult/Structures/CultStructureCraftSystem.cs index 93b9af4f2a..a85c3a12d5 100644 --- a/Content.Server/_White/Cult/Structures/CultStructureCraftSystem.cs +++ b/Content.Server/_White/Cult/Structures/CultStructureCraftSystem.cs @@ -25,10 +25,10 @@ public sealed class CultStructureCraftSystem : EntitySystem if (!_playerManager.TryGetSessionByEntity(args.User, out var session) || session is not IPlayerSession playerSession) return; - if (component.UserInterface != null) + if (_uiSystem.TryGetUi(uid, component.UserInterfaceKey, out var bui)) { - _uiSystem.CloseUi(component.UserInterface, playerSession); - _uiSystem.OpenUi(component.UserInterface, playerSession); + _uiSystem.CloseUi(bui, playerSession); + _uiSystem.OpenUi(bui, playerSession); } } } diff --git a/Content.Server/_White/Cult/Structures/RunicMetalComponent.cs b/Content.Server/_White/Cult/Structures/RunicMetalComponent.cs index 568e6bb95e..c037a05d74 100644 --- a/Content.Server/_White/Cult/Structures/RunicMetalComponent.cs +++ b/Content.Server/_White/Cult/Structures/RunicMetalComponent.cs @@ -8,7 +8,7 @@ namespace Content.Server.White.Cult.Structures; public sealed partial class RunicMetalComponent : Component { [ViewVariables(VVAccess.ReadOnly)] - public BoundUserInterface? UserInterface => Owner.GetUIOrNull(CultStructureCraftUiKey.Key); + public Enum UserInterfaceKey = CultStructureCraftUiKey.Key; [ViewVariables(VVAccess.ReadWrite), DataField("delay")] public float Delay = 1; diff --git a/Content.Server/_White/Cult/TimedProduction/CultistFactoryComponent.cs b/Content.Server/_White/Cult/TimedProduction/CultistFactoryComponent.cs index d719b7ce42..e4baf644c8 100644 --- a/Content.Server/_White/Cult/TimedProduction/CultistFactoryComponent.cs +++ b/Content.Server/_White/Cult/TimedProduction/CultistFactoryComponent.cs @@ -20,7 +20,7 @@ public sealed partial class CultistFactoryComponent : Component [DataField("products", customTypeSerializer: typeof(PrototypeIdListSerializer))] public IReadOnlyCollection Products = ArraySegment.Empty; - public BoundUserInterface? UserInterface => Owner.GetUIOrNull(CultistAltarUiKey.Key); + public Enum UserInterfaceKey = CultistAltarUiKey.Key; [ViewVariables(VVAccess.ReadOnly)] public bool Active = true; diff --git a/Content.Server/_White/Cult/TimedProduction/CultistFactorySystem.cs b/Content.Server/_White/Cult/TimedProduction/CultistFactorySystem.cs index a67fc765c4..1798992033 100644 --- a/Content.Server/_White/Cult/TimedProduction/CultistFactorySystem.cs +++ b/Content.Server/_White/Cult/TimedProduction/CultistFactorySystem.cs @@ -81,7 +81,7 @@ public sealed class CultistFactorySystem : EntitySystem if (_ui.TryGetUi(uid, CultistAltarUiKey.Key, out var bui)) { - UserInterfaceSystem.SetUiState(bui, new CultistFactoryBUIState(component.Products)); + _ui.SetUiState(bui, new CultistFactoryBUIState(component.Products)); _ui.OpenUi(bui, actor.PlayerSession); } } @@ -128,7 +128,7 @@ public sealed class CultistFactorySystem : EntitySystem var xform = Transform(uid); var ev = new CultAnchorDoAfterEvent(xform.Anchored); - var doArgs = new DoAfterArgs(user, time, ev, uid, uid); + var doArgs = new DoAfterArgs(_entityManager, user, time, ev, uid, uid); _doAfterSystem.TryStartDoAfter(doArgs); } diff --git a/Resources/Prototypes/Objectives/cultObjectives.yml b/Resources/Prototypes/Objectives/cultObjectives.yml index 8472033859..05fe14fae6 100644 --- a/Resources/Prototypes/Objectives/cultObjectives.yml +++ b/Resources/Prototypes/Objectives/cultObjectives.yml @@ -1,5 +1,11 @@ -- type: objective +- type: entity + noSpawn: true + parent: BaseObjective id: CultistKillObjective - issuer: Cult - conditions: - - !type:KillCultistTarget {} + description: objective-condition-kill-person-description + components: + - type: Objective + icon: + sprite: /White/Cult/interface.rsi + state: icon + - type: KillCultistTargetCondition