Ejemplo n.º 1
0
        public void UpdateIsTop(int value, int x, int y, int z)
        {
            Terrain terrain = base.SubsystemTerrain.Terrain;

            if (y < 255)
            {
                TerrainChunk chunkAtCell = terrain.GetChunkAtCell(x, z);
                if (chunkAtCell != null)
                {
                    int  num      = TerrainChunk.CalculateCellIndex(x & 0xF, y, z & 0xF);
                    int  contents = Terrain.ExtractContents(chunkAtCell.GetCellValueFast(num + 1));
                    int  data     = Terrain.ExtractData(value);
                    bool isTop    = !m_fluidBlock.IsTheSameFluid(contents);
                    chunkAtCell.SetCellValueFast(num, Terrain.ReplaceData(value, FluidBlock.SetIsTop(data, isTop)));
                }
            }
        }
Ejemplo n.º 2
0
 public override BlockPlacementData GetDigValue(SubsystemTerrain subsystemTerrain, ComponentMiner componentMiner, int value, int toolValue, TerrainRaycastResult raycastResult)
 {
     return(new BlockPlacementData
     {
         Value = (Terrain.ExtractData(value) & 65536) != 0 ? Terrain.ReplaceData(MagmaBlock.Index
                                                                                 , FluidBlock.SetIsTop(FluidBlock.SetLevel(0, 4), toolValue == MagmaBucketBlock.Index)) : 0,
         CellFace = raycastResult.CellFace
     });
 }
 public void UpdateFluidIsTop(TerrainChunk chunk)
 {
     _ = m_subsystemTerrain.Terrain;
     for (int i = 0; i < 16; i++)
     {
         for (int j = 0; j < 16; j++)
         {
             int num  = TerrainChunk.CalculateCellIndex(i, 255, j);
             int num2 = 0;
             int num3 = 255;
             while (num3 >= 0)
             {
                 int cellValueFast = chunk.GetCellValueFast(num);
                 int num4          = Terrain.ExtractContents(cellValueFast);
                 if (num4 != 0 && num4 != num2 && BlocksManager.Blocks[num4] is FluidBlock)
                 {
                     int data = Terrain.ExtractData(cellValueFast);
                     chunk.SetCellValueFast(num, Terrain.MakeBlockValue(num4, 0, FluidBlock.SetIsTop(data, isTop: true)));
                 }
                 num2 = num4;
                 num3--;
                 num--;
             }
         }
     }
 }