Get the crafting speed of an assembler in script?

spworwell
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sat Mar 07, 2015 6:32 pm
Contact:

Get the crafting speed of an assembler in script?

Post by spworwell »

Where can I find the underlined properties in the information available to an executing mod?
It's in the raw data, but data.raw doesn't seem to be accessible from config.lua anywhere in the lifecycle
I also can't find enough information in the entity and item prototypes to reconstruct it.
Attachments
Untitled.png
Untitled.png (190.09 KiB) Viewed 4647 times

spworwell
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sat Mar 07, 2015 6:32 pm
Contact:

Re: Get the crafting speed of an assembler in script?

Post by spworwell »

bump


spworwell
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sat Mar 07, 2015 6:32 pm
Contact:

Re: Get the crafting speed of an assembler in script?

Post by spworwell »

thanks Dave, but that property is only available on Modules, so it doesn't tell me what the base crafting speed or energy cost of an assembler, and I can't figure out the base + module values w/o knowing the base values.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3713
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Get the crafting speed of an assembler in script?

Post by DaveMcW »

Code: Select all

local power = machine.electric_drain * 1800
local pollution = machine.electric_emissions * power
Sadly I can't find crafting speed either. Maybe you can post in modding interface requests.

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

Re: Get the crafting speed of an assembler in script?

Post by Klonan »

DaveMcW wrote:

Code: Select all

local power = machine.electric_drain * 1800
local pollution = machine.electric_emissions * power
Sadly I can't find crafting speed either. Maybe you can post in modding interface requests.

Maybe that is right,

Moved to interface requests

Theanderblast
Inserter
Inserter
Posts: 46
Joined: Fri Aug 19, 2016 2:48 pm
Contact:

Re: Get the crafting speed of an assembler in script?

Post by Theanderblast »

I'd like this too. I"m thinking of a mod that adds a selection tool where you select a bunch of assemblers (for example) and it tells you the maximum rate of consumption and production they currently could do, in items per second (or minute), based on the modules it has, the beacon effects it's getting, the assembler's crafting speed.

There are mods which tell you what machines are currently producing/consuming, but not the max possible rates.

I'm wondering if the OP has the same idea I do... :)

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3713
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Get the crafting speed of an assembler in script?

Post by DaveMcW »

It was added in 0.15, this thread should be moved to implemented.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Get the crafting speed of an assembler in script?

Post by bobingabout »

.
Last edited by bobingabout on Tue Jun 20, 2017 8:03 am, edited 1 time in total.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3713
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Get the crafting speed of an assembler in script?

Post by DaveMcW »

Code: Select all

/c game.print(game.entity_prototypes["assembling-machine-1"].crafting_speed)

Theanderblast
Inserter
Inserter
Posts: 46
Joined: Fri Aug 19, 2016 2:48 pm
Contact:

Re: Get the crafting speed of an assembler in script?

Post by Theanderblast »

DaveMcW wrote:

Code: Select all

/c game.print(game.entity_prototypes["assembling-machine-1"].crafting_speed)
... gives you the base rate of all aseembling-machine-1s, not the rate of a particular assembling-machine-1 with modules and beacons.

Bilka
Factorio Staff
Factorio Staff
Posts: 3300
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Get the crafting speed of an assembler in script?

Post by Bilka »

Added for 0.17.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Implemented mod requests”