Ticket #3567: AllowMaxFailCounttobesetbytheuser.diff

File AllowMaxFailCounttobesetbytheuser.diff, 1.3 KB (added by Stan, 9 years ago)

A proposal.

  • binaries/data/mods/public/maps/random/rmgen/placer.js

     
    396396        warn("SimpleObject: minAngle should be less than or equal to maxAngle");
    397397}
    398398
    399 SimpleObject.prototype.place = function(cx, cz, player, avoidSelf, constraint)
     399SimpleObject.prototype.place = function(cx, cz, player, avoidSelf, constraint, maxFailCount = 20)
    400400{
    401401    var failCount = 0;
    402402    var count = randInt(this.minCount, this.maxCount);
     
    452452            if (fail)
    453453            {
    454454                failCount++;
    455                 if (failCount > 20) // TODO: Make this adjustable
     455                if (failCount > maxFailCount)
    456456                {
    457457                    return undefined;
    458458                }
     
    495495        warn("RandomObject: minAngle should be less than or equal to maxAngle");
    496496}
    497497
    498 RandomObject.prototype.place = function(cx, cz, player, avoidSelf, constraint)
     498RandomObject.prototype.place = function(cx, cz, player, avoidSelf, constraint, maxFailCount = 20)
    499499{
    500500    var failCount = 0;
    501501    var count = randInt(this.minCount, this.maxCount);
     
    554554            if (fail)
    555555            {
    556556                failCount++;
    557                 if (failCount > 20) // TODO: Make this adjustable
     557                if (failCount > maxFailCount)
    558558                {
    559559                    return undefined;
    560560                }