public void CreateDome(Player p, byte type, DomeType domeType, ushort radius) { List<Pos> buffer = new List<Pos>(); Level level = p.level; ushort cx = (ushort)(p.pos[0] / 32), cy = (ushort)(p.pos[1] / 32), cz = (ushort)(p.pos[2] / 32); ushort sx = (ushort)(cx - radius - 1), sy = (ushort)(cy - radius - 1), sz = (ushort)(cz - radius - 1), ex = (ushort)(cx + radius + 1), ey = (ushort)(cy + radius + 1), ez = (ushort)(cz + radius + 1); if (domeType == DomeType.Hollow) { for (ushort x = sx; x < ex; x++) for (ushort y = sy; y < ey; y++) for (ushort z = sz; z < ez; z++) if (Math.Round(Distance(cx, cy, cz, x, y, z)) == radius) if (level.GetTile(x, y, z) != type) { Pos pos = new Pos(); pos.x = x; pos.y = y; pos.z = z; buffer.Add(pos); } } else if (domeType == DomeType.Solid) { for (ushort x = sx; x < ex; x++) for (ushort y = sy; y < ey; y++) for (ushort z = sz; z < ez; z++) if (Math.Round(Distance(cx, cy, cz, x, y, z)) <= radius) if (level.GetTile(x, y, z) != type) { Pos pos = new Pos(); pos.x = x; pos.y = y; pos.z = z; buffer.Add(pos); } } Execute(p, buffer, type); }
public void CreateDome(Player p, byte type, DomeType domeType, ushort radius) { List <Pos> buffer = new List <Pos>(); Level level = p.level; ushort cx = (ushort)(p.pos[0] / 32), cy = (ushort)(p.pos[1] / 32), cz = (ushort)(p.pos[2] / 32); ushort sx = (ushort)(cx - radius - 1), sy = (ushort)(cy - radius - 1), sz = (ushort)(cz - radius - 1), ex = (ushort)(cx + radius + 1), ey = (ushort)(cy + radius + 1), ez = (ushort)(cz + radius + 1); if (domeType == DomeType.Hollow) { for (ushort x = sx; x < ex; x++) { for (ushort y = sy; y < ey; y++) { for (ushort z = sz; z < ez; z++) { if (Math.Round(Distance(cx, cy, cz, x, y, z)) == radius) { if (level.GetTile(x, y, z) != type) { Pos pos = new Pos(); pos.x = x; pos.y = y; pos.z = z; buffer.Add(pos); } } } } } } else if (domeType == DomeType.Solid) { for (ushort x = sx; x < ex; x++) { for (ushort y = sy; y < ey; y++) { for (ushort z = sz; z < ez; z++) { if (Math.Round(Distance(cx, cy, cz, x, y, z)) <= radius) { if (level.GetTile(x, y, z) != type) { Pos pos = new Pos(); pos.x = x; pos.y = y; pos.z = z; buffer.Add(pos); } } } } } } Execute(p, buffer, type); }