First time modder here. I want a mod that increases the players inventory size when you research a certain technology. So far I have managed to make the technology and icons and everything but I can't get the actual logic to work. Where/how should I do this part?
I've checked how other mods increase size and gone through the lua api and found this:
character_inventory_slots_bonus :: uint [RW] the number of additional inventory slots the character main inventory has. -- Info from the LUA api
inventory_size_bonus = 10 -- Used by armors / power armors to increase inventory size
data.raw["player"]["player"].inventory_size = 120 -- Used by LargerInventory mod to set size to 120 at game start.
I'm not sure where/how to use these though, the mod either crashes when researching it or crashes on startup even when I put these rows in the control.lua file or directly in the technology.lua file.
I have a control.lua that triggers on the research done:
Code: Select all
script.on_event(defines.events.on_research_finished, function(event)
local research = event.research
local force = research.force
local name = research.name
if name == "larger-inventory-size-1" then
--something here?
end
end
)
And the technology:
Code: Select all
{
type = "technology",
name="larger-inventory-size-1",
icon = "__LargerInventoryResearch__/larger-inventory-size.png",
icon_size = 128,
effects =
{
{
--Something here?
}
},
unit =
{
count = 1,
ingredients =
{
{"science-pack-1", 1}
},
time = 5
},
order="c-k-f-a",
},
Many thanks in advance for any help on how to solve this!