Skip to content

Commit

Permalink
Cherry-picked commit 0d0edbb from space-wizards/space-station-14/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Slava0135 authored and SimpleStation14 committed Apr 21, 2024
1 parent 3bf08c7 commit bf627a6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Explosion.Components;
using Content.Server.Explosion.EntitySystems;
using Content.Server.Fluids.EntitySystems;
using Content.Server.Nutrition.Components;
using Content.Server.Popups;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Explosion.Components;
using Content.Shared.Interaction;
using Content.Shared.Nutrition;
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.Rejuvenate;
Expand All @@ -32,7 +31,10 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<CreamPieComponent, InteractUsingEvent>(OnInteractUsing);
// activate BEFORE entity is deleted and trash is spawned
SubscribeLocalEvent<CreamPieComponent, ConsumeDoAfterEvent>(OnConsume, before: [typeof(FoodSystem)]);
SubscribeLocalEvent<CreamPieComponent, SliceFoodEvent>(OnSlice);

SubscribeLocalEvent<CreamPiedComponent, RejuvenateEvent>(OnRejuvenate);
}

Expand All @@ -56,7 +58,12 @@ protected override void SplattedCreamPie(EntityUid uid, CreamPieComponent creamP
EntityManager.QueueDeleteEntity(uid);
}

private void OnInteractUsing(Entity<CreamPieComponent> entity, ref InteractUsingEvent args)
private void OnConsume(Entity<CreamPieComponent> entity, ref ConsumeDoAfterEvent args)
{
ActivatePayload(entity);
}

private void OnSlice(Entity<CreamPieComponent> entity, ref SliceFoodEvent args)
{
ActivatePayload(entity);
}
Expand Down
3 changes: 3 additions & 0 deletions Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Server.Nutrition; // DeltaV
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Nutrition.Components;
using Content.Shared.Nutrition;
using Content.Shared.Nutrition.Components;
using Content.Shared.Chemistry.Components;
using Content.Shared.Examine;
Expand Down Expand Up @@ -67,6 +68,8 @@ private bool TrySliceFood(EntityUid uid, EntityUid user, EntityUid usedItem,
FillSlice(sliceUid, lostSolution);

_audio.PlayPvs(component.Sound, transform.Coordinates, AudioParams.Default.WithVolume(-2));
var ev = new SliceFoodEvent();

Check failure on line 71 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

There is no argument given that corresponds to the required parameter 'user' of 'SliceFoodEvent.SliceFoodEvent(EntityUid, EntityUid, EntityUid)'

Check failure on line 71 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

There is no argument given that corresponds to the required parameter 'user' of 'SliceFoodEvent.SliceFoodEvent(EntityUid, EntityUid, EntityUid)'

Check failure on line 71 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

There is no argument given that corresponds to the required parameter 'user' of 'SliceFoodEvent.SliceFoodEvent(EntityUid, EntityUid, EntityUid)'

Check failure on line 71 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

There is no argument given that corresponds to the required parameter 'user' of 'SliceFoodEvent.SliceFoodEvent(EntityUid, EntityUid, EntityUid)'

Check failure on line 71 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

There is no argument given that corresponds to the required parameter 'user' of 'SliceFoodEvent.SliceFoodEvent(EntityUid, EntityUid, EntityUid)'

Check failure on line 71 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

There is no argument given that corresponds to the required parameter 'user' of 'SliceFoodEvent.SliceFoodEvent(EntityUid, EntityUid, EntityUid)'

Check failure on line 71 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

There is no argument given that corresponds to the required parameter 'user' of 'SliceFoodEvent.SliceFoodEvent(EntityUid, EntityUid, EntityUid)'

Check failure on line 71 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

There is no argument given that corresponds to the required parameter 'user' of 'SliceFoodEvent.SliceFoodEvent(EntityUid, EntityUid, EntityUid)'
RaiseLocalEvent(uid, ref ev);

Check failure on line 72 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

Tried to raise a value event 'Content.Server.Nutrition.SliceFoodEvent' by-ref

Check failure on line 72 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

Tried to raise a value event 'Content.Server.Nutrition.SliceFoodEvent' by-ref

Check failure on line 72 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Tried to raise a value event 'Content.Server.Nutrition.SliceFoodEvent' by-ref

Check failure on line 72 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Tried to raise a value event 'Content.Server.Nutrition.SliceFoodEvent' by-ref

Check failure on line 72 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

Tried to raise a value event 'Content.Server.Nutrition.SliceFoodEvent' by-ref

Check failure on line 72 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

Tried to raise a value event 'Content.Server.Nutrition.SliceFoodEvent' by-ref

Check failure on line 72 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Tried to raise a value event 'Content.Server.Nutrition.SliceFoodEvent' by-ref

Check failure on line 72 in Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Tried to raise a value event 'Content.Server.Nutrition.SliceFoodEvent' by-ref

// Decrease size of item based on count - Could implement in the future
// Bug with this currently is the size in a container is not updated
Expand Down
6 changes: 6 additions & 0 deletions Content.Shared/Nutrition/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,9 @@ public VapeDoAfterEvent(Solution solution, bool forced)

public override DoAfterEvent Clone() => this;
}

/// <summary>
/// Raised before food is sliced
/// </summary>
[ByRefEvent]
public record struct SliceFoodEvent();
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@
path: /Audio/Weapons/Guns/Empty/empty.ogg
ejectSound:
path: /Audio/Weapons/Guns/Empty/empty.ogg
swap: false
disableEject: true
- type: Tag
tags:
- Fruit
Expand Down

0 comments on commit bf627a6

Please sign in to comment.