Factorio: Add optional filtering for item sends displayed in-game (#1142)

* Factorio: Added feature to filter item sends displayed in-game.

* Factorio: Document item send filter feature.

* Factorio: Fix item send filter for item links.

* (Removed superfluous type annotations.)

* CommonClient: Added is_uninteresting_item_send helper.
This commit is contained in:
recklesscoder
2022-10-28 00:07:57 +02:00
committed by GitHub
parent aeb78eaa10
commit 924f484be0
6 changed files with 50 additions and 2 deletions

View File

@@ -312,6 +312,12 @@ class CommonContext:
return self.slot in self.slot_info[slot].group_members
return False
def is_uninteresting_item_send(self, print_json_packet: dict) -> bool:
"""Helper function for filtering out ItemSend prints that do not concern the local player."""
return print_json_packet.get("type", "") == "ItemSend" \
and not self.slot_concerns_self(print_json_packet["receiving"]) \
and not self.slot_concerns_self(print_json_packet["item"].player)
def on_print(self, args: dict):
logger.info(args["text"])