I might just be mis-understanding how to use the existing Collect goal, but it seems like there should be an option to specify a type of object rather than an individual object’s id? For instance, if you wanted to make a goal of collecting 5 of the same type of object, you could create a “collect” goal and then list all of the items as “targets”. What would be better in that situation is to be able to specify a “type” of object, like sword or mushroom and a “how many”. As it stand right now, adding a “how many” attribute with a value other than 1 seems to make the goal impossible (haven’t really traced through to see why that is). Without the “how many” attribute it requires all specified items to be collected.
The main problem is that if you want to collect lots of objects, then you have to list all of items individually as targets instead of just saying how many you want collected.
As a non-expert in coffeescript, I’m thinking something like: ( codecombat / app / lib / world / GoalManager.coffee )
checkCollected: (goalID, who, targets, thangID, itemID, frameNumber) -> return unless itemID in targets return unless thangID in who @updateGoalState(goalID, thangID, 'collected', frameNumber)
checkCollected: (goalID, who, targets, thangID, item, frameNumber) -> return unless item.id in targets or item.type in targets return unless thangID in who @updateGoalState(goalID, thangID, 'collected', frameNumber)
Edit: I made a mistake in how I described the issue originally. I think the above is now correct.