// Token: 0x06003D64 RID: 15716 RVA: 0x000DBA80 File Offset: 0x000D9C80 protected internal virtual void OnOwnedByMasterStructure(global::StructureMaster master) { this._master = master; global::NGCView component = base.GetComponent <global::NGCView>(); if (component && !this.addedDestroyCallback && component) { this.addedDestroyCallback = true; component.OnPreDestroy += this.cl_predestroy; } }
protected void SMSet(uLink.NetworkViewID masterViewID) { Facepunch.NetworkView networkView = Facepunch.NetworkView.Find(masterViewID); if (networkView) { global::StructureMaster component = networkView.GetComponent <global::StructureMaster>(); if (component) { component.AppendStructureComponent(this); } else { Debug.LogWarning("No Master On GO", networkView); } } else { Debug.LogWarning("Couldnt find master view", this); } }
// Token: 0x06003D66 RID: 15718 RVA: 0x000DBB30 File Offset: 0x000D9D30 public virtual bool CheckLocation(global::StructureMaster master, Vector3 placePos, Quaternion placeRot) { bool flag = false; bool flag2 = false; Vector3 vector = master.transform.InverseTransformPoint(placePos); if (master.GetMaterialType() != global::StructureMaster.StructureMaterialType.UNSET && master.GetMaterialType() != this.GetMaterialType()) { if (global::StructureComponent.logFailures) { Debug.Log("Not proper material type, master is :" + master.GetMaterialType()); } return(false); } global::StructureComponent componentFromPositionWorld = master.GetComponentFromPositionWorld(placePos); if (componentFromPositionWorld != null) { if (global::StructureComponent.logFailures) { Debug.Log("Occupied space", componentFromPositionWorld); } flag = true; } global::StructureComponent structureComponent = master.CompByLocal(vector - new Vector3(0f, global::StructureMaster.gridSpacingY, 0f)); if (this.type != global::StructureComponent.StructureComponentType.Foundation) { bool foundationForPoint = master.GetFoundationForPoint(placePos); if (foundationForPoint) { flag2 = true; } } if (this.type == global::StructureComponent.StructureComponentType.Wall || this.type == global::StructureComponent.StructureComponentType.Doorway || this.type == global::StructureComponent.StructureComponentType.WindowWall) { if (flag) { return(false); } Vector3 vector2 = placePos + placeRot * -Vector3.right * 2.5f; global::StructureComponent componentFromPositionWorld2 = master.GetComponentFromPositionWorld(vector2); Vector3 vector3 = placePos + placeRot * Vector3.right * 2.5f; global::StructureComponent componentFromPositionWorld3 = master.GetComponentFromPositionWorld(vector3); if (global::StructureComponent.logFailures) { Debug.DrawLine(vector2, vector3, Color.cyan); } if (componentFromPositionWorld2 && componentFromPositionWorld3) { bool flag3; if (componentFromPositionWorld2.type != global::StructureComponent.StructureComponentType.Pillar) { if (global::StructureComponent.logFailures) { Debug.Log("Left was not acceptable", componentFromPositionWorld2); } flag3 = false; } else { flag3 = true; } bool flag4; if (componentFromPositionWorld3.type != global::StructureComponent.StructureComponentType.Pillar) { if (global::StructureComponent.logFailures) { Debug.Log("Right was not acceptable", componentFromPositionWorld3); } flag4 = false; } else { flag4 = true; } return(flag3 && flag4); } if (global::StructureComponent.logFailures) { if (!componentFromPositionWorld2) { Debug.Log("Did not find left"); } if (!componentFromPositionWorld3) { Debug.Log("Did not find right"); } } return(false); } else { if (this.type == global::StructureComponent.StructureComponentType.Foundation) { foreach (global::StructureMaster structureMaster in global::StructureMaster.AllStructuresWithBounds) { if (!(structureMaster == master)) { if (structureMaster.containedBounds.Intersects(new Bounds(placePos, new Vector3(5f, 5f, 4f)))) { if (global::StructureComponent.logFailures) { Debug.Log("Too close to something"); } return(false); } } } bool flag5 = master.IsValidFoundationSpot(placePos); if (global::StructureComponent.logFailures) { Debug.Log(string.Concat(new object[] { "returning here : mastervalid:", flag5, "compinplace", componentFromPositionWorld })); } return(flag5 && !componentFromPositionWorld); } if (this.type == global::StructureComponent.StructureComponentType.Ramp) { return(componentFromPositionWorld == null && (master.IsValidFoundationSpot(placePos) || (structureComponent && (structureComponent.type == global::StructureComponent.StructureComponentType.Ceiling || structureComponent.type == global::StructureComponent.StructureComponentType.Foundation)))); } if (this.type == global::StructureComponent.StructureComponentType.Pillar) { return(((structureComponent && structureComponent.type == global::StructureComponent.StructureComponentType.Pillar) || flag2) && !flag); } if (this.type != global::StructureComponent.StructureComponentType.Stairs && this.type != global::StructureComponent.StructureComponentType.Ceiling) { return(false); } if (flag) { return(false); } Vector3[] array = new Vector3[] { new Vector3(-2.5f, 0f, -2.5f), new Vector3(2.5f, 0f, 2.5f), new Vector3(-2.5f, 0f, 2.5f), new Vector3(2.5f, 0f, -2.5f) }; foreach (Vector3 vector4 in array) { global::StructureComponent structureComponent2 = master.CompByLocal(vector + vector4); if (structureComponent2 == null || structureComponent2.type != global::StructureComponent.StructureComponentType.Pillar) { return(false); } } return(true); } }
// Token: 0x06003D7F RID: 15743 RVA: 0x000DC410 File Offset: 0x000DA610 public static global::StructureMaster[] RayTestStructures(Ray ray, float maxDistance) { List <global::StructureMaster> list = null; bool flag = false; List <KeyValuePair <global::StructureMaster, float> > list2 = new List <KeyValuePair <global::StructureMaster, float> >(); foreach (global::StructureMaster structureMaster in global::StructureMaster.AllStructuresWithBounds) { if (!structureMaster) { if (!flag) { flag = true; list = new List <global::StructureMaster>(); } list.Add(structureMaster); } else { float num = 0f; Bounds bounds2; bool bounds; try { bounds = structureMaster.GetBounds(out bounds2); } catch (Exception ex) { if (!flag) { flag = true; list = new List <global::StructureMaster>(); } list.Add(structureMaster); Debug.LogException(ex, structureMaster); continue; } if (bounds && bounds2.IntersectRay(ray, ref num) && num <= maxDistance) { list2.Add(new KeyValuePair <global::StructureMaster, float>(structureMaster, num)); } } } if (flag) { foreach (global::StructureMaster item in list) { global::StructureMaster.g_Structures.Remove(item); global::StructureMaster.g_StructuresWithBounds.Remove(item); } } if (list2.Count == 0) { return(global::StructureMaster.Empty.array); } list2.Sort((KeyValuePair <global::StructureMaster, float> x, KeyValuePair <global::StructureMaster, float> y) => x.Value.CompareTo(y.Value)); global::StructureMaster[] array = new global::StructureMaster[list2.Count]; int num2 = 0; foreach (KeyValuePair <global::StructureMaster, float> keyValuePair in list2) { array[num2++] = keyValuePair.Key; } return(array); }