Prevent Quantum Spin Inverter from Teleporting Things into Microwaves (#29200)
* Prevent Quantum Spin Inverter from Teleporting Things into Microwaves * Simplifies code, GetTeleportingEntity instead of TryGet, adds failed teleport message * remove using Linguini.Syntax.Ast; * capital... * re-add CanInsert and Fixes microwave issue * beb * beeb
This commit is contained in:
@@ -79,6 +79,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
SubscribeLocalEvent<MicrowaveComponent, EntInsertedIntoContainerMessage>(OnContentUpdate);
|
||||
SubscribeLocalEvent<MicrowaveComponent, EntRemovedFromContainerMessage>(OnContentUpdate);
|
||||
SubscribeLocalEvent<MicrowaveComponent, InteractUsingEvent>(OnInteractUsing, after: new[] { typeof(AnchorableSystem) });
|
||||
SubscribeLocalEvent<MicrowaveComponent, ContainerIsInsertingAttemptEvent>(OnInsertAttempt);
|
||||
SubscribeLocalEvent<MicrowaveComponent, BreakageEventArgs>(OnBreak);
|
||||
SubscribeLocalEvent<MicrowaveComponent, PowerChangedEvent>(OnPowerChanged);
|
||||
SubscribeLocalEvent<MicrowaveComponent, AnchorStateChangedEvent>(OnAnchorChanged);
|
||||
@@ -309,6 +310,32 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
UpdateUserInterfaceState(uid, component);
|
||||
}
|
||||
|
||||
private void OnInsertAttempt(Entity<MicrowaveComponent> ent, ref ContainerIsInsertingAttemptEvent args)
|
||||
{
|
||||
if (ent.Comp.Broken)
|
||||
{
|
||||
args.Cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (TryComp<ItemComponent>(args.EntityUid, out var item))
|
||||
{
|
||||
if (_item.GetSizePrototype(item.Size) > _item.GetSizePrototype(ent.Comp.MaxItemSize))
|
||||
{
|
||||
args.Cancel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
args.Cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ent.Comp.Storage.Count >= ent.Comp.Capacity)
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
private void OnInteractUsing(Entity<MicrowaveComponent> ent, ref InteractUsingEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
|
||||
Reference in New Issue
Block a user