diff --git a/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs b/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs index 9e5e24b3e48f73..3f748486577281 100644 --- a/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs +++ b/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs @@ -19,6 +19,10 @@ using Robust.Shared.Map; using Robust.Shared.Network; using Dependency = Robust.Shared.IoC.DependencyAttribute; +using Content.Shared.SS220.Spray.Components; +using Content.Shared.SS220.Spray.Events; +using Content.Shared.SS220.Spray.System; +using YamlDotNet.Core.Tokens; namespace Content.Shared.Chemistry.EntitySystems; @@ -82,6 +86,7 @@ public override void Initialize() SubscribeLocalEvent(OnExamineSolution); SubscribeLocalEvent>(OnSolutionExaminableVerb); SubscribeLocalEvent(OnMapInit); + SubscribeLocalEvent(OnGetSolution); if (NetManager.IsServer) { @@ -1217,4 +1222,17 @@ public FixedPoint2 ClampReagentAmountByConcentration( dissolvedReagentAmount += overflow; return dissolvedReagentAmount; } + + // SS220 Refactor nuzzle begin + private void OnGetSolution(Entity entity, ref TakeSolutionEvent takeSolutionEvent) + { + if (!TryGetSolution(entity.Owner, ClothingSlotSolutionProviderComponent.ContainmentSolutionName, out var entsoln, out var solution)) + return; + + if(entsoln != null) + { + var splitSolution = SplitSolution(entsoln.Value, 10f); + } + } + // SS220 Refactor nuzzle end } diff --git a/Content.Shared/SS220/Spray/Components/ClothingSlotSolutionProviderComponent.cs b/Content.Shared/SS220/Spray/Components/ClothingSlotSolutionProviderComponent.cs new file mode 100644 index 00000000000000..336a6e045d5a19 --- /dev/null +++ b/Content.Shared/SS220/Spray/Components/ClothingSlotSolutionProviderComponent.cs @@ -0,0 +1,27 @@ +using Content.Shared.Inventory; +using Content.Shared.Whitelist; +using Robust.Shared.GameStates; +using Content.Shared.SS220.Spray.System; + +namespace Content.Shared.SS220.Spray.Components; + +/// +/// This is used for relaying solition events +/// to an entity in the user's clothing slot. +/// +[RegisterComponent, NetworkedComponent, Access(typeof(SharedSpraySystem))] +public sealed partial class ClothingSlotSolutionProviderComponent : Component +{ + public const string ContainmentSolutionName = "containmentsolution"; + /// + /// The slot that the ammo provider should be located in. + /// + [DataField("solutionRequiredSlot", required: true)] + public SlotFlags SolutionRequiredSlot; + + /// + /// A whitelist for determining whether or not an solution provider is valid. + /// + [DataField("solutionProviderWhitelist")] + public EntityWhitelist? SolutionProviderWhitelist; +} diff --git a/Content.Shared/SS220/Spray/Events/GetSolutionCountEvent.cs b/Content.Shared/SS220/Spray/Events/GetSolutionCountEvent.cs new file mode 100644 index 00000000000000..0082283f95faaf --- /dev/null +++ b/Content.Shared/SS220/Spray/Events/GetSolutionCountEvent.cs @@ -0,0 +1,11 @@ +namespace Content.Shared.SS220.Spray.Events; + +/// +/// Raised on an AmmoProvider to request deets. +/// +[ByRefEvent] +public struct GetSolutionCountEvent +{ + public int Count; + public int Capacity; +} diff --git a/Content.Shared/SS220/Spray/Events/TakeSolutionEvent.cs b/Content.Shared/SS220/Spray/Events/TakeSolutionEvent.cs new file mode 100644 index 00000000000000..13476d1a929b31 --- /dev/null +++ b/Content.Shared/SS220/Spray/Events/TakeSolutionEvent.cs @@ -0,0 +1,23 @@ +using Robust.Shared.Map; +using Content.Shared.Weapons.Ranged; + +namespace Content.Shared.SS220.Spray.Events; + +/// +/// Raised on a gun when it would like to take the specified amount of ammo. +/// +public sealed class TakeSolutionEvent : EntityEventArgs +{ + public readonly EntityUid? User; + public byte SolutionAmount { get; } + + /// + /// If no ammo returned what is the reason for it? + /// + public string? Reason; + + public TakeSolutionEvent(EntityUid? user, byte solutionAmount) + { + } + +} diff --git a/Content.Shared/SS220/Spray/Systems/SharedSpraySystem.Clothing.cs b/Content.Shared/SS220/Spray/Systems/SharedSpraySystem.Clothing.cs new file mode 100644 index 00000000000000..3748e2577e6b08 --- /dev/null +++ b/Content.Shared/SS220/Spray/Systems/SharedSpraySystem.Clothing.cs @@ -0,0 +1,61 @@ +using System.Diagnostics.CodeAnalysis; +using Content.Shared.Inventory; +using Content.Shared.SS220.Spray.Components; +using Content.Shared.SS220.Spray.Events; +using Content.Shared.Whitelist; +using Linguini.Bundle.Errors; +using Robust.Shared.Containers; + +namespace Content.Shared.SS220.Spray.System; + +public sealed partial class SharedSpraySystem : EntitySystem +{ + [Dependency] private readonly InventorySystem _inventory = default!; + [Dependency] private readonly SharedContainerSystem _container = default!; + [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; + + public override void Initialize() + { + SubscribeLocalEvent(OnClothingTakeSolution); + SubscribeLocalEvent(OnClothingSolutionCount); + } + + private void OnClothingTakeSolution(EntityUid uid, ClothingSlotSolutionProviderComponent component, TakeSolutionEvent args) + { + if (!TryGetClothingSlotEntity(uid, component, out var entity)) + return; + RaiseLocalEvent(entity.Value, args); + } + + private void OnClothingSolutionCount(EntityUid uid, ClothingSlotSolutionProviderComponent component, ref GetSolutionCountEvent args) + { + if (!TryGetClothingSlotEntity(uid, component, out var entity)) + return; + RaiseLocalEvent(entity.Value, ref args); + } + + private bool TryGetClothingSlotEntity(EntityUid uid, ClothingSlotSolutionProviderComponent component, [NotNullWhen(true)] out EntityUid? slotEntity) + { + slotEntity = null; + + if (!_container.TryGetContainingContainer(uid, out var container)) + return false; + var user = container.Owner; + + if (!_inventory.TryGetContainerSlotEnumerator(user, out var enumerator, component.SolutionRequiredSlot)) + return false; + + while (enumerator.NextItem(out var item)) + { + if (component.SolutionProviderWhitelist == null || + !_whitelistSystem.IsValid(component.SolutionProviderWhitelist, uid)) + continue; + + slotEntity = item; + return true; + } + + return false; + } +} + diff --git a/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/objects/weapons/guns/basic/spraynozzle.ftl b/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/objects/weapons/guns/basic/spraynozzle.ftl index a5ce8719a29b5b..43fee543420e35 100644 --- a/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/objects/weapons/guns/basic/spraynozzle.ftl +++ b/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/objects/weapons/guns/basic/spraynozzle.ftl @@ -1,2 +1,2 @@ -ent-WeaponSprayNozzle = форсунка-распылитель - .desc = Мощное разбрызгивающее устройство, используемое в связке с ранцевым резервуаром с водой. +ent-SprayNozzle = пневматический распылитель высокого давления + .desc = Мощное разбрызгивающее устройство, используемое в связке с ранцевым резервуаром с космическим очистителем. diff --git a/Resources/Maps/Nonstations/nukieplanet.yml b/Resources/Maps/Nonstations/nukieplanet.yml index 2063451a0ee48b..5924969591756a 100644 --- a/Resources/Maps/Nonstations/nukieplanet.yml +++ b/Resources/Maps/Nonstations/nukieplanet.yml @@ -15170,7 +15170,7 @@ entities: parent: 104 - type: BallisticAmmoProvider unspawnedCount: 2 -- proto: WeaponSprayNozzle +- proto: SprayNozzle entities: - uid: 152 components: diff --git a/Resources/Maps/Shuttles/dart.yml b/Resources/Maps/Shuttles/dart.yml index a3c552b84ab542..efa1b817eaea1f 100644 --- a/Resources/Maps/Shuttles/dart.yml +++ b/Resources/Maps/Shuttles/dart.yml @@ -6583,7 +6583,7 @@ entities: - type: Transform pos: -1.5,6.5 parent: 1 -- proto: WeaponSprayNozzle +- proto: SprayNozzle entities: - uid: 337 components: diff --git a/Resources/Prototypes/Entities/Clothing/Back/specific.yml b/Resources/Prototypes/Entities/Clothing/Back/specific.yml index e0ad84f9cad77b..dfd098ec037339 100644 --- a/Resources/Prototypes/Entities/Clothing/Back/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Back/specific.yml @@ -19,7 +19,7 @@ enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface # Corvax-HiddenDesc-Start - - type: HiddenDescription + - type: HiddenDescription entries: - label: corvax-hidden-desc-Chameleon-syndicate whitelistMind: @@ -73,6 +73,10 @@ interfaces: enum.TransferAmountUiKey.Key: type: TransferAmountBoundUserInterface + # SS220 Nuzzle refactor begin + enum.StorageUiKey.Key: + type: StorageBoundUserInterface + # SS220 Nuzzle refactor end - type: DrawableSolution solution: tank - type: RefillableSolution @@ -81,3 +85,11 @@ solution: tank - type: ExaminableSolution solution: tank + # SS220 Nuzzle refactor begin + - type: Storage + grid: + - 0,0,1,1 + whitelist: + components: + - ClothingSlotSolutionProvider + # SS220 Nuzzle refactor begin diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 2446ec2eb8b4af..197d69e6ba412b 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -313,7 +313,7 @@ - ChemistryEmptyBottle01 - AdvMopItem - TrashBagAdvanced #SS220 Borg Modules - - WeaponSprayNozzle + - SprayNozzle - ClothingBackpackWaterTank - MegaSprayBottle - TimerTrigger diff --git a/Resources/Prototypes/Recipes/Lathes/janitorial.yml b/Resources/Prototypes/Recipes/Lathes/janitorial.yml index 9ba7dfa1889e94..e6aa0a353f6523 100644 --- a/Resources/Prototypes/Recipes/Lathes/janitorial.yml +++ b/Resources/Prototypes/Recipes/Lathes/janitorial.yml @@ -90,8 +90,8 @@ Wood: 200 - type: latheRecipe - id: WeaponSprayNozzle - result: WeaponSprayNozzle + id: SprayNozzle + result: SprayNozzle completetime: 5 materials: Steel: 1500 diff --git a/Resources/Prototypes/Research/civilianservices.yml b/Resources/Prototypes/Research/civilianservices.yml index 15b190adde7463..5a9c3c202ac5ac 100644 --- a/Resources/Prototypes/Research/civilianservices.yml +++ b/Resources/Prototypes/Research/civilianservices.yml @@ -191,7 +191,7 @@ tier: 2 cost: 10000 recipeUnlocks: - - WeaponSprayNozzle + - SprayNozzle - ClothingBackpackWaterTank - type: technology diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/spraynozzle.yml b/Resources/Prototypes/SS220/Tools/spraynozzle.yml similarity index 93% rename from Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/spraynozzle.yml rename to Resources/Prototypes/SS220/Tools/spraynozzle.yml index fe9f94e0afa7a8..8d4717c6afea70 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/spraynozzle.yml +++ b/Resources/Prototypes/SS220/Tools/spraynozzle.yml @@ -1,5 +1,5 @@ - type: entity - id: WeaponSprayNozzle + id: SprayNozzle parent: BaseItem name: spray nozzle description: A high-powered spray nozzle used in conjunction with a backpack-mounted water tank. @@ -24,7 +24,7 @@ soundGunshot: path: /Audio/Weapons/Guns/Gunshots/water_spray.ogg - type: Appearance - - type: ClothingSlotAmmoProvider + - type: ClothingSlotSolutionProvider targetSlot: BACK providerWhitelist: tags: