Exemple #1
0
        public CoopConstructionExToken GetCoopConstructionExToken(CoopConstructionEx coopEx, BoltEntity parentEntity)
        {
            CoopConstructionExToken coopConstructionExToken = new CoopConstructionExToken();

            coopConstructionExToken.Architects = new CoopConstructionExToken.ArchitectData[coopEx.Architects.Length];
            for (int i = 0; i < coopEx.Architects.Length; i++)
            {
                coopConstructionExToken.Parent = parentEntity;
                coopConstructionExToken.Architects[i].PointsCount     = (coopEx.Architects[i] as ICoopStructure).MultiPointsCount;
                coopConstructionExToken.Architects[i].PointsPositions = (coopEx.Architects[i] as ICoopStructure).MultiPointsPositions.ToArray();
                coopConstructionExToken.Architects[i].CustomToken     = (coopEx.Architects[i] as ICoopStructure).CustomToken;
                if (coopEx.Architects[i] is FoundationArchitect)
                {
                    coopConstructionExToken.Architects[i].AboveGround = ((FoundationArchitect)coopEx.Architects[i])._aboveGround;
                }
                else if (coopEx.Architects[i] is RoofArchitect)
                {
                    if ((coopEx.Architects[i] as RoofArchitect).CurrentSupport != null)
                    {
                        coopConstructionExToken.Architects[i].Support = ((coopEx.Architects[i] as RoofArchitect).CurrentSupport as MonoBehaviour).GetComponent <BoltEntity>();
                    }
                }
                else if (coopEx.Architects[i] is FloorArchitect && (coopEx.Architects[i] as FloorArchitect).CurrentSupport != null)
                {
                    coopConstructionExToken.Architects[i].Support = ((coopEx.Architects[i] as FloorArchitect).CurrentSupport as MonoBehaviour).GetComponent <BoltEntity>();
                }
            }
            return(coopConstructionExToken);
        }
    public override void Attached()
    {
        CoopConstructionExToken coopConstructionExToken = (CoopConstructionExToken)this.entity.attachToken;

        for (int i = 0; i < coopConstructionExToken.Architects.Length; i++)
        {
            ICoopStructure coopStructure = (ICoopStructure)this.Architects[i];
            coopStructure.CustomToken          = coopConstructionExToken.Architects[i].CustomToken;
            coopStructure.MultiPointsCount     = coopConstructionExToken.Architects[i].PointsCount;
            coopStructure.MultiPointsPositions = coopConstructionExToken.Architects[i].PointsPositions.ToList <Vector3>();
            coopStructure.WasPlaced            = true;
            if (coopStructure is FoundationArchitect && coopConstructionExToken.Architects[i].AboveGround)
            {
                ((FoundationArchitect)coopStructure)._aboveGround = true;
            }
            if (coopConstructionExToken.Architects[i].Support)
            {
                IStructureSupport structureSupport = coopConstructionExToken.Architects[i].Support.GetComponentInChildren(typeof(IStructureSupport)) as IStructureSupport;
                if (structureSupport != null)
                {
                    if (coopStructure is RoofArchitect)
                    {
                        (coopStructure as RoofArchitect).CurrentSupport = structureSupport;
                    }
                    if (coopStructure is FloorArchitect)
                    {
                        (coopStructure as FloorArchitect).CurrentSupport = structureSupport;
                    }
                }
            }
        }
        this.entity.SendMessage("OnDeserialized");
        base.Attached();
    }
