Skip to content

Commit

Permalink
Adjustments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian16199 committed Sep 27, 2023
1 parent e856c41 commit 2d1b319
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 9 deletions.
74 changes: 74 additions & 0 deletions Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ internal sealed class SliceableFoodSystem : EntitySystem
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!; // this line belongs to deep fryer nyano.

public override void Initialize()
{
Expand Down Expand Up @@ -57,6 +58,11 @@ private bool TrySliceFood(EntityUid uid, EntityUid user, EntityUid usedItem,
return false;
}

var attemptEvent = new SliceFoodAttemptEvent(user, usedItem, uid); //Start of Nyano deepfyer.
RaiseLocalEvent(uid, attemptEvent);
if (attemptEvent.Cancelled)
return false; //End of Nyano Deepfryer.

var sliceUid = Spawn(component.Slice, transform.Coordinates);

var lostSolution = _solutionContainerSystem.SplitSolution(uid, solution,
Expand All @@ -77,6 +83,8 @@ private bool TrySliceFood(EntityUid uid, EntityUid user, EntityUid usedItem,
xform.LocalRotation = 0;
}

_audioSystem.PlayPvs(component.Sound, uid, AudioParams.Default.WithVolume(-2f)); //Nyano deepfryer.

SoundSystem.Play(component.Sound.GetSound(), Filter.Pvs(uid),
transform.Coordinates, AudioParams.Default.WithVolume(-2));

Expand All @@ -88,6 +96,9 @@ private bool TrySliceFood(EntityUid uid, EntityUid user, EntityUid usedItem,
// }

component.Count--;

var sliceEvent = new SliceFoodEvent(user, usedItem, uid, sliceUid); //Start of Nyano deep fryer.
RaiseLocalEvent(uid, sliceEvent); //End of Nyano deep fryer

// If someone makes food proto with 1 slice...
if (component.Count < 1)
Expand Down Expand Up @@ -116,6 +127,9 @@ private bool TrySliceFood(EntityUid uid, EntityUid user, EntityUid usedItem,
xform.LocalRotation = 0;
}

var sliceSplitEvent = new SliceFoodEvent(user, usedItem, uid, sliceUid); //Start of Nyano deep fryer.
RaiseLocalEvent(uid, sliceSplitEvent); //End of Nyano deep fryer

DeleteFood(uid, user);
return true;
}
Expand Down Expand Up @@ -159,4 +173,64 @@ private void OnExamined(EntityUid uid, SliceableFoodComponent component, Examine
args.PushMarkup(Loc.GetString("sliceable-food-component-on-examine-remaining-slices-text", ("remainingCount", component.Count)));
}
}

public sealed class SliceFoodAttemptEvent : CancellableEntityEventArgs //Start of Nyano Deep fryer
{
/// <summary>
/// Who's doing the slicing?
/// <summary>
public EntityUid User;

/// <summary>
/// What's doing the slicing?
/// <summary>
public EntityUid Tool;

/// <summary>
/// What's being sliced?
/// <summary>
public EntityUid Food;

public SliceFoodAttemptEvent(EntityUid user, EntityUid tool, EntityUid food)
{
User = user;
Tool = tool;
Food = food;
}
}

public sealed class SliceFoodEvent : EntityEventArgs
{
/// <summary>
/// Who did the slicing?
/// <summary>
public EntityUid User;

/// <summary>
/// What did the slicing?
/// <summary>
public EntityUid Tool;

/// <summary>
/// What has been sliced?
/// <summary>
/// <remarks>
/// This could soon be deleted if there was not enough food left to
/// continue slicing.
/// </remarks>
public EntityUid Food;

/// <summary>
/// What is the slice?
/// <summary>
public EntityUid Slice;

public SliceFoodEvent(EntityUid user, EntityUid tool, EntityUid food, EntityUid slice)
{
User = user;
Tool = tool;
Food = food;
Slice = slice;
}
} //End of Nyano Deep fryer.
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
using Content.Server.Kitchen.EntitySystems;
using Content.Server.Nutrition;
using Content.Shared.Nutrition; // Changed from Server to Shared.
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Construction.Prototypes;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
reagent-physical-desc-enigmatic = enigmatic
reagent-physical-desc-porous = porous
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,15 @@
components:
- type: Sprite
state: butter
- type: SolutionContainerManager
solutions:
food:
maxVol: 15
reagents:
- ReagentId: Butter
Quantity: 15
- type: Extractable
grindableSolutionName: food

- type: entity
name: stick of cannabis butter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
drink:
maxVol: 100
reagents:
- ReagentId: OilCorn
- ReagentId: Cornoil # Changed from OilCorn to fit wizden code.
Quantity: 100

- type: entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
Steel: 4
Glass: 2
Cable: 4
- type: ReverseEngineering
recipes:
- DeepFryerMachineCircuitboard
# type: ReverseEngineering
# recipes:
# DeepFryerMachineCircuitboard
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
- terrible
solution: vat_oil
fryingOils:
- OilCorn
- Cornoil # changed from OilCorn to Cornoil to fit wizden code.
- OilGhee
- OilOlive
unsafeOilVolumeEffects:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@
effects:
- !type:AdjustReagent
reagent: Nutriment
amount: 0.75
amount: 0.75
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
impact: Medium
minTemp: 373.15
reactants:
OilCorn:
Cornoil: # Changed to Cornoil from OilCorn to fit wizden code.
amount: 1
Water:
amount: 1
Expand Down
4 changes: 4 additions & 0 deletions Resources/Prototypes/Roles/Jobs/Civilian/chef.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
extendedAccess:
- Hydroponics
- Bar
special: # Start of Nyano Deep fryer
- !type:AddComponentSpecial
components:
- type: ProfessionalChef # End of Nyano Deep fryer

- type: startingGear
id: ChefGear
Expand Down

0 comments on commit 2d1b319

Please sign in to comment.