Kilarin wrote:get_inventory():get_width(player
4aiman wrote:get_inventory():get_size(player
4aiman wrote:get_inventory():get_size(player
Krock wrote:When you try to get the item outside of the itembar length, then it just takes it from the next inventory slot.
Kilarin wrote:Krock wrote:When you try to get the item outside of the itembar length, then it just takes it from the next inventory slot.
Yep. I don't need it for explorertools or bridgetool. I'm working on a variation of the compass mod and I would like to know if the compass is in the active inventory or not. When you take the compass out of the active slots, there is no need to be wasting cpu updating it. (Also, I turn off a hud update when the compass is no longer in the active slots)
Right now I've just got it hard coded to 8. But it would sure be nice to be able to determine what the inventory width really is, just in case another mod has modified it. I could do the total inventory width/4, but that isn't safe because a mod could always add or subtract a row.
minetest.register_globalstep(function(dtime)
for _, player in pairs(minetest.get_connected_players()) do
if player:get_wielded_item():get_name() == "youritem" then
update()
end
end
end)
4aiman wrote: "active slots", not "active slot". Otherwise helpful ;)
RealBadAngel wrote:Propably you need something like this:
local hotbar = inv:get_list("main")
for i = 1, 8 doUsers browsing this forum: No registered users and 7 guests