Inserter pickup/dropoff target in case of overlapping entities

Place to get help with not working mods / modding interface.
andrei
Burner Inserter
Burner Inserter
Posts: 14
Joined: Tue Aug 27, 2019 8:32 pm
Contact:

Inserter pickup/dropoff target in case of overlapping entities

Post by andrei »

Is there a way to specify preferred pickup/dropoff target for an inserter that is pointing at two intersecting entities? Ideally I would like entity prototype to specify inserter_priority (similarly selection_priority) or something like this.

────────────────

FWIW I found a workaround, but it’s far from ideal. I’m setting drop_target/pickup_target at runtime in the following manner:
  • Inserter built ⇒ check entities in inserter pickup_position/drop_position and choose an appropriate target.
  • Inserter rotated ⇒ same.
  • Length of a configurable inserter has changed ⇒ same.
  • One of the potentially overlapping entities built ⇒ find all inserters within a radius of N tiles from it; check if they are pointing at the entity; if yes, choose an appropriate target.
This works... more or less. But I’m not happy with this solution:
  1. The last step relies on a hard-coded maximum inserter length, while in reality it’s not limited.
  2. This is not compatible with other mods that allow changing inserter pickup/dropoff location dynamically, because there is no event for that.
  3. I’m concerned about performance (haven't tested on a really large base yet).
Post Reply

Return to “Modding help”