Change /copy behaviour to show how many blocks you went over the limit by instead of immediately stopping when you reach the limit. (Thanks Joshim4)

This commit is contained in:
UnknownShadow200 2016-06-19 23:47:46 +10:00
parent 86e45cd165
commit 1eee2dda2c
2 changed files with 10 additions and 10 deletions

View File

@ -124,20 +124,20 @@ namespace MCGalaxy.Commands.Building {
if (b == Block.custom_block)
extB = p.level.GetExtTile(xx, yy, zz);
if (b != Block.air || state.PasteAir) {
if (b != Block.air || state.PasteAir)
state.UsedBlocks++;
if (state.UsedBlocks > p.group.maxBlocks) {
Player.Message(p, "You tried to copy " + state.UsedBlocks + " or more blocks.");
Player.Message(p, "You cannot copy more than " + p.group.maxBlocks + ".");
state = null;
return;
}
}
state.Blocks[index] = b;
state.ExtBlocks[index] = extB;
index++;
}
if (state.UsedBlocks > p.group.maxBlocks) {
Player.Message(p, "You tried to copy {0} blocks. You cannot copy more than {1} blocks.",
state.UsedBlocks, p.group.maxBlocks);
state.Blocks = null; state.ExtBlocks = null; state = null;
return;
}
p.CopyBuffer = state;
if (cpos.type == 1) {
DrawOp op = new CuboidDrawOp();

View File

@ -29,7 +29,7 @@ namespace MCGalaxy {
public static bool Read(string path, Action<string, string> processor, char separator = '=') {
if (!File.Exists(path)) return false;
using (StreamReader reader = new CP437Reader(path)) {
using (CP437Reader reader = new CP437Reader(path)) {
string line;
while ((line = reader.ReadLine()) != null) {
if (line == "" || line[0] == '#') continue;
@ -46,7 +46,7 @@ namespace MCGalaxy {
public static bool Read<T>(string path, ref T state, LineProcessor<T> processor, char separator = '=') {
if (!File.Exists(path)) return false;
using (StreamReader reader = new CP437Reader(path)) {
using (CP437Reader reader = new CP437Reader(path)) {
string line;
while ((line = reader.ReadLine()) != null) {
if (line == "" || line[0] == '#') continue;