Replace the 'Cannot build here' message with an actually useful one.

This commit is contained in:
UnknownShadow200 2016-08-13 17:06:37 +10:00
parent 95d5ffed9c
commit 6a1ade461b

View File

@ -50,6 +50,8 @@ namespace MCGalaxy {
if (old == Block.Zero) return; if (old == Block.Zero) return;
if (jailed || !agreed || !canBuild) { RevertBlock(x, y, z); return; } if (jailed || !agreed || !canBuild) { RevertBlock(x, y, z); return; }
if (level.IsMuseum && Blockchange == null) return; if (level.IsMuseum && Blockchange == null) return;
if (action > 1) { Leave("Unknown block action!", true); return; }
bool doDelete = !painting && action == 0;
if (!deleteMode) { if (!deleteMode) {
PhysicsArgs args = level.foundInfo(x, y, z); PhysicsArgs args = level.foundInfo(x, y, z);
@ -90,7 +92,7 @@ namespace MCGalaxy {
} }
if (!Block.canPlace(this, old) && !Block.BuildIn(old) && !Block.AllowBreak(old)) { if (!Block.canPlace(this, old) && !Block.BuildIn(old) && !Block.AllowBreak(old)) {
SendMessage("Cannot build here!"); Formatter.MessageBlock(this, doDelete ? "delete " : "replace ", old);
RevertBlock(x, y, z); return; RevertBlock(x, y, z); return;
} }
@ -99,12 +101,11 @@ namespace MCGalaxy {
RevertBlock(x, y, z); return; RevertBlock(x, y, z); return;
} }
if (old >= 200 && old < 220) { if (old >= Block.air_flood && old <= Block.air_door_air) {
SendMessage("Block is active, you cant disturb it!"); SendMessage("Block is active, you cannot disturb it.");
RevertBlock(x, y, z); return; RevertBlock(x, y, z); return;
} }
if (action > 1 ) { Leave("Unknown block action!", true); return; }
byte blockRaw = block; byte blockRaw = block;
if (block < Block.CpeCount) block = bindings[block]; if (block < Block.CpeCount) block = bindings[block];
@ -119,8 +120,7 @@ namespace MCGalaxy {
byte heldExt = 0; byte heldExt = 0;
byte heldBlock = GetActualHeldBlock(out heldExt); byte heldBlock = GetActualHeldBlock(out heldExt);
int index = level.PosToInt(x, y, z); int index = level.PosToInt(x, y, z);
if (doDelete) {
if (!painting && action == 0) {
if (DeleteBlock(old, x, y, z, block, extBlock)) if (DeleteBlock(old, x, y, z, block, extBlock))
level.AddToBlockDB(this, index, heldBlock, heldExt, true); level.AddToBlockDB(this, index, heldBlock, heldExt, true);
} else { } else {