(result)
| 597 | } |
| 598 | |
| 599 | function generateDecorations (result) { |
| 600 | for (const name in result.preset.decorations) { |
| 601 | const decoration = result.preset.decorations[name] |
| 602 | for (const num of _.range(Math.ceil(result.presetSize.sizeFactor * _.random(decoration.num[0], decoration.num[1])))) { // eslint-disable-line no-unused-vars |
| 603 | let rect |
| 604 | if (buildFunctions[name] !== undefined) { |
| 605 | buildFunctions[name](result, decoration) |
| 606 | continue |
| 607 | } |
| 608 | |
| 609 | while (true) { |
| 610 | rect = { |
| 611 | x: _.random((decoration.width / 2) + (result.preset.borderSize / 2) + thangSizes.borderSize.x, result.presetSize.x - (decoration.width / 2) - (result.preset.borderSize / 2) - thangSizes.borderSize.x), |
| 612 | y: _.random((decoration.height / 2) + (result.preset.borderSize / 2) + thangSizes.borderSize.y, result.presetSize.y - (decoration.height / 2) - (result.preset.borderSize / 2) - thangSizes.borderSize.y), |
| 613 | width: decoration.width, |
| 614 | height: decoration.height |
| 615 | } |
| 616 | if (addRect(result, rect)) break |
| 617 | } |
| 618 | |
| 619 | for (const cluster in decoration.clusters) { |
| 620 | const range = decoration.clusters[cluster] |
| 621 | for (const i of _.range(_.random(range[0], range[1]))) { // eslint-disable-line no-unused-vars |
| 622 | while (!addThang(result, { |
| 623 | id: getRandomThang(clusters[cluster].thangs), |
| 624 | pos: { |
| 625 | x: _.random(rect.x - (rect.width / 2), rect.x + (rect.width / 2)), |
| 626 | y: _.random(rect.y - (rect.height / 2), rect.y + (rect.height / 2)) |
| 627 | }, |
| 628 | margin: clusters[cluster].margin |
| 629 | })) { |
| 630 | continue |
| 631 | } |
| 632 | } |
| 633 | } |
| 634 | } |
| 635 | } |
| 636 | } |
| 637 | |
| 638 | function generateEnemies (result, defeatThangsGoal) { |
| 639 | let i |
no test coverage detected