diff --git a/Content.Server/Chemistry/Components/SolutionSpikerComponent.cs b/Content.Shared/Chemistry/Components/SolutionSpikerComponent.cs similarity index 51% rename from Content.Server/Chemistry/Components/SolutionSpikerComponent.cs rename to Content.Shared/Chemistry/Components/SolutionSpikerComponent.cs index 1fad6c9a3e..e6cf9e0205 100644 --- a/Content.Server/Chemistry/Components/SolutionSpikerComponent.cs +++ b/Content.Shared/Chemistry/Components/SolutionSpikerComponent.cs @@ -1,30 +1,40 @@ -namespace Content.Server.Chemistry.Components; +using Content.Shared.Chemistry.EntitySystems; +using Robust.Shared.GameStates; -[RegisterComponent] +namespace Content.Shared.Chemistry.Components; + +[RegisterComponent, NetworkedComponent, Access(typeof(SolutionSpikerSystem))] public sealed partial class SolutionSpikerComponent : Component { /// /// The source solution to take the reagents from in order /// to spike the other solution container. /// - [DataField] - public string SourceSolution { get; private set; } = string.Empty; + [DataField(required: true)] + public string SourceSolution = string.Empty; /// /// If spiking with this entity should ignore empty containers or not. /// [DataField] - public bool IgnoreEmpty { get; private set; } + public bool IgnoreEmpty; + + /// + /// If true, the entity is deleted after spiking. + /// This is almost certainly what you want. + /// + [DataField] + public bool Delete = true; /// /// What should pop up when spiking with this entity. /// [DataField] - public LocId Popup { get; private set; } = "spike-solution-generic"; + public LocId Popup = "spike-solution-generic"; /// /// What should pop up when spiking fails because the container was empty. /// [DataField] - public LocId PopupEmpty { get; private set; } = "spike-solution-empty-generic"; + public LocId PopupEmpty = "spike-solution-empty-generic"; } diff --git a/Content.Server/Chemistry/EntitySystems/SolutionSpikableSystem.cs b/Content.Shared/Chemistry/EntitySystems/SolutionSpikerSystem.cs similarity index 61% rename from Content.Server/Chemistry/EntitySystems/SolutionSpikableSystem.cs rename to Content.Shared/Chemistry/EntitySystems/SolutionSpikerSystem.cs index 7518b45a8b..f179580604 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionSpikableSystem.cs +++ b/Content.Shared/Chemistry/EntitySystems/SolutionSpikerSystem.cs @@ -1,12 +1,9 @@ -using Content.Server.Chemistry.Components; -using Content.Server.Chemistry.Containers.EntitySystems; -using Content.Server.Explosion.EntitySystems; -using Content.Server.Popups; +using Content.Shared.Popups; using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Components.SolutionManager; using Content.Shared.Interaction; -namespace Content.Server.Chemistry.EntitySystems; +namespace Content.Shared.Chemistry.EntitySystems; /// /// Entity system used to handle when solution containers are 'spiked' @@ -17,11 +14,10 @@ namespace Content.Server.Chemistry.EntitySystems; /// Examples of spikable entity interactions include pills being dropped into glasses, /// eggs being cracked into bowls, and so on. /// -public sealed class SolutionSpikableSystem : EntitySystem +public sealed class SolutionSpikerSystem : EntitySystem { - [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; - [Dependency] private readonly TriggerSystem _triggerSystem = default!; - [Dependency] private readonly PopupSystem _popupSystem = default!; + [Dependency] private readonly SharedPopupSystem _popup = default!; + [Dependency] private readonly SharedSolutionContainerSystem _solution = default!; public override void Initialize() { @@ -47,23 +43,24 @@ public sealed class SolutionSpikableSystem : EntitySystem { if (!Resolve(source, ref spikableSource, ref managerSource, false) || !Resolve(target, ref spikableTarget, ref managerTarget, false) - || !_solutionContainerSystem.TryGetRefillableSolution((target, spikableTarget, managerTarget), out var targetSoln, out var targetSolution) - || !_solutionContainerSystem.TryGetSolution((source, managerSource), spikableSource.SourceSolution, out _, out var sourceSolution)) + || !_solution.TryGetRefillableSolution((target, spikableTarget, managerTarget), out var targetSoln, out var targetSolution) + || !_solution.TryGetSolution((source, managerSource), spikableSource.SourceSolution, out _, out var sourceSolution)) { return; } if (targetSolution.Volume == 0 && !spikableSource.IgnoreEmpty) { - _popupSystem.PopupEntity(Loc.GetString(spikableSource.PopupEmpty, ("spiked-entity", target), ("spike-entity", source)), user, user); + _popup.PopupClient(Loc.GetString(spikableSource.PopupEmpty, ("spiked-entity", target), ("spike-entity", source)), user, user); return; } - if (!_solutionContainerSystem.ForceAddSolution(targetSoln.Value, sourceSolution)) + if (!_solution.ForceAddSolution(targetSoln.Value, sourceSolution)) return; - _popupSystem.PopupEntity(Loc.GetString(spikableSource.Popup, ("spiked-entity", target), ("spike-entity", source)), user, user); + _popup.PopupClient(Loc.GetString(spikableSource.Popup, ("spiked-entity", target), ("spike-entity", source)), user, user); sourceSolution.RemoveAllSolution(); - _triggerSystem.Trigger(source, user); + if (spikableSource.Delete) + QueueDel(source); } } diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Food/egg.yml b/Resources/Prototypes/Entities/Objects/Consumable/Food/egg.yml index 449b996dac..8cd2fa70ee 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Food/egg.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Food/egg.yml @@ -30,7 +30,6 @@ sourceSolution: food ignoreEmpty: true popup: spike-solution-egg - - type: DeleteOnTrigger # egg fragile - type: DamageOnHighSpeedImpact minimumSpeed: 0.1 diff --git a/Resources/Prototypes/Entities/Objects/Specific/Medical/morgue.yml b/Resources/Prototypes/Entities/Objects/Specific/Medical/morgue.yml index c34ca70c45..7f59949a37 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Medical/morgue.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Medical/morgue.yml @@ -118,7 +118,6 @@ - type: SolutionSpiker sourceSolution: food ignoreEmpty: true - - type: DeleteOnTrigger - type: Extractable grindableSolutionName: food diff --git a/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml b/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml index a8acc5ff9c..ab65940fab 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml @@ -454,7 +454,6 @@ maxVol: 20 - type: SolutionSpiker sourceSolution: food - - type: DeleteOnTrigger - type: Extractable grindableSolutionName: food - type: StaticPrice