Get entities created by spill_item_stack?

Place to get help with not working mods / modding interface.
Thalassicus
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Apr 29, 2016 11:03 am
Contact:

Get entities created by spill_item_stack?

Post by Thalassicus »

How do I get the entities created by LuaSurface::spill_item_stack()?

I tried the code below. It creates the entities, but nearbyLoot is empty.

Code: Select all

local loot = {name="iron-plate", count=10}
event.entity.surface.spill_item_stack(event.entity.position, loot)

local nearbyLoot = event.entity.surface.find_entities_filtered{
  position=event.entity.position,
  radius=10,
  name=loot.name
}
if next(nearbyLoot) == nil then
  log("no nearby loot")
  return
end
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: Get entities created by spill_item_stack?

Post by Deadlock989 »

Spilled items are an entity named "item-on-ground". They have a "stack" property which describes what item the entity represents.
Post Reply

Return to “Modding help”