Page 1 of 1

[0.12.1] remove_item doesn't seem to work

Posted: Thu Jul 30, 2015 11:53 pm
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})

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

Posted: Fri Jul 31, 2015 12:27 am
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.

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

Posted: Fri Jul 31, 2015 12:42 am
by oLaudix
Try:

Code: Select all

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

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

Posted: Fri Jul 31, 2015 12:56 am
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

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

Posted: Fri Jul 31, 2015 7:57 am
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 :)

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

Posted: Fri Jul 31, 2015 11:51 am
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.

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

Posted: Fri Jul 31, 2015 1:28 pm
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 :)

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

Posted: Fri Jul 31, 2015 1:49 pm
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

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

Posted: Sat Aug 08, 2015 2:54 pm
by Klonan
Just posting to say, my mod works excellently now with the new remove_item() functionality! Thank you great devs