diff --git a/docs/release-notes.md b/docs/release-notes.md index 98fdb85..5f85f05 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,7 +1,12 @@ -# 2014 03 08 +# 2014 03 12 ## Version 2.0.6 +Added Drone.MAX_VOLUME and Drone.MAX_SIDE properties to specify limits on size of Drone ops. +This is to stop individual players from hogging the CPU in a classrom environment. + +# 2014 03 08 + Fixed issues #115 #122 #123 Improved background processing of Drone build commands. diff --git a/src/main/js/plugins/drone/drone.js b/src/main/js/plugins/drone/drone.js index a43954b..4a5aead 100644 --- a/src/main/js/plugins/drone/drone.js +++ b/src/main/js/plugins/drone/drone.js @@ -1057,6 +1057,15 @@ Drone.prototype.cuboida = function(/* Array */ blocks, w, h, d, overwrite, immed return this; }; +Drone.MAX_VOLUME = 1000000; +Drone.MAX_SIDE = 1000; + +var tooBig = function(w, h, d ) { + return ( w * h * d ) >= Drone.MAX_VOLUME || + ( w >= Drone.MAX_SIDE ) || + ( h >= Drone.MAX_SIDE ) || + ( d >= Drone.MAX_SIDE ); +}; /* faster cuboid because blockid, meta and world must be provided use this method when you need to repeatedly place blocks @@ -1072,7 +1081,7 @@ Drone.prototype.cuboidX = function( blockType, meta, w, h, d, immediate ) { if ( typeof w == 'undefined' ) { w = 1; } - if ( ( w * h * d ) >= 1000000 ) { + if ( tooBig( w, h, d ) ) { this.sign([ 'Build too Big!', 'width:' + w,