From bbb2059482621faf4f816df80bacab367e7b5540 Mon Sep 17 00:00:00 2001 From: ThereDrD0 <88589686+ThereDrD0@users.noreply.github.com> Date: Sat, 16 Mar 2024 18:31:06 +0300 Subject: [PATCH] fix: fix unnecessary devices in shitsilo (#211) --- .../Materials/UI/MaterialStorageControl.xaml.cs | 2 ++ Content.Server/Lathe/LatheSystem.cs | 3 ++- .../Materials/MaterialStorageSystem.cs | 4 +++- Content.Shared/Lathe/SharedLatheSystem.cs | 2 ++ .../Materials/SharedMaterialStorageSystem.cs | 3 ++- .../_White/ShitSilo/BluespaceSiloComponent.cs | 9 +++++++++ .../Entities/Structures/Machines/lathe.yml | 17 ++++++++++++++++- .../Structures/Machines/doc_printer.yml | 1 + 8 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 Content.Shared/_White/ShitSilo/BluespaceSiloComponent.cs diff --git a/Content.Client/Materials/UI/MaterialStorageControl.xaml.cs b/Content.Client/Materials/UI/MaterialStorageControl.xaml.cs index 2d4934d5ce..8c67505532 100644 --- a/Content.Client/Materials/UI/MaterialStorageControl.xaml.cs +++ b/Content.Client/Materials/UI/MaterialStorageControl.xaml.cs @@ -1,4 +1,5 @@ using System.Linq; +using Content.Shared._White.ShitSilo; using Content.Shared.Materials; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.Controls; @@ -44,6 +45,7 @@ public sealed partial class MaterialStorageControl : BoxContainer } var gridStorage = _entityManager.TryGetComponent(_owner, out var transformComponent) && + _entityManager.HasComponent(_owner) && _entityManager.TryGetComponent(transformComponent.GridUid, out var materialStorageComponent) ? materialStorageComponent : null; diff --git a/Content.Server/Lathe/LatheSystem.cs b/Content.Server/Lathe/LatheSystem.cs index 5b0c152ad3..89ec193bcb 100644 --- a/Content.Server/Lathe/LatheSystem.cs +++ b/Content.Server/Lathe/LatheSystem.cs @@ -8,6 +8,7 @@ using Content.Server.Materials; using Content.Server.Power.Components; using Content.Server.Power.EntitySystems; using Content.Server.Stack; +using Content.Shared._White.ShitSilo; using Content.Shared.UserInterface; using Content.Shared.Database; using Content.Shared.Emag.Components; @@ -164,7 +165,7 @@ namespace Content.Server.Lathe ? (int) (-amount * component.MaterialUseMultiplier) : -amount; - var gridUid = + var gridUid = HasComp(uid) && TryComp(uid, out var transformComponent) ? transformComponent.GridUid : null; var gridStorage = diff --git a/Content.Server/Materials/MaterialStorageSystem.cs b/Content.Server/Materials/MaterialStorageSystem.cs index 1cf99a35e6..48f9aa661c 100644 --- a/Content.Server/Materials/MaterialStorageSystem.cs +++ b/Content.Server/Materials/MaterialStorageSystem.cs @@ -5,6 +5,7 @@ using Content.Shared.Popups; using Content.Shared.Stacks; using Content.Server.Power.Components; using Content.Server.Stack; +using Content.Shared._White.ShitSilo; using Content.Shared.ActionBlocker; using Content.Shared.Construction; using Content.Shared.Database; @@ -78,7 +79,8 @@ public sealed class MaterialStorageSystem : SharedMaterialStorageSystem volume = sheetsToExtract * volumePerSheet; } - var gridUid = TryComp(uid, out var transformComponent) + var gridUid = HasComp(uid) && + TryComp(uid, out var transformComponent) ? transformComponent.GridUid : null; diff --git a/Content.Shared/Lathe/SharedLatheSystem.cs b/Content.Shared/Lathe/SharedLatheSystem.cs index 7b8770bf46..71b16a9991 100644 --- a/Content.Shared/Lathe/SharedLatheSystem.cs +++ b/Content.Shared/Lathe/SharedLatheSystem.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using Content.Shared._White.ShitSilo; using Content.Shared.Emag.Systems; using Content.Shared.Materials; using Content.Shared.Research.Prototypes; @@ -45,6 +46,7 @@ public abstract class SharedLatheSystem : EntitySystem var adjustedAmount = AdjustMaterial(needed, recipe.ApplyMaterialDiscount, component.MaterialUseMultiplier); var gridUid = + HasComp(uid) && TryComp(uid, out var transformComponent) ? transformComponent.GridUid : null; diff --git a/Content.Shared/Materials/SharedMaterialStorageSystem.cs b/Content.Shared/Materials/SharedMaterialStorageSystem.cs index 5605b8a5d9..e8977a55b8 100644 --- a/Content.Shared/Materials/SharedMaterialStorageSystem.cs +++ b/Content.Shared/Materials/SharedMaterialStorageSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using Content.Shared._White.ShitSilo; using Content.Shared.Interaction; using Content.Shared.Interaction.Components; using Content.Shared.Lathe; @@ -295,7 +296,7 @@ public abstract class SharedMaterialStorageSystem : EntitySystem var multiplier = TryComp(toInsert, out var stackComponent) ? stackComponent.Count : 1; var totalVolume = 0; - var gridUid = HasComp(receiver) && + var gridUid = HasComp(receiver) && TryComp(receiver, out var transformComponent) ? transformComponent.GridUid : null; diff --git a/Content.Shared/_White/ShitSilo/BluespaceSiloComponent.cs b/Content.Shared/_White/ShitSilo/BluespaceSiloComponent.cs new file mode 100644 index 0000000000..6d7f3446f8 --- /dev/null +++ b/Content.Shared/_White/ShitSilo/BluespaceSiloComponent.cs @@ -0,0 +1,9 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared._White.ShitSilo; + +[RegisterComponent, NetworkedComponent] +public sealed partial class BluespaceSiloComponent : Component +{ + +} diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 515a40e236..7d4858eca9 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -18,6 +18,7 @@ layer: - MachineLayer - type: Lathe + - type: BluespaceSilo - type: MaterialStorage - type: Destructible thresholds: @@ -225,6 +226,7 @@ - MagazineGrenadeEmpty - GrenadeEMP - GrenadeFlash + - type: BluespaceSilo - type: entity id: AutolatheHyperConvection @@ -237,6 +239,7 @@ - type: Lathe materialUseMultiplier: 0.5 timeMultiplier: 1.5 + - type: BluespaceSilo - type: LatheHeatProducing - type: Machine board: AutolatheHyperConvectionMachineCircuitboard @@ -349,6 +352,7 @@ - WeaponAdvancedLaser - WeaponLaserCannon - WeaponXrayCannon + - type: BluespaceSilo - type: entity id: ProtolatheHyperConvection @@ -361,6 +365,7 @@ - type: Lathe materialUseMultiplier: 0.5 timeMultiplier: 1.5 + - type: BluespaceSilo - type: LatheHeatProducing - type: Machine board: ProtolatheHyperConvectionMachineCircuitboard @@ -476,6 +481,7 @@ - ArtifactCrusherMachineCircuitboard - TelecomServerCircuitboard - MassMediaCircuitboard + - type: BluespaceSilo - type: MaterialStorage whitelist: tags: @@ -588,6 +594,7 @@ - HamtrLLeg - HamtrRLeg - VimHarness + - type: BluespaceSilo - type: MaterialStorage whitelist: tags: @@ -640,6 +647,7 @@ - AbominationCube - SpaceCarpCube - SpaceTickCube + - type: BluespaceSilo - type: entity id: SecurityTechFab @@ -770,6 +778,7 @@ - Sheet - RawMaterial - Ingot + - type: BluespaceSilo - type: entity id: AmmoTechFab @@ -816,11 +825,12 @@ - MagazineBoxMagnumAP - MagazineBoxAntiMateriel - MagazineBoxCaselessRifle + - type: BluespaceSilo - type: MaterialStorage whitelist: tags: - Sheet - + - - type: entity id: MedicalTechFab parent: BaseLathe @@ -889,6 +899,7 @@ - SyringeBluespace - SyringeCryostasis - ClothingEyesHudMedical + - type: BluespaceSilo - type: Machine board: MedicalTechFabCircuitboard - type: StealTarget @@ -1073,6 +1084,7 @@ - ClothingOuterWinterCentcom - ClothingOuterWinterSyndie - ClothingOuterWinterSyndieCap + - type: BluespaceSilo - type: MaterialStorage whitelist: tags: @@ -1119,6 +1131,7 @@ - IngotGold30 - IngotSilver30 - MaterialBananium10 + - type: BluespaceSilo - type: entity parent: OreProcessor @@ -1147,6 +1160,7 @@ - IngotGold30 - IngotSilver30 - MaterialBananium10 + - type: BluespaceSilo - type: entity parent: BaseLathe @@ -1178,3 +1192,4 @@ staticRecipes: - MaterialSheetMeat - SheetPaper + - type: BluespaceSilo diff --git a/Resources/Prototypes/White/Entities/Structures/Machines/doc_printer.yml b/Resources/Prototypes/White/Entities/Structures/Machines/doc_printer.yml index 16c2174118..5559938e08 100644 --- a/Resources/Prototypes/White/Entities/Structures/Machines/doc_printer.yml +++ b/Resources/Prototypes/White/Entities/Structures/Machines/doc_printer.yml @@ -20,6 +20,7 @@ layer: - TabletopMachineLayer - type: Lathe + - type: BluespaceSilo - type: MaterialStorage - type: ActivatableUI key: enum.LatheUiKey.Key