Make default wielditem scale a config option

This commit is contained in:
stujones11 2019-04-07 20:44:32 +01:00
parent a11586e718
commit 300f1bfe0d
2 changed files with 8 additions and 3 deletions

@ -17,3 +17,5 @@ to your minetest.conf
Servers can also control how often to verify the wield item of each Servers can also control how often to verify the wield item of each
individual player by setting `wield3d_update_time = 10` (seconds) individual player by setting `wield3d_update_time = 10` (seconds)
The default wielditem scale can now be specified by including `wield3d_scale = 0.25`

@ -28,20 +28,23 @@ wield3d = {}
dofile(minetest.get_modpath(minetest.get_current_modname()).."/location.lua") dofile(minetest.get_modpath(minetest.get_current_modname()).."/location.lua")
local player_wielding = {}
local has_wieldview = minetest.get_modpath("wieldview") local has_wieldview = minetest.get_modpath("wieldview")
local update_time = minetest.settings:get("wield3d_update_time") local update_time = minetest.settings:get("wield3d_update_time")
local verify_time = minetest.settings:get("wield3d_verify_time") local verify_time = minetest.settings:get("wield3d_verify_time")
local player_wielding = {} local wield_scale = minetest.settings:get("wield3d_scale")
update_time = update_time and tonumber(update_time) or 1 update_time = update_time and tonumber(update_time) or 1
verify_time = verify_time and tonumber(verify_time) or 10 verify_time = verify_time and tonumber(verify_time) or 10
wield_scale = verify_time and tonumber(wield_scale) or 0.25 -- default scale
local location = { local location = {
"Arm_Right", -- default bone "Arm_Right", -- default bone
{x=0, y=5.5, z=3}, -- default position {x=0, y=5.5, z=3}, -- default position
{x=-90, y=225, z=90}, -- default rotation {x=-90, y=225, z=90}, -- default rotation
{x=0.25, y=0.25}, -- default scale {x=wield_scale, y=wield_scale},
} }
local function add_wield_entity(player) local function add_wield_entity(player)
if not player or not player:is_player() then if not player or not player:is_player() then
return return