Code: Select all
script.on_event(defines.events.on_player_dropped_item,
function(event)
local droppedItemName = event.entity.stack.name
...
...
)
(Let me know if you see something)
1: Is this the best way to determine "what" was dropped?
I want to detect when a player drops wood on the ground for use in making a random campfire to cook on.
2: I found this :
Which led me to believe this "stack" is the best handle to an item out in the world, laying on the ground...because there is no inventory slot for it...Class LuaItemStack
A reference to an item and count owned by some external entity.
Notes
In most instances this is a simple reference as in: it points at a specific slot in an inventory and not the item in the slot.
In the instance this references an item on a LuaTransportLine the reference is only guaranteed to stay valid (and refer to the same item) as long as nothing changes the transport line.
Is this assumption correct, or is there a better way?