Page 1 of 1

Reproducing spill_item_stack behavior in Lua

Posted: Mon Mar 26, 2018 3:03 am
by sparr
viewtopic.php?f=58&t=59047

I need to "spill" an item at the target position if it will fit. Since spill_item_stack always skips that position (and starts with the surrounding positions), I need to reproduce its behavior. I've tried just doing surface.find_entity, but that misses things on belts nearby, or find_entities_filtered but I can't get the search area right. And if I get the search wrong, then I risk doing create_entity on top of a full belt, which doesn't work right (viewtopic.php?f=23&t=59032)

Anyone have tips on how I can accomplish this?