-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA Signed-off-by: Eris <[email protected]>
- Loading branch information
1 parent
3c0d4a0
commit 34540e5
Showing
1 changed file
with
33 additions
and
1 deletion.
There are no files selected for viewing
34 changes: 33 additions & 1 deletion
34
Content.Shared/Nyanotrasen/Kitchen/SharedDeepfryerSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,37 @@ | ||
namespace Content.Shared.Nyanotrasen.Kitchen; | ||
using Content.Shared.DragDrop; | ||
using Robust.Shared.Physics.Components; | ||
using Robust.Shared.Physics.Events; | ||
using Robust.Shared.Physics.Systems; | ||
using Content.Shared.Nyanotrasen.Kitchen.Components; | ||
using Content.Shared.Item; | ||
using Content.Shared.Body.Components; | ||
|
||
namespace Content.Shared.Nyanotrasen.Kitchen; | ||
|
||
public abstract class SharedDeepfryerSystem : EntitySystem | ||
{ | ||
protected void OnCanDragDropOn(EntityUid uid, SharedDeepFryerComponent component, ref CanDropTargetEvent args) | ||
{ | ||
if (args.Handled) | ||
return; | ||
|
||
args.CanDrop = CanInsert(uid, args.Dragged); | ||
args.Handled = true; | ||
} | ||
|
||
public virtual bool CanInsert(EntityUid uid, EntityUid entity) | ||
{ | ||
if (!Transform(uid).Anchored) | ||
return false; | ||
|
||
var storable = HasComp<ItemComponent>(entity); | ||
if (!storable && !HasComp<BodyComponent>(entity)) | ||
return false; | ||
|
||
if (TryComp<PhysicsComponent>(entity, out var physics) && (physics.CanCollide) || storable) | ||
return true; | ||
else | ||
return false; | ||
|
||
} | ||
} |