(Solved) How does Space Age calculate the rocket capacity of items that don't have weights in the lua file?

Place to post guides, observations, things related to modding that are not mods themselves.
Plantagen
Inserter
Inserter
Posts: 23
Joined: Tue Jul 14, 2020 5:56 pm
Contact:

(Solved) How does Space Age calculate the rocket capacity of items that don't have weights in the lua file?

Post by Plantagen »

I am trying to do some calculations on rocket capacity and looking into the data files, specifically these

https://github.com/wube/factorio-data/b ... s/item.lua

https://github.com/wube/factorio-data/b ... s/item.lua


A lot of the items have weights that correspond to their rocket capacity. For example, Iron ore has a weight of `2 * kg` and the rocket capacity is 500 for iron ore, so this makes sense.

But some other items do not have a weight in the Lua file. stone-brick does not. iron-plate doesn't either. The rocket capacity of iron-plate is 1000 while stone-brick is 500, so they can't have some default value for all items missing a weight.

Does anyone know where in the data files this is specified? I searched the repo for "stone-brick" and could not find a weight defined near any of the matches.


Update: I found this description. Is it valid? Seems a bit complex for what I'm trying to do.

https://lua-api.factorio.com/latest/aux ... eight.html

Update 2: Is it possible to run an in-game script to just print out the rocket capacity of each items? That would solve my problem too.
Last edited by Plantagen on Mon Aug 03, 2026 9:21 am, edited 2 times in total.
Plantagen
Inserter
Inserter
Posts: 23
Joined: Tue Jul 14, 2020 5:56 pm
Contact:

Re: How does Space Age calculate the rocket capacity of items that don't have weights in the lua file?

Post by Plantagen »

With some help from Google, I now have this script that I can run in the game console and it prints a file with weight and rocket capacity for items. I could not find any errors for those items I remember the actual in-game capacity, so I think it is correct.

Code: Select all

/c local output = "Item Name,Weight (kg),Rocket Capacity\n" for name, item in pairs(prototypes.item) do if item.weight and item.weight > 0 then local weight_kg = item.weight / 1000 local cap = math.floor(1000 / weight_kg) output = output .. string.format('"%s",%.3f,"%s"\n', name, weight_kg, cap) end end helpers.write_file("rocket_weights.csv", output) game.print("Data successfully written to script-output/rocket_weights.csv")
This gives me the data I need for my calculations. I don't need to know how they are calculated (as originally asked in the topic).


Update:

With some more Google help, I got a script that exports the recipes as json too

Code: Select all

/c local list = {} for _, r in pairs(game.player.force.recipes) do table.insert(list, {name = r.name, categories = r.prototype.categories, energy = r.energy, ingredients = r.ingredients, products = r.products}) end helpers.write_file("recipes.json", helpers.table_to_json(list))

Post Reply

Return to “Modding discussion”