MCPcopy Create free account
hub / github.com/codecombat/codecombat / generateGetToLocations

Function generateGetToLocations

app/lib/terrain-generation.js:660–676  ·  view source on GitHub ↗
(result, getToLocationsGoal)

Source from the content-addressed store, hash-verified

658}
659
660function generateGetToLocations (result, getToLocationsGoal) {
661 while (true) {
662 const locationThang = {
663 id: 'Goal Junior',
664 pos: getRandomPosition(result),
665 margin: 0
666 }
667 if (addThang(result, locationThang)) {
668 getToLocationsGoal.getToLocations.targets = [locationThang.id]
669 break
670 }
671 }
672 if (!getToLocationsGoal.getToLocations.targets.length) {
673 console.log("Couldn't find space for a goal; removing getToLocationsGoal")
674 result.goals = _.without(result.goals, getToLocationsGoal)
675 }
676}
677
678function generateCollectThangs (result, collectThangsGoal) {
679 let lastThangCount = result.thangs.length

Callers 1

generateThangsFunction · 0.85

Calls 3

getRandomPositionFunction · 0.85
addThangFunction · 0.85
logMethod · 0.80

Tested by

no test coverage detected