Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

I've been helping a friend use parts of your framework, but their recipes  consisted of multiples of one item, and I had to change the check_ingredients function to accommodate that, and I thought I would share here if anybody else needs that too

    def check_ingredients(craftitem):
        # Count how many of each ingredient is required
        from collections import Counter
        required = Counter(craftitem.cost)
        for item_id, needed in required.items():
            if inv.count(item_id) < needed:
                return False
        return True