public void MovingBlocksCollidedWithTerrain(IMovingBlockSet movingBlockSet, Point3 p) { if (!(movingBlockSet.Id == "Piston")) { return; } Point3 point = (Point3)movingBlockSet.Tag; int cellValue = m_subsystemTerrain.Terrain.GetCellValue(point.X, point.Y, point.Z); if (Terrain.ExtractContents(cellValue) != 237) { return; } Point3 point2 = CellFace.FaceToPoint3(PistonBlock.GetFace(Terrain.ExtractData(cellValue))); int num = p.X * point2.X + p.Y * point2.Y + p.Z * point2.Z; int num2 = point.X * point2.X + point.Y * point2.Y + point.Z * point2.Z; if (num > num2) { if (IsBlockBlocking(base.SubsystemTerrain.Terrain.GetCellValue(p.X, p.Y, p.Z))) { movingBlockSet.Stop(); } else { base.SubsystemTerrain.DestroyCell(0, p.X, p.Y, p.Z, 0, noDrop: false, noParticleSystem: false); } } }
public void MovingBlocksCollidedWithTerrain(IMovingBlockSet movingBlockSet, Point3 p) { if (movingBlockSet.Id == "CollapsingBlock") { int cellValue = base.SubsystemTerrain.Terrain.GetCellValue(p.X, p.Y, p.Z); if (IsCollapseSupportBlock(cellValue)) { movingBlockSet.Stop(); } else if (IsCollapseDestructibleBlock(cellValue)) { base.SubsystemTerrain.DestroyCell(0, p.X, p.Y, p.Z, 0, noDrop: false, noParticleSystem: false); } } }