private bool CanDestroy(SharedSingularityComponent component, EntityUid entity) { return(entity == component.Owner || EntityManager.HasComponent <IMapGridComponent>(entity) || EntityManager.HasComponent <GhostComponent>(entity) || EntityManager.HasComponent <ContainmentFieldComponent>(entity) || EntityManager.HasComponent <ContainmentFieldGeneratorComponent>(entity)); }
private bool CanDestroy(SharedSingularityComponent component, IEntity entity) { return(entity == component.Owner || entity.HasComponent <IMapGridComponent>() || entity.HasComponent <GhostComponent>() || entity.HasComponent <ContainmentFieldComponent>() || entity.HasComponent <ContainmentFieldGeneratorComponent>()); }
private bool CanDestroy(SharedSingularityComponent component, EntityUid entity) { return(entity != component.Owner && !EntityManager.HasComponent <IMapGridComponent>(entity) && !EntityManager.HasComponent <GhostComponent>(entity) && (component.Level > 4 || !EntityManager.HasComponent <ContainmentFieldComponent>(entity) && !(EntityManager.TryGetComponent <ContainmentFieldGeneratorComponent>(entity, out var containFieldGen) && _fieldGeneratorSystem.CanRepel(component, containFieldGen)))); }
protected override bool PreventCollide(EntityUid uid, SharedSingularityComponent component, PreventCollideEvent args) { if (base.PreventCollide(uid, component, args)) { return(true); } var otherUid = args.BodyB.Owner; if (args.Cancelled) { return(true); } // If it's not cancelled then we'll cancel if we can't immediately destroy it on collision if (!CanDestroy(component, otherUid)) { args.Cancel(); } return(true); }
public bool CanRepel(SharedSingularityComponent toRepel, ContainmentFieldGeneratorComponent component) => component.Connection1?.Item2?.CanRepel(toRepel) == true || component.Connection2?.Item2?.CanRepel(toRepel) == true;