public virtual bool CanInsert(SharedDisposalUnitComponent component, EntityUid entity) { if (!EntityManager.GetComponent <TransformComponent>(component.Owner).Anchored) { return(false); } // TODO: Probably just need a disposable tag. if (!EntityManager.TryGetComponent(entity, out SharedItemComponent? storable) && !EntityManager.HasComponent <SharedBodyComponent>(entity)) { return(false); } if (!EntityManager.TryGetComponent(entity, out IPhysBody? physics) || !physics.CanCollide && storable == null) { if (!(EntityManager.TryGetComponent(entity, out MobStateComponent? damageState) && damageState.IsDead())) { return(false); } } return(true); }
private void OnCanDragDropOn(EntityUid uid, SharedDisposalUnitComponent component, CanDragDropOnEvent args) { if (args.Handled) { return; } args.CanDrop = CanInsert(component, args.Dragged); args.Handled = true; }
private void OnPreventCollide(EntityUid uid, SharedDisposalUnitComponent component, PreventCollideEvent args) { var otherBody = args.BodyB.Owner; // Items dropped shouldn't collide but items thrown should if (EntityManager.HasComponent <SharedItemComponent>(otherBody) && !EntityManager.HasComponent <ThrownItemComponent>(otherBody)) { args.Cancel(); return; } if (component.RecentlyEjected.Contains(otherBody)) { args.Cancel(); } }
public bool CanInsert(SharedDisposalUnitComponent component, EntityUid entityId) { var entity = EntityManager.GetEntity(entityId); return(CanInsert(component, entity)); }