Exemple #3
0
        private void OnPlaced()
        {
            base.enabled = false;
            Transform child = this._ghosts[this._currentGhost]._go.transform.GetChild(0);

            if (!BoltNetwork.isRunning)
            {
                if (LocalPlayer.Create.BuildingPlacer.LastHit != null && LocalPlayer.Create.BuildingPlacer.LastHit.Value.transform.GetComponentInParent <BoltEntity>())
                {
                    child.parent = LocalPlayer.Create.BuildingPlacer.LastHit.Value.transform.GetComponentInParent <BoltEntity>().transform;
                }
                else
                {
                    child.parent = null;
                }
                child.SendMessage("OnPlaced", SendMessageOptions.DontRequireReceiver);
                GameObject gameObject = child.Find("Trigger").gameObject;
                gameObject.SetActive(true);
                if (this._ghosts[this._currentGhost]._initialize)
                {
                    gameObject.GetComponent <Craft_Structure>().Initialize();
                }
                UnityEngine.Object.Destroy(base.gameObject);
            }
            else
            {
                CoopConstructionEx component = child.GetComponent <CoopConstructionEx>();
                if (component)
                {
                    BoltEntity component2   = child.GetComponent <BoltEntity>();
                    BoltEntity parentEntity = LocalPlayer.Create.GetParentEntity(child.gameObject);
                    component.SendMessage("OnSerializing");
                    CoopConstructionExToken coopConstructionExToken = LocalPlayer.Create.GetCoopConstructionExToken(component, parentEntity);
                    PlaceFoundationEx       placeFoundationEx       = PlaceFoundationEx.Create(GlobalTargets.OnlyServer);
                    placeFoundationEx.Parent   = parentEntity;
                    placeFoundationEx.Position = child.transform.position;
                    placeFoundationEx.Prefab   = component2.prefabId;
                    placeFoundationEx.Token    = coopConstructionExToken;
                    placeFoundationEx.Send();
                }
                else
                {
                    PlaceConstruction placeConstruction = PlaceConstruction.Create(GlobalTargets.OnlyServer);
                    if (LocalPlayer.Create.BuildingPlacer.LastHit != null)
                    {
                        placeConstruction.Parent = LocalPlayer.Create.BuildingPlacer.LastHit.Value.transform.GetComponentInParent <BoltEntity>();
                    }
                    placeConstruction.PrefabId = child.GetComponent <BoltEntity>().prefabId;
                    placeConstruction.Position = child.position;
                    placeConstruction.Rotation = child.rotation;
                    FoundationArchitect component3 = child.GetComponent <FoundationArchitect>();
                    if (component3)
                    {
                        placeConstruction.AboveGround = component3._aboveGround;
                    }
                    placeConstruction.Send();
                }
                UnityEngine.Object.Destroy(base.gameObject, 0.05f);
            }
        }
Exemple #4
0
        private void OnPlaced()
        {
            base.enabled = false;
            Transform child;

            if (this._inWaterGo.activeSelf)
            {
                child = this._inWaterGo.transform.GetChild(0);
            }
            else
            {
                child = this._outWaterGo.transform.GetChild(0);
            }
            if (!BoltNetwork.isRunning)
            {
                if (LocalPlayer.Create.BuildingPlacer.LastHit != null && LocalPlayer.Create.BuildingPlacer.LastHit.Value.transform.GetComponentInParent <BoltEntity>())
                {
                    child.parent = LocalPlayer.Create.BuildingPlacer.LastHit.Value.transform.GetComponentInParent <BoltEntity>().transform;
                }
                else if (LocalPlayer.Create.ParentEntity)
                {
                    DynamicBuilding component = LocalPlayer.Create.ParentEntity.GetComponent <DynamicBuilding>();
                    child.transform.parent = ((!component || !component._parentOverride) ? LocalPlayer.Create.ParentEntity.transform : component._parentOverride);
                }
                else
                {
                    child.parent = null;
                }
                child.SendMessage("OnPlaced", SendMessageOptions.DontRequireReceiver);
                GameObject gameObject = child.Find("Trigger").gameObject;
                gameObject.SetActive(true);
                if ((this._inWaterGo.activeSelf && this._initializeOutWater) || (this._outWaterGo.activeSelf && this._initializeInWater))
                {
                    gameObject.GetComponent <Craft_Structure>().Initialize();
                }
                UnityEngine.Object.Destroy(base.gameObject);
            }
            else
            {
                CoopConstructionEx component2 = child.GetComponent <CoopConstructionEx>();
                if (component2)
                {
                    BoltEntity component3 = child.GetComponent <BoltEntity>();
                    BoltEntity boltEntity = LocalPlayer.Create.GetParentEntity(child.gameObject) ?? LocalPlayer.Create.ParentEntity;
                    component2.SendMessage("OnSerializing");
                    CoopConstructionExToken coopConstructionExToken = LocalPlayer.Create.GetCoopConstructionExToken(component2, boltEntity);
                    PlaceFoundationEx       placeFoundationEx       = PlaceFoundationEx.Create(GlobalTargets.OnlyServer);
                    placeFoundationEx.Parent   = boltEntity;
                    placeFoundationEx.Position = child.transform.position;
                    placeFoundationEx.Prefab   = component3.prefabId;
                    placeFoundationEx.Token    = coopConstructionExToken;
                    placeFoundationEx.Send();
                }
                else
                {
                    PlaceConstruction placeConstruction = PlaceConstruction.Create(GlobalTargets.OnlyServer);
                    if (LocalPlayer.Create.BuildingPlacer.LastHit != null)
                    {
                        placeConstruction.Parent = LocalPlayer.Create.BuildingPlacer.LastHit.Value.transform.GetComponentInParent <BoltEntity>();
                    }
                    placeConstruction.PrefabId = child.GetComponent <BoltEntity>().prefabId;
                    placeConstruction.Position = child.position;
                    placeConstruction.Rotation = child.rotation;
                    FoundationArchitect component4 = child.GetComponent <FoundationArchitect>();
                    if (component4)
                    {
                        placeConstruction.AboveGround = component4._aboveGround;
                    }
                    placeConstruction.Send();
                }
                UnityEngine.Object.Destroy(base.gameObject, 0.05f);
            }
        }
