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.
spill_item_stack returns created entities
-
- Burner Inserter
- Posts: 9
- Joined: Fri Apr 29, 2016 11:03 am
- Contact:
Re: spill_item_stack returns created entities
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.
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.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: spill_item_stack returns created entities
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.