public void CheckDefinitionRelatedConditionsOrThrow(IZone zone, Position spawnPosition, long owner) { //the egg WILL build this pbsNode after activation var pbsNodeEntityDefault = TargetPBSNodeDefault; if (pbsNodeEntityDefault == EntityDefault.None) { Logger.Error("pbsNodeDefinition was not found:" + pbsNodeEntityDefault + " in egg:" + Definition + " " + ED.Name); throw new PerpetuumException(ErrorCodes.ConsistencyError); } if (pbsNodeEntityDefault.CategoryFlags.IsCategory(CategoryFlags.cf_pbs_docking_base)) { //check deploying of bases PBSHelper.ValidatePBSDockingBasePlacement(zone, spawnPosition, owner, pbsNodeEntityDefault).ThrowIfError(); return; } //kiveve amiket lehet kivulre pakolni if (!PBSHelper.IsPlaceableOutsideOfBase(pbsNodeEntityDefault.CategoryFlags)) { //checks for corporation's docking base in range PBSHelper.ValidatePBSNodePlacing(zone, spawnPosition, owner, pbsNodeEntityDefault).ThrowIfError(); } //itt meg lehet mast is megnezni egyelore nem kellett }
private bool IsAnyNodeOutsideOfNetworkRange(IEnumerable <IPBSObject> pbsObjects, PBSDockingBase pbsDockingBase) { foreach (var pbsObject in pbsObjects) { var unit = (Unit)pbsObject; if (PBSHelper.IsPlaceableOutsideOfBase((unit.ED.CategoryFlags))) { continue; } if (!unit.CurrentPosition.IsInRangeOf2D(pbsDockingBase.CurrentPosition, pbsDockingBase.GetNetworkNodeRange())) { return(true); } } return(false); }
public static bool IsPlaceableOutsideOfDockingbaseRange(this Unit unit) { return(PBSHelper.IsPlaceableOutsideOfBase(unit.ED.CategoryFlags)); }