Openable refactor (#19750)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
using Content.Server.Chemistry.EntitySystems;
|
using Content.Server.Chemistry.EntitySystems;
|
||||||
using Content.Server.Fluids.Components;
|
using Content.Server.Fluids.Components;
|
||||||
using Content.Server.Nutrition.Components;
|
using Content.Server.Nutrition.EntitySystems;
|
||||||
using Content.Shared.Chemistry.Components;
|
using Content.Shared.Chemistry.Components;
|
||||||
using Content.Shared.Chemistry.Reaction;
|
using Content.Shared.Chemistry.Reaction;
|
||||||
using Content.Shared.Chemistry.Reagent;
|
using Content.Shared.Chemistry.Reagent;
|
||||||
@@ -23,11 +23,14 @@ namespace Content.Server.Fluids.EntitySystems;
|
|||||||
|
|
||||||
public sealed partial class PuddleSystem
|
public sealed partial class PuddleSystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly OpenableSystem _openable = default!;
|
||||||
|
|
||||||
private void InitializeSpillable()
|
private void InitializeSpillable()
|
||||||
{
|
{
|
||||||
SubscribeLocalEvent<SpillableComponent, ExaminedEvent>(OnExamined);
|
SubscribeLocalEvent<SpillableComponent, ExaminedEvent>(OnExamined);
|
||||||
SubscribeLocalEvent<SpillableComponent, LandEvent>(SpillOnLand);
|
SubscribeLocalEvent<SpillableComponent, LandEvent>(SpillOnLand);
|
||||||
SubscribeLocalEvent<SpillableComponent, MeleeHitEvent>(SplashOnMeleeHit);
|
// openable handles the event if its closed
|
||||||
|
SubscribeLocalEvent<SpillableComponent, MeleeHitEvent>(SplashOnMeleeHit, after: new[] { typeof(OpenableSystem) });
|
||||||
SubscribeLocalEvent<SpillableComponent, GetVerbsEvent<Verb>>(AddSpillVerb);
|
SubscribeLocalEvent<SpillableComponent, GetVerbsEvent<Verb>>(AddSpillVerb);
|
||||||
SubscribeLocalEvent<SpillableComponent, GotEquippedEvent>(OnGotEquipped);
|
SubscribeLocalEvent<SpillableComponent, GotEquippedEvent>(OnGotEquipped);
|
||||||
SubscribeLocalEvent<SpillableComponent, SolutionSpikeOverflowEvent>(OnSpikeOverflow);
|
SubscribeLocalEvent<SpillableComponent, SolutionSpikeOverflowEvent>(OnSpikeOverflow);
|
||||||
@@ -54,6 +57,9 @@ public sealed partial class PuddleSystem
|
|||||||
|
|
||||||
private void SplashOnMeleeHit(EntityUid uid, SpillableComponent component, MeleeHitEvent args)
|
private void SplashOnMeleeHit(EntityUid uid, SpillableComponent component, MeleeHitEvent args)
|
||||||
{
|
{
|
||||||
|
if (args.Handled)
|
||||||
|
return;
|
||||||
|
|
||||||
// When attacking someone reactive with a spillable entity,
|
// When attacking someone reactive with a spillable entity,
|
||||||
// splash a little on them (touch react)
|
// splash a little on them (touch react)
|
||||||
// If this also has solution transfer, then assume the transfer amount is how much we want to spill.
|
// If this also has solution transfer, then assume the transfer amount is how much we want to spill.
|
||||||
@@ -62,9 +68,6 @@ public sealed partial class PuddleSystem
|
|||||||
if (!_solutionContainerSystem.TryGetDrainableSolution(uid, out var solution))
|
if (!_solutionContainerSystem.TryGetDrainableSolution(uid, out var solution))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (TryComp<DrinkComponent>(uid, out var drink) && !drink.Opened)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var hitCount = args.HitEntities.Count;
|
var hitCount = args.HitEntities.Count;
|
||||||
|
|
||||||
var totalSplit = FixedPoint2.Min(solution.MaxVolume * 0.25, solution.Volume);
|
var totalSplit = FixedPoint2.Min(solution.MaxVolume * 0.25, solution.Volume);
|
||||||
@@ -80,6 +83,7 @@ public sealed partial class PuddleSystem
|
|||||||
if (totalSplit == 0)
|
if (totalSplit == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
args.Handled = true;
|
||||||
foreach (var hit in args.HitEntities)
|
foreach (var hit in args.HitEntities)
|
||||||
{
|
{
|
||||||
if (!HasComp<ReactiveComponent>(hit))
|
if (!HasComp<ReactiveComponent>(hit))
|
||||||
@@ -135,7 +139,7 @@ public sealed partial class PuddleSystem
|
|||||||
if (!_solutionContainerSystem.TryGetSolution(uid, component.SolutionName, out var solution))
|
if (!_solutionContainerSystem.TryGetSolution(uid, component.SolutionName, out var solution))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (TryComp<DrinkComponent>(uid, out var drink) && !drink.Opened)
|
if (_openable.IsClosed(uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (args.User != null)
|
if (args.User != null)
|
||||||
@@ -156,7 +160,7 @@ public sealed partial class PuddleSystem
|
|||||||
if (!_solutionContainerSystem.TryGetSolution(args.Target, component.SolutionName, out var solution))
|
if (!_solutionContainerSystem.TryGetSolution(args.Target, component.SolutionName, out var solution))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (TryComp<DrinkComponent>(args.Target, out var drink) && (!drink.Opened))
|
if (_openable.IsClosed(args.Target))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (solution.Volume == FixedPoint2.Zero)
|
if (solution.Volume == FixedPoint2.Zero)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using Content.Shared.Item;
|
|||||||
using Content.Shared.Glue;
|
using Content.Shared.Glue;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Server.Chemistry.EntitySystems;
|
using Content.Server.Chemistry.EntitySystems;
|
||||||
using Content.Server.Nutrition.Components;
|
using Content.Server.Nutrition.EntitySystems;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Hands;
|
using Content.Shared.Hands;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
@@ -26,7 +26,7 @@ public sealed class GlueSystem : SharedGlueSystem
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<GlueComponent, AfterInteractEvent>(OnInteract);
|
SubscribeLocalEvent<GlueComponent, AfterInteractEvent>(OnInteract, after: new[] { typeof(OpenableSystem) });
|
||||||
SubscribeLocalEvent<GluedComponent, ComponentInit>(OnGluedInit);
|
SubscribeLocalEvent<GluedComponent, ComponentInit>(OnGluedInit);
|
||||||
SubscribeLocalEvent<GluedComponent, GotEquippedHandEvent>(OnHandPickUp);
|
SubscribeLocalEvent<GluedComponent, GotEquippedHandEvent>(OnHandPickUp);
|
||||||
}
|
}
|
||||||
@@ -40,11 +40,6 @@ public sealed class GlueSystem : SharedGlueSystem
|
|||||||
if (!args.CanReach || args.Target is not { Valid: true } target)
|
if (!args.CanReach || args.Target is not { Valid: true } target)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (TryComp<DrinkComponent>(uid, out var drink) && !drink.Opened)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TryGlue(uid, component, target, args.User))
|
if (TryGlue(uid, component, target, args.User))
|
||||||
{
|
{
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.Chemistry.EntitySystems;
|
using Content.Server.Chemistry.EntitySystems;
|
||||||
using Content.Server.Nutrition.Components;
|
using Content.Server.Nutrition.EntitySystems;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.IdentityManagement;
|
using Content.Shared.IdentityManagement;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
@@ -23,7 +23,7 @@ public sealed class LubeSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<LubeComponent, AfterInteractEvent>(OnInteract);
|
SubscribeLocalEvent<LubeComponent, AfterInteractEvent>(OnInteract, after: new[] { typeof(OpenableSystem) });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInteract(EntityUid uid, LubeComponent component, AfterInteractEvent args)
|
private void OnInteract(EntityUid uid, LubeComponent component, AfterInteractEvent args)
|
||||||
@@ -34,11 +34,6 @@ public sealed class LubeSystem : EntitySystem
|
|||||||
if (!args.CanReach || args.Target is not { Valid: true } target)
|
if (!args.CanReach || args.Target is not { Valid: true } target)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (TryComp<DrinkComponent>(uid, out var drink) && !drink.Opened)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TryLube(uid, component, target, args.User))
|
if (TryLube(uid, component, target, args.User))
|
||||||
{
|
{
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Content.Server.Chemistry.EntitySystems;
|
|||||||
using Content.Server.Construction;
|
using Content.Server.Construction;
|
||||||
using Content.Server.Fluids.EntitySystems;
|
using Content.Server.Fluids.EntitySystems;
|
||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.Nutrition.Components;
|
using Content.Server.Nutrition.EntitySystems;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.Stack;
|
using Content.Server.Stack;
|
||||||
@@ -29,6 +29,7 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
|
|||||||
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
||||||
[Dependency] private readonly GameTicker _ticker = default!;
|
[Dependency] private readonly GameTicker _ticker = default!;
|
||||||
[Dependency] private readonly MaterialStorageSystem _materialStorage = default!;
|
[Dependency] private readonly MaterialStorageSystem _materialStorage = default!;
|
||||||
|
[Dependency] private readonly OpenableSystem _openable = default!;
|
||||||
[Dependency] private readonly PopupSystem _popup = default!;
|
[Dependency] private readonly PopupSystem _popup = default!;
|
||||||
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
|
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
|
||||||
[Dependency] private readonly SharedBodySystem _body = default!; //bobby
|
[Dependency] private readonly SharedBodySystem _body = default!; //bobby
|
||||||
@@ -85,8 +86,7 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
|
|||||||
if (TryComp<SolutionContainerManagerComponent>(args.Used, out var managerComponent) &&
|
if (TryComp<SolutionContainerManagerComponent>(args.Used, out var managerComponent) &&
|
||||||
managerComponent.Solutions.Any(s => s.Value.AvailableVolume > 0))
|
managerComponent.Solutions.Any(s => s.Value.AvailableVolume > 0))
|
||||||
{
|
{
|
||||||
if (TryComp<DrinkComponent>(args.Used, out var drink) &&
|
if (_openable.IsClosed(args.Used))
|
||||||
!drink.Opened)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (TryComp<SolutionTransferComponent>(args.Used, out var transfer) &&
|
if (TryComp<SolutionTransferComponent>(args.Used, out var transfer) &&
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public sealed class NPCUtilitySystem : EntitySystem
|
|||||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||||
[Dependency] private readonly NpcFactionSystem _npcFaction = default!;
|
[Dependency] private readonly NpcFactionSystem _npcFaction = default!;
|
||||||
|
[Dependency] private readonly OpenableSystem _openable = default!;
|
||||||
[Dependency] private readonly PuddleSystem _puddle = default!;
|
[Dependency] private readonly PuddleSystem _puddle = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||||
[Dependency] private readonly SolutionContainerSystem _solutions = default!;
|
[Dependency] private readonly SolutionContainerSystem _solutions = default!;
|
||||||
@@ -156,6 +157,10 @@ public sealed class NPCUtilitySystem : EntitySystem
|
|||||||
if (!TryComp<FoodComponent>(targetUid, out var food))
|
if (!TryComp<FoodComponent>(targetUid, out var food))
|
||||||
return 0f;
|
return 0f;
|
||||||
|
|
||||||
|
// mice can't eat unpeeled bananas, need monkey's help
|
||||||
|
if (_openable.IsClosed(targetUid))
|
||||||
|
return 0f;
|
||||||
|
|
||||||
if (!_food.IsDigestibleBy(owner, targetUid, food))
|
if (!_food.IsDigestibleBy(owner, targetUid, food))
|
||||||
return 0f;
|
return 0f;
|
||||||
|
|
||||||
@@ -173,7 +178,11 @@ public sealed class NPCUtilitySystem : EntitySystem
|
|||||||
}
|
}
|
||||||
case DrinkValueCon:
|
case DrinkValueCon:
|
||||||
{
|
{
|
||||||
if (!TryComp<DrinkComponent>(targetUid, out var drink) || !drink.Opened)
|
if (!TryComp<DrinkComponent>(targetUid, out var drink))
|
||||||
|
return 0f;
|
||||||
|
|
||||||
|
// can't drink closed drinks
|
||||||
|
if (_openable.IsClosed(targetUid))
|
||||||
return 0f;
|
return 0f;
|
||||||
|
|
||||||
// only drink when thirsty
|
// only drink when thirsty
|
||||||
|
|||||||
@@ -1,54 +1,41 @@
|
|||||||
using Content.Server.Nutrition.EntitySystems;
|
using Content.Server.Nutrition.EntitySystems;
|
||||||
using Content.Shared.DoAfter;
|
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
|
||||||
namespace Content.Server.Nutrition.Components
|
namespace Content.Server.Nutrition.Components;
|
||||||
{
|
|
||||||
[RegisterComponent]
|
[RegisterComponent, Access(typeof(DrinkSystem))]
|
||||||
[Access(typeof(DrinkSystem))]
|
|
||||||
public sealed partial class DrinkComponent : Component
|
public sealed partial class DrinkComponent : Component
|
||||||
{
|
{
|
||||||
[DataField("solution")]
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public string SolutionName { get; set; } = DefaultSolutionName;
|
public string Solution = "drink";
|
||||||
public const string DefaultSolutionName = "drink";
|
|
||||||
|
|
||||||
[DataField("useSound")]
|
[DataField]
|
||||||
public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/drink.ogg");
|
public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/drink.ogg");
|
||||||
|
|
||||||
[DataField("isOpen")]
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
internal bool DefaultToOpened;
|
public FixedPoint2 TransferAmount = FixedPoint2.New(5);
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
[DataField("transferAmount")]
|
|
||||||
public FixedPoint2 TransferAmount { get; [UsedImplicitly] private set; } = FixedPoint2.New(5);
|
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
public bool Opened;
|
|
||||||
|
|
||||||
[DataField("openSounds")]
|
|
||||||
public SoundSpecifier OpenSounds = new SoundCollectionSpecifier("canOpenSounds");
|
|
||||||
|
|
||||||
[DataField("pressurized")]
|
|
||||||
public bool Pressurized;
|
|
||||||
|
|
||||||
[DataField("burstSound")]
|
|
||||||
public SoundSpecifier BurstSound = new SoundPathSpecifier("/Audio/Effects/flash_bang.ogg");
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How long it takes to drink this yourself.
|
/// How long it takes to drink this yourself.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("delay")]
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public float Delay = 1;
|
public float Delay = 1;
|
||||||
|
|
||||||
[DataField("examinable")]
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool Examinable = true;
|
public bool Examinable = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If true, trying to drink when empty will not handle the event.
|
||||||
|
/// This means other systems such as equipping on use can run.
|
||||||
|
/// Example usecase is the bucket.
|
||||||
|
/// </summary>
|
||||||
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public bool IgnoreEmpty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is how many seconds it takes to force feed someone this drink.
|
/// This is how many seconds it takes to force feed someone this drink.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("forceFeedDelay")]
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public float ForceFeedDelay = 3;
|
public float ForceFeedDelay = 3;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -6,34 +6,34 @@ using Robust.Shared.Audio;
|
|||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
namespace Content.Server.Nutrition.Components
|
namespace Content.Server.Nutrition.Components;
|
||||||
{
|
|
||||||
[RegisterComponent, Access(typeof(FoodSystem))]
|
[RegisterComponent, Access(typeof(FoodSystem))]
|
||||||
public sealed partial class FoodComponent : Component
|
public sealed partial class FoodComponent : Component
|
||||||
{
|
{
|
||||||
[DataField("solution")]
|
[DataField]
|
||||||
public string SolutionName { get; set; } = "food";
|
public string Solution = "food";
|
||||||
|
|
||||||
[DataField("useSound")]
|
[DataField]
|
||||||
public SoundSpecifier UseSound { get; set; } = new SoundPathSpecifier("/Audio/Items/eatfood.ogg");
|
public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/eatfood.ogg");
|
||||||
|
|
||||||
[DataField("trash", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
[DataField]
|
||||||
public string? TrashPrototype { get; set; }
|
public EntProtoId? TrashPrototype;
|
||||||
|
|
||||||
[DataField("transferAmount")]
|
[DataField]
|
||||||
public FixedPoint2? TransferAmount { get; set; } = FixedPoint2.New(5);
|
public FixedPoint2? TransferAmount = FixedPoint2.New(5);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Acceptable utensil to use
|
/// Acceptable utensil to use
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("utensil")]
|
[DataField]
|
||||||
public UtensilType Utensil = UtensilType.Fork; //There are more "solid" than "liquid" food
|
public UtensilType Utensil = UtensilType.Fork; //There are more "solid" than "liquid" food
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Is utensil required to eat this food
|
/// Is utensil required to eat this food
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("utensilRequired")]
|
[DataField]
|
||||||
public bool UtensilRequired = false;
|
public bool UtensilRequired;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If this is set to true, food can only be eaten if you have a stomach with a
|
/// If this is set to true, food can only be eaten if you have a stomach with a
|
||||||
@@ -41,52 +41,32 @@ namespace Content.Server.Nutrition.Components
|
|||||||
/// rather than just being digestible by anything that can eat food.
|
/// rather than just being digestible by anything that can eat food.
|
||||||
/// Whitelist the food component to allow eating of normal food.
|
/// Whitelist the food component to allow eating of normal food.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("requiresSpecialDigestion")]
|
[DataField]
|
||||||
public bool RequiresSpecialDigestion = false;
|
public bool RequiresSpecialDigestion;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stomachs required to digest this entity.
|
/// Stomachs required to digest this entity.
|
||||||
/// Used to simulate 'ruminant' digestive systems (which can digest grass)
|
/// Used to simulate 'ruminant' digestive systems (which can digest grass)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("requiredStomachs")]
|
[DataField]
|
||||||
public int RequiredStomachs = 1;
|
public int RequiredStomachs = 1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The localization identifier for the eat message. Needs a "food" entity argument passed to it.
|
/// The localization identifier for the eat message. Needs a "food" entity argument passed to it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("eatMessage")]
|
[DataField]
|
||||||
public string EatMessage = "food-nom";
|
public string EatMessage = "food-nom";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How long it takes to eat the food personally.
|
/// How long it takes to eat the food personally.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("delay")]
|
[DataField]
|
||||||
public float Delay = 1;
|
public float Delay = 1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is how many seconds it takes to force feed someone this food.
|
/// This is how many seconds it takes to force feed someone this food.
|
||||||
/// Should probably be smaller for small items like pills.
|
/// Should probably be smaller for small items like pills.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("forceFeedDelay")]
|
[DataField]
|
||||||
public float ForceFeedDelay = 3;
|
public float ForceFeedDelay = 3;
|
||||||
|
|
||||||
[ViewVariables]
|
|
||||||
public int UsesRemaining
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution))
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TransferAmount == null)
|
|
||||||
return solution.Volume == 0 ? 0 : 1;
|
|
||||||
|
|
||||||
return solution.Volume == 0
|
|
||||||
? 0
|
|
||||||
: Math.Max(1, (int) Math.Ceiling((solution.Volume / (FixedPoint2)TransferAmount).Float()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
46
Content.Server/Nutrition/Components/OpenableComponent.cs
Normal file
46
Content.Server/Nutrition/Components/OpenableComponent.cs
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
using Content.Server.Nutrition.EntitySystems;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
|
||||||
|
namespace Content.Server.Nutrition.Components;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A drink or food that can be opened.
|
||||||
|
/// Starts closed, open it with Z or E.
|
||||||
|
/// </summary>
|
||||||
|
[RegisterComponent, Access(typeof(OpenableSystem))]
|
||||||
|
public sealed partial class OpenableComponent : Component
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this drink or food is opened or not.
|
||||||
|
/// Drinks can only be drunk or poured from/into when open, and food can only be eaten when open.
|
||||||
|
/// </summary>
|
||||||
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public bool Opened;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If this is false you cant press Z to open it.
|
||||||
|
/// Requires an OpenBehavior damage threshold or other logic to open.
|
||||||
|
/// </summary>
|
||||||
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public bool OpenableByHand = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Text shown when examining and its open.
|
||||||
|
/// </summary>
|
||||||
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public string ExamineText = "drink-component-on-examine-is-opened";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The locale id for the popup shown when IsClosed is called and closed. Needs a "owner" entity argument passed to it.
|
||||||
|
/// Defaults to the popup drink uses since its "correct".
|
||||||
|
/// It's still generic enough that you should change it if you make openable non-drinks, i.e. unwrap it first, peel it first.
|
||||||
|
/// </summary>
|
||||||
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public string ClosedPopup = "drink-component-try-use-drink-not-open";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sound played when opening.
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public SoundSpecifier Sound = new SoundCollectionSpecifier("canOpenSounds");
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using Content.Server.Nutrition.EntitySystems;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
|
|
||||||
|
namespace Content.Server.Nutrition.Components;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Lets a drink burst open when thrown while closed.
|
||||||
|
/// Requires <see cref="DrinkComponent"/> and <see cref="OpenableComponent"/> to work.
|
||||||
|
/// </summary>
|
||||||
|
[RegisterComponent, Access(typeof(DrinkSystem))]
|
||||||
|
public sealed partial class PressurizedDrinkComponent : Component
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Chance for the drink to burst when thrown while closed.
|
||||||
|
/// </summary>
|
||||||
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float BurstChance = 0.25f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sound played when the drink bursts.
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public SoundSpecifier BurstSound = new SoundPathSpecifier("/Audio/Effects/flash_bang.ogg")
|
||||||
|
{
|
||||||
|
Params = AudioParams.Default.WithVolume(-4)
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -41,7 +41,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
|
|
||||||
if (EntityManager.TryGetComponent(uid, out FoodComponent? foodComp))
|
if (EntityManager.TryGetComponent(uid, out FoodComponent? foodComp))
|
||||||
{
|
{
|
||||||
if (_solutions.TryGetSolution(uid, foodComp.SolutionName, out var solution))
|
if (_solutions.TryGetSolution(uid, foodComp.Solution, out var solution))
|
||||||
{
|
{
|
||||||
_puddle.TrySpillAt(uid, solution, out _, false);
|
_puddle.TrySpillAt(uid, solution, out _, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Server.Chemistry.EntitySystems;
|
|||||||
using Content.Server.Chemistry.ReagentEffects;
|
using Content.Server.Chemistry.ReagentEffects;
|
||||||
using Content.Server.Fluids.EntitySystems;
|
using Content.Server.Fluids.EntitySystems;
|
||||||
using Content.Server.Forensics;
|
using Content.Server.Forensics;
|
||||||
|
using Content.Server.Inventory;
|
||||||
using Content.Server.Nutrition.Components;
|
using Content.Server.Nutrition.Components;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Administration.Logs;
|
using Content.Shared.Administration.Logs;
|
||||||
@@ -19,7 +20,6 @@ using Content.Shared.FixedPoint;
|
|||||||
using Content.Shared.IdentityManagement;
|
using Content.Shared.IdentityManagement;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Mobs.Components;
|
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
using Content.Shared.Nutrition;
|
using Content.Shared.Nutrition;
|
||||||
using Content.Shared.Nutrition.Components;
|
using Content.Shared.Nutrition.Components;
|
||||||
@@ -36,14 +36,15 @@ namespace Content.Server.Nutrition.EntitySystems;
|
|||||||
public sealed class DrinkSystem : EntitySystem
|
public sealed class DrinkSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly BodySystem _body = default!;
|
[Dependency] private readonly BodySystem _body = default!;
|
||||||
[Dependency] private readonly FoodSystem _food = default!;
|
|
||||||
[Dependency] private readonly FlavorProfileSystem _flavorProfile = default!;
|
[Dependency] private readonly FlavorProfileSystem _flavorProfile = default!;
|
||||||
|
[Dependency] private readonly FoodSystem _food = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||||
|
[Dependency] private readonly OpenableSystem _openable = default!;
|
||||||
[Dependency] private readonly PopupSystem _popup = default!;
|
[Dependency] private readonly PopupSystem _popup = default!;
|
||||||
[Dependency] private readonly PuddleSystem _puddleSystem = default!;
|
[Dependency] private readonly PuddleSystem _puddle = default!;
|
||||||
[Dependency] private readonly ReactiveSystem _reaction = default!;
|
[Dependency] private readonly ReactiveSystem _reaction = default!;
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
@@ -59,13 +60,16 @@ public sealed class DrinkSystem : EntitySystem
|
|||||||
// TODO add InteractNoHandEvent for entities like mice.
|
// TODO add InteractNoHandEvent for entities like mice.
|
||||||
SubscribeLocalEvent<DrinkComponent, SolutionChangedEvent>(OnSolutionChange);
|
SubscribeLocalEvent<DrinkComponent, SolutionChangedEvent>(OnSolutionChange);
|
||||||
SubscribeLocalEvent<DrinkComponent, ComponentInit>(OnDrinkInit);
|
SubscribeLocalEvent<DrinkComponent, ComponentInit>(OnDrinkInit);
|
||||||
SubscribeLocalEvent<DrinkComponent, LandEvent>(HandleLand);
|
// run before inventory so for bucket it always tries to drink before equipping (when empty)
|
||||||
SubscribeLocalEvent<DrinkComponent, UseInHandEvent>(OnUse);
|
// run after openable so its always open -> drink
|
||||||
|
SubscribeLocalEvent<DrinkComponent, UseInHandEvent>(OnUse, before: new[] { typeof(ServerInventorySystem) }, after: new[] { typeof(OpenableSystem) });
|
||||||
SubscribeLocalEvent<DrinkComponent, AfterInteractEvent>(AfterInteract);
|
SubscribeLocalEvent<DrinkComponent, AfterInteractEvent>(AfterInteract);
|
||||||
SubscribeLocalEvent<DrinkComponent, GetVerbsEvent<AlternativeVerb>>(AddDrinkVerb);
|
SubscribeLocalEvent<DrinkComponent, GetVerbsEvent<AlternativeVerb>>(AddDrinkVerb);
|
||||||
SubscribeLocalEvent<DrinkComponent, ExaminedEvent>(OnExamined);
|
// put drink amount after opened
|
||||||
SubscribeLocalEvent<DrinkComponent, SolutionTransferAttemptEvent>(OnTransferAttempt);
|
SubscribeLocalEvent<DrinkComponent, ExaminedEvent>(OnExamined, after: new[] { typeof(OpenableSystem) });
|
||||||
SubscribeLocalEvent<DrinkComponent, ConsumeDoAfterEvent>(OnDoAfter);
|
SubscribeLocalEvent<DrinkComponent, ConsumeDoAfterEvent>(OnDoAfter);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<PressurizedDrinkComponent, LandEvent>(OnPressurizedDrinkLand);
|
||||||
}
|
}
|
||||||
|
|
||||||
private FixedPoint2 DrinkVolume(EntityUid uid, DrinkComponent? component = null)
|
private FixedPoint2 DrinkVolume(EntityUid uid, DrinkComponent? component = null)
|
||||||
@@ -73,7 +77,7 @@ public sealed class DrinkSystem : EntitySystem
|
|||||||
if (!Resolve(uid, ref component))
|
if (!Resolve(uid, ref component))
|
||||||
return FixedPoint2.Zero;
|
return FixedPoint2.Zero;
|
||||||
|
|
||||||
if (!_solutionContainer.TryGetSolution(uid, component.SolutionName, out var sol))
|
if (!_solutionContainer.TryGetSolution(uid, component.Solution, out var sol))
|
||||||
return FixedPoint2.Zero;
|
return FixedPoint2.Zero;
|
||||||
|
|
||||||
return sol.Volume;
|
return sol.Volume;
|
||||||
@@ -95,7 +99,7 @@ public sealed class DrinkSystem : EntitySystem
|
|||||||
if (!Resolve(uid, ref comp))
|
if (!Resolve(uid, ref comp))
|
||||||
return 0f;
|
return 0f;
|
||||||
|
|
||||||
if (!_solutionContainer.TryGetSolution(uid, comp.SolutionName, out var solution))
|
if (!_solutionContainer.TryGetSolution(uid, comp.Solution, out var solution))
|
||||||
return 0f;
|
return 0f;
|
||||||
|
|
||||||
var total = 0f;
|
var total = 0f;
|
||||||
@@ -123,19 +127,24 @@ public sealed class DrinkSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnExamined(EntityUid uid, DrinkComponent component, ExaminedEvent args)
|
private void OnExamined(EntityUid uid, DrinkComponent component, ExaminedEvent args)
|
||||||
{
|
{
|
||||||
if (!component.Opened || !args.IsInDetailsRange || !component.Examinable)
|
var hasOpenable = TryComp<OpenableComponent>(uid, out var openable);
|
||||||
|
if (_openable.IsClosed(uid, null, openable) || !args.IsInDetailsRange || !component.Examinable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var color = IsEmpty(uid, component) ? "gray" : "yellow";
|
// put Empty / Xu after Opened, or start a new line
|
||||||
var openedText =
|
args.Message.AddMarkup(hasOpenable ? " - " : "\n");
|
||||||
Loc.GetString(IsEmpty(uid, component) ? "drink-component-on-examine-is-empty" : "drink-component-on-examine-is-opened");
|
|
||||||
args.Message.AddMarkup($"\n{Loc.GetString("drink-component-on-examine-details-text", ("colorName", color), ("text", openedText))}");
|
var empty = IsEmpty(uid, component);
|
||||||
if (!IsEmpty(uid, component))
|
if (empty)
|
||||||
{
|
{
|
||||||
|
args.Message.AddMarkup(Loc.GetString("drink-component-on-examine-is-empty"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (TryComp<ExaminableSolutionComponent>(uid, out var comp))
|
if (TryComp<ExaminableSolutionComponent>(uid, out var comp))
|
||||||
{
|
{
|
||||||
//provide exact measurement for beakers
|
//provide exact measurement for beakers
|
||||||
args.Message.AddMarkup($" - {Loc.GetString("drink-component-on-examine-exact-volume", ("amount", DrinkVolume(uid, component)))}");
|
args.Message.AddMarkup(Loc.GetString("drink-component-on-examine-exact-volume", ("amount", DrinkVolume(uid, component))));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -147,27 +156,7 @@ public sealed class DrinkSystem : EntitySystem
|
|||||||
> 33 => HalfEmptyOrHalfFull(args),
|
> 33 => HalfEmptyOrHalfFull(args),
|
||||||
_ => "drink-component-on-examine-is-mostly-empty",
|
_ => "drink-component-on-examine-is-mostly-empty",
|
||||||
};
|
};
|
||||||
args.Message.AddMarkup($" - {Loc.GetString(remainingString)}");
|
args.Message.AddMarkup(Loc.GetString(remainingString));
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetOpen(EntityUid uid, bool opened = false, DrinkComponent? component = null)
|
|
||||||
{
|
|
||||||
if(!Resolve(uid, ref component))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (opened == component.Opened)
|
|
||||||
return;
|
|
||||||
|
|
||||||
component.Opened = opened;
|
|
||||||
|
|
||||||
if (!_solutionContainer.TryGetSolution(uid, component.SolutionName, out _))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (EntityManager.TryGetComponent<AppearanceComponent>(uid, out var appearance))
|
|
||||||
{
|
|
||||||
_appearance.SetData(uid, DrinkCanStateVisual.Opened, opened, appearance);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,56 +173,47 @@ public sealed class DrinkSystem : EntitySystem
|
|||||||
if (args.Handled)
|
if (args.Handled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!component.Opened)
|
|
||||||
{
|
|
||||||
//Do the opening stuff like playing the sounds.
|
|
||||||
_audio.PlayPvs(_audio.GetSound(component.OpenSounds), args.User);
|
|
||||||
|
|
||||||
SetOpen(uid, true, component);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
args.Handled = TryDrink(args.User, args.User, component, uid);
|
args.Handled = TryDrink(args.User, args.User, component, uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleLand(EntityUid uid, DrinkComponent component, ref LandEvent args)
|
private void OnPressurizedDrinkLand(EntityUid uid, PressurizedDrinkComponent comp, ref LandEvent args)
|
||||||
{
|
{
|
||||||
if (component.Pressurized &&
|
if (!TryComp<DrinkComponent>(uid, out var drink) || !TryComp<OpenableComponent>(uid, out var openable))
|
||||||
!component.Opened &&
|
return;
|
||||||
_random.Prob(0.25f) &&
|
|
||||||
_solutionContainer.TryGetSolution(uid, component.SolutionName, out var interactions))
|
if (!openable.Opened &&
|
||||||
|
_random.Prob(comp.BurstChance) &&
|
||||||
|
_solutionContainer.TryGetSolution(uid, drink.Solution, out var interactions))
|
||||||
{
|
{
|
||||||
component.Opened = true;
|
// using SetOpen instead of TryOpen to not play 2 sounds
|
||||||
UpdateAppearance(uid, component);
|
_openable.SetOpen(uid, true, openable);
|
||||||
|
|
||||||
var solution = _solutionContainer.SplitSolution(uid, interactions, interactions.Volume);
|
var solution = _solutionContainer.SplitSolution(uid, interactions, interactions.Volume);
|
||||||
_puddleSystem.TrySpillAt(uid, solution, out _);
|
_puddle.TrySpillAt(uid, solution, out _);
|
||||||
|
|
||||||
_audio.PlayPvs(_audio.GetSound(component.BurstSound), uid, AudioParams.Default.WithVolume(-4));
|
_audio.PlayPvs(comp.BurstSound, uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDrinkInit(EntityUid uid, DrinkComponent component, ComponentInit args)
|
private void OnDrinkInit(EntityUid uid, DrinkComponent component, ComponentInit args)
|
||||||
{
|
{
|
||||||
SetOpen(uid, component.DefaultToOpened, component);
|
if (TryComp<DrainableSolutionComponent>(uid, out var existingDrainable))
|
||||||
|
|
||||||
if (EntityManager.TryGetComponent(uid, out DrainableSolutionComponent? existingDrainable))
|
|
||||||
{
|
{
|
||||||
// Beakers have Drink component but they should use the existing Drainable
|
// Beakers have Drink component but they should use the existing Drainable
|
||||||
component.SolutionName = existingDrainable.Solution;
|
component.Solution = existingDrainable.Solution;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_solutionContainer.EnsureSolution(uid, component.SolutionName);
|
_solutionContainer.EnsureSolution(uid, component.Solution);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateAppearance(uid, component);
|
UpdateAppearance(uid, component);
|
||||||
|
|
||||||
if (TryComp(uid, out RefillableSolutionComponent? refillComp))
|
if (TryComp(uid, out RefillableSolutionComponent? refillComp))
|
||||||
refillComp.Solution = component.SolutionName;
|
refillComp.Solution = component.Solution;
|
||||||
|
|
||||||
if (TryComp(uid, out DrainableSolutionComponent? drainComp))
|
if (TryComp(uid, out DrainableSolutionComponent? drainComp))
|
||||||
drainComp.Solution = component.SolutionName;
|
drainComp.Solution = component.Solution;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSolutionChange(EntityUid uid, DrinkComponent component, SolutionChangedEvent args)
|
private void OnSolutionChange(EntityUid uid, DrinkComponent component, SolutionChangedEvent args)
|
||||||
@@ -251,34 +231,23 @@ public sealed class DrinkSystem : EntitySystem
|
|||||||
|
|
||||||
var drainAvailable = DrinkVolume(uid, component);
|
var drainAvailable = DrinkVolume(uid, component);
|
||||||
_appearance.SetData(uid, FoodVisuals.Visual, drainAvailable.Float(), appearance);
|
_appearance.SetData(uid, FoodVisuals.Visual, drainAvailable.Float(), appearance);
|
||||||
_appearance.SetData(uid, DrinkCanStateVisual.Opened, component.Opened, appearance);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnTransferAttempt(EntityUid uid, DrinkComponent component, SolutionTransferAttemptEvent args)
|
|
||||||
{
|
|
||||||
if (!component.Opened)
|
|
||||||
{
|
|
||||||
args.Cancel(Loc.GetString("drink-component-try-use-drink-not-open", ("owner", uid)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TryDrink(EntityUid user, EntityUid target, DrinkComponent drink, EntityUid item)
|
private bool TryDrink(EntityUid user, EntityUid target, DrinkComponent drink, EntityUid item)
|
||||||
{
|
{
|
||||||
if (!EntityManager.HasComponent<BodyComponent>(target))
|
if (!HasComp<BodyComponent>(target))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!drink.Opened)
|
if (_openable.IsClosed(item, user))
|
||||||
{
|
|
||||||
_popup.PopupEntity(Loc.GetString("drink-component-try-use-drink-not-open",
|
|
||||||
("owner", EntityManager.GetComponent<MetaDataComponent>(item).EntityName)), item, user);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
if (!_solutionContainer.TryGetSolution(item, drink.SolutionName, out var drinkSolution) ||
|
if (!_solutionContainer.TryGetSolution(item, drink.Solution, out var drinkSolution) ||
|
||||||
drinkSolution.Volume <= 0)
|
drinkSolution.Volume <= 0)
|
||||||
{
|
{
|
||||||
_popup.PopupEntity(Loc.GetString("drink-component-try-use-drink-is-empty",
|
if (drink.IgnoreEmpty)
|
||||||
("entity", EntityManager.GetComponent<MetaDataComponent>(item).EntityName)), item, user);
|
return false;
|
||||||
|
|
||||||
|
_popup.PopupEntity(Loc.GetString("drink-component-try-use-drink-is-empty", ("entity", item)), item, user);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,8 +266,7 @@ public sealed class DrinkSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
var userName = Identity.Entity(user, EntityManager);
|
var userName = Identity.Entity(user, EntityManager);
|
||||||
|
|
||||||
_popup.PopupEntity(Loc.GetString("drink-component-force-feed", ("user", userName)),
|
_popup.PopupEntity(Loc.GetString("drink-component-force-feed", ("user", userName)), user, target);
|
||||||
user, target);
|
|
||||||
|
|
||||||
// logging
|
// logging
|
||||||
_adminLogger.Add(LogType.ForceFeed, LogImpact.Medium, $"{ToPrettyString(user):user} is forcing {ToPrettyString(target):target} to drink {ToPrettyString(item):drink} {SolutionContainerSystem.ToPrettyString(drinkSolution)}");
|
_adminLogger.Add(LogType.ForceFeed, LogImpact.Medium, $"{ToPrettyString(user):user} is forcing {ToPrettyString(target):target} to drink {ToPrettyString(item):drink} {SolutionContainerSystem.ToPrettyString(drinkSolution)}");
|
||||||
@@ -365,11 +333,11 @@ public sealed class DrinkSystem : EntitySystem
|
|||||||
|
|
||||||
if (!_body.TryGetBodyOrganComponents<StomachComponent>(args.Target.Value, out var stomachs, body))
|
if (!_body.TryGetBodyOrganComponents<StomachComponent>(args.Target.Value, out var stomachs, body))
|
||||||
{
|
{
|
||||||
_popup.PopupEntity(forceDrink ? Loc.GetString("drink-component-try-use-drink-cannot-drink-other") : Loc.GetString("drink-component-try-use-drink-had-enough"), args.Target.Value, args.User);
|
_popup.PopupEntity(Loc.GetString(forceDrink ? "drink-component-try-use-drink-cannot-drink-other" : "drink-component-try-use-drink-had-enough"), args.Target.Value, args.User);
|
||||||
|
|
||||||
if (HasComp<RefillableSolutionComponent>(args.Target.Value))
|
if (HasComp<RefillableSolutionComponent>(args.Target.Value))
|
||||||
{
|
{
|
||||||
_puddleSystem.TrySpillAt(args.User, drained, out _);
|
_puddle.TrySpillAt(args.User, drained, out _);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +355,7 @@ public sealed class DrinkSystem : EntitySystem
|
|||||||
if (forceDrink)
|
if (forceDrink)
|
||||||
{
|
{
|
||||||
_popup.PopupEntity(Loc.GetString("drink-component-try-use-drink-had-enough-other"), args.Target.Value, args.User);
|
_popup.PopupEntity(Loc.GetString("drink-component-try-use-drink-had-enough-other"), args.Target.Value, args.User);
|
||||||
_puddleSystem.TrySpillAt(args.Target.Value, drained, out _);
|
_puddle.TrySpillAt(args.Target.Value, drained, out _);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_solutionContainer.TryAddSolution(uid, solution, drained);
|
_solutionContainer.TryAddSolution(uid, solution, drained);
|
||||||
@@ -423,7 +391,7 @@ public sealed class DrinkSystem : EntitySystem
|
|||||||
_adminLogger.Add(LogType.Ingestion, LogImpact.Low, $"{ToPrettyString(args.User):target} drank {ToPrettyString(uid):drink}");
|
_adminLogger.Add(LogType.Ingestion, LogImpact.Low, $"{ToPrettyString(args.User):target} drank {ToPrettyString(uid):drink}");
|
||||||
}
|
}
|
||||||
|
|
||||||
_audio.PlayPvs(_audio.GetSound(component.UseSound), args.Target.Value, AudioParams.Default.WithVolume(-2f));
|
_audio.PlayPvs(component.UseSound, args.Target.Value, AudioParams.Default.WithVolume(-2f));
|
||||||
|
|
||||||
_reaction.DoEntityReaction(args.Target.Value, solution, ReactionMethod.Ingestion);
|
_reaction.DoEntityReaction(args.Target.Value, solution, ReactionMethod.Ingestion);
|
||||||
//TODO: Grab the stomach UIDs somehow without using Owner
|
//TODO: Grab the stomach UIDs somehow without using Owner
|
||||||
@@ -442,11 +410,12 @@ public sealed class DrinkSystem : EntitySystem
|
|||||||
if (uid == ev.User ||
|
if (uid == ev.User ||
|
||||||
!ev.CanInteract ||
|
!ev.CanInteract ||
|
||||||
!ev.CanAccess ||
|
!ev.CanAccess ||
|
||||||
!EntityManager.TryGetComponent(ev.User, out BodyComponent? body) ||
|
!TryComp<BodyComponent>(ev.User, out var body) ||
|
||||||
!_body.TryGetBodyOrganComponents<StomachComponent>(ev.User, out var stomachs, body))
|
!_body.TryGetBodyOrganComponents<StomachComponent>(ev.User, out var stomachs, body))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (EntityManager.TryGetComponent<MobStateComponent>(uid, out var mobState) && _mobStateSystem.IsAlive(uid, mobState))
|
// no drinking from living drinks, have to kill them first.
|
||||||
|
if (_mobState.IsAlive(uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AlternativeVerb verb = new()
|
AlternativeVerb verb = new()
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ using Content.Shared.IdentityManagement;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
using Content.Shared.Mobs.Components;
|
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
using Content.Shared.Nutrition;
|
using Content.Shared.Nutrition;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
@@ -30,28 +29,29 @@ using Robust.Shared.Utility;
|
|||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Content.Shared.Storage;
|
using Content.Shared.Storage;
|
||||||
|
|
||||||
namespace Content.Server.Nutrition.EntitySystems
|
namespace Content.Server.Nutrition.EntitySystems;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles feeding attempts both on yourself and on the target.
|
/// Handles feeding attempts both on yourself and on the target.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class FoodSystem : EntitySystem
|
public sealed class FoodSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
[Dependency] private readonly BodySystem _body = default!;
|
||||||
[Dependency] private readonly FlavorProfileSystem _flavorProfileSystem = default!;
|
[Dependency] private readonly FlavorProfileSystem _flavorProfile = default!;
|
||||||
[Dependency] private readonly BodySystem _bodySystem = default!;
|
|
||||||
[Dependency] private readonly StomachSystem _stomachSystem = default!;
|
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
|
||||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
|
||||||
[Dependency] private readonly UtensilSystem _utensilSystem = default!;
|
|
||||||
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
|
|
||||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
[Dependency] private readonly OpenableSystem _openable = default!;
|
||||||
|
[Dependency] private readonly PopupSystem _popup = default!;
|
||||||
[Dependency] private readonly ReactiveSystem _reaction = default!;
|
[Dependency] private readonly ReactiveSystem _reaction = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
|
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
||||||
|
[Dependency] private readonly SharedHandsSystem _hands = default!;
|
||||||
|
[Dependency] private readonly SharedInteractionSystem _interaction = default!;
|
||||||
|
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
|
||||||
[Dependency] private readonly StackSystem _stack = default!;
|
[Dependency] private readonly StackSystem _stack = default!;
|
||||||
|
[Dependency] private readonly StomachSystem _stomach = default!;
|
||||||
|
[Dependency] private readonly UtensilSystem _utensil = default!;
|
||||||
|
|
||||||
public const float MaxFeedDistance = 1.0f;
|
public const float MaxFeedDistance = 1.0f;
|
||||||
|
|
||||||
@@ -60,7 +60,8 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
// TODO add InteractNoHandEvent for entities like mice.
|
// TODO add InteractNoHandEvent for entities like mice.
|
||||||
SubscribeLocalEvent<FoodComponent, UseInHandEvent>(OnUseFoodInHand);
|
// run after openable for wrapped/peelable foods
|
||||||
|
SubscribeLocalEvent<FoodComponent, UseInHandEvent>(OnUseFoodInHand, after: new[] { typeof(OpenableSystem) });
|
||||||
SubscribeLocalEvent<FoodComponent, AfterInteractEvent>(OnFeedFood);
|
SubscribeLocalEvent<FoodComponent, AfterInteractEvent>(OnFeedFood);
|
||||||
SubscribeLocalEvent<FoodComponent, GetVerbsEvent<AlternativeVerb>>(AddEatVerb);
|
SubscribeLocalEvent<FoodComponent, GetVerbsEvent<AlternativeVerb>>(AddEatVerb);
|
||||||
SubscribeLocalEvent<FoodComponent, ConsumeDoAfterEvent>(OnDoAfter);
|
SubscribeLocalEvent<FoodComponent, ConsumeDoAfterEvent>(OnDoAfter);
|
||||||
@@ -93,44 +94,42 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
|
|
||||||
public (bool Success, bool Handled) TryFeed(EntityUid user, EntityUid target, EntityUid food, FoodComponent foodComp)
|
public (bool Success, bool Handled) TryFeed(EntityUid user, EntityUid target, EntityUid food, FoodComponent foodComp)
|
||||||
{
|
{
|
||||||
//Suppresses self-eating
|
//Suppresses eating yourself and alive mobs
|
||||||
if (food == user || TryComp<MobStateComponent>(food, out var mobState) && _mobStateSystem.IsAlive(food, mobState)) // Suppresses eating alive mobs
|
if (food == user || _mobState.IsAlive(food))
|
||||||
return (false, false);
|
return (false, false);
|
||||||
|
|
||||||
// Target can't be fed or they're already eating
|
// Target can't be fed or they're already eating
|
||||||
if (!TryComp<BodyComponent>(target, out var body))
|
if (!TryComp<BodyComponent>(target, out var body))
|
||||||
return (false, false);
|
return (false, false);
|
||||||
|
|
||||||
if (!_solutionContainerSystem.TryGetSolution(food, foodComp.SolutionName, out var foodSolution) || foodSolution.Name == null)
|
if (_openable.IsClosed(food, user))
|
||||||
|
return (false, true);
|
||||||
|
|
||||||
|
if (!_solutionContainer.TryGetSolution(food, foodComp.Solution, out var foodSolution) || foodSolution.Name == null)
|
||||||
return (false, false);
|
return (false, false);
|
||||||
|
|
||||||
if (!_bodySystem.TryGetBodyOrganComponents<StomachComponent>(target, out var stomachs, body))
|
if (!_body.TryGetBodyOrganComponents<StomachComponent>(target, out var stomachs, body))
|
||||||
return (false, false);
|
return (false, false);
|
||||||
|
|
||||||
var forceFeed = user != target;
|
|
||||||
|
|
||||||
// Check for special digestibles
|
// Check for special digestibles
|
||||||
if (!IsDigestibleBy(food, foodComp, stomachs))
|
if (!IsDigestibleBy(food, foodComp, stomachs))
|
||||||
{
|
return (false, false);
|
||||||
_popupSystem.PopupEntity(
|
|
||||||
forceFeed
|
if (!TryGetRequiredUtensils(user, foodComp, out _))
|
||||||
? Loc.GetString("food-system-cant-digest-other", ("entity", food))
|
return (false, false);
|
||||||
: Loc.GetString("food-system-cant-digest", ("entity", food)), user, user);
|
|
||||||
return (false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for used storage on the food item
|
// Check for used storage on the food item
|
||||||
if (TryComp<StorageComponent>(food, out var storageState) && storageState.StorageUsed != 0)
|
if (TryComp<StorageComponent>(food, out var storageState) && storageState.StorageUsed != 0)
|
||||||
{
|
{
|
||||||
_popupSystem.PopupEntity(Loc.GetString("food-has-used-storage", ("food", food)), user, user);
|
_popup.PopupEntity(Loc.GetString("food-has-used-storage", ("food", food)), user, user);
|
||||||
return (false, true);
|
return (false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var flavors = _flavorProfileSystem.GetLocalizedFlavorsMessage(food, user, foodSolution);
|
var flavors = _flavorProfile.GetLocalizedFlavorsMessage(food, user, foodSolution);
|
||||||
|
|
||||||
if (foodComp.UsesRemaining <= 0)
|
if (GetUsesRemaining(food, foodComp) <= 0)
|
||||||
{
|
{
|
||||||
_popupSystem.PopupEntity(Loc.GetString("food-system-try-use-food-is-empty", ("entity", food)), user, user);
|
_popup.PopupEntity(Loc.GetString("food-system-try-use-food-is-empty", ("entity", food)), user, user);
|
||||||
DeleteAndSpawnTrash(foodComp, food, user);
|
DeleteAndSpawnTrash(foodComp, food, user);
|
||||||
return (false, true);
|
return (false, true);
|
||||||
}
|
}
|
||||||
@@ -138,27 +137,25 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
if (IsMouthBlocked(target, user))
|
if (IsMouthBlocked(target, user))
|
||||||
return (false, true);
|
return (false, true);
|
||||||
|
|
||||||
if (!_interactionSystem.InRangeUnobstructed(user, food, popup: true))
|
if (!_interaction.InRangeUnobstructed(user, food, popup: true))
|
||||||
return (false, true);
|
return (false, true);
|
||||||
|
|
||||||
if (!_interactionSystem.InRangeUnobstructed(user, target, MaxFeedDistance, popup: true))
|
if (!_interaction.InRangeUnobstructed(user, target, MaxFeedDistance, popup: true))
|
||||||
return (false, true);
|
return (false, true);
|
||||||
|
|
||||||
// TODO make do-afters account for fixtures in the range check.
|
// TODO make do-afters account for fixtures in the range check.
|
||||||
if (!Transform(user).MapPosition.InRange(Transform(target).MapPosition, MaxFeedDistance))
|
if (!Transform(user).MapPosition.InRange(Transform(target).MapPosition, MaxFeedDistance))
|
||||||
{
|
{
|
||||||
var message = Loc.GetString("interaction-system-user-interaction-cannot-reach");
|
var message = Loc.GetString("interaction-system-user-interaction-cannot-reach");
|
||||||
_popupSystem.PopupEntity(message, user, user);
|
_popup.PopupEntity(message, user, user);
|
||||||
return (false, true);
|
return (false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TryGetRequiredUtensils(user, foodComp, out _))
|
var forceFeed = user != target;
|
||||||
return (false, true);
|
|
||||||
|
|
||||||
if (forceFeed)
|
if (forceFeed)
|
||||||
{
|
{
|
||||||
var userName = Identity.Entity(user, EntityManager);
|
var userName = Identity.Entity(user, EntityManager);
|
||||||
_popupSystem.PopupEntity(Loc.GetString("food-system-force-feed", ("user", userName)),
|
_popup.PopupEntity(Loc.GetString("food-system-force-feed", ("user", userName)),
|
||||||
user, target);
|
user, target);
|
||||||
|
|
||||||
// logging
|
// logging
|
||||||
@@ -188,7 +185,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
NeedHand = forceFeed,
|
NeedHand = forceFeed,
|
||||||
};
|
};
|
||||||
|
|
||||||
_doAfterSystem.TryStartDoAfter(doAfterArgs);
|
_doAfter.TryStartDoAfter(doAfterArgs);
|
||||||
return (true, true);
|
return (true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,10 +197,10 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
if (!TryComp<BodyComponent>(args.Target.Value, out var body))
|
if (!TryComp<BodyComponent>(args.Target.Value, out var body))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_bodySystem.TryGetBodyOrganComponents<StomachComponent>(args.Target.Value, out var stomachs, body))
|
if (!_body.TryGetBodyOrganComponents<StomachComponent>(args.Target.Value, out var stomachs, body))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_solutionContainerSystem.TryGetSolution(args.Used, args.Solution, out var solution))
|
if (!_solutionContainer.TryGetSolution(args.Used, args.Solution, out var solution))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!TryGetRequiredUtensils(args.User, component, out var utensils))
|
if (!TryGetRequiredUtensils(args.User, component, out var utensils))
|
||||||
@@ -214,7 +211,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO this should really be checked every tick.
|
// TODO this should really be checked every tick.
|
||||||
if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target.Value))
|
if (!_interaction.InRangeUnobstructed(args.User, args.Target.Value))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var forceFeed = args.User != args.Target;
|
var forceFeed = args.User != args.Target;
|
||||||
@@ -222,7 +219,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
var transferAmount = component.TransferAmount != null ? FixedPoint2.Min((FixedPoint2) component.TransferAmount, solution.Volume) : solution.Volume;
|
var transferAmount = component.TransferAmount != null ? FixedPoint2.Min((FixedPoint2) component.TransferAmount, solution.Volume) : solution.Volume;
|
||||||
|
|
||||||
var split = _solutionContainerSystem.SplitSolution(uid, solution, transferAmount);
|
var split = _solutionContainer.SplitSolution(uid, solution, transferAmount);
|
||||||
|
|
||||||
//TODO: Get the stomach UID somehow without nabbing owner
|
//TODO: Get the stomach UID somehow without nabbing owner
|
||||||
// Get the stomach with the highest available solution volume
|
// Get the stomach with the highest available solution volume
|
||||||
@@ -231,10 +228,10 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
foreach (var (stomach, _) in stomachs)
|
foreach (var (stomach, _) in stomachs)
|
||||||
{
|
{
|
||||||
var owner = stomach.Owner;
|
var owner = stomach.Owner;
|
||||||
if (!_stomachSystem.CanTransferSolution(owner, split))
|
if (!_stomach.CanTransferSolution(owner, split))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!_solutionContainerSystem.TryGetSolution(owner, StomachSystem.DefaultSolutionName,
|
if (!_solutionContainer.TryGetSolution(owner, StomachSystem.DefaultSolutionName,
|
||||||
out var stomachSol))
|
out var stomachSol))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -248,13 +245,13 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
// No stomach so just popup a message that they can't eat.
|
// No stomach so just popup a message that they can't eat.
|
||||||
if (stomachToUse == null)
|
if (stomachToUse == null)
|
||||||
{
|
{
|
||||||
_solutionContainerSystem.TryAddSolution(uid, solution, split);
|
_solutionContainer.TryAddSolution(uid, solution, split);
|
||||||
_popupSystem.PopupEntity(forceFeed ? Loc.GetString("food-system-you-cannot-eat-any-more-other") : Loc.GetString("food-system-you-cannot-eat-any-more"), args.Target.Value, args.User);
|
_popup.PopupEntity(forceFeed ? Loc.GetString("food-system-you-cannot-eat-any-more-other") : Loc.GetString("food-system-you-cannot-eat-any-more"), args.Target.Value, args.User);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_reaction.DoEntityReaction(args.Target.Value, solution, ReactionMethod.Ingestion);
|
_reaction.DoEntityReaction(args.Target.Value, solution, ReactionMethod.Ingestion);
|
||||||
_stomachSystem.TryTransferSolution(stomachToUse.Owner, split, stomachToUse);
|
_stomach.TryTransferSolution(stomachToUse.Owner, split, stomachToUse);
|
||||||
|
|
||||||
var flavors = args.FlavorMessage;
|
var flavors = args.FlavorMessage;
|
||||||
|
|
||||||
@@ -262,17 +259,17 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
{
|
{
|
||||||
var targetName = Identity.Entity(args.Target.Value, EntityManager);
|
var targetName = Identity.Entity(args.Target.Value, EntityManager);
|
||||||
var userName = Identity.Entity(args.User, EntityManager);
|
var userName = Identity.Entity(args.User, EntityManager);
|
||||||
_popupSystem.PopupEntity(Loc.GetString("food-system-force-feed-success", ("user", userName), ("flavors", flavors)),
|
_popup.PopupEntity(Loc.GetString("food-system-force-feed-success", ("user", userName), ("flavors", flavors)),
|
||||||
uid, uid);
|
uid, uid);
|
||||||
|
|
||||||
_popupSystem.PopupEntity(Loc.GetString("food-system-force-feed-success-user", ("target", targetName)), args.User, args.User);
|
_popup.PopupEntity(Loc.GetString("food-system-force-feed-success-user", ("target", targetName)), args.User, args.User);
|
||||||
|
|
||||||
// log successful force feed
|
// log successful force feed
|
||||||
_adminLogger.Add(LogType.ForceFeed, LogImpact.Medium, $"{ToPrettyString(uid):user} forced {ToPrettyString(args.User):target} to eat {ToPrettyString(uid):food}");
|
_adminLogger.Add(LogType.ForceFeed, LogImpact.Medium, $"{ToPrettyString(uid):user} forced {ToPrettyString(args.User):target} to eat {ToPrettyString(uid):food}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_popupSystem.PopupEntity(Loc.GetString(component.EatMessage, ("food", uid), ("flavors", flavors)), args.User, args.User);
|
_popup.PopupEntity(Loc.GetString(component.EatMessage, ("food", uid), ("flavors", flavors)), args.User, args.User);
|
||||||
|
|
||||||
// log successful voluntary eating
|
// log successful voluntary eating
|
||||||
_adminLogger.Add(LogType.Ingestion, LogImpact.Low, $"{ToPrettyString(args.User):target} ate {ToPrettyString(uid):food}");
|
_adminLogger.Add(LogType.Ingestion, LogImpact.Low, $"{ToPrettyString(args.User):target} ate {ToPrettyString(uid):food}");
|
||||||
@@ -283,7 +280,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
// Try to break all used utensils
|
// Try to break all used utensils
|
||||||
foreach (var utensil in utensils)
|
foreach (var utensil in utensils)
|
||||||
{
|
{
|
||||||
_utensilSystem.TryBreak(utensil, args.User);
|
_utensil.TryBreak(utensil, args.User);
|
||||||
}
|
}
|
||||||
|
|
||||||
args.Repeat = !forceFeed;
|
args.Repeat = !forceFeed;
|
||||||
@@ -294,11 +291,11 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
if (stack.Count > 1)
|
if (stack.Count > 1)
|
||||||
{
|
{
|
||||||
_stack.SetCount(uid, stack.Count - 1);
|
_stack.SetCount(uid, stack.Count - 1);
|
||||||
_solutionContainerSystem.TryAddSolution(uid, solution, split);
|
_solutionContainer.TryAddSolution(uid, solution, split);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (component.UsesRemaining > 0)
|
else if (GetUsesRemaining(uid, component) > 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -321,19 +318,19 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
{
|
{
|
||||||
//We're empty. Become trash.
|
//We're empty. Become trash.
|
||||||
var position = Transform(food).MapPosition;
|
var position = Transform(food).MapPosition;
|
||||||
var finisher = EntityManager.SpawnEntity(component.TrashPrototype, position);
|
var finisher = Spawn(component.TrashPrototype, position);
|
||||||
|
|
||||||
// If the user is holding the item
|
// If the user is holding the item
|
||||||
if (user != null && _handsSystem.IsHolding(user.Value, food, out var hand))
|
if (user != null && _hands.IsHolding(user.Value, food, out var hand))
|
||||||
{
|
{
|
||||||
EntityManager.DeleteEntity(food);
|
Del(food);
|
||||||
|
|
||||||
// Put the trash in the user's hand
|
// Put the trash in the user's hand
|
||||||
_handsSystem.TryPickup(user.Value, finisher, hand);
|
_hands.TryPickup(user.Value, finisher, hand);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityManager.QueueDeleteEntity(food);
|
QueueDel(food);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddEatVerb(EntityUid uid, FoodComponent component, GetVerbsEvent<AlternativeVerb> ev)
|
private void AddEatVerb(EntityUid uid, FoodComponent component, GetVerbsEvent<AlternativeVerb> ev)
|
||||||
@@ -341,11 +338,16 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
if (uid == ev.User ||
|
if (uid == ev.User ||
|
||||||
!ev.CanInteract ||
|
!ev.CanInteract ||
|
||||||
!ev.CanAccess ||
|
!ev.CanAccess ||
|
||||||
!EntityManager.TryGetComponent(ev.User, out BodyComponent? body) ||
|
!TryComp<BodyComponent>(ev.User, out var body) ||
|
||||||
!_bodySystem.TryGetBodyOrganComponents<StomachComponent>(ev.User, out var stomachs, body))
|
!_body.TryGetBodyOrganComponents<StomachComponent>(ev.User, out var stomachs, body))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (EntityManager.TryGetComponent<MobStateComponent>(uid, out var mobState) && _mobStateSystem.IsAlive(uid, mobState))
|
// have to kill mouse before eating it
|
||||||
|
if (_mobState.IsAlive(uid))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// only give moths eat verb for clothes since it would just fail otherwise
|
||||||
|
if (!IsDigestibleBy(uid, component, stomachs))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AlternativeVerb verb = new()
|
AlternativeVerb verb = new()
|
||||||
@@ -370,7 +372,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
if (!Resolve(food, ref foodComp, false))
|
if (!Resolve(food, ref foodComp, false))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!_bodySystem.TryGetBodyOrganComponents<StomachComponent>(uid, out var stomachs))
|
if (!_body.TryGetBodyOrganComponents<StomachComponent>(uid, out var stomachs))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return IsDigestibleBy(food, foodComp, stomachs);
|
return IsDigestibleBy(food, foodComp, stomachs);
|
||||||
@@ -420,10 +422,10 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
|
|
||||||
var usedTypes = UtensilType.None;
|
var usedTypes = UtensilType.None;
|
||||||
|
|
||||||
foreach (var item in _handsSystem.EnumerateHeld(user, hands))
|
foreach (var item in _hands.EnumerateHeld(user, hands))
|
||||||
{
|
{
|
||||||
// Is utensil?
|
// Is utensil?
|
||||||
if (!EntityManager.TryGetComponent(item, out UtensilComponent? utensil))
|
if (!TryComp<UtensilComponent>(item, out var utensil))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((utensil.Types & component.Utensil) != 0 && // Acceptable type?
|
if ((utensil.Types & component.Utensil) != 0 && // Acceptable type?
|
||||||
@@ -438,7 +440,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
// If "required" field is set, try to block eating without proper utensils used
|
// If "required" field is set, try to block eating without proper utensils used
|
||||||
if (component.UtensilRequired && (usedTypes & component.Utensil) != component.Utensil)
|
if (component.UtensilRequired && (usedTypes & component.Utensil) != component.Utensil)
|
||||||
{
|
{
|
||||||
_popupSystem.PopupEntity(Loc.GetString("food-you-need-to-hold-utensil", ("utensil", component.Utensil ^ usedTypes)), user, user);
|
_popup.PopupEntity(Loc.GetString("food-you-need-to-hold-utensil", ("utensil", component.Utensil ^ usedTypes)), user, user);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,8 +457,8 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
|
|
||||||
IngestionBlockerComponent? blocker;
|
IngestionBlockerComponent? blocker;
|
||||||
|
|
||||||
if (_inventorySystem.TryGetSlotEntity(uid, "mask", out var maskUid) &&
|
if (_inventory.TryGetSlotEntity(uid, "mask", out var maskUid) &&
|
||||||
EntityManager.TryGetComponent(maskUid, out blocker) &&
|
TryComp(maskUid, out blocker) &&
|
||||||
blocker.Enabled)
|
blocker.Enabled)
|
||||||
{
|
{
|
||||||
args.Blocker = maskUid;
|
args.Blocker = maskUid;
|
||||||
@@ -464,8 +466,8 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_inventorySystem.TryGetSlotEntity(uid, "head", out var headUid) &&
|
if (_inventory.TryGetSlotEntity(uid, "head", out var headUid) &&
|
||||||
EntityManager.TryGetComponent(headUid, out blocker) &&
|
TryComp(headUid, out blocker) &&
|
||||||
blocker.Enabled)
|
blocker.Enabled)
|
||||||
{
|
{
|
||||||
args.Blocker = headUid;
|
args.Blocker = headUid;
|
||||||
@@ -487,12 +489,28 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
RaiseLocalEvent(uid, attempt, false);
|
RaiseLocalEvent(uid, attempt, false);
|
||||||
if (attempt.Cancelled && attempt.Blocker != null && popupUid != null)
|
if (attempt.Cancelled && attempt.Blocker != null && popupUid != null)
|
||||||
{
|
{
|
||||||
var name = EntityManager.GetComponent<MetaDataComponent>(attempt.Blocker.Value).EntityName;
|
_popup.PopupEntity(Loc.GetString("food-system-remove-mask", ("entity", attempt.Blocker.Value)),
|
||||||
_popupSystem.PopupEntity(Loc.GetString("food-system-remove-mask", ("entity", name)),
|
|
||||||
uid, popupUid.Value);
|
uid, popupUid.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return attempt.Cancelled;
|
return attempt.Cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the number of bites this food has left, based on how much food solution there is and how much of it to eat per bite.
|
||||||
|
/// </summary>
|
||||||
|
public int GetUsesRemaining(EntityUid uid, FoodComponent? comp = null)
|
||||||
|
{
|
||||||
|
if (!Resolve(uid, ref comp))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!_solutionContainer.TryGetSolution(uid, comp.Solution, out var solution) || solution.Volume == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// eat all in 1 go, so non empty is 1 bite
|
||||||
|
if (comp.TransferAmount == null)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return Math.Max(1, (int) Math.Ceiling((solution.Volume / (FixedPoint2) comp.TransferAmount).Float()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
140
Content.Server/Nutrition/EntitySystems/OpenableSystem.cs
Normal file
140
Content.Server/Nutrition/EntitySystems/OpenableSystem.cs
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
using Content.Server.Chemistry.EntitySystems;
|
||||||
|
using Content.Server.Fluids.EntitySystems;
|
||||||
|
using Content.Server.Nutrition.Components;
|
||||||
|
using Content.Shared.Examine;
|
||||||
|
using Content.Shared.Interaction;
|
||||||
|
using Content.Shared.Interaction.Events;
|
||||||
|
using Content.Shared.Nutrition.Components;
|
||||||
|
using Content.Shared.Popups;
|
||||||
|
using Content.Shared.Weapons.Melee.Events;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
|
namespace Content.Server.Nutrition.EntitySystems;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides API for openable food and drinks, handles opening on use and preventing transfer when closed.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class OpenableSystem : EntitySystem
|
||||||
|
{
|
||||||
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
|
||||||
|
SubscribeLocalEvent<OpenableComponent, ComponentInit>(OnInit);
|
||||||
|
SubscribeLocalEvent<OpenableComponent, UseInHandEvent>(OnUse);
|
||||||
|
SubscribeLocalEvent<OpenableComponent, ExaminedEvent>(OnExamined, after: new[] { typeof(PuddleSystem) });
|
||||||
|
SubscribeLocalEvent<OpenableComponent, SolutionTransferAttemptEvent>(OnTransferAttempt);
|
||||||
|
SubscribeLocalEvent<OpenableComponent, MeleeHitEvent>(HandleIfClosed);
|
||||||
|
SubscribeLocalEvent<OpenableComponent, AfterInteractEvent>(HandleIfClosed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnInit(EntityUid uid, OpenableComponent comp, ComponentInit args)
|
||||||
|
{
|
||||||
|
UpdateAppearance(uid, comp);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUse(EntityUid uid, OpenableComponent comp, UseInHandEvent args)
|
||||||
|
{
|
||||||
|
if (args.Handled || !comp.OpenableByHand)
|
||||||
|
return;
|
||||||
|
|
||||||
|
args.Handled = TryOpen(uid, comp);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnExamined(EntityUid uid, OpenableComponent comp, ExaminedEvent args)
|
||||||
|
{
|
||||||
|
if (!comp.Opened || !args.IsInDetailsRange)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var text = Loc.GetString(comp.ExamineText);
|
||||||
|
args.PushMarkup(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTransferAttempt(EntityUid uid, OpenableComponent comp, SolutionTransferAttemptEvent args)
|
||||||
|
{
|
||||||
|
if (!comp.Opened)
|
||||||
|
{
|
||||||
|
// message says its just for drinks, shouldn't matter since you typically dont have a food that is openable and can be poured out
|
||||||
|
args.Cancel(Loc.GetString("drink-component-try-use-drink-not-open", ("owner", uid)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleIfClosed(EntityUid uid, OpenableComponent comp, HandledEntityEventArgs args)
|
||||||
|
{
|
||||||
|
// prevent spilling/pouring/whatever drinks when closed
|
||||||
|
args.Handled = !comp.Opened;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the entity either does not have OpenableComponent or it is opened.
|
||||||
|
/// Drinks that don't have OpenableComponent are automatically open, so it returns true.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsOpen(EntityUid uid, OpenableComponent? comp = null)
|
||||||
|
{
|
||||||
|
if (!Resolve(uid, ref comp, false))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return comp.Opened;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the entity both has OpenableComponent and is not opened.
|
||||||
|
/// Drinks that don't have OpenableComponent are automatically open, so it returns false.
|
||||||
|
/// If user is not null a popup will be shown to them.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsClosed(EntityUid uid, EntityUid? user = null, OpenableComponent? comp = null)
|
||||||
|
{
|
||||||
|
if (!Resolve(uid, ref comp, false))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (comp.Opened)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (user != null)
|
||||||
|
_popup.PopupEntity(Loc.GetString(comp.ClosedPopup, ("owner", uid)), user.Value, user.Value);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update open visuals to the current value.
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateAppearance(EntityUid uid, OpenableComponent? comp = null, AppearanceComponent? appearance = null)
|
||||||
|
{
|
||||||
|
if (!Resolve(uid, ref comp))
|
||||||
|
return;
|
||||||
|
|
||||||
|
_appearance.SetData(uid, OpenableVisuals.Opened, comp.Opened, appearance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the opened field and updates open visuals.
|
||||||
|
/// </summary>
|
||||||
|
public void SetOpen(EntityUid uid, bool opened = true, OpenableComponent? comp = null)
|
||||||
|
{
|
||||||
|
if (!Resolve(uid, ref comp) || opened == comp.Opened)
|
||||||
|
return;
|
||||||
|
|
||||||
|
comp.Opened = opened;
|
||||||
|
|
||||||
|
UpdateAppearance(uid, comp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If closed, opens it and plays the sound.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Whether it got opened</returns>
|
||||||
|
public bool TryOpen(EntityUid uid, OpenableComponent? comp = null)
|
||||||
|
{
|
||||||
|
if (!Resolve(uid, ref comp) || comp.Opened)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
SetOpen(uid, true, comp);
|
||||||
|
_audio.PlayPvs(comp.Sound, uid);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -47,7 +47,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_solutionContainerSystem.TryGetSolution(uid, food.SolutionName, out var solution))
|
if (!_solutionContainerSystem.TryGetSolution(uid, food.Solution, out var solution))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
{
|
{
|
||||||
// Replace all reagents on prototype not just copying poisons (example: slices of eaten pizza should have less nutrition)
|
// Replace all reagents on prototype not just copying poisons (example: slices of eaten pizza should have less nutrition)
|
||||||
if (TryComp<FoodComponent>(sliceUid, out var sliceFoodComp) &&
|
if (TryComp<FoodComponent>(sliceUid, out var sliceFoodComp) &&
|
||||||
_solutionContainerSystem.TryGetSolution(sliceUid, sliceFoodComp.SolutionName, out var itsSolution))
|
_solutionContainerSystem.TryGetSolution(sliceUid, sliceFoodComp.Solution, out var itsSolution))
|
||||||
{
|
{
|
||||||
_solutionContainerSystem.RemoveAllSolution(sliceUid, itsSolution);
|
_solutionContainerSystem.RemoveAllSolution(sliceUid, itsSolution);
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
var foodComp = EnsureComp<FoodComponent>(uid);
|
var foodComp = EnsureComp<FoodComponent>(uid);
|
||||||
|
|
||||||
EnsureComp<SolutionContainerManagerComponent>(uid);
|
EnsureComp<SolutionContainerManagerComponent>(uid);
|
||||||
_solutionContainerSystem.EnsureSolution(uid, foodComp.SolutionName);
|
_solutionContainerSystem.EnsureSolution(uid, foodComp.Solution);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnExamined(EntityUid uid, SliceableFoodComponent component, ExaminedEvent args)
|
private void OnExamined(EntityUid uid, SliceableFoodComponent component, ExaminedEvent args)
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ namespace Content.Shared.Nutrition.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public enum DrinkCanStateVisual : byte
|
public enum OpenableVisuals : byte
|
||||||
{
|
{
|
||||||
Closed,
|
Opened,
|
||||||
Opened
|
Layer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
drink-component-on-use-is-empty = {$owner} is empty!
|
drink-component-on-use-is-empty = {$owner} is empty!
|
||||||
drink-component-on-examine-is-empty = Empty
|
drink-component-on-examine-is-empty = [color=gray]Empty[/color]
|
||||||
drink-component-on-examine-is-opened = Opened
|
drink-component-on-examine-is-opened = [color=yellow]Opened[/color]
|
||||||
drink-component-on-examine-details-text = [color={$colorName}]{$text}[/color]
|
|
||||||
drink-component-on-examine-is-full = Full
|
drink-component-on-examine-is-full = Full
|
||||||
drink-component-on-examine-is-mostly-full = Mostly Full
|
drink-component-on-examine-is-mostly-full = Mostly Full
|
||||||
drink-component-on-examine-is-half-full = Halfway Full
|
drink-component-on-examine-is-half-full = Halfway Full
|
||||||
|
|||||||
@@ -152,7 +152,6 @@
|
|||||||
!type:SpreaderNode
|
!type:SpreaderNode
|
||||||
nodeGroupID: Spreader
|
nodeGroupID: Spreader
|
||||||
- type: Drink
|
- type: Drink
|
||||||
isOpen: true
|
|
||||||
delay: 3
|
delay: 3
|
||||||
transferAmount: 1
|
transferAmount: 1
|
||||||
solution: puddle
|
solution: puddle
|
||||||
|
|||||||
@@ -40,8 +40,6 @@
|
|||||||
id: DrinkGlassBase
|
id: DrinkGlassBase
|
||||||
abstract: true
|
abstract: true
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
|
||||||
isOpen: true
|
|
||||||
- type: Damageable
|
- type: Damageable
|
||||||
damageContainer: Inorganic
|
damageContainer: Inorganic
|
||||||
damageModifierSet: Glass
|
damageModifierSet: Glass
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
id: DrinkBottleBaseFull
|
id: DrinkBottleBaseFull
|
||||||
abstract: true
|
abstract: true
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Openable
|
||||||
openSounds:
|
sound:
|
||||||
collection: bottleOpenSounds
|
collection: bottleOpenSounds
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
@@ -130,8 +130,9 @@
|
|||||||
reagents:
|
reagents:
|
||||||
- ReagentId: Grenadine
|
- ReagentId: Grenadine
|
||||||
Quantity: 100
|
Quantity: 100
|
||||||
- type: Drink
|
# intended use is to spike drinks so starts open
|
||||||
isOpen: true
|
- type: Openable
|
||||||
|
opened: true
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Consumable/Drinks/grenadinebottle.rsi
|
sprite: Objects/Consumable/Drinks/grenadinebottle.rsi
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,8 @@
|
|||||||
abstract: true
|
abstract: true
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
openSounds:
|
- type: Openable
|
||||||
collection: canOpenSounds
|
- type: PressurizedDrink
|
||||||
pressurized: true
|
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
drink:
|
drink:
|
||||||
@@ -25,7 +24,7 @@
|
|||||||
state: icon
|
state: icon
|
||||||
layers:
|
layers:
|
||||||
- state: icon
|
- state: icon
|
||||||
map: ["drinkCanIcon"]
|
map: ["enum.OpenableVisuals.Layer"]
|
||||||
- type: FitsInDispenser
|
- type: FitsInDispenser
|
||||||
solution: drink
|
solution: drink
|
||||||
- type: DrawableSolution
|
- type: DrawableSolution
|
||||||
@@ -37,8 +36,8 @@
|
|||||||
- type: Appearance
|
- type: Appearance
|
||||||
- type: GenericVisualizer
|
- type: GenericVisualizer
|
||||||
visuals:
|
visuals:
|
||||||
enum.DrinkCanStateVisual.Opened:
|
enum.OpenableVisuals.Opened:
|
||||||
drinkCanIcon:
|
enum.OpenableVisuals.Layer:
|
||||||
True: {state: "icon_open"}
|
True: {state: "icon_open"}
|
||||||
False: {state: "icon"}
|
False: {state: "icon"}
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
- key: enum.TransferAmountUiKey.Key
|
- key: enum.TransferAmountUiKey.Key
|
||||||
type: TransferAmountBoundUserInterface
|
type: TransferAmountBoundUserInterface
|
||||||
- type: Drink
|
- type: Drink
|
||||||
isOpen: true
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: icon
|
state: icon
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
|
|||||||
@@ -4,9 +4,8 @@
|
|||||||
name: space glue tube
|
name: space glue tube
|
||||||
description: High performance glue intended for maintenance of extremely complex mechanical equipment. DON'T DRINK!
|
description: High performance glue intended for maintenance of extremely complex mechanical equipment. DON'T DRINK!
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Openable
|
||||||
isOpen: false
|
sound:
|
||||||
openSounds:
|
|
||||||
collection: packetOpenSounds
|
collection: packetOpenSounds
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Consumable/Drinks/glue-tube.rsi
|
sprite: Objects/Consumable/Drinks/glue-tube.rsi
|
||||||
@@ -40,9 +39,8 @@
|
|||||||
name: space lube tube
|
name: space lube tube
|
||||||
description: High performance lubricant intended for maintenance of extremely complex mechanical equipment.
|
description: High performance lubricant intended for maintenance of extremely complex mechanical equipment.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Openable
|
||||||
isOpen: false
|
sound:
|
||||||
openSounds:
|
|
||||||
collection: packetOpenSounds
|
collection: packetOpenSounds
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Consumable/Drinks/lube-tube.rsi
|
sprite: Objects/Consumable/Drinks/lube-tube.rsi
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
drink:
|
drink:
|
||||||
maxVol: 100
|
maxVol: 100
|
||||||
- type: Drink
|
- type: Drink
|
||||||
isOpen: true
|
|
||||||
- type: FitsInDispenser
|
- type: FitsInDispenser
|
||||||
solution: drink
|
solution: drink
|
||||||
- type: DrawableSolution
|
- type: DrawableSolution
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
canChangeTransferAmount: true
|
canChangeTransferAmount: true
|
||||||
maxTransferAmount: 5
|
maxTransferAmount: 5
|
||||||
- type: Drink
|
- type: Drink
|
||||||
isOpen: true
|
|
||||||
- type: MeleeWeapon
|
- type: MeleeWeapon
|
||||||
soundNoDamage:
|
soundNoDamage:
|
||||||
path: "/Audio/Effects/Fluids/splat.ogg"
|
path: "/Audio/Effects/Fluids/splat.ogg"
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
Blunt: 5
|
Blunt: 5
|
||||||
- type: Drink
|
- type: Drink
|
||||||
solution: food
|
solution: food
|
||||||
isOpen: true
|
|
||||||
- type: DrawableSolution
|
- type: DrawableSolution
|
||||||
solution: food
|
solution: food
|
||||||
- type: Damageable
|
- type: Damageable
|
||||||
|
|||||||
@@ -31,7 +31,8 @@
|
|||||||
- type: Drink
|
- type: Drink
|
||||||
solution: food
|
solution: food
|
||||||
refillable: false
|
refillable: false
|
||||||
openSounds:
|
- type: Openable
|
||||||
|
sound:
|
||||||
collection: packetOpenSounds
|
collection: packetOpenSounds
|
||||||
# Since this one is closed, the only way to insert liquid is with a syringe.
|
# Since this one is closed, the only way to insert liquid is with a syringe.
|
||||||
- type: InjectableSolution
|
- type: InjectableSolution
|
||||||
@@ -372,7 +373,8 @@
|
|||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
solution: food
|
solution: food
|
||||||
openSounds:
|
- type: Openable
|
||||||
|
sound:
|
||||||
collection: pop
|
collection: pop
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
@@ -552,7 +554,6 @@
|
|||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
solution: food
|
solution: food
|
||||||
isOpen: true
|
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
food:
|
food:
|
||||||
|
|||||||
@@ -24,10 +24,11 @@
|
|||||||
solution: food
|
solution: food
|
||||||
- type: Drink
|
- type: Drink
|
||||||
solution: food
|
solution: food
|
||||||
openSounds:
|
|
||||||
collection: packetOpenSounds
|
|
||||||
useSound:
|
useSound:
|
||||||
path: /Audio/Items/eating_1.ogg
|
path: /Audio/Items/eating_1.ogg
|
||||||
|
- type: Openable
|
||||||
|
sound:
|
||||||
|
collection: packetOpenSounds
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
solution: food
|
solution: food
|
||||||
- type: MeleeWeapon
|
- type: MeleeWeapon
|
||||||
|
|||||||
@@ -1024,9 +1024,8 @@
|
|||||||
name: crazy glue
|
name: crazy glue
|
||||||
description: A bottle of crazy glue manufactured by Honk! Co.
|
description: A bottle of crazy glue manufactured by Honk! Co.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Openable
|
||||||
isOpen: false
|
sound:
|
||||||
openSounds:
|
|
||||||
collection: packetOpenSounds
|
collection: packetOpenSounds
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Fun/glue.rsi
|
sprite: Objects/Fun/glue.rsi
|
||||||
|
|||||||
@@ -160,7 +160,6 @@
|
|||||||
- MobLayer
|
- MobLayer
|
||||||
- type: Pullable
|
- type: Pullable
|
||||||
- type: Drink
|
- type: Drink
|
||||||
isOpen: true
|
|
||||||
solution: bucket
|
solution: bucket
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
- type: SolutionContainerVisuals
|
- type: SolutionContainerVisuals
|
||||||
@@ -414,7 +413,6 @@
|
|||||||
- key: enum.StorageUiKey.Key
|
- key: enum.StorageUiKey.Key
|
||||||
type: StorageBoundUserInterface
|
type: StorageBoundUserInterface
|
||||||
- type: Drink
|
- type: Drink
|
||||||
isOpen: true
|
|
||||||
solution: bucket
|
solution: bucket
|
||||||
- type: ContainerContainer
|
- type: ContainerContainer
|
||||||
containers:
|
containers:
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
- key: enum.TransferAmountUiKey.Key
|
- key: enum.TransferAmountUiKey.Key
|
||||||
type: TransferAmountBoundUserInterface
|
type: TransferAmountBoundUserInterface
|
||||||
- type: Drink
|
- type: Drink
|
||||||
isOpen: true
|
|
||||||
solution: beaker
|
solution: beaker
|
||||||
- type: Spillable
|
- type: Spillable
|
||||||
solution: beaker
|
solution: beaker
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
maxFillLevels: 6
|
maxFillLevels: 6
|
||||||
fillBaseName: bottle-1-
|
fillBaseName: bottle-1-
|
||||||
- type: Drink
|
- type: Drink
|
||||||
isOpen: true
|
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
drink: # This solution name and target volume is hard-coded in ChemMasterComponent
|
drink: # This solution name and target volume is hard-coded in ChemMasterComponent
|
||||||
|
|||||||
@@ -45,7 +45,6 @@
|
|||||||
- key: enum.TransferAmountUiKey.Key
|
- key: enum.TransferAmountUiKey.Key
|
||||||
type: TransferAmountBoundUserInterface
|
type: TransferAmountBoundUserInterface
|
||||||
- type: Drink
|
- type: Drink
|
||||||
isOpen: true
|
|
||||||
solution: beaker
|
solution: beaker
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
- type: SolutionContainerVisuals
|
- type: SolutionContainerVisuals
|
||||||
@@ -136,7 +135,6 @@
|
|||||||
- key: enum.TransferAmountUiKey.Key
|
- key: enum.TransferAmountUiKey.Key
|
||||||
type: TransferAmountBoundUserInterface
|
type: TransferAmountBoundUserInterface
|
||||||
- type: Drink
|
- type: Drink
|
||||||
isOpen: true
|
|
||||||
solution: beaker
|
solution: beaker
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
- type: SolutionContainerVisuals
|
- type: SolutionContainerVisuals
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
description: It's a boring old bucket.
|
description: It's a boring old bucket.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
isOpen: true
|
|
||||||
solution: bucket
|
solution: bucket
|
||||||
|
ignoreEmpty: true
|
||||||
- type: Clickable
|
- type: Clickable
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Tools/bucket.rsi
|
sprite: Objects/Tools/bucket.rsi
|
||||||
|
|||||||
Reference in New Issue
Block a user