diff --git a/README.md b/README.md index d1c6389..442a41b 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,10 @@ Servers can also control how often to verify the wield item of each individual player by setting `wield3d_verify_time = 10` (seconds) The default wielditem scale can now be specified by including `wield3d_scale = 0.25` + + +### Known Issues + +Items occasionally disappear when viewing in 3rd person. This is a minetest engine bug and not the fault of the mod, turning 3rd person off then back on restores the view. + +Wield item switches direction at certain animation key-frames. I have yet to identify the true cause of this issue but a specially adapted version of the player model can be found [here](https://github.com/stujones11/minetest-models/tree/master/character/sam_viewer) that attempts to work around the problem. diff --git a/init.lua b/init.lua index dd75ad2..ffa808f 100644 --- a/init.lua +++ b/init.lua @@ -60,9 +60,7 @@ local function add_wield_entity(player) textures = {"wield3d:hand"}, visual_size = location[4], }) - player_wielding[name] = {} - player_wielding[name].item = "" - player_wielding[name].location = location + player_wielding[name] = {item="", location=location} end end end @@ -158,13 +156,11 @@ local function verify_wielditems() table.insert(names, name) end end - -- clean-up player_wielding table - for name, _ in pairs(player_wielding) do - if not tmp[name] then - player_wielding[name] = nil - end - end player_iter = table_iter(names) + -- clean-up player_wielding table + for name, wield in pairs(player_wielding) do + player_wielding[name] = tmp[name] and wield + end end -- only deal with one player per server step local name = player_iter() @@ -178,8 +174,11 @@ local function verify_wielditems() for _, object in pairs(objects) do local entity = object:get_luaentity() if entity and entity.wielder == name then + if wielding then + -- remove duplicates + object:remove() + end wielding = true - break end end if not wielding then