[solved] Decreasing player inventory size?

Post Reply
Polymechanos
New member
Posts: 4
Joined: Thu May 07, 2020 00:38
GitHub: OPolymechanos
In-game: Polymechanos

[solved] Decreasing player inventory size?

by Polymechanos » Post

I'm working on building a game that requires a smaller player inventory size than the standard 32-slot inventory. I've been through the sfinv documentation, but I can't make heads or tails of how to change the number of default player inventory slots.

Does anyone have any suggestions of how to do this? Or where to look?

Or does anyone know of a mod/game that does this? (Nodecore doesn't count--I want inventory beyond the hotbar, just fewer slots.)

Cheers!
Last edited by Polymechanos on Fri Oct 23, 2020 17:46, edited 1 time in total.

User avatar
Nathan.S
Member
Posts: 1035
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: Decreasing player inventory size?

by Nathan.S » Post

Code: Select all

minetest.register_on_joinplayer(function(player)
   player:get_inventory():set_size('main', 8*3)
end
Do note you'll also need to change the formspec, not sure where that is saved normally, but you could always provide a new formspec to use if you wanted.

Code: Select all

player:set_inventory_formspec(player.formspec_here)
player.formspec_here could be replaced with the actual formspec, or just a variable that has the actual formspec defined in it.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

Polymechanos
New member
Posts: 4
Joined: Thu May 07, 2020 00:38
GitHub: OPolymechanos
In-game: Polymechanos

Re: Decreasing player inventory size?

by Polymechanos » Post

Nathan,
Awesome. Thanks! I'll give that a try.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest