upgrade inventory size via research.

Place to get help with not working mods / modding interface.
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

upgrade inventory size via research.

Post by bobingabout »

what if I wanted to add a few levels of research that could give +10 or +20 per level to your inventory space, is there a way to do that?

for example, I can just add more

Code: Select all

    effects =
    {
      {
        type = "num-quick-bars",
        modifier = 1
      }
    },
and

Code: Select all

    effects =
    {
      {
        type = "character-logistic-slots",
        modifier = 5
      }
    },
to add more of the apropriate item, but I can't figure out how to add more inventory space via research.

but I can double the inventory space with the following line:

Code: Select all

data.raw["player"]["player"].inventory_size = 120 -- up from 60

Any ideas?
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: upgrade inventory size via research.

Post by FreeER »

The only technology modifiers that are available at this time are specified on the wiki, here. There is not one for the player's inventory, you'd have to make a new player character and then 'swap' the characters from the original player to the new (improved) character...there are a few drawbacks to this, first it's annoying ;) You have to manually move the player's inventory from the old to the new, which leads to a problem. There is no method to copy the inventory of one entity to another (that I know of), which means you have to get the names of the items in the original entity's inventory and insert them into the new entity's inventory, not a major problem there but annoying, except that you can not access the inventory of modular armor (basic or power), so you can not move any modular armor from one entity to another and keep the equiment that is inside because there is no way to find out what is inside the modular armor...You'd have to instead check for when that research is done, then prompt the player to remove any modular armor (put it into a chest) and then after the player notifies the code that they have done so (via console remote.call, aka script interface, or gui, or any other method you decide to code) you could perform the swap of the rest of their inventory. annoying, but possible.

Even more annoying was if you wanted to make multiple changes based on tech (so that any combination could be possible at any time)...if you wanted to have increased inventory and increased health tech, you'd need 3 extra player characters (1*2+1), one with inventory one with health and one with both. If you wanted to then add an increased health regen speed you have 4 more (a new one with just regen, inventory+regen, health+regen, health+inventory+regen) for a total of 7 extra players prototypes (3*2+1)... so for each new tech you double however many you had previously (assuming that the original player counts as 0) and add 1 (the tech itself)... 2*#old+1=#total (edit: hm... I can't seem to think of the proper formula for x tech = number of additional prototypes..., some variation of n!/r!(n-k)! but... since you can choose all of n (k = n) that'd be n!/r! and r is the number of possibilities which is n!, so...(n!)!? that's not right lol, never was good at combinations and permutations)

I really hope the devs eventually add dynamic changes of prototypes globally (aka you can change any field of a prototype during the game, and all entities within the world and new ones (of that prototype) would be updated with those changes)...likely a decent amount of work to make that possible though.
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: upgrade inventory size via research.

Post by bobingabout »

That looks like a very annoying solution indeed...

I think I'll pass on it for now, and perhaps ask the devs if it is possible to add a research type to increase inventory space.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
Post Reply

Return to “Modding help”