Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private string CheckTargetLocation(BasePlayer player, Vector3 targetLocation, bool build, bool owner)
- {
- BuildingBlock buildingBlock1 = (BuildingBlock)null;
- BuildingPrivlidge cup = (BuildingPrivlidge)null;
- var entities = Pool.GetList<BuildingBlock>();
- Vis.Entities(targetLocation, 0.1f, entities, blockLayer);
- var cups = false;
- for (int index = 0; index < entities.Count; ++index)
- {
- BuildingBlock buildingBlock2 = entities[index];
- if (buildingBlock2.IsOlderThan((BaseEntity)buildingBlock1))
- {
- BuildingManager.Building building = buildingBlock2.GetBuilding();
- if (building != null)
- {
- BuildingPrivlidge buildingPrivilege = building.GetDominatingBuildingPrivilege();
- if (!((UnityEngine.Object)buildingPrivilege == (UnityEngine.Object)null))
- {
- buildingBlock1 = buildingBlock2;
- cup = buildingPrivilege;
- }
- }
- }
- }
- if (cup == null)
- {
- return null;
- }
- cups = true;
- if (owner)
- {
- var returnhook = BuildingOwners?.Call("FindBlockData", buildingBlock1);
- if (returnhook is string)
- {
- string ownerid = (string) returnhook;
- if (player.userID.ToString() == ownerid)
- {
- Pool.FreeList(ref entities);
- return null;
- }
- var returnHasFriend = Clans?.CallHook("HasFriend", Convert.ToUInt64(ownerid), player.userID);
- if (returnHasFriend != null && (bool)returnHasFriend)
- {
- Pool.FreeList(ref entities);
- return null;
- }
- }
- if (returnhook is bool || returnhook == null)
- {
- if (player.userID == cup.OwnerID)
- {
- Pool.FreeList(ref entities);
- return null;
- }
- var hasFriend = Clans?.CallHook("HasFriend", cup.OwnerID, player.userID);
- if (hasFriend != null && (bool)hasFriend)
- {
- Pool.FreeList(ref entities);
- return null;
- }
- }
- }
- if (cup.IsAuthed(player))
- {
- Pool.FreeList(ref entities);
- return null;
- }
- Pool.FreeList(ref entities);
- return cups && !build ? "TPIntoBuildingBlocked" : null;
- }
Advertisement
Add Comment
Please, Sign In to add comment