public override void Execute(HcMap map, string[] args) { var sw = new Stopwatch(); sw.Start(); Vector3S mapSize = map.GetSize(); MapSize = mapSize; var data = new byte[mapSize.X * mapSize.Y * mapSize.Z]; for (short x = 0; x < mapSize.X; x++) { for (short y = 0; y < mapSize.Y; y++) { for (short z = 0; z < (mapSize.Z / 2); z++) { data[GetBlockCoords(x, y, z)] = z == (mapSize.Z / 2) - 1 ? _grassBlock : _dirtBlock; } } } map.SetMap(data); sw.Stop(); Chat.SendMapChat($"&cMap created in {sw.Elapsed.TotalSeconds}s.", 0, map); map.Resend(); }
public override void Execute(HcMap map, string[] args) { Vector3S mapSize = map.GetSize(); MapSize = mapSize; var data = new byte[mapSize.X * mapSize.Y * mapSize.Z]; map.SetMap(data); map.Resend(); }
public override void Execute(HcMap map, string[] args) { var sw = new Stopwatch(); sw.Start(); Vector3S mapSize = map.GetSize(); MapSize = mapSize; var data = new byte[mapSize.X * mapSize.Y * mapSize.Z]; for (short ix = 0; ix < mapSize.X; ix++) { for (short iy = 0; iy < mapSize.Y; iy++) { data[GetBlockCoords(ix, iy, 0)] = _whiteCloth; } //map.BlockChange(-1, (short) ix, (short) iy, 0, whiteBlock, airBlock, false, false, false, 1); } for (short ix = 0; ix < mapSize.X; ix++) { for (short iz = 0; iz < mapSize.Z / 2; iz++) { data[GetBlockCoords(ix, 0, iz)] = _whiteCloth; data[GetBlockCoords(ix, mapSize.Y - 1, iz)] = _whiteCloth; // map.BlockChange(-1, (short) ix, 0, (short) iz, whiteBlock, airBlock, false, false, false, 1); // map.BlockChange(-1, (short) ix, (short) (map.CWMap.SizeY - 1), (short) iz, whiteBlock, airBlock, // false, false, false, 1); } } for (short iy = 0; iy < mapSize.Y; iy++) { for (short iz = 0; iz < mapSize.Z / 2; iz++) { data[GetBlockCoords(0, iy, iz)] = _whiteCloth; data[GetBlockCoords(mapSize.X - 1, iy, iz)] = _whiteCloth; // map.BlockChange(-1, 0, (short) iy, (short) iz, whiteBlock, airBlock, false, false, false, 1); // map.BlockChange(-1, (short) (map.CWMap.SizeX - 1), (short) iy, (short) iz, whiteBlock, airBlock, // false, false, false, 1); } } map.SetMap(data); sw.Stop(); Chat.SendMapChat($"&cMap created in {sw.Elapsed.TotalSeconds}s.", 0, map); map.Resend(); }
public override void Execute(HcMap map, string[] args) { var sw = new Stopwatch(); sw.Start(); byte bedrockBlock = BlockManager.GetBlock("solid").Id; Vector3S mapSize = map.GetSize(); MapSize = mapSize; var data = new byte[mapSize.X * mapSize.Y * mapSize.Z]; for (short ix = 0; ix < mapSize.X; ix++) { for (short iy = 0; iy < mapSize.Y; iy++) { data[GetBlockCoords(ix, iy, 0)] = bedrockBlock; } } for (short ix = 0; ix < mapSize.X; ix++) { for (short iz = 0; iz < mapSize.Z / 2; iz++) { data[GetBlockCoords(ix, 0, iz)] = bedrockBlock; data[GetBlockCoords(ix, mapSize.Y - 1, iz)] = bedrockBlock; } } for (short iy = 0; iy < mapSize.Y; iy++) { for (short iz = 0; iz < mapSize.Z / 2; iz++) { data[GetBlockCoords(0, iy, iz)] = bedrockBlock; data[GetBlockCoords(mapSize.X - 1, iy, iz)] = bedrockBlock; } } map.SetMap(data); sw.Stop(); Chat.SendMapChat($"&cMap created in {sw.Elapsed.TotalSeconds}s.", 0, map); map.Resend(); }
public override void Execute(HcMap map, string[] args) { Stopwatch sw = Stopwatch.StartNew(); Vector3S mapSize = map.GetSize(); MapSize = mapSize; var data = new byte[mapSize.X * mapSize.Y * mapSize.Z]; double hmapSizeX = Math.Ceiling(mapSize.X / (double)_mapScale); double hmapSizeY = Math.Ceiling(mapSize.Y / (double)_mapScale); const int fields = 1; var mBuildings = new Dictionary <double, int>(); var rng = new Random(); for (var x = 0; x < hmapSizeX + 2; x++) { for (var y = 0; y < hmapSizeY + 2; y++) { double number = (x + y * hmapSizeX) * fields; mBuildings[number] = rng.Next(0, mapSize.Z); } } for (var x = 0; x < hmapSizeX + 2; x++) { for (var y = 0; y < hmapSizeY + 2; y++) { double number = (x + y * hmapSizeX) * fields; int oheight = mBuildings[number]; int height = oheight * _priority; var count = 0; for (int ax = -_area; ax < _area; ax++) { for (int ay = -_area; ay < _area; ay++) { if (x + ax < 0 || x + ax >= hmapSizeX || y + ay < 0 || y + ay >= hmapSizeY) { continue; } double num = x + ax + (y + ay) * hmapSizeX * fields; int bheight = mBuildings[num]; height = height + bheight; count++; } } height = (int)Math.Floor(((double)height / (count + _priority))); int bx = x * _mapScale; int by = y * _mapScale; byte mat = BlockManager.GetBlock("Red Cloth").Id; //21; // -- material for (var iz = 0; iz < height; iz++) { if (mat > 33) { mat = BlockManager.GetBlock("Red Cloth").Id; } for (var ix = 0; ix < _mapScale; ix++) { for (var iy = 0; iy < _mapScale; iy++) { if (bx + ix > mapSize.X || by + iy > mapSize.Y) { continue; } int xCoord = bx + ix; int yCoord = by + iy; data[GetBlockCoords(xCoord, yCoord, iz)] = mat; } } mat++; } } } map.SetMap(data); sw.Stop(); Chat.SendMapChat("&2Contructed \"Candy\" in &a" + sw.Elapsed.TotalSeconds + "&2s.", 0, map); map.Resend(); }