[SOLVED] Changing stack_size for a units inventory

Place to get help with not working mods / modding interface.
Chymor
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Jul 02, 2016 5:34 pm
Contact:

[SOLVED] Changing stack_size for a units inventory

Post by Chymor »

Hi

I'm new to modding but I really like factorio and thought I'd make an attempt at changing the combat balance a bit.

As a part of this i want to drastically reduce the amount of ammo a gun turret can store. This would make them dependent on a logistics supply.
I realize this can be done by can be done by reducing the stack_size for bullets, but I don't want to reduce the amount chests can hold.I have searched through the files, but the inventory and stack_sizes only seems to appear on entities, so I'm guessing the inventory and stack_size logic is coded in c++.

Is it possible to do this with the modding api? Or through some other workaround?
Last edited by Chymor on Sun Sep 04, 2016 1:10 pm, edited 1 time in total.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Changing stack_size for a units inventory

Post by Nexela »

To change the maginze_size or stack_size you would need to edit the item prototype in the data.lua stage. There is not a way to have separate stack_sizes.

Some things you could do. Change the magazine_size. This will cause the ammo to run out faster. Possibly even reduce the recipe cost to accommodate it. Keep in mind this will affect the player's ammo too.

Another thing you could do would be to create a new ammo type for turrets that would have different stack sizes and magazine sizes

To change the magazine size in data.lua

data.raw.item["firearm-magazine"].magazine_size=5

Don't forget to do the same thing for the piercing rounds too.
Chymor
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Jul 02, 2016 5:34 pm
Contact:

Re: Changing stack_size for a units inventory

Post by Chymor »

Thanks for the reply.

I think "turret-only" bullets is the best way forward. If they have slightly different properties it even makes a sense.
Post Reply

Return to “Modding help”