Exemple #5
0
        private IEnumerator PlaceGhostRoutine(bool chain)
        {
            BuildingTypes bType = this.CurrentBlueprint._type;

            yield return(null);

            if (this.CreateMode)
            {
                this.ShownPlace = false;
                this.CreateMode = false;
                if (!this.ToolsShown)
                {
                    base.SendMessage("BuildToolsTut");
                    this.ToolsShown = true;
                }
                TreeStructure ts = this._currentGhost.GetComponentInChildren <TreeStructure>();
                if (ts && this.TargetTree)
                {
                    if (this.TargetTree.CompareTag("conTree"))
                    {
                        ts.TreeId = this.TargetTree.parent.GetComponent <TreeHealth>().LodTree.GetComponentInChildren <CoopTreeId>().Id;
                    }
                    else
                    {
                        ts.TreeId = this.TargetTree.GetComponent <TreeHealth>().LodTree.GetComponentInChildren <CoopTreeId>().Id;
                    }
                    ts.enabled = true;
                    if (!BoltNetwork.isRunning)
                    {
                        Scene.ActiveMB.StartCoroutine(ts.OnDeserialized());
                    }
                }
                CoopConstructionEx     coopEx            = this._currentGhost.GetComponent <CoopConstructionEx>();
                WallArchitect          wallArch          = this.CurrentGhost.GetComponent <WallArchitect>();
                ICoopTokenConstruction tokenConstruction = this._currentGhost.GetComponent <ICoopTokenConstruction>();
                this.ParentEntity = this.GetParentEntity(this._currentGhost);
                if (BoltNetwork.isRunning && !wallArch)
                {
                    BoltEntity component = this._currentGhost.GetComponent <BoltEntity>();
                    if (tokenConstruction != null)
                    {
                        PlaceFoundationEx placeFoundationEx = PlaceFoundationEx.Create(GlobalTargets.OnlyServer);
                        placeFoundationEx.Position = this._currentGhost.transform.position;
                        placeFoundationEx.Rotation = this._currentGhost.transform.rotation;
                        placeFoundationEx.Prefab   = component.prefabId;
                        placeFoundationEx.Token    = tokenConstruction.CustomToken;
                        placeFoundationEx.Parent   = this.ParentEntity;
                        placeFoundationEx.Send();
                        UnityEngine.Object.Destroy(this._currentGhost);
                    }
                    else if (coopEx)
                    {
                        coopEx.SendMessage("OnSerializing");
                        CoopConstructionExToken coopConstructionExToken = this.GetCoopConstructionExToken(coopEx, this.ParentEntity);
                        PlaceFoundationEx       placeFoundationEx2      = PlaceFoundationEx.Create(GlobalTargets.OnlyServer);
                        placeFoundationEx2.Parent   = this.ParentEntity;
                        placeFoundationEx2.Position = this._currentGhost.transform.position;
                        placeFoundationEx2.Rotation = this._currentGhost.transform.rotation;
                        placeFoundationEx2.Prefab   = component.prefabId;
                        placeFoundationEx2.Token    = coopConstructionExToken;
                        placeFoundationEx2.Send();
                        UnityEngine.Object.Destroy(this._currentGhost);
                    }
                    else if (!this._currentGhost.GetComponent(typeof(IAnchorableStructure)) && component)
                    {
                        this._currentGhost.AddComponent <CoopDestroyPredictedGhost>();
                        this._currentGhost.AddComponent <destroyAfter>().destroyTime = 2f;
                        PlaceConstruction placeConstruction = PlaceConstruction.Create(GlobalTargets.OnlyServer);
                        placeConstruction.Parent   = this.ParentEntity;
                        placeConstruction.PrefabId = component.prefabId;
                        placeConstruction.Position = this._currentGhost.transform.position;
                        placeConstruction.Rotation = this._currentGhost.transform.rotation;
                        if (ts)
                        {
                            placeConstruction.TreeIndex = ts.TreeId;
                        }
                        placeConstruction.Send();
                        this._currentGhost.SendMessage("OnPlacingRemotely", SendMessageOptions.DontRequireReceiver);
                    }
                    else
                    {
                        this._currentGhost.SendMessage("OnPlaced", false, SendMessageOptions.DontRequireReceiver);
                    }
                }
                else
                {
                    this._currentGhost.SendMessage("OnPlaced", false, SendMessageOptions.DontRequireReceiver);
                    this._currentGhost.transform.Find("Trigger").gameObject.SetActive(true);
                    Transform transform = this._currentGhost.transform.Find("LastBuiltLocation");
                    if (transform)
                    {
                        transform.gameObject.SetActive(true);
                    }
                    if (this.ParentEntity)
                    {
                        DynamicBuilding component2 = this.ParentEntity.GetComponent <DynamicBuilding>();
                        this._currentGhost.transform.parent = ((!component2 || !component2._parentOverride) ? this.ParentEntity.transform : component2._parentOverride);
                    }
                }
                this.ClearReferences(!chain);
                LocalPlayer.Sfx.PlayPlaceGhost();
                this.RefreshGrabber();
                yield return(YieldPresets.WaitPointFiveSeconds);

                if (chain)
                {
                    this.MultiPlaceAction(bType);
                }
            }
            yield break;
        }
    public static void AttachBuildingBoltEntity(BoltEntity entity)
    {
        if (!BoltNetwork.isServer)
        {
            return;
        }
        if (!CoopSteamServerStarter.SaveIsLoading)
        {
            return;
        }
        if (!entity)
        {
            return;
        }
        if (entity.IsAttached())
        {
            return;
        }
        BoltEntitySettingsModifier boltEntitySettingsModifier = entity.ModifySettings();
        BridgeArchitect            component  = entity.GetComponent <BridgeArchitect>();
        ZiplineArchitect           component2 = entity.GetComponent <ZiplineArchitect>();
        GardenArchitect            component3 = entity.GetComponent <GardenArchitect>();
        CraneArchitect             component4 = entity.GetComponent <CraneArchitect>();

        if (boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IFireState)
        {
            BoltNetwork.Attach(entity);
        }
        else if (boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IRaftState)
        {
            BoltNetwork.Attach(entity);
            if (entity && entity.isAttached && entity.StateIs <IRaftState>())
            {
                entity.GetState <IRaftState>().IsReal = true;
            }
        }
        else if (boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IMultiHolderState)
        {
            BoltNetwork.Attach(entity);
            if (entity && entity.isAttached && entity.StateIs <IMultiHolderState>())
            {
                entity.GetState <IMultiHolderState>().IsReal = true;
                MultiHolder[] componentsInChildren = entity.GetComponentsInChildren <MultiHolder>(true);
                if (componentsInChildren.Length > 0)
                {
                    componentsInChildren[0]._contentActual     = componentsInChildren[0]._contentAmount;
                    componentsInChildren[0]._contentTypeActual = componentsInChildren[0]._content;
                }
            }
        }
        else if (component)
        {
            BoltNetwork.Attach(entity, component.CustomToken);
        }
        else if (component2)
        {
            BoltNetwork.Attach(entity, component2.CustomToken);
        }
        else if (component3)
        {
            BoltNetwork.Attach(entity, component3.CustomToken);
        }
        else if (component4)
        {
            BoltNetwork.Attach(entity, component4.CustomToken);
        }
        else if (boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IFoundationState || boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IBuildingState || boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IRabbitCage || boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.ITreeBuildingState || boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.ITrapLargeState || boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IBuildingDestructibleState || boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IWallChunkBuildingState)
        {
            CoopBuildingEx     component5 = entity.GetComponent <CoopBuildingEx>();
            WallChunkArchitect component6 = entity.GetComponent <WallChunkArchitect>();
            if (component6)
            {
                BoltNetwork.Attach(entity, component6.CustomToken);
            }
            else if (component5)
            {
                CoopConstructionExToken coopConstructionExToken = new CoopConstructionExToken();
                coopConstructionExToken.Architects = new CoopConstructionExToken.ArchitectData[component5.Architects.Length];
                for (int i = 0; i < component5.Architects.Length; i++)
                {
                    coopConstructionExToken.Architects[i].PointsCount     = (component5.Architects[i] as ICoopStructure).MultiPointsCount;
                    coopConstructionExToken.Architects[i].PointsPositions = (component5.Architects[i] as ICoopStructure).MultiPointsPositions.ToArray();
                    coopConstructionExToken.Architects[i].CustomToken     = (component5.Architects[i] as ICoopStructure).CustomToken;
                    if (component5.Architects[i] is FoundationArchitect)
                    {
                        coopConstructionExToken.Architects[i].AboveGround = ((FoundationArchitect)component5.Architects[i])._aboveGround;
                    }
                    if (component5.Architects[i] is RoofArchitect && (component5.Architects[i] as RoofArchitect).CurrentSupport != null)
                    {
                        coopConstructionExToken.Architects[i].Support = ((component5.Architects[i] as RoofArchitect).CurrentSupport as MonoBehaviour).GetComponent <BoltEntity>();
                    }
                    if (component5.Architects[i] is FloorArchitect && (component5.Architects[i] as FloorArchitect).CurrentSupport != null)
                    {
                        coopConstructionExToken.Architects[i].Support = ((component5.Architects[i] as FloorArchitect).CurrentSupport as MonoBehaviour).GetComponent <BoltEntity>();
                    }
                    CoopSteamServerStarter.AttachBuildingBoltEntity(coopConstructionExToken.Architects[i].Support);
                }
                BoltNetwork.Attach(entity, coopConstructionExToken);
            }
            else
            {
                BoltNetwork.Attach(entity);
            }
        }
        else if (boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IConstructionState || boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IWallChunkConstructionState)
        {
            CoopConstructionEx component7 = entity.GetComponent <CoopConstructionEx>();
            WallChunkArchitect component8 = entity.GetComponent <WallChunkArchitect>();
            if (component8)
            {
                BoltNetwork.Attach(entity, component8.CustomToken);
            }
            else if (component7)
            {
                CoopConstructionExToken coopConstructionExToken2 = new CoopConstructionExToken();
                coopConstructionExToken2.Architects = new CoopConstructionExToken.ArchitectData[component7.Architects.Length];
                for (int j = 0; j < component7.Architects.Length; j++)
                {
                    coopConstructionExToken2.Architects[j].PointsCount     = (component7.Architects[j] as ICoopStructure).MultiPointsCount;
                    coopConstructionExToken2.Architects[j].PointsPositions = (component7.Architects[j] as ICoopStructure).MultiPointsPositions.ToArray();
                    coopConstructionExToken2.Architects[j].CustomToken     = (component7.Architects[j] as ICoopStructure).CustomToken;
                    if (component7.Architects[j] is FoundationArchitect)
                    {
                        coopConstructionExToken2.Architects[j].AboveGround = ((FoundationArchitect)component7.Architects[j])._aboveGround;
                    }
                    if (component7.Architects[j] is RoofArchitect && (component7.Architects[j] as RoofArchitect).CurrentSupport != null)
                    {
                        coopConstructionExToken2.Architects[j].Support = ((component7.Architects[j] as RoofArchitect).CurrentSupport as MonoBehaviour).GetComponent <BoltEntity>();
                    }
                    if (component7.Architects[j] is FloorArchitect && (component7.Architects[j] as FloorArchitect).CurrentSupport != null)
                    {
                        coopConstructionExToken2.Architects[j].Support = ((component7.Architects[j] as FloorArchitect).CurrentSupport as MonoBehaviour).GetComponent <BoltEntity>();
                    }
                    CoopSteamServerStarter.AttachBuildingBoltEntity(coopConstructionExToken2.Architects[j].Support);
                }
                BoltNetwork.Attach(entity, coopConstructionExToken2);
            }
            else
            {
                BoltNetwork.Attach(entity);
            }
        }
    }
 public static void AttachBuildingBoltEntity(BoltEntity entity)
 {
     if (!BoltNetwork.isServer)
     {
         return;
     }
     if (!CoopSteamServerStarter.SaveIsLoading)
     {
         return;
     }
     if (!entity)
     {
         return;
     }
     if (entity.IsAttached())
     {
         return;
     }
     BoltEntitySettingsModifier boltEntitySettingsModifier = entity.ModifySettings();
     BridgeArchitect component = entity.GetComponent<BridgeArchitect>();
     if (boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IFireState)
     {
         BoltNetwork.Attach(entity);
     }
     else if (boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IRaftState)
     {
         BoltNetwork.Attach(entity);
         if (entity && entity.isAttached && entity.StateIs<IRaftState>())
         {
             entity.GetState<IRaftState>().IsReal = true;
         }
     }
     else if (boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IMultiHolderState)
     {
         BoltNetwork.Attach(entity);
         if (entity && entity.isAttached && entity.StateIs<IMultiHolderState>())
         {
             entity.GetState<IMultiHolderState>().IsReal = true;
             MultiHolder[] componentsInChildren = entity.GetComponentsInChildren<MultiHolder>(true);
             if (componentsInChildren.Length > 0)
             {
                 componentsInChildren[0]._contentActual = componentsInChildren[0]._contentAmount;
                 componentsInChildren[0]._contentTypeActual = componentsInChildren[0]._content;
             }
         }
     }
     else if (component)
     {
         BoltNetwork.Attach(entity, component.CustomToken);
     }
     else if (boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IFoundationState || boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IBuildingState || boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IRabbitCage || boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.ITreeBuildingState || boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.ITrapLargeState || boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IBuildingDestructibleState || boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IWallChunkBuildingState)
     {
         CoopBuildingEx component2 = entity.GetComponent<CoopBuildingEx>();
         WallChunkArchitect component3 = entity.GetComponent<WallChunkArchitect>();
         if (component3)
         {
             BoltNetwork.Attach(entity, component3.CustomToken);
         }
         else if (component2)
         {
             CoopConstructionExToken coopConstructionExToken = new CoopConstructionExToken();
             coopConstructionExToken.Architects = new CoopConstructionExToken.ArchitectData[component2.Architects.Length];
             for (int i = 0; i < component2.Architects.Length; i++)
             {
                 coopConstructionExToken.Architects[i].PointsCount = (component2.Architects[i] as ICoopStructure).MultiPointsCount;
                 coopConstructionExToken.Architects[i].PointsPositions = (component2.Architects[i] as ICoopStructure).MultiPointsPositions.ToArray();
                 coopConstructionExToken.Architects[i].CustomToken = (component2.Architects[i] as ICoopStructure).CustomToken;
                 if (component2.Architects[i] is FoundationArchitect)
                 {
                     coopConstructionExToken.Architects[i].AboveGround = ((FoundationArchitect)component2.Architects[i])._aboveGround;
                 }
                 if (component2.Architects[i] is RoofArchitect && (component2.Architects[i] as RoofArchitect).CurrentSupport != null)
                 {
                     coopConstructionExToken.Architects[i].Support = ((component2.Architects[i] as RoofArchitect).CurrentSupport as MonoBehaviour).GetComponent<BoltEntity>();
                 }
                 if (component2.Architects[i] is FloorArchitect && (component2.Architects[i] as FloorArchitect).CurrentSupport != null)
                 {
                     coopConstructionExToken.Architects[i].Support = ((component2.Architects[i] as FloorArchitect).CurrentSupport as MonoBehaviour).GetComponent<BoltEntity>();
                 }
                 CoopSteamServerStarter.AttachBuildingBoltEntity(coopConstructionExToken.Architects[i].Support);
             }
             BoltNetwork.Attach(entity, coopConstructionExToken);
         }
         else
         {
             BoltNetwork.Attach(entity);
         }
     }
     else if (boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IConstructionState || boltEntitySettingsModifier.serializerId == StateSerializerTypeIds.IWallChunkConstructionState)
     {
         CoopConstructionEx component4 = entity.GetComponent<CoopConstructionEx>();
         WallChunkArchitect component5 = entity.GetComponent<WallChunkArchitect>();
         if (component5)
         {
             BoltNetwork.Attach(entity, component5.CustomToken);
         }
         else if (component4)
         {
             CoopConstructionExToken coopConstructionExToken2 = new CoopConstructionExToken();
             coopConstructionExToken2.Architects = new CoopConstructionExToken.ArchitectData[component4.Architects.Length];
             for (int j = 0; j < component4.Architects.Length; j++)
             {
                 coopConstructionExToken2.Architects[j].PointsCount = (component4.Architects[j] as ICoopStructure).MultiPointsCount;
                 coopConstructionExToken2.Architects[j].PointsPositions = (component4.Architects[j] as ICoopStructure).MultiPointsPositions.ToArray();
                 coopConstructionExToken2.Architects[j].CustomToken = (component4.Architects[j] as ICoopStructure).CustomToken;
                 if (component4.Architects[j] is FoundationArchitect)
                 {
                     coopConstructionExToken2.Architects[j].AboveGround = ((FoundationArchitect)component4.Architects[j])._aboveGround;
                 }
                 if (component4.Architects[j] is RoofArchitect && (component4.Architects[j] as RoofArchitect).CurrentSupport != null)
                 {
                     coopConstructionExToken2.Architects[j].Support = ((component4.Architects[j] as RoofArchitect).CurrentSupport as MonoBehaviour).GetComponent<BoltEntity>();
                 }
                 if (component4.Architects[j] is FloorArchitect && (component4.Architects[j] as FloorArchitect).CurrentSupport != null)
                 {
                     coopConstructionExToken2.Architects[j].Support = ((component4.Architects[j] as FloorArchitect).CurrentSupport as MonoBehaviour).GetComponent<BoltEntity>();
                 }
                 CoopSteamServerStarter.AttachBuildingBoltEntity(coopConstructionExToken2.Architects[j].Support);
             }
             BoltNetwork.Attach(entity, coopConstructionExToken2);
         }
         else
         {
             BoltNetwork.Attach(entity);
         }
     }
 }