Exemple #1
0
    override public void SetBasement(SurfaceBlock b, PixelPosByte pos)
    {
        if (b == null)
        {
            return;
        }
        SetBuildingData(b, pos);
        basement.ReplaceMaterial(ResourceType.CONCRETE_ID);
        colony = GameMaster.colonyController;
        colony.AddDock(this);
        if (!subscribedToUpdate)
        {
            GameMaster.realMaster.labourUpdateEvent += LabourUpdate;
            subscribedToUpdate = true;
        }
        if (!subscribedToChunkUpdate)
        {
            basement.myChunk.ChunkUpdateEvent += ChunkUpdated;
            subscribedToChunkUpdate            = true;
        }
        dependentBlocksList = new List <Block>();
        // #checkPositionCorrectness
        switch (modelRotation)
        {
        case 0: correctLocation = basement.myChunk.BlockShipCorridorIfPossible(basement.pos.z + 1, basement.pos.y - 1, false, SMALL_SHIPS_PATH_WIDTH, this, ref dependentBlocksList); break;

        case 2: correctLocation = basement.myChunk.BlockShipCorridorIfPossible(basement.pos.x + 1, basement.pos.y - 1, true, SMALL_SHIPS_PATH_WIDTH, this, ref dependentBlocksList); break;

        case 4: correctLocation = basement.myChunk.BlockShipCorridorIfPossible(basement.pos.z - 2, basement.pos.y - 1, false, SMALL_SHIPS_PATH_WIDTH, this, ref dependentBlocksList); break;

        case 6: correctLocation = basement.myChunk.BlockShipCorridorIfPossible(basement.pos.x - 2, basement.pos.y - 1, true, SMALL_SHIPS_PATH_WIDTH, this, ref dependentBlocksList); break;
        }
        // end
        if (correctLocation)
        {
            shipArrivingTimer = SHIP_ARRIVING_TIME * GameMaster.tradeVesselsTrafficCoefficient * (1 - (colony.docksLevel * 2 / 100f)) / 2f;
        }
    }