public static bool isCubeGeoPassable(ushort ID, GeothermalGenerator gen)
 {
     return(ID == eCubeTypes.Magma || ID == eCubeTypes.MagmaFluid || (config.getBoolean(FTConfig.ConfigEntries.GEO_PIPE_PASS) && (ID == eCubeTypes.Magmacite || (CubeHelper.IsOre(ID) && gen.mShaftEndY < -1000))));
 }
예제 #2
0
 public static bool shouldAvoidBlock(ushort ID)
 {
     return(CubeHelper.IsReinforced(ID) || CubeHelper.IsOre(ID));
 }
예제 #3
0
 public static bool IsOre(ItemBase i)
 {
     return(i is ItemCubeStack && CubeHelper.IsOre((i as ItemCubeStack).mCubeType));
 }
예제 #4
0
 public static bool isCubeGeoPassable(ushort ID, GeothermalGenerator gen)
 {
     return(ID == eCubeTypes.Magma || ID == eCubeTypes.MagmaFluid || ID == eCubeTypes.Magmacite || (CubeHelper.IsOre(ID) && gen.mShaftEndY < -1050));
 }
예제 #5
0
    private DigResult AttemptToDig(long checkX, long checkY, long checkZ)
    {
        mnCurrentDigSizeY = digArea.CurrentHeight;
        var segment = mFrustrum != null
            ? AttemptGetSegment(checkX, checkY, checkZ)
            : WorldScript.instance.GetSegment(checkX, checkY, checkZ);

        if (segment == null || !segment.mbInitialGenerationComplete || segment.mbDestroyed)
        {
            mrDigDelay = 1f;
            return(DigResult.Fail);
        }

        ushort cube = segment.GetCube(checkX, checkY, checkZ);

        if (cube == eCubeTypes.CentralPowerHub)
        {
            return(DigResult.Dig);
        }

        if (cube == mReplaceType)
        {
            return(DigResult.Skip);
        }

        if (CubeHelper.IsReinforced(cube) && eExcavateState != ExcavateState.ClearAll)
        {
            return(DigResult.Dig);
        }

        if (CubeHelper.HasEntity((int)cube) && eExcavateState != ExcavateState.ClearAll)
        {
            if (cube != eCubeTypes.AlienPlant && cube != eCubeTypes.ArachnidRock)
            {
                return(DigResult.Dig);
            }
        }

        if (TerrainData.GetHardness(cube, 0) > 500f)
        {
            return(DigResult.Dig);
        }

        if (eExcavateState == ExcavateState.ClearGarbage)
        {
            if (CubeHelper.IsOre(cube))
            {
                return(DigResult.Dig);
            }
        }

        // Tranqs Creative Survival mod really breaks this call as nearly everything in the game is craftable.
        if (CraftingManager.IsCraftable(cube) && cube != eCubeTypes.Giger &&
            eExcavateState != ExcavateState.ClearAll)
        {
            // ore should never ever be craftable
            if (!CubeHelper.IsOre(cube))
            {
                return(DigResult.Dig);
            }
        }

        int num  = (int)(checkX - segment.baseX);
        int num2 = (int)(checkY - segment.baseY);
        int num3 = (int)(checkZ - segment.baseZ);

        if (num == 0 && base.AttemptGetSegment(checkX - 1L, checkY, checkZ) == null)
        {
            return(DigResult.Fail);
        }

        if (num == 15 && base.AttemptGetSegment(checkX + 1L, checkY, checkZ) == null)
        {
            return(DigResult.Fail);
        }

        if (num2 == 0 && base.AttemptGetSegment(checkX, checkY - 1L, checkZ) == null)
        {
            return(DigResult.Fail);
        }

        if (num2 == 15 && base.AttemptGetSegment(checkX, checkY + 1L, checkZ) == null)
        {
            return(DigResult.Fail);
        }

        if (num3 == 0 && base.AttemptGetSegment(checkX, checkY, checkZ - 1L) == null)
        {
            return(DigResult.Fail);
        }

        if (num3 == 15 && base.AttemptGetSegment(checkX, checkY, checkZ + 1L) == null)
        {
            return(DigResult.Fail);
        }

        ushort mValue = segment.GetCubeData(checkX, checkY, checkZ).mValue;

        WorldScript.instance.BuildFromEntity(segment, checkX, checkY, checkZ, this.mReplaceType,
                                             TerrainData.GetDefaultValue(this.mReplaceType));
        this.mrCurrentPower -= this.mrPowerRate;
        this.mbLocatedBlock  = true;
        this.mnBlocksDestroyed++;
        if (segment.mbInLocalFrustrum)
        {
            if (eDropState == DropState.DropSome)
            {
                bool flag = true;
                if (CubeHelper.IsGarbage(cube) && this.mRand.Next(100) > 5)
                {
                    flag = false;
                }

                if (flag)
                {
                    Vector3 velocity = new Vector3((float)this.mRand.NextDouble() - 0.5f, 0f,
                                                   (float)this.mRand.NextDouble() - 0.5f);
                    velocity.x *= 5f;
                    velocity.z *= 5f;
                    ItemManager.DropNewCubeStack(cube, mValue, 1, checkX, checkY, checkZ, velocity);
                }
            }

            if (eDropState == DropState.DropAll)
            {
                Vector3 velocity = new Vector3((float)this.mRand.NextDouble() - 0.5f, 0f,
                                               (float)this.mRand.NextDouble() - 0.5f);
                velocity.x *= 5f;
                velocity.z *= 5f;
                ItemManager.DropNewCubeStack(cube, mValue, 1, checkX, checkY, checkZ, velocity);
            }

            if (eDropState == DropState.DropOre && CubeHelper.IsOre(cube))
            {
                Vector3 velocity = new Vector3((float)this.mRand.NextDouble() - 0.5f, 0f,
                                               (float)this.mRand.NextDouble() - 0.5f);
                velocity.x *= 5f;
                velocity.z *= 5f;
                ItemManager.DropNewCubeStack(cube, mValue, 1, checkX, checkY, checkZ, velocity);
            }

            this.mrTimeSinceShoot = 0f;
        }

        return(DigResult.Dig);
    }