Page 1 of 1

Locomotive weight shrinks

Posted: Sat Oct 26, 2024 8:37 pm
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 267 times

Re: Locomotive weight shrinks

Posted: Sat Oct 26, 2024 10:48 pm
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

Re: Locomotive weight shrinks

Posted: Sun Oct 27, 2024 8:08 am
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