diff --git a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs index c7e1824c40..9c3d023966 100644 --- a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs @@ -61,6 +61,7 @@ namespace Content.Server.Kitchen.EntitySystems SubscribeLocalEvent(OnInteractUsing, after: new[] { typeof(AnchorableSystem) }); SubscribeLocalEvent(OnBreak); SubscribeLocalEvent(OnPowerChanged); + SubscribeLocalEvent(OnAnchorChanged); SubscribeLocalEvent(OnSuicide); SubscribeLocalEvent(OnRefreshParts); SubscribeLocalEvent(OnUpgradeExamine); @@ -279,11 +280,16 @@ namespace Content.Server.Kitchen.EntitySystems { SetAppearance(ent, MicrowaveVisualState.Idle, ent.Comp); RemComp(ent); - _sharedContainer.EmptyContainer(ent.Comp.Storage); } UpdateUserInterfaceState(ent, ent.Comp); } + private void OnAnchorChanged(EntityUid uid, MicrowaveComponent component, ref AnchorStateChangedEvent args) + { + if(!args.Anchored) + _sharedContainer.EmptyContainer(component.Storage); + } + private void OnRefreshParts(Entity ent, ref RefreshPartsEvent args) { var cookRating = args.PartRatings[ent.Comp.MachinePartCookTimeMultiplier]; @@ -342,7 +348,7 @@ namespace Content.Server.Kitchen.EntitySystems /// public void Wzhzhzh(EntityUid uid, MicrowaveComponent component, EntityUid? user) { - if (!HasContents(component) || HasComp(uid)) + if (!HasContents(component) || HasComp(uid) || !(TryComp(uid, out var apc) && apc.Powered)) return; var solidsDict = new Dictionary();