Player inventory callbacks

Player inventory callbacks

Postby Skulls » Sat Mar 23, 2019 2:12 am

For player inventories are there callbacks like the detached inventory on_take, on_put or do you need to parse from the receive fields? I'm trying to figure out a way to detect when an item was placed in a slot.
Skulls
Member
 
Posts: 114
Joined: Thu Dec 21, 2017 5:41 pm
In-game: Skulls

Re: Player inventory callbacks

Postby Skulls » Sun Mar 24, 2019 3:24 am

Looks like callbacks for the player inventory (non-detached or node) are

minetest.register_allow_player_inventory_action(function(player, action, inventory, inventory_info)
minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info))

As it says in the lua_api.txt a "move" action will have the item in the "from_list" when it is being checked for allowability, but the "to_list" when it is being placed. This small detail could cause several minutes (or hours... in my case) of frustration because the ItemStack seems to be fine when checked but then nil when placed.
Skulls
Member
 
Posts: 114
Joined: Thu Dec 21, 2017 5:41 pm
In-game: Skulls



Return to Modding Discussion



Who is online

Users browsing this forum: Bing Bot [Bot] and 0 guests