Fix throwable solution (#4590)
* Fix throwable solution * Revert previous commit * Change Spillable and SpillBehavior * Fix sloth's suggestion. Add more documents
This commit is contained in:
@@ -10,13 +10,32 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
|||||||
[DataDefinition]
|
[DataDefinition]
|
||||||
public class SpillBehavior : IThresholdBehavior
|
public class SpillBehavior : IThresholdBehavior
|
||||||
{
|
{
|
||||||
|
[DataField("solution")]
|
||||||
|
public string? Solution;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If there is a SpillableComponent on IEntity owner 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(IEntity owner, DestructibleSystem system)
|
public void Execute(IEntity owner, DestructibleSystem system)
|
||||||
{
|
{
|
||||||
// TODO see if this is correct
|
var solutionContainerSystem = EntitySystem.Get<SolutionContainerSystem>();
|
||||||
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(owner, SpillableComponent.SolutionName, out var solution))
|
|
||||||
return;
|
|
||||||
|
|
||||||
solution.SpillAt(owner.Transform.Coordinates, "PuddleSmear", false);
|
|
||||||
|
if (owner.TryGetComponent(out SpillableComponent? spillableComponent) &&
|
||||||
|
solutionContainerSystem.TryGetSolution(owner.Uid, spillableComponent.SolutionName,
|
||||||
|
out var compSolution))
|
||||||
|
{
|
||||||
|
compSolution.SpillAt(owner.Transform.Coordinates, "PuddleSmear", false);
|
||||||
|
}
|
||||||
|
else if (Solution != null &&
|
||||||
|
solutionContainerSystem.TryGetSolution(owner.Uid, Solution, out var behaviorSolution))
|
||||||
|
{
|
||||||
|
behaviorSolution.SpillAt(owner.Transform.Coordinates, "PuddleSmear", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Shared.Notification.Managers;
|
|||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Fluids.Components
|
namespace Content.Server.Fluids.Components
|
||||||
{
|
{
|
||||||
@@ -14,7 +15,9 @@ namespace Content.Server.Fluids.Components
|
|||||||
public class SpillableComponent : Component, IDropped
|
public class SpillableComponent : Component, IDropped
|
||||||
{
|
{
|
||||||
public override string Name => "Spillable";
|
public override string Name => "Spillable";
|
||||||
public const string SolutionName = "puddle";
|
|
||||||
|
[DataField("solution")]
|
||||||
|
public string SolutionName = "puddle";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Transfers solution from the held container to the floor.
|
/// Transfers solution from the held container to the floor.
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
types:
|
types:
|
||||||
Blunt: 5
|
Blunt: 5
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: food
|
||||||
- type: Damageable
|
- type: Damageable
|
||||||
damageContainer: Inorganic
|
damageContainer: Inorganic
|
||||||
- type: Destructible
|
- type: Destructible
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
useSound:
|
useSound:
|
||||||
path: /Audio/Items/eating_1.ogg
|
path: /Audio/Items/eating_1.ogg
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: food
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: ReagentContainerBase
|
parent: ReagentContainerBase
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
types:
|
types:
|
||||||
Blunt: 5
|
Blunt: 5
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: food
|
||||||
- type: Damageable
|
- type: Damageable
|
||||||
damageContainer: Inorganic
|
damageContainer: Inorganic
|
||||||
- type: Destructible
|
- type: Destructible
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: icon
|
state: icon
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: drink
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.TransferAmountUiKey.Key
|
- key: enum.TransferAmountUiKey.Key
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
types:
|
types:
|
||||||
Blunt: 10
|
Blunt: 10
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: drink
|
||||||
- type: Damageable
|
- type: Damageable
|
||||||
damageContainer: Inorganic
|
damageContainer: Inorganic
|
||||||
- type: Destructible
|
- type: Destructible
|
||||||
|
|||||||
@@ -23,8 +23,8 @@
|
|||||||
type: TransferAmountBoundUserInterface
|
type: TransferAmountBoundUserInterface
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: icon
|
state: icon
|
||||||
|
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: drink
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: DrinkCanBaseFull
|
parent: DrinkCanBaseFull
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: icon
|
state: icon
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: drink
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: DrinkBaseCup
|
parent: DrinkBaseCup
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
- type: Drink
|
- type: Drink
|
||||||
isOpen: true
|
isOpen: true
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: drink
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.TransferAmountUiKey.Key
|
- key: enum.TransferAmountUiKey.Key
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
- type: DrainableSolution
|
- type: DrainableSolution
|
||||||
solution: spray
|
solution: spray
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: spray
|
||||||
- type: ItemCooldown
|
- type: ItemCooldown
|
||||||
- type: Spray
|
- type: Spray
|
||||||
transferAmount: 1
|
transferAmount: 1
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
solution: spray
|
solution: spray
|
||||||
- type: SolutionTransfer
|
- type: SolutionTransfer
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: spray
|
||||||
- type: ItemCooldown
|
- type: ItemCooldown
|
||||||
- type: Spray
|
- type: Spray
|
||||||
transferAmount: 10
|
transferAmount: 10
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
- type: Item
|
- type: Item
|
||||||
sprite: Objects/Specific/Chemistry/beaker.rsi
|
sprite: Objects/Specific/Chemistry/beaker.rsi
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: drink
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: bottle
|
name: bottle
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
- key: enum.TransferAmountUiKey.Key
|
- key: enum.TransferAmountUiKey.Key
|
||||||
type: TransferAmountBoundUserInterface
|
type: TransferAmountBoundUserInterface
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: beaker
|
||||||
- type: Drink
|
- type: Drink
|
||||||
isOpen: true
|
isOpen: true
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
@@ -167,6 +168,7 @@
|
|||||||
- key: enum.TransferAmountUiKey.Key
|
- key: enum.TransferAmountUiKey.Key
|
||||||
type: TransferAmountBoundUserInterface
|
type: TransferAmountBoundUserInterface
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: dropper
|
||||||
- type: Item
|
- type: Item
|
||||||
sprite: Objects/Specific/Chemistry/dropper.rsi
|
sprite: Objects/Specific/Chemistry/dropper.rsi
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
@@ -200,6 +202,7 @@
|
|||||||
- type: Injector
|
- type: Injector
|
||||||
injectOnly: false
|
injectOnly: false
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: injector
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
visuals:
|
visuals:
|
||||||
# this visualizer used for reagent inside
|
# this visualizer used for reagent inside
|
||||||
|
|||||||
@@ -40,3 +40,4 @@
|
|||||||
mask:
|
mask:
|
||||||
- Impassable
|
- Impassable
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
solution: bucket
|
||||||
|
|||||||
Reference in New Issue
Block a user