[0.12.1] remove_item doesn't seem to work

Post Reply
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5151
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

[0.12.1] remove_item doesn't seem to work

Post by Klonan »

Ayo, im working on a mod to fuel burners from furnaces, and so the technique is, insert coal into the burner, remove a piece of coal from the furnace using script. However remove_item doesn't seem to take from any of the furnaces inventories. I'm not sure if i'm doing something wrong, or it is a bug indeed...

Code: Select all

burner.insert({name = "coal", count = 1})				
leeched[1].remove_item({name = "coal", count = 1})

johanwanderer
Fast Inserter
Fast Inserter
Posts: 157
Joined: Fri Jun 26, 2015 11:13 pm

Re: [0.12.1] remove_item doesn't seem to work

Post by johanwanderer »

Did you try different inventory? There is get_inventory(x) and get_output_inventory(x).

I usually surround that with a pcall because I haven't been able to figure when it is appropriate to have x > 1.

User avatar
oLaudix
Filter Inserter
Filter Inserter
Posts: 282
Joined: Sun Jun 14, 2015 3:24 pm
Contact:

Re: [0.12.1] remove_item doesn't seem to work

Post by oLaudix »

Try:

Code: Select all

local item
item = {name = "coal", count = 1}
leeched[1].remove(item )
Image

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5151
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.12.1] remove_item doesn't seem to work

Post by Klonan »

oLaudix wrote:Try:

Code: Select all

local item
item = {name = "coal", count = 1}
leeched[1].remove(item )
no dice :[
johanwanderer wrote:Did you try different inventory? There is get_inventory(x) and get_output_inventory(x).

I usually surround that with a pcall because I haven't been able to figure when it is appropriate to have x > 1.
I'm not calling the inventory in the script since the method is called on the entity

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.12.1] remove_item doesn't seem to work

Post by kovarex »

Well, there isn't method remove_item as opposite to insert in entity.

I was also missing that actually, as calling it on individual inventories isn't as comfortable.

This is not technically a bug, so I'm moving it to mod interface request, but I'm letting rseding know, so he will probably do it :)

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5151
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.12.1] remove_item doesn't seem to work

Post by Klonan »

kovarex wrote:Well, there isn't method remove_item as opposite to insert in entity.

I was also missing that actually, as calling it on individual inventories isn't as comfortable.

This is not technically a bug, so I'm moving it to mod interface request, but I'm letting rseding know, so he will probably do it :)


ahh okay, the WIki led me to believe that it worked like that.

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

Re: [0.12.1] remove_item doesn't seem to work

Post by Rseding91 »

Klonan wrote:
kovarex wrote:Well, there isn't method remove_item as opposite to insert in entity.

I was also missing that actually, as calling it on individual inventories isn't as comfortable.

This is not technically a bug, so I'm moving it to mod interface request, but I'm letting rseding know, so he will probably do it :)


ahh okay, the WIki led me to believe that it worked like that.
Well, it will in 0.12.3 :)
If you want to get ahold of me I'm almost always on Discord.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5151
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.12.1] remove_item doesn't seem to work

Post by Klonan »

Rseding91 wrote:
Klonan wrote:
kovarex wrote:Well, there isn't method remove_item as opposite to insert in entity.

I was also missing that actually, as calling it on individual inventories isn't as comfortable.

This is not technically a bug, so I'm moving it to mod interface request, but I'm letting rseding know, so he will probably do it :)


ahh okay, the WIki led me to believe that it worked like that.
Well, it will in 0.12.3 :)

:]

thank you <3

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5151
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.12.1] remove_item doesn't seem to work

Post by Klonan »

Just posting to say, my mod works excellently now with the new remove_item() functionality! Thank you great devs

Post Reply

Return to “Implemented mod requests”