private bool checkSpace() { this.angle = base.player.look.yaw; if (((ItemStructureAsset)base.player.equipment.asset).construct == EConstruct.FLOOR || ((ItemStructureAsset)base.player.equipment.asset).construct == EConstruct.FLOOR_POLY) { Physics.SphereCast(base.player.look.aim.position, 0.1f, base.player.look.aim.forward, ref this.hit, ((ItemStructureAsset)base.player.equipment.asset).range, RayMasks.STRUCTURE_INTERACT); if (this.hit.transform != null) { if (this.hit.transform.CompareTag("Structure")) { ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, ushort.Parse(this.hit.transform.name)); if (itemStructureAsset == null || (itemStructureAsset.construct != EConstruct.FLOOR && itemStructureAsset.construct != EConstruct.FLOOR_POLY)) { this.point = this.hit.point; if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.ROOF); } return(false); } float num = float.MaxValue; Transform transform = null; for (int i = 0; i < 4; i++) { Transform transform2 = this.hit.transform.FindChild("Side_" + i); if (transform2 == null) { break; } float sqrMagnitude = (this.hit.point - transform2.position).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; transform = transform2; } } if (!(transform != null)) { this.point = this.hit.point; if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.BLOCKED); } return(false); } this.angle = transform.transform.rotation.eulerAngles.y; this.point = transform.transform.position + transform.transform.forward * StructureManager.WALL; Vector3 vector = this.point; if (((ItemStructureAsset)base.player.equipment.asset).construct == EConstruct.FLOOR_POLY) { vector -= transform.transform.forward; } if (Physics.OverlapSphereNonAlloc(vector, 1f, UseableStructure.checkColliders, RayMasks.BLOCK_STRUCTURE) > 0) { if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.BLOCKED); } return(false); } } else { this.point = this.hit.point; if (!this.hit.transform.CompareTag("Ground") || this.hit.normal.y <= 0.5f) { if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.GROUND); } return(false); } if (!Level.checkSafe(this.point)) { PlayerUI.hint(null, EPlayerMessage.BOUNDS); return(false); } if (Physics.OverlapSphereNonAlloc(this.point, 1f, UseableStructure.checkColliders, RayMasks.BLOCK_STRUCTURE) > 0) { if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.BLOCKED); } return(false); } } return(true); } this.point = Vector3.zero; return(false); } else if (((ItemStructureAsset)base.player.equipment.asset).construct == EConstruct.WALL || ((ItemStructureAsset)base.player.equipment.asset).construct == EConstruct.RAMPART) { Physics.SphereCast(base.player.look.aim.position, 0.1f, base.player.look.aim.forward, ref this.hit, ((ItemStructureAsset)base.player.equipment.asset).range, RayMasks.WALLS_INTERACT); if (!(this.hit.transform != null)) { this.point = Vector3.zero; if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.WALL); } return(false); } if (!this.hit.transform.CompareTag("Logic") || this.hit.transform.name.IndexOf("Wall") <= -1) { this.point = Vector3.zero; if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.WALL); } return(false); } this.point = this.hit.transform.position; this.angle = this.hit.transform.rotation.eulerAngles.y; if (((ItemStructureAsset)base.player.equipment.asset).construct == EConstruct.RAMPART) { this.point += Vector3.down * 1.225f; } if (this.checkOverlap(Physics.OverlapSphereNonAlloc(this.hit.transform.position, 0.33f, UseableStructure.checkColliders, RayMasks.BLOCK_STRUCTURE))) { if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.BLOCKED); } return(false); } if (this.checkOverlap(Physics.OverlapSphereNonAlloc(this.hit.transform.position + Vector3.up * 1.5f, 0.33f, UseableStructure.checkColliders, RayMasks.BLOCK_STRUCTURE))) { if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.BLOCKED); } return(false); } if (this.checkOverlap(Physics.OverlapSphereNonAlloc(this.hit.transform.position - Vector3.up * 1.5f, 0.33f, UseableStructure.checkColliders, RayMasks.BLOCK_STRUCTURE))) { if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.BLOCKED); } return(false); } if (Physics.OverlapSphereNonAlloc(this.point - this.hit.transform.up * StructureManager.WALL, 0.01f, UseableStructure.checkColliders, RayMasks.STRUCTURE) == 0) { if (base.channel.isOwner) { PlayerUI.hint(null, (((ItemStructureAsset)base.player.equipment.asset).construct != EConstruct.RAMPART) ? EPlayerMessage.PILLAR : EPlayerMessage.POST); } return(false); } if (Physics.OverlapSphereNonAlloc(this.point + this.hit.transform.up * StructureManager.WALL, 0.01f, UseableStructure.checkColliders, RayMasks.STRUCTURE) == 0) { if (base.channel.isOwner) { PlayerUI.hint(null, (((ItemStructureAsset)base.player.equipment.asset).construct != EConstruct.RAMPART) ? EPlayerMessage.PILLAR : EPlayerMessage.POST); } return(false); } return(true); } else if (((ItemStructureAsset)base.player.equipment.asset).construct == EConstruct.ROOF || ((ItemStructureAsset)base.player.equipment.asset).construct == EConstruct.ROOF_POLY) { Physics.SphereCast(base.player.look.aim.position, 0.1f, base.player.look.aim.forward, ref this.hit, ((ItemStructureAsset)base.player.equipment.asset).range, RayMasks.ROOFS_INTERACT); if (this.hit.transform != null) { if (this.hit.transform.CompareTag("Logic") && this.hit.transform.name.IndexOf("Roof") > -1) { this.point = this.hit.transform.position; this.angle = this.hit.transform.rotation.eulerAngles.y; for (int j = 0; j < 4; j++) { Transform transform3 = this.hit.transform.parent.FindChild("Pillar_" + j); if (transform3 == null) { break; } if (Physics.OverlapSphereNonAlloc(transform3.position, 0.01f, UseableStructure.checkColliders, RayMasks.STRUCTURE) == 0) { if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.PILLAR); } return(false); } } Vector3 vector2 = this.point; if (((ItemStructureAsset)base.player.equipment.asset).construct == EConstruct.ROOF_POLY) { vector2 += this.hit.transform.up; } if (Physics.OverlapSphereNonAlloc(vector2, 1f, UseableStructure.checkColliders, RayMasks.BLOCK_STRUCTURE) > 0) { if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.BLOCKED); } return(false); } if (((ItemStructureAsset)base.player.equipment.asset).construct == EConstruct.ROOF && Physics.OverlapSphereNonAlloc(vector2 + this.hit.transform.right * StructureManager.WALL * 0.5f, 0.33f, UseableStructure.checkColliders, RayMasks.BLOCK_STRUCTURE) > 0) { if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.BLOCKED); } return(false); } if (Physics.OverlapSphereNonAlloc(vector2 + Vector3.down * 2f, 0.33f, UseableStructure.checkColliders, RayMasks.BLOCK_STRUCTURE) > 0) { if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.BLOCKED); } return(false); } } else { if (!this.hit.transform.CompareTag("Structure")) { this.point = Vector3.zero; if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.ROOF); } return(false); } ItemStructureAsset itemStructureAsset2 = (ItemStructureAsset)Assets.find(EAssetType.ITEM, ushort.Parse(this.hit.transform.name)); if (itemStructureAsset2 == null || (itemStructureAsset2.construct != EConstruct.FLOOR && itemStructureAsset2.construct != EConstruct.ROOF && itemStructureAsset2.construct != EConstruct.FLOOR_POLY && itemStructureAsset2.construct != EConstruct.ROOF_POLY)) { this.point = Vector3.zero; if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.ROOF); } return(false); } float num2 = float.MaxValue; Transform transform4 = null; Vector3 vector3 = Vector3.zero; for (int k = 0; k < 4; k++) { Transform transform5 = this.hit.transform.FindChild("Side_" + k); if (transform5 == null) { break; } float sqrMagnitude2 = (this.hit.point - transform5.position).sqrMagnitude; if (sqrMagnitude2 < num2) { num2 = sqrMagnitude2; transform4 = transform5; } } if (transform4 != null) { this.angle = transform4.transform.rotation.eulerAngles.y; this.point = transform4.transform.position + transform4.transform.forward * StructureManager.WALL; vector3 = this.point; if (((ItemStructureAsset)base.player.equipment.asset).construct == EConstruct.ROOF_POLY) { vector3 -= transform4.transform.forward; } } else { this.point = Vector3.zero; if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.ROOF); } } if (Physics.OverlapSphereNonAlloc(vector3, 1f, UseableStructure.checkColliders, RayMasks.BLOCK_STRUCTURE) > 0) { if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.BLOCKED); } return(false); } if (((ItemStructureAsset)base.player.equipment.asset).construct == EConstruct.ROOF && Physics.OverlapSphereNonAlloc(vector3 + this.hit.transform.right * StructureManager.WALL * 0.5f, 0.33f, UseableStructure.checkColliders, RayMasks.BLOCK_STRUCTURE) > 0) { if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.BLOCKED); } return(false); } if (Physics.OverlapSphereNonAlloc(vector3 + Vector3.down * 2f, 0.33f, UseableStructure.checkColliders, RayMasks.BLOCK_STRUCTURE) > 0) { if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.BLOCKED); } return(false); } } return(true); } this.point = Vector3.zero; return(false); } else { if (((ItemStructureAsset)base.player.equipment.asset).construct != EConstruct.PILLAR && ((ItemStructureAsset)base.player.equipment.asset).construct != EConstruct.POST) { this.point = Vector3.zero; return(false); } Physics.SphereCast(base.player.look.aim.position, 0.1f, base.player.look.aim.forward, ref this.hit, ((ItemStructureAsset)base.player.equipment.asset).range, RayMasks.CORNERS_INTERACT); if (!(this.hit.transform != null)) { this.point = Vector3.zero; return(false); } if (!this.hit.transform.CompareTag("Logic") || this.hit.transform.name.IndexOf("Pillar") <= -1) { this.point = Vector3.zero; if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.CORNER); } return(false); } this.point = this.hit.transform.position; this.angle = this.hit.transform.rotation.eulerAngles.y; if (((ItemStructureAsset)base.player.equipment.asset).construct == EConstruct.POST) { this.point += Vector3.down * 1.225f; } if (this.checkOverlap(Physics.OverlapSphereNonAlloc(this.point, 0.01f, UseableStructure.checkColliders, RayMasks.BLOCK_STRUCTURE))) { if (base.channel.isOwner) { PlayerUI.hint(null, EPlayerMessage.BLOCKED); } return(false); } return(true); } }