// Token: 0x060033CD RID: 13261 RVA: 0x000C2024 File Offset: 0x000C0224 public void CheckPlacementResults(Ray ray, out Vector3 pos, out Quaternion rot, out global::TransCarrier carrier, out global::DeployableItemDataBlock.DeployPlaceResults results) { float num = this.placeRange; bool flag = false; bool flag2 = false; bool flag3 = false; global::DeployableObject deployableObject = null; bool flag4 = false; bool flag5 = false; bool flag6 = this.minCastRadius >= float.Epsilon; RaycastHit raycastHit; bool flag8; MeshBatchInstance meshBatchInstance; bool flag7 = (!flag6) ? Facepunch.MeshBatch.MeshBatchPhysics.Raycast(ray, ref raycastHit, num, -472317957, ref flag8, ref meshBatchInstance) : Facepunch.MeshBatch.MeshBatchPhysics.SphereCast(ray, this.minCastRadius, ref raycastHit, num, -472317957, ref flag8, ref meshBatchInstance); Vector3 point = ray.GetPoint(num); if (!flag7) { Vector3 vector = point; vector.y += 0.5f; flag4 = Facepunch.MeshBatch.MeshBatchPhysics.Raycast(vector, Vector3.down, ref raycastHit, 5f, -472317957, ref flag8, ref meshBatchInstance); } Vector3 vector2; Vector3 vector3; if (flag7 || flag4) { IDMain idmain = (!flag8) ? IDBase.GetMain(raycastHit.collider) : meshBatchInstance.idMain; flag3 = (idmain is global::StructureComponent || idmain is global::StructureMaster); vector2 = raycastHit.point; vector3 = raycastHit.normal; flag = (!flag3 && (deployableObject = (idmain as global::DeployableObject))); if (this.carrierSphereCastMode != global::DeployableItemDataBlock.CarrierSphereCastMode.Allowed && flag7 && flag6 && !global::DeployableItemDataBlock.NonVariantSphereCast(ray, vector2)) { float num2; Ray ray2; if (this.carrierSphereCastMode == global::DeployableItemDataBlock.CarrierSphereCastMode.AdjustedRay) { Vector3 origin = ray.origin; Vector3 point2 = raycastHit.point; Vector3 vector4 = point2 - origin; num2 = vector4.magnitude + this.minCastRadius * 2f; ray2..ctor(origin, vector4); Debug.DrawLine(ray.origin, ray.GetPoint(num2), Color.cyan); } else { num2 = num + this.minCastRadius; ray2 = ray; } RaycastHit raycastHit2; bool flag10; MeshBatchInstance meshBatchInstance2; bool flag9; if (!(flag9 = Facepunch.MeshBatch.MeshBatchPhysics.Raycast(ray2, ref raycastHit2, num2, -472317957, ref flag10, ref meshBatchInstance2))) { Vector3 vector5 = vector2; vector5.y += 0.5f; flag9 = Facepunch.MeshBatch.MeshBatchPhysics.Raycast(vector5, Vector3.down, ref raycastHit2, 5f, -472317957, ref flag10, ref meshBatchInstance2); } if (flag9) { IDMain idmain2 = (!flag10) ? IDBase.GetMain(raycastHit2.collider) : meshBatchInstance2.idMain; carrier = ((!idmain2) ? raycastHit2.collider.GetComponent <global::TransCarrier>() : idmain2.GetLocal <global::TransCarrier>()); } else { carrier = null; } } else { carrier = ((!idmain) ? raycastHit.collider.gameObject : idmain.gameObject).GetComponent <global::TransCarrier>(); } flag2 = (raycastHit.collider is TerrainCollider || raycastHit.collider.gameObject.layer == 10); flag5 = true; } else { vector2 = point; vector3 = Vector3.up; carrier = null; } bool flag11 = false; global::Hardpoint hardpoint = null; if (this.hardpointType != global::Hardpoint.hardpoint_type.None) { hardpoint = global::Hardpoint.GetHardpointFromRay(ray, this.hardpointType); if (hardpoint) { flag11 = true; vector2 = hardpoint.transform.position; vector3 = hardpoint.transform.up; carrier = hardpoint.GetMaster().GetTransCarrier(); flag5 = true; } } bool flag12 = false; if (this.spacingRadius > 0f) { Collider[] array = Physics.OverlapSphere(vector2, this.spacingRadius); foreach (Collider collider in array) { GameObject gameObject = collider.gameObject; IDBase component = collider.gameObject.GetComponent <IDBase>(); if (component != null) { gameObject = component.idMain.gameObject; } if (gameObject.CompareTag(this.ObjectToPlace.gameObject.tag) && Vector3.Distance(vector2, gameObject.transform.position) < this.spacingRadius) { flag12 = true; break; } } } bool flag13 = false; if (flag && !this.forcePlaceable && deployableObject.cantPlaceOn) { flag13 = true; } pos = vector2; if (this.orientationMode == global::DeployableOrientationMode.Default) { if (this.uprightOnly) { this.orientationMode = global::DeployableOrientationMode.Upright; } else { this.orientationMode = global::DeployableOrientationMode.NormalUp; } } Quaternion quaternion; switch (this.orientationMode) { case global::DeployableOrientationMode.NormalUp: quaternion = global::TransformHelpers.LookRotationForcedUp(ray.direction, vector3); break; case global::DeployableOrientationMode.Upright: quaternion = global::TransformHelpers.LookRotationForcedUp(ray.direction, Vector3.up); break; case global::DeployableOrientationMode.NormalForward: { Vector3 forward = Vector3.Cross(ray.direction, Vector3.up); quaternion = global::TransformHelpers.LookRotationForcedUp(forward, vector3); break; } case global::DeployableOrientationMode.HardpointPosRot: if (flag11) { quaternion = hardpoint.transform.rotation; } else { quaternion = global::TransformHelpers.LookRotationForcedUp(ray.direction, Vector3.up); } break; default: throw new NotImplementedException(); } rot = quaternion * this.ObjectToPlace.transform.localRotation; bool flag14 = false; if (this.checkPlacementZones) { flag14 = global::NoPlacementZone.ValidPos(pos); } float num3 = Vector3.Angle(vector3, Vector3.up); results.falseFromDeployable = ((!this.CanStackOnDeployables && flag) || flag13); results.falseFromTerrian = (this.TerrainOnly && !flag2); results.falseFromClose = (this.spacingRadius > 0f && flag12); results.falseFromHardpoint = (this.requireHardpoint && !flag11); results.falseFromAngle = (!this.requireHardpoint && num3 >= this.ObjectToPlace.maxSlope); results.falseFromPlacementZone = (this.checkPlacementZones && !flag14); results.falseFromHittingNothing = !flag5; results.falseFromStructure = (this.StructureOnly && !flag3); results.falseFromFitRequirements = (this.fitRequirements != null && !this.fitRequirements.Test(pos, (!this.fitTestForcedUp) ? rot : global::TransformHelpers.LookRotationForcedUp(rot, Vector3.up), this.ObjectToPlace.transform.localScale)); }
// Token: 0x06003BE1 RID: 15329 RVA: 0x000D5BC8 File Offset: 0x000D3DC8 public void AddHardpoint(global::Hardpoint point) { this._points.Add(point); }