mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 15:23:48 +01:00
Fix wielditem change
This commit is contained in:
parent
cb1192d9d8
commit
47a927005b
@ -427,11 +427,12 @@ end)
|
|||||||
minetest.register_globalstep(function()
|
minetest.register_globalstep(function()
|
||||||
for _, player in pairs(minetest.get_connected_players()) do
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
local item, index = player:get_wielded_item(), player:get_wield_index()
|
local item, index = player:get_wielded_item(), player:get_wield_index()
|
||||||
local previous_item, previous_index = player.wield.item, player.wield.index
|
local playerdata = players[player:get_player_name()]
|
||||||
|
local previous_item, previous_index = playerdata.wield.item, playerdata.wield.index
|
||||||
if item:get_name() ~= previous_item or index ~= previous_index then
|
if item:get_name() ~= previous_item or index ~= previous_index then
|
||||||
player.wield.item = item
|
playerdata.wield.item = item
|
||||||
player.wield.index = index
|
playerdata.wield.index = index
|
||||||
modlib.table.icall(player, previous_item, previous_index, item)
|
modlib.table.icall(registered_on_wielditem_changes, player, previous_item, previous_index, item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user