# Conflicts: # Content.Client/Crayon/CrayonDecalVisualizer.cs # Content.Client/Tabletop/TabletopSystem.cs # Content.IntegrationTests/Tests/InventoryHelpersTest.cs # Content.Server/AI/EntitySystems/AiSystem.cs # Content.Server/AI/Utility/AiLogic/UtilityAI.cs # Content.Server/AME/AMENodeGroup.cs # Content.Server/Administration/AdminVerbSystem.cs # Content.Server/Body/Systems/RespiratorSystem.cs # Content.Server/Chemistry/Components/InjectorComponent.cs # Content.Server/Chemistry/TileReactions/CleanTileReaction.cs # Content.Server/Chemistry/TileReactions/SpillTileReaction.cs # Content.Server/Crayon/CrayonComponent.cs # Content.Server/Doors/Components/ServerDoorComponent.cs # Content.Server/Explosion/EntitySystems/TriggerSystem.cs # Content.Server/Fluids/Components/MopComponent.cs # Content.Server/Fluids/Components/SpillExtensions.cs # Content.Server/Fluids/EntitySystems/PuddleSystem.cs # Content.Server/Instruments/InstrumentSystem.cs # Content.Server/Nutrition/EntitySystems/DrinkSystem.cs # Content.Server/Nutrition/EntitySystems/FoodSystem.cs # Content.Server/PneumaticCannon/PneumaticCannonSystem.cs # Content.Server/Storage/Components/EntityStorageComponent.cs # Content.Server/Storage/Components/StorageFillComponent.cs # Content.Server/Stunnable/StunbatonSystem.cs # Content.Server/Throwing/ThrowHelper.cs # Content.Server/Weapon/Ranged/Barrels/BarrelSystem.cs # Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs # Content.Server/Weapon/Ranged/ServerRangedWeaponComponent.cs # Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs # Content.Shared/Damage/Components/DamageableComponent.cs # Content.Shared/Damage/Systems/DamageableSystem.cs # Content.Shared/MobState/Components/MobStateComponent.cs # Content.Shared/Slippery/SharedSlipperySystem.cs
45 lines
1.8 KiB
C#
45 lines
1.8 KiB
C#
using Content.Server.Chemistry.EntitySystems;
|
|
using Content.Server.Fluids.Components;
|
|
using Content.Server.Fluids.EntitySystems;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
|
|
namespace Content.Server.Destructible.Thresholds.Behaviors
|
|
{
|
|
[UsedImplicitly]
|
|
[DataDefinition]
|
|
public class SpillBehavior : IThresholdBehavior
|
|
{
|
|
[DataField("solution")]
|
|
public string? Solution;
|
|
|
|
/// <summary>
|
|
/// If there is a SpillableComponent on EntityUidowner use it to create a puddle/smear.
|
|
/// Or whatever solution is specified in the behavior itself.
|
|
/// If none are available do nothing.
|
|
/// </summary>
|
|
/// <param name="owner">Entity on which behavior is executed</param>
|
|
/// <param name="system">system calling the behavior</param>
|
|
public void Execute(EntityUid owner, DestructibleSystem system)
|
|
{
|
|
var solutionContainerSystem = EntitySystem.Get<SolutionContainerSystem>();
|
|
var spillableSystem = EntitySystem.Get<SpillableSystem>();
|
|
|
|
var coordinates = system.EntityManager.GetComponent<TransformComponent>(owner).Coordinates;
|
|
|
|
if (system.EntityManager.TryGetComponent(owner, out SpillableComponent? spillableComponent) &&
|
|
solutionContainerSystem.TryGetSolution(owner, spillableComponent.SolutionName,
|
|
out var compSolution))
|
|
{
|
|
spillableSystem.SpillAt(compSolution, coordinates, "PuddleSmear", false);
|
|
}
|
|
else if (Solution != null &&
|
|
solutionContainerSystem.TryGetSolution(owner, Solution, out var behaviorSolution))
|
|
{
|
|
spillableSystem.SpillAt(behaviorSolution, coordinates, "PuddleSmear", false);
|
|
}
|
|
}
|
|
}
|
|
}
|