override public void Annihilate(StructureAnnihilationOrder order)
 {
     if (destroyed)
     {
         return;
     }
     else
     {
         destroyed = true;
     }
     PrepareWorkbuildingForDestruction(order);
     if (subscribedToUpdate)
     {
         GameMaster.realMaster.labourUpdateEvent -= LabourUpdate;
         subscribedToUpdate = false;
     }
     if (current == this)
     {
         current = null;
         if (order.doSpecialChecks)
         {
             var observer = colony.observer;
             if (observer != null && observer.activeFastButtons.Contains(ID))
             {
                 observer.RemoveFastButton(this);
             }
         }
     }
     Destroy(gameObject);
 }
示例#2
0
    override public void Annihilate(StructureAnnihilationOrder order)
    {
        if (destroyed)
        {
            return;
        }
        else
        {
            destroyed = true;
        }
        bool     initiateCheckRequest = true;
        ChunkPos cpos = ChunkPos.zer0;

        if (basement != null & order.doSpecialChecks)
        {
            cpos = basement.pos;
        }
        else
        {
            initiateCheckRequest = false;
        }
        PrepareBuildingForDestruction(order);
        if (initiateCheckRequest & order.doSpecialChecks)
        {
            AddonCheckRequest(cpos);
        }

        Destroy(gameObject);
    }
示例#3
0
 override public void Annihilate(StructureAnnihilationOrder order)
 {
     if (destroyed)
     {
         return;
     }
     else
     {
         destroyed = true;
     }
     if (!order.sendMessageToBasement)
     {
         basement = null;
     }
     PrepareWorkbuildingForDestruction(order);
     if (order.doSpecialChecks && (basement != null & order.sendMessageToBasement) && basement.materialID == ResourceType.FERTILE_SOIL_ID)
     {
         basement.ChangeMaterial(ResourceType.DIRT_ID, true);
     }
     if (subscribedToUpdate)
     {
         GameMaster.realMaster.labourUpdateEvent -= LabourUpdate;
         subscribedToUpdate = false;
     }
     Destroy(gameObject);
 }
示例#4
0
 override public void Annihilate(StructureAnnihilationOrder order)
 {
     if (destroyed)
     {
         return;
     }
     else
     {
         destroyed = true;
     }
     if (order.doSpecialChecks && recruitingCentersList.Contains(this))
     {
         recruitingCentersList.Remove(this);
     }
     PrepareWorkbuildingForDestruction(order);
     if (subscribedToUpdate)
     {
         GameMaster.realMaster.labourUpdateEvent -= LabourUpdate;
         subscribedToUpdate = false;
     }
     if (recruitingCentersList.Count == 0 & rcenterObserver != null)
     {
         Destroy(rcenterObserver);
     }
     Destroy(gameObject);
 }
 override public void Annihilate(StructureAnnihilationOrder order)
 {
     if (destroyed)
     {
         return;
     }
     else
     {
         destroyed = true;
     }
     if (!order.sendMessageToBasement)
     {
         basement = null;
     }
     PrepareBuildingForDestruction(order);
     if (order.doSpecialChecks)
     {
         if (transmittersList.Contains(this))
         {
             transmittersList.Remove(this);
         }
         if (transmissionID != NO_TRANSMISSION_VALUE)
         {
             Expedition.ChangeTransmissionStatus(transmissionID, null);
         }
     }
     Destroy(gameObject);
 }
    public StructureAnnihilationOrder ChangeMessageSending(bool x)
    {
        var c = new StructureAnnihilationOrder(this);

        c.sendMessageToBasement = x;
        return(c);
    }
示例#7
0
    override public void Annihilate(StructureAnnihilationOrder order)
    {
        if (destroyed)
        {
            return;
        }
        else
        {
            destroyed = true;
        }
        PrepareBuildingForDestruction(order);
        var rm = GameMaster.realMaster;

        if (order.doSpecialChecks)
        {
            rm.colonyController.DeleteHousing(this);
            if (basement != null)
            {
                var bpos = basement.pos;
                basement.myChunk.GetBlock(bpos.OneBlockHigher())?.DropBlockerLink(this);
                basement.myChunk.GetBlock(bpos.TwoBlocksHigher())?.DropBlockerLink(this);
            }
        }
        if (subscribedToRestoreBlockersUpdate)
        {
            GameMaster.realMaster.blockersRestoreEvent -= RestoreBlockers;
            subscribedToRestoreBlockersUpdate           = false;
        }
        Destroy(gameObject);
    }
 protected void PrepareBuildingForDestruction(StructureAnnihilationOrder order)
 {
     if (order.doSpecialChecks && connectedToPowerGrid)
     {
         GameMaster.realMaster.colonyController.DisconnectFromPowerGrid(this);
     }
     PrepareStructureForDestruction(order);
 }
    public override void Annihilate(StructureAnnihilationOrder order)
    {
        if (order.doSpecialChecks && blockersList != null && basement != null)
        {
            var chunk = basement.myChunk;
            chunk.ClearBlockersList(this, blockersList, true);
            var   cpos = basement.pos;
            Plane p;
            void CheckAndUnblock(in ChunkPos position)
            {
                Block bx = chunk.GetBlock(position);

                if (bx != null && bx.TryGetPlane(Block.UP_FACE_INDEX, out p))
                {
                    p.UnblockFromStructure(this);
                }
            }

            ChunkPos cpos2 = new ChunkPos(cpos.x - 1, cpos.y, cpos.z + 1); if (cpos2.isOkay)
            {
                CheckAndUnblock(cpos2);
            }
            cpos2 = new ChunkPos(cpos.x, cpos.y, cpos.z + 1); if (cpos2.isOkay)
            {
                CheckAndUnblock(cpos2);
            }
            cpos2 = new ChunkPos(cpos.x + 1, cpos.y, cpos.z + 1); if (cpos2.isOkay)
            {
                CheckAndUnblock(cpos2);
            }
            cpos2 = new ChunkPos(cpos.x - 1, cpos.y, cpos.z); if (cpos2.isOkay)
            {
                CheckAndUnblock(cpos2);
            }
            cpos2 = new ChunkPos(cpos.x + 1, cpos.y, cpos.z); if (cpos2.isOkay)
            {
                CheckAndUnblock(cpos2);
            }
            cpos2 = new ChunkPos(cpos.x - 1, cpos.y, cpos.z - 1); if (cpos2.isOkay)
            {
                CheckAndUnblock(cpos2);
            }
            cpos2 = new ChunkPos(cpos.x, cpos.y, cpos.z - 1); if (cpos2.isOkay)
            {
                CheckAndUnblock(cpos2);
            }
            cpos2 = new ChunkPos(cpos.x + 1, cpos.y, cpos.z - 1); if (cpos2.isOkay)
            {
                CheckAndUnblock(cpos2);
            }
        }
        base.Annihilate(order);
    }
示例#10
0
 override public void Annihilate(StructureAnnihilationOrder order)
 {
     if (destroyed)
     {
         return;
     }
     else
     {
         destroyed = true;
     }
     PrepareBuildingForDestruction(order);
     Destroy(gameObject);
 }
示例#11
0
    public static void Annihilate(IPlanable obj, StructureAnnihilationOrder order)
    {
        var bo = order.GetOrderForIPlanable();

        if (!obj.HaveBlock())
        {
            obj.Delete(bo);
        }
        else
        {
            var b = obj.GetBlock();
            obj.NullifyBlockLink();
            b.myChunk.DeleteBlock(b.pos, bo);
        }
    }
示例#12
0
    /// <summary>
    /// Do not use directly, use "Set Basement" instead
    /// </summary>
    /// <param name="s">S.</param>
    public void AddStructure(Structure s)
    { // with autoreplacing
        if (s == null)
        {
            return;
        }
        if (s.surfaceRect.x > INNER_RESOLUTION | s.surfaceRect.z > INNER_RESOLUTION)
        {
            return;
        }
        if (structures == null)
        {
            structures = new List <Structure>();
        }
        if (s.surfaceRect.size == 1 && s.surfaceRect.size == 1)
        {
            AddCellStructure(s);
            return;
        }

        if (fulfillStatus != FullfillStatus.Empty)
        {
            SurfaceRect sr = s.surfaceRect;
            int         i  = 0;
            if (sr == SurfaceRect.full)
            {// destroy everything there
                ClearSurface(PlaneAnnihilationOrder.ClearByStructure);
            }
            else
            {
                Structure se;
                while (i < structures.Count)
                {
                    se = structures[i];
                    if (se != null)
                    {
                        if (se.surfaceRect.Intersect(sr))
                        {
                            se.Annihilate(StructureAnnihilationOrder.GetReplacingOrder(se.isArtificial));
                        }
                    }
                    i++;
                }
            }
        }
        SetStructureTransform(s);
        RecalculateSurface();
    }
示例#13
0
 override public void Annihilate(StructureAnnihilationOrder order)
 {
     if (destroyed)
     {
         return;
     }
     else
     {
         destroyed = true;
     }
     PrepareStructureForDestruction(order);
     basement = null;
     if (settlement != null)
     {
         settlement.needRecalculation = true;
     }
     Destroy(gameObject);
 }
示例#14
0
 override public void Annihilate(StructureAnnihilationOrder order)
 {
     if (destroyed)
     {
         return;
     }
     else
     {
         destroyed = true;
     }
     if (lodComponent != null)
     {
         lodComponent.PrepareToDestroy();
         lodComponent = null;
     }
     PrepareStructureForDestruction(order);
     basement = null;
     Destroy(gameObject);
 }
 override public void Annihilate(StructureAnnihilationOrder order)
 {
     if (destroyed)
     {
         return;
     }
     else
     {
         destroyed = true;
     }
     PrepareBuildingForDestruction(order);
     // removed colony.RemoveHousing because of dropping hq field
     if (subscribedToRestoreBlockersEvent)
     {
         GameMaster.realMaster.blockersRestoreEvent -= RestoreBlockers;
         subscribedToRestoreBlockersEvent            = false;
     }
     Destroy(gameObject);
 }
示例#16
0
    override public void Annihilate(StructureAnnihilationOrder order)
    {
        if (destroyed | GameMaster.sceneClearing)
        {
            return;
        }
        else
        {
            destroyed = true;
        }
        bool basementNotNull = basement != null;

        if (subscribedToVisibilityEvent)
        {
            if (basementNotNull)
            {
                basement.visibilityChangedEvent -= this.SetVisibility;
            }
            oaksCount--;
        }
        if (!order.sendMessageToBasement)
        {
            basement        = null;
            basementNotNull = false;
        }
        else
        {
            if (basementNotNull)
            {
                basement.RemoveStructure(this);
                //if (basement.grassland != null) basement.grassland.AddLifepower((int)(lifepower * GameMaster.realMaster.lifepowerLossesPercent));
            }
        }
        if (basementNotNull)
        {
            basement = null;
        }
        ReturnModelToPool();
        Destroy(gameObject);
        UpdatePool();
    }