Fix bug with ActivelyMicrowavedComponent being stuck in powercuts (#23997)
This commit is contained in:
@@ -110,11 +110,6 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
|
|
||||||
SetAppearance(ent.Owner, MicrowaveVisualState.Idle, microwaveComponent);
|
SetAppearance(ent.Owner, MicrowaveVisualState.Idle, microwaveComponent);
|
||||||
microwaveComponent.PlayingStream = _audio.Stop(microwaveComponent.PlayingStream);
|
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)
|
private void OnEntityUnpaused(Entity<ActiveMicrowaveComponent> ent, ref EntityUnpausedEvent args)
|
||||||
@@ -332,7 +327,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
{
|
{
|
||||||
ent.Comp.Broken = true;
|
ent.Comp.Broken = true;
|
||||||
SetAppearance(ent, MicrowaveVisualState.Broken, ent.Comp);
|
SetAppearance(ent, MicrowaveVisualState.Broken, ent.Comp);
|
||||||
RemComp<ActiveMicrowaveComponent>(ent);
|
StopCooking(ent);
|
||||||
_container.EmptyContainer(ent.Comp.Storage);
|
_container.EmptyContainer(ent.Comp.Storage);
|
||||||
UpdateUserInterfaceState(ent, ent.Comp);
|
UpdateUserInterfaceState(ent, ent.Comp);
|
||||||
}
|
}
|
||||||
@@ -342,7 +337,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
if (!args.Powered)
|
if (!args.Powered)
|
||||||
{
|
{
|
||||||
SetAppearance(ent, MicrowaveVisualState.Idle, ent.Comp);
|
SetAppearance(ent, MicrowaveVisualState.Idle, ent.Comp);
|
||||||
RemComp<ActiveMicrowaveComponent>(ent);
|
StopCooking(ent);
|
||||||
}
|
}
|
||||||
UpdateUserInterfaceState(ent, ent.Comp);
|
UpdateUserInterfaceState(ent, ent.Comp);
|
||||||
}
|
}
|
||||||
@@ -502,6 +497,15 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
UpdateUserInterfaceState(uid, component);
|
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)
|
public static (FoodRecipePrototype, int) CanSatisfyRecipe(MicrowaveComponent component, FoodRecipePrototype recipe, Dictionary<string, int> solids, Dictionary<string, FixedPoint2> reagents)
|
||||||
{
|
{
|
||||||
var portions = 0;
|
var portions = 0;
|
||||||
@@ -565,11 +569,6 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
//this means the microwave has finished cooking.
|
//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
|
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)
|
if (active.PortionedRecipe.Item1 != null)
|
||||||
{
|
{
|
||||||
var coords = Transform(uid).Coordinates;
|
var coords = Transform(uid).Coordinates;
|
||||||
@@ -582,8 +581,8 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
|
|
||||||
_container.EmptyContainer(microwave.Storage);
|
_container.EmptyContainer(microwave.Storage);
|
||||||
UpdateUserInterfaceState(uid, microwave);
|
UpdateUserInterfaceState(uid, microwave);
|
||||||
EntityManager.RemoveComponentDeferred<ActiveMicrowaveComponent>(uid);
|
|
||||||
_audio.PlayPvs(microwave.FoodDoneSound, uid);
|
_audio.PlayPvs(microwave.FoodDoneSound, uid);
|
||||||
|
StopCooking((uid, microwave));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user