Getting assembling machine crafting content.

Place to get help with not working mods / modding interface.
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Getting assembling machine crafting content.

Post by ficolas »

Im going to change the way the underground mining drill works, you will need to select a recipe (normal drilling, fast drilling and soft drilling), at the beggining you only have normal drilling and you need to research the other, this allows me to add diferent tipes of drilling and to make the drill animated.

But my problem now is, that I want to get the assembly machine content (an object called normal drilling, fast drilling or soft drilling) so I did this:

Code: Select all

if 	minerEntities[z].name=="underground-mining-drill-2" and math.random(5)<=glob.undergroundminer[i].richness and minerEntities[z].getitemcount("soft-drilling")>0 or minerEntities[z].getitemcount("fast-drilling")>0 or minerEntities[z].getitemcount("normal-drilling")>0 then
But that doesnt seem to work, so I went to the game, and did this:

Code: Select all

game.getplayer().print(game.player.character.getselected().getitemcount("normal-drilling"))
And it prints 0...
even when there is one... Whats the problem?

I think that the problem is that assembly machines arent inventories, so you cant place stuff inside with the code :S
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Getting assembling machine crafting content.

Post by kovarex »

The assembling machine doesn't work with the getitemcount command, I can add this for the next release.
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Getting assembling machine crafting content.

Post by ficolas »

yes please :) and thanx.

I have readed something about a 0.4.3, but 0.4.2 isnt out yet, so why would 0.4.3 be released?
What will be the next update, 0.4.2 or 0.5?
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Getting assembling machine crafting content.

Post by kovarex »

The next will be probably 0.5, the 0.4.3 was just update of the scenario pack.

Btw, you can now solve the problem with assembling machine in little bit ugly way.

You can do:

Code: Select all

machine.getinventory(1).getitemcount("my-item") + machine.getinventory(2).getitemcount("my-item")
Those 1 and 2 are constants for input/output inventory, these are not defined in defines (and will be in next version).
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Getting assembling machine crafting content.

Post by ficolas »

kovarex wrote:The next will be probably 0.5, the 0.4.3 was just update of the scenario pack.

Btw, you can now solve the problem with assembling machine in little bit ugly way.

You can do:

Code: Select all

machine.getinventory(1).getitemcount("my-item") + machine.getinventory(2).getitemcount("my-item")
Those 1 and 2 are constants for input/output inventory, these are not defined in defines (and will be in next version).
Ok thanx :)

What is the inventory slot number one?
The input?

So I need to use only the second, the input?
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Getting assembling machine crafting content.

Post by ficolas »

Also, im not sure if this is a bug or not, but an assembly machine with effectivity 1, takes 4 seconds to craft a recipe that should take 8 seconds.
Post Reply

Return to “Modding help”