spill_item_stack returns created entities

Post Reply
Thalassicus
Burner Inserter
Burner Inserter
Posts: 9
Joined: Fri Apr 29, 2016 11:03 am
Contact:

spill_item_stack returns created entities

Post by Thalassicus »

It'd be helpful if LuaSurface::spill_item_stack() returned the table of items it create.

I made aliens drop loot, and I'm attempting to mark the loot for deconstruction after there's no more enemies in a certain radius. This time delay means I can't use the instantaneous deconstruction provided by spill_item_stack(). I must store the items in a list, and check the list periodically.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13202
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: spill_item_stack returns created entities

Post by Rseding91 »

Ok. I didn't want to do this in the past because it would make the function a lot slower returning all the entities every time but in the meantime I created a way of only returning the results if something is actually using them.

So, calling spill_item_stack() is as cheap as before and if you do something like: local results = surface.spill_item_stack() then you pay the cost of storing all the results.
If you want to get ahold of me I'm almost always on Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: spill_item_stack returns created entities

Post by eradicator »

Rseding91 wrote:
Tue Mar 10, 2020 1:38 pm
in the meantime I created a way of only returning the results if something is actually using them.
Could that also be applied to returning the ghost entity (if any) in LuaEntity.die()?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Implemented mod requests”