Prevent inserting into unpowered lathes (#12405)

Entities with MaterialStorageComponent should not accept materials if
they are supposed to be powered, and are not actually powered.

This fixes being able to insert ores into unpowered or unanchored ore
processors, among other issues.
This commit is contained in:
Kevin Zheng 2022-11-08 12:56:53 -08:00 committed by GitHub
parent df1ace61c3
commit d431ea05b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -1,5 +1,6 @@
using Content.Shared.Materials;
using Content.Shared.Popups;
using Content.Server.Power.Components;
using Robust.Shared.Player;
namespace Content.Server.Materials;
@ -16,6 +17,8 @@ public sealed class MaterialStorageSystem : SharedMaterialStorageSystem
{
if (!Resolve(receiver, ref component))
return false;
if (TryComp<ApcPowerReceiverComponent>(receiver, out var power) && !power.Powered)
return false;
if (!base.TryInsertMaterialEntity(user, toInsert, receiver, component))
return false;
_audio.PlayPvs(component.InsertingSound, component.Owner);