static void MarkHandler([NotNull] Player player, [NotNull] CommandReader cmd)
{
Map map = player.WorldMap;
int x, y, z;
Vector3I coords;
if (cmd.NextInt(out x) && cmd.NextInt(out y) && cmd.NextInt(out z))
{
if (cmd.HasNext)
{
CdMark.PrintUsage(player);
return;
}
coords = new Vector3I(x, y, z);
}
else
{
coords = player.Position.ToBlockCoords();
}
coords.X = Math.Min(map.Width - 1, Math.Max(0, coords.X));
coords.Y = Math.Min(map.Length - 1, Math.Max(0, coords.Y));
coords.Z = Math.Min(map.Height - 1, Math.Max(0, coords.Z));
if (player.SelectionMarksExpected > 0)
{
player.SelectionAddMark(coords, true, true);
}
else
{
player.MessageNow("Cannot mark - no selection in progress.");
}
}