Accessing player's armor inventory

Post Reply
User avatar
MisterE
Member
Posts: 694
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Accessing player's armor inventory

by MisterE » Post

I just had a problem finding and accessing a player's armor inventory while using the mods 3d_armor and unified inventory.

A mod that I was debugging was trying to check if the armor inventory was empty with:

Code: Select all

player_inv:is_empty("armor")
that wasnt working, in fact, there is no inventory list called 'armor'.

It turns out that the player's armor inventory is a detached inventory. It can be accessed with:

Code: Select all

			local player_name = player:get_player_name()
			local player_armor_inv = minetest.get_inventory({type="detached", name=player_name.."_armor"})

Just thought I would throw this out there, in case anyone else runs into this problem.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests