mirror of
https://github.com/stujones11/wield3d.git
synced 2024-12-28 08:47:27 +01:00
Improve docs and minor code optimisations
This commit is contained in:
parent
cc34741dde
commit
469c0a09e4
@ -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)
|
individual player by setting `wield3d_verify_time = 10` (seconds)
|
||||||
|
|
||||||
The default wielditem scale can now be specified by including `wield3d_scale = 0.25`
|
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.
|
||||||
|
19
init.lua
19
init.lua
@ -60,9 +60,7 @@ local function add_wield_entity(player)
|
|||||||
textures = {"wield3d:hand"},
|
textures = {"wield3d:hand"},
|
||||||
visual_size = location[4],
|
visual_size = location[4],
|
||||||
})
|
})
|
||||||
player_wielding[name] = {}
|
player_wielding[name] = {item="", location=location}
|
||||||
player_wielding[name].item = ""
|
|
||||||
player_wielding[name].location = location
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -158,13 +156,11 @@ local function verify_wielditems()
|
|||||||
table.insert(names, name)
|
table.insert(names, name)
|
||||||
end
|
end
|
||||||
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)
|
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
|
end
|
||||||
-- only deal with one player per server step
|
-- only deal with one player per server step
|
||||||
local name = player_iter()
|
local name = player_iter()
|
||||||
@ -178,8 +174,11 @@ local function verify_wielditems()
|
|||||||
for _, object in pairs(objects) do
|
for _, object in pairs(objects) do
|
||||||
local entity = object:get_luaentity()
|
local entity = object:get_luaentity()
|
||||||
if entity and entity.wielder == name then
|
if entity and entity.wielder == name then
|
||||||
|
if wielding then
|
||||||
|
-- remove duplicates
|
||||||
|
object:remove()
|
||||||
|
end
|
||||||
wielding = true
|
wielding = true
|
||||||
break
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not wielding then
|
if not wielding then
|
||||||
|
Loading…
Reference in New Issue
Block a user