How to find out which item was launched in the rocket

Place to get help with not working mods / modding interface.
User avatar
WIZ4
Fast Inserter
Fast Inserter
Posts: 209
Joined: Thu Apr 07, 2016 1:36 pm
Contact:

How to find out which item was launched in the rocket

Post by WIZ4 »

How to find out which item was launched in the rocket in event on_rocket_launched?
My native language is russian. Sorry if my messages are difficult to read.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5404
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: How to find out which item was launched in the rocket

Post by Klonan »

WIZ4 wrote:How to find out which item was launched in the rocket in event on_rocket_launched?
You can check the rocket inventory:

Code: Select all

function on_rocket_launch(event)
  local rocket = event.rocket
  local inventory = rocket.get_inventory(1)
  local contents = inventory.get_contents()
  game.print(serpent.block(contents))
end
User avatar
WIZ4
Fast Inserter
Fast Inserter
Posts: 209
Joined: Thu Apr 07, 2016 1:36 pm
Contact:

Re: How to find out which item was launched in the rocket

Post by WIZ4 »

Thanks!
My native language is russian. Sorry if my messages are difficult to read.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: How to find out which item was launched in the rocket

Post by eradicator »

Code: Select all

local inventory = rocket.get_inventory(1)
Why does that inventory not have a defines.inventory name?
Post Reply

Return to “Modding help”