From af76a4a76b2fe54521b90d3de7db5aa76f3c0d85 Mon Sep 17 00:00:00 2001 From: Repo <47093363+Titian3@users.noreply.github.com> Date: Thu, 21 Dec 2023 23:23:01 +1300 Subject: [PATCH] Prevent mice from spilling containers. (#22812) Added component on mouse prototype to prevent spill verb from being added --- .../Fluids/Components/PreventSpillerComponent.cs | 7 +++++++ .../Fluids/EntitySystems/PuddleSystem.Spillable.cs | 5 +++++ Resources/Prototypes/Entities/Mobs/NPCs/animals.yml | 1 + 3 files changed, 13 insertions(+) create mode 100644 Content.Server/Fluids/Components/PreventSpillerComponent.cs diff --git a/Content.Server/Fluids/Components/PreventSpillerComponent.cs b/Content.Server/Fluids/Components/PreventSpillerComponent.cs new file mode 100644 index 0000000000..37096f1bb3 --- /dev/null +++ b/Content.Server/Fluids/Components/PreventSpillerComponent.cs @@ -0,0 +1,7 @@ +namespace Content.Server.Fluids.Components; + +[RegisterComponent] +public sealed partial class PreventSpillerComponent : Component +{ + +} diff --git a/Content.Server/Fluids/EntitySystems/PuddleSystem.Spillable.cs b/Content.Server/Fluids/EntitySystems/PuddleSystem.Spillable.cs index 78bdfc6d06..e1681d8731 100644 --- a/Content.Server/Fluids/EntitySystems/PuddleSystem.Spillable.cs +++ b/Content.Server/Fluids/EntitySystems/PuddleSystem.Spillable.cs @@ -26,6 +26,7 @@ namespace Content.Server.Fluids.EntitySystems; public sealed partial class PuddleSystem { [Dependency] private readonly OpenableSystem _openable = default!; + [Dependency] private readonly IEntityManager _entityManager = default!; private void InitializeSpillable() { @@ -184,6 +185,10 @@ public sealed partial class PuddleSystem if (solution.Volume == FixedPoint2.Zero) return; + if (_entityManager.HasComponent(args.User)) + return; + + Verb verb = new() { Text = Loc.GetString("spill-target-verb-get-data-text") diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index 60663785a6..c4f3fccd51 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -1290,6 +1290,7 @@ needsHands: true - type: BadFood - type: NonSpreaderZombie + - type: PreventSpiller - type: entity parent: MobMouse