Locomotive weight shrinks

Place to get help with not working mods / modding interface.
User avatar
zebez
Burner Inserter
Burner Inserter
Posts: 12
Joined: Sun Jul 03, 2016 9:53 am
Contact:

Locomotive weight shrinks

Post by zebez »

Hello, im new to modding this game and learning. I have simple mod that changes all recipes to be allowed to get boosted by productivty, but I have found a sideeffect I don't understand.

This single line in a data-updates.lua makes the locomotive weigh only 66.6 kg in the rocket, normally it weighs 200 kg, exactly 3 times lower. Why is this?

Code: Select all

data.raw.recipe["locomotive"].allow_productivity = true
10-26-2024, 22-30-35.png
10-26-2024, 22-30-35.png (13.2 KiB) Viewed 202 times
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3719
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Locomotive weight shrinks

Post by DaveMcW »

If an item does not allow productivity, you get one stack per rocket.

If an item does allow productivity, the rocket weight is the weight of all its ingredients.

You can override this by setting ItemPrototype.weight. In your case you would want to set:

Code: Select all

data.raw['item-with-entity-data']['locomotive'].weight = 1 * tons / data.raw['item-with-entity-data']['locomotive'].stack_size
Last edited by DaveMcW on Mon Oct 28, 2024 2:11 pm, edited 1 time in total.
User avatar
zebez
Burner Inserter
Burner Inserter
Posts: 12
Joined: Sun Jul 03, 2016 9:53 am
Contact:

Re: Locomotive weight shrinks

Post by zebez »

Ah thank you. This is what I came up with, it feels better that a rocket can't carry a locomotive at all. I think I was trying to change the weight on the entity first but it did nothing for the rocket.

Code: Select all

data.raw['item-with-entity-data']['car'].weight = 700 * kg
data.raw['item-with-entity-data']['tank'].weight = 20 * tons
data.raw['item-with-entity-data']['locomotive'].weight = 2 * tons
data.raw['item-with-entity-data']['cargo-wagon'].weight = 1 * tons
data.raw['item-with-entity-data']['fluid-wagon'].weight = 1 * tons
data.raw['item-with-entity-data']['artillery-wagon'].weight = 4 * tons
Post Reply

Return to “Modding help”