From: themias <89101928+themias@users.noreply.github.com> Date: Thu, 4 Jan 2024 00:36:31 +0000 (-0500) Subject: microwave ejection tweak (#23460) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=53f18e8e91a7503bb743549d602c4500fb92641c;p=space-station-14.git microwave ejection tweak (#23460) --- 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();