Put items inside cakes! (#31015)

* First commit

* I'm silly

* Please be it

* Some more fixes

* Cleanup

* fine!

* removed = false

* review

---------

Co-authored-by: Milon <milonpl.git@proton.me>
This commit is contained in:
beck-thompson
2025-04-23 20:00:50 -07:00
committed by GitHub
parent 7fded8c8c5
commit 186cef25ca
10 changed files with 60 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
using Content.Shared.Construction.EntitySystems;
using Content.Shared.Damage;
using Content.Shared.Destructible;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
@@ -6,6 +7,7 @@ using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Item;
using Content.Shared.Materials;
using Content.Shared.Nutrition;
using Content.Shared.Popups;
using Content.Shared.Storage.Components;
using Content.Shared.Tools.EntitySystems;
@@ -30,6 +32,7 @@ public sealed class SecretStashSystem : EntitySystem
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly ToolOpenableSystem _toolOpenableSystem = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
public override void Initialize()
{
@@ -38,6 +41,7 @@ public sealed class SecretStashSystem : EntitySystem
SubscribeLocalEvent<SecretStashComponent, DestructionEventArgs>(OnDestroyed);
SubscribeLocalEvent<SecretStashComponent, GotReclaimedEvent>(OnReclaimed);
SubscribeLocalEvent<SecretStashComponent, InteractUsingEvent>(OnInteractUsing, after: new[] { typeof(ToolOpenableSystem), typeof(AnchorableSystem) });
SubscribeLocalEvent<SecretStashComponent, AfterFullyEatenEvent>(OnEaten);
SubscribeLocalEvent<SecretStashComponent, InteractHandEvent>(OnInteractHand);
SubscribeLocalEvent<SecretStashComponent, GetVerbsEvent<InteractionVerb>>(OnGetVerb);
}
@@ -57,6 +61,14 @@ public sealed class SecretStashSystem : EntitySystem
DropContentsAndAlert(entity, args.ReclaimerCoordinates);
}
private void OnEaten(Entity<SecretStashComponent> entity, ref AfterFullyEatenEvent args)
{
// TODO: When newmed is finished should do damage to teeth (Or something like that!)
var damage = entity.Comp.DamageEatenItemInside;
if (HasItemInside(entity) && damage != null)
_damageableSystem.TryChangeDamage(args.User, damage, true);
}
private void OnInteractUsing(Entity<SecretStashComponent> entity, ref InteractUsingEvent args)
{
if (args.Handled || !IsStashOpen(entity))