Ticket #3567: AllowMaxFailCounttobesetbytheuser.diff
File AllowMaxFailCounttobesetbytheuser.diff, 1.3 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/maps/random/rmgen/placer.js
396 396 warn("SimpleObject: minAngle should be less than or equal to maxAngle"); 397 397 } 398 398 399 SimpleObject.prototype.place = function(cx, cz, player, avoidSelf, constraint )399 SimpleObject.prototype.place = function(cx, cz, player, avoidSelf, constraint, maxFailCount = 20) 400 400 { 401 401 var failCount = 0; 402 402 var count = randInt(this.minCount, this.maxCount); … … 452 452 if (fail) 453 453 { 454 454 failCount++; 455 if (failCount > 20) // TODO: Make this adjustable455 if (failCount > maxFailCount) 456 456 { 457 457 return undefined; 458 458 } … … 495 495 warn("RandomObject: minAngle should be less than or equal to maxAngle"); 496 496 } 497 497 498 RandomObject.prototype.place = function(cx, cz, player, avoidSelf, constraint )498 RandomObject.prototype.place = function(cx, cz, player, avoidSelf, constraint, maxFailCount = 20) 499 499 { 500 500 var failCount = 0; 501 501 var count = randInt(this.minCount, this.maxCount); … … 554 554 if (fail) 555 555 { 556 556 failCount++; 557 if (failCount > 20) // TODO: Make this adjustable557 if (failCount > maxFailCount) 558 558 { 559 559 return undefined; 560 560 }