public void OnStructureBuild(object o) { bool flag = true; if (this._buildings != null) { Create.BuildingTypes buildingTypes = (Create.BuildingTypes)((int)o); for (int i = 0; i < this._buildings.Length; i++) { BuildingTypeList buildingTypeList = this._buildings[i]; if (!buildingTypeList._done) { for (int j = 0; j < buildingTypeList._types.Length; j++) { if (buildingTypeList._types[j] == buildingTypes) { buildingTypeList._done = true; break; } } if (!buildingTypeList._done) { flag = false; } } } if (flag) { this.SetDone(); this.Clear(); } } else { Debug.LogError("Broken BuildingCondition, likely serializer didn't load it correctly"); } }
private void Build() { if (this._type != Create.BuildingTypes.None) { EventRegistry.Player.Publish(TfEvent.BuiltStructure, this._type); this._type = Create.BuildingTypes.None; } if (BoltNetwork.isClient) { if (base.enabled) { base.enabled = false; this.AllOff(); } return; } if (!this._ghost) { this._ghost = base.transform.parent.gameObject; } GameObject gameObject; if (BoltNetwork.isServer) { if (this.entity.attachToken != null) { if (this.entity.attachToken is CoopWallChunkToken) { (this.entity.attachToken as CoopWallChunkToken).Additions = this.entity.GetComponent<WallChunkArchitect>().Addition; } gameObject = BoltNetwork.Instantiate(this.Built, this.entity.attachToken, this._ghost.transform.position, this._ghost.transform.rotation).gameObject; } else { gameObject = BoltNetwork.Instantiate(this.Built, this.entity.attachToken, this._ghost.transform.position, this._ghost.transform.rotation).gameObject; BoltEntity component = gameObject.GetComponent<BoltEntity>(); if (component && component.isAttached && component.StateIs<IMultiHolderState>()) { component.GetState<IMultiHolderState>().IsReal = true; } BoltEntity component2 = gameObject.GetComponent<BoltEntity>(); if (component2 && component.isAttached && component2.StateIs<IRaftState>()) { component2.GetState<IRaftState>().IsReal = true; } } } else { gameObject = (GameObject)UnityEngine.Object.Instantiate(this.Built, this._ghost.transform.position, this._ghost.transform.rotation); } TreeStructure component3 = this._ghost.GetComponent<TreeStructure>(); if (component3) { TreeStructure treeStructure = gameObject.GetComponent<TreeStructure>(); if (!treeStructure) { treeStructure = gameObject.AddComponent<TreeStructure>(); } treeStructure.TreeId = component3.TreeId; } ropeSetGroundHeight component4 = gameObject.GetComponent<ropeSetGroundHeight>(); if (component4) { gameObject.SendMessage("setGroundTriggerHeight", SendMessageOptions.DontRequireReceiver); } if (this._ghost.transform.parent != null) { gameObject.transform.parent = this._ghost.transform.parent; } this.OnBuilt(gameObject); this.OnBuilt = null; base.enabled = false; this._initialized = false; if (this._ghost) { base.StartCoroutine(this.DelayedDestroy()); } else { this.AllOff(); } if (this._playTwinkle && LocalPlayer.Sfx) { LocalPlayer.Sfx.PlayBuildingComplete(gameObject, true); } }
private void Build() { if (this._type != Create.BuildingTypes.None) { EventRegistry.Player.Publish(TfEvent.BuiltStructure, this._type); this._type = Create.BuildingTypes.None; } if (BoltNetwork.isClient) { if (base.enabled) { base.enabled = false; this.AllOff(); } return; } if (!this._ghost) { this._ghost = base.transform.parent.gameObject; } GameObject gameObject; if (BoltNetwork.isServer) { if (this.entity.attachToken != null) { if (this.entity.attachToken is CoopWallChunkToken) { (this.entity.attachToken as CoopWallChunkToken).Additions = this.entity.GetComponent <WallChunkArchitect>().Addition; } gameObject = BoltNetwork.Instantiate(this.Built, this.entity.attachToken, this._ghost.transform.position, this._ghost.transform.rotation).gameObject; } else { gameObject = BoltNetwork.Instantiate(this.Built, this.entity.attachToken, this._ghost.transform.position, this._ghost.transform.rotation).gameObject; BoltEntity component = gameObject.GetComponent <BoltEntity>(); if (component && component.isAttached && component.StateIs <IMultiHolderState>()) { component.GetState <IMultiHolderState>().IsReal = true; } BoltEntity component2 = gameObject.GetComponent <BoltEntity>(); if (component2 && component.isAttached && component2.StateIs <IRaftState>()) { component2.GetState <IRaftState>().IsReal = true; } } } else { gameObject = (GameObject)UnityEngine.Object.Instantiate(this.Built, this._ghost.transform.position, this._ghost.transform.rotation); } TreeStructure component3 = this._ghost.GetComponent <TreeStructure>(); if (component3) { TreeStructure treeStructure = gameObject.GetComponent <TreeStructure>(); if (!treeStructure) { treeStructure = gameObject.AddComponent <TreeStructure>(); } treeStructure.TreeId = component3.TreeId; } ropeSetGroundHeight component4 = gameObject.GetComponent <ropeSetGroundHeight>(); if (component4) { gameObject.SendMessage("setGroundTriggerHeight", SendMessageOptions.DontRequireReceiver); } if (this._ghost.transform.parent != null) { gameObject.transform.parent = this._ghost.transform.parent; } this.OnBuilt(gameObject); this.OnBuilt = null; base.enabled = false; this._initialized = false; if (this._ghost) { base.StartCoroutine(this.DelayedDestroy()); } else { this.AllOff(); } if (this._playTwinkle && LocalPlayer.Sfx) { LocalPlayer.Sfx.PlayBuildingComplete(gameObject, true); } }