SetAppearance(ent.Owner, MicrowaveVisualState.Idle, microwaveComponent);
microwaveComponent.PlayingStream = _audio.Stop(microwaveComponent.PlayingStream);
-
- foreach (var solid in microwaveComponent.Storage.ContainedEntities)
- {
- RemComp<ActivelyMicrowavedComponent>(solid);
- }
}
private void OnEntityUnpaused(Entity<ActiveMicrowaveComponent> ent, ref EntityUnpausedEvent args)
{
ent.Comp.Broken = true;
SetAppearance(ent, MicrowaveVisualState.Broken, ent.Comp);
- RemComp<ActiveMicrowaveComponent>(ent);
+ StopCooking(ent);
_container.EmptyContainer(ent.Comp.Storage);
UpdateUserInterfaceState(ent, ent.Comp);
}
if (!args.Powered)
{
SetAppearance(ent, MicrowaveVisualState.Idle, ent.Comp);
- RemComp<ActiveMicrowaveComponent>(ent);
+ StopCooking(ent);
}
UpdateUserInterfaceState(ent, ent.Comp);
}
UpdateUserInterfaceState(uid, component);
}
+ private void StopCooking(Entity<MicrowaveComponent> ent)
+ {
+ RemCompDeferred<ActiveMicrowaveComponent>(ent);
+ foreach (var solid in ent.Comp.Storage.ContainedEntities)
+ {
+ RemCompDeferred<ActivelyMicrowavedComponent>(solid);
+ }
+ }
+
public static (FoodRecipePrototype, int) CanSatisfyRecipe(MicrowaveComponent component, FoodRecipePrototype recipe, Dictionary<string, int> solids, Dictionary<string, FixedPoint2> reagents)
{
var portions = 0;
//this means the microwave has finished cooking.
AddTemperature(microwave, Math.Max(frameTime + active.CookTimeRemaining, 0)); //Though there's still a little bit more heat to pump out
- foreach (var solid in microwave.Storage.ContainedEntities)
- {
- EntityManager.RemoveComponentDeferred<ActivelyMicrowavedComponent>(solid);
- }
-
if (active.PortionedRecipe.Item1 != null)
{
var coords = Transform(uid).Coordinates;
_container.EmptyContainer(microwave.Storage);
UpdateUserInterfaceState(uid, microwave);
- EntityManager.RemoveComponentDeferred<ActiveMicrowaveComponent>(uid);
_audio.PlayPvs(microwave.FoodDoneSound, uid);
+ StopCooking((uid, microwave));
}
}