Question about entity

Place to get help with not working mods / modding interface.
Post Reply
User avatar
darius456
Fast Inserter
Fast Inserter
Posts: 222
Joined: Thu Jan 02, 2014 6:33 am
Contact:

Question about entity

Post by darius456 »

Why:
This work: game.player.print(game.player.selected.getitemcount())
but this doesn't: game.player.selected.removeitem({name="iron-gear-wheel",count=2}) when I print result I get 0 -> it mean no item removed

My cursor is above assembly machine mk2 which produces iron-gear-wheel.
In this assembly currently are: 0 iron plate and 3 iron-gear-wheel.

I wish to remove iron-gear-wheel from assembly machine... completely remove (delete), not move to inventory.
Is it possible to create new entity (assembly machine) and order it thru the script to craft some specific item?

Please help, need this to my 3rd mod :)
Lenovo Y580 8GB Ram GF660m 128GB SSD W7

User avatar
darius456
Fast Inserter
Fast Inserter
Posts: 222
Joined: Thu Jan 02, 2014 6:33 am
Contact:

Re: Question about entity

Post by darius456 »

I have found this site in wiki: LINK

But this doesn't work:
remove - LuaEntity doesn't cantain readable property remove
clear - LuaEntity doesn't cantain readable property clear

This work:
getitemcount()
insert({name="name",count=x})

This work but...: - this method found here
game.player.selected.removeitem({name="name",count=x}) (and mouse over assembling machine or chest) - always return 0
when I use it on player inventory it work:
game.player.removeitem({name="name",count=x})

How to remove item from assembly machine? - > Solved -> game.player.selected.getinventory(2).remove({name="iron-gear-wheel",count=2})
Lenovo Y580 8GB Ram GF660m 128GB SSD W7

Post Reply

Return to “Modding help”