Example #1
0
 public override void OnPoll(int value, int x, int y, int z, int pollPass)
 {
     if (m_random.Float(0f, 1f) < 0.5f && !IvyBlock.IsGrowthStopCell(x, y, z) && Terrain.ExtractContents(base.SubsystemTerrain.Terrain.GetCellValue(x, y - 1, z)) == 0)
     {
         m_toUpdate[new Point3(x, y - 1, z)] = value;
     }
 }
Example #2
0
        public override void OnNeighborBlockChanged(int x, int y, int z, int neighborX, int neighborY, int neighborZ)
        {
            int  face      = IvyBlock.GetFace(Terrain.ExtractData(base.SubsystemTerrain.Terrain.GetCellValue(x, y, z)));
            bool flag      = false;
            int  cellValue = base.SubsystemTerrain.Terrain.GetCellValue(x, y + 1, z);

            if (Terrain.ExtractContents(cellValue) == 197 && IvyBlock.GetFace(Terrain.ExtractData(cellValue)) == face)
            {
                flag = true;
            }
            if (!flag)
            {
                Point3 point      = CellFace.FaceToPoint3(face);
                int    cellValue2 = base.SubsystemTerrain.Terrain.GetCellValue(x + point.X, y + point.Y, z + point.Z);
                if (!BlocksManager.Blocks[Terrain.ExtractContents(cellValue2)].IsCollidable)
                {
                    base.SubsystemTerrain.DestroyCell(0, x, y, z, 0, noDrop: true, noParticleSystem: false);
                }
            }
        }