Improve docs and minor code optimisations

This commit is contained in:
stujones11 2019-04-08 19:25:48 +01:00
parent cc34741dde
commit 469c0a09e4
2 changed files with 16 additions and 10 deletions

@ -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.

@ -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