I kept getting a crash as the results of used items were compacted into a list string from using extend instead of in append for the results of an item_use_results. Changing the results.extend to results.append fixed the issue
+ def use(self, item_entity, **kwargs):
+ results = []
+
+ item_component = item_entity.item
+
+ if item_component.use_function is None:
+ results.append({'message': Message('The {0} cannot be used'.format(item_entity.name), libtcod.yellow)})
+ else:
+ kwargs = {**item_component.function_kwargs, **kwargs}
+ item_use_results = item_component.use_function(self.owner, **kwargs)
+
+ for item_use_result in item_use_results:
+ if item_use_result.get('consumed'):
+ self.remove_item(item_entity)
+
>>>> results.extend(item_use_results) <- Should be RESULTS.APPEND
+
+ return results
+
+ def remove_item(self, item):
+ self.items.remove(item)
Hey guys,
I kept getting a crash as the results of used items were compacted into a list string from using extend instead of in append for the results of an item_use_results. Changing the results.extend to results.append fixed the issue