request_items

class RequestItemsMixin(name: str, similar_entities: list[str], **kwargs: dict)

Enables an entity to request items during its construction. Note that this is not for Logistics requests such as requester and buffer chests (that’s what RequestFiltersMixin is for). Instead this is for specifying additional construction components, things like speed modules for beacons or productivity modules for assembling machines.

set_item_request(item: str, count: int) None

Requests an amount of an item. Removes the item request if count is set to 0 or None. Manages module_slots_occupied.

Raises a number of warnings if the requested item is mismatched for the type of entity you’re requesting items for. For example, ModuleLimitationWarning will be raised when requesting an item that is not a module to a Beacon entity.

Parameters:
  • item – The string name of the requested item.

  • count – The desired amount of that item.

Raises:
  • TypeError – If item is anything other than a str, or if count is anything other than an int or None.

  • InvalidItemError – If item is not a valid item name.

  • ValueError – If count is less than zero.

set_item_requests(items: dict) None

Sets all of the item requests for the Entity. Takes items as a dict in the format:

{item_1: count_1, item_2: count_2, ...}

where item_x is a str and count_x is a positive integer.

Parameters:

items – A dictionary of the desired items in the format specified above.

Raises:
  • TypeError – If item_x is anything other than a str, or if count_x is anything other than an int or None.

  • InvalidItemError – If item_x is not a valid item name.

  • ValueError – If count_x is less than zero.