Add ability to override visual scale, closes #1

This commit is contained in:
stujones11 2016-11-27 18:13:35 +00:00
parent aa6405f636
commit 81618d564d
2 changed files with 35 additions and 28 deletions

@ -11,6 +11,7 @@ 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
} }
local function add_wield_entity(player) local function add_wield_entity(player)
@ -21,6 +22,10 @@ local function add_wield_entity(player)
local object = minetest.add_entity(pos, "wield3d:wield_entity") local object = minetest.add_entity(pos, "wield3d:wield_entity")
if object then if object then
object:set_attach(player, location[1], location[2], location[3]) object:set_attach(player, location[1], location[2], location[3])
object:set_properties({
textures = {"wield3d:hand"},
visual_size = location[4],
})
player_wielding[name] = {} player_wielding[name] = {}
player_wielding[name].item = "" player_wielding[name].item = ""
player_wielding[name].object = object player_wielding[name].object = object
@ -38,8 +43,6 @@ minetest.register_entity("wield3d:wield_entity", {
physical = false, physical = false,
collisionbox = {-0.125,-0.125,-0.125, 0.125,0.125,0.125}, collisionbox = {-0.125,-0.125,-0.125, 0.125,0.125,0.125},
visual = "wielditem", visual = "wielditem",
visual_size = {x=0.25, y=0.25},
textures = {"wield3d:hand"},
on_activate = function(self, staticdata) on_activate = function(self, staticdata)
if staticdata == "expired" then if staticdata == "expired" then
self.object:remove() self.object:remove()
@ -84,7 +87,10 @@ minetest.register_globalstep(function(dtime)
wield.object:set_attach(player, loc[1], loc[2], loc[3]) wield.object:set_attach(player, loc[1], loc[2], loc[3])
wield.location = {loc[1], loc[2], loc[3]} wield.location = {loc[1], loc[2], loc[3]}
end end
wield.object:set_properties({textures={item}}) wield.object:set_properties({
textures = {item},
visual_size = loc[4],
})
end end
else else
add_wield_entity(player) add_wield_entity(player)

@ -2,34 +2,35 @@
local bone = "Arm_Right" local bone = "Arm_Right"
local pos = {x=0, y=5.5, z=3} local pos = {x=0, y=5.5, z=3}
local scale = {x=0.25, y=0.25}
local rx = -90 local rx = -90
local rz = 90 local rz = 90
wield3d.location = { wield3d.location = {
["default:torch"] = {bone, pos, {x=rx, y=180, z=rz}}, ["default:torch"] = {bone, pos, {x=rx, y=180, z=rz}, scale},
["default:sapling"] = {bone, pos, {x=rx, y=180, z=rz}}, ["default:sapling"] = {bone, pos, {x=rx, y=180, z=rz}, scale},
["flowers:dandelion_white"] = {bone, pos, {x=rx, y=180, z=rz}}, ["flowers:dandelion_white"] = {bone, pos, {x=rx, y=180, z=rz}, scale},
["flowers:dandelion_yellow"] = {bone, pos, {x=rx, y=180, z=rz}}, ["flowers:dandelion_yellow"] = {bone, pos, {x=rx, y=180, z=rz}, scale},
["flowers:geranium"] = {bone, pos, {x=rx, y=180, z=rz}}, ["flowers:geranium"] = {bone, pos, {x=rx, y=180, z=rz}, scale},
["flowers:rose"] = {bone, pos, {x=rx, y=180, z=rz}}, ["flowers:rose"] = {bone, pos, {x=rx, y=180, z=rz}, scale},
["flowers:tulip"] = {bone, pos, {x=rx, y=180, z=rz}}, ["flowers:tulip"] = {bone, pos, {x=rx, y=180, z=rz}, scale},
["flowers:viola"] = {bone, pos, {x=rx, y=180, z=rz}}, ["flowers:viola"] = {bone, pos, {x=rx, y=180, z=rz}, scale},
["default:shovel_wood"] = {bone, pos, {x=rx, y=135, z=rz}}, ["default:shovel_wood"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["default:shovel_stone"] = {bone, pos, {x=rx, y=135, z=rz}}, ["default:shovel_stone"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["default:shovel_steel"] = {bone, pos, {x=rx, y=135, z=rz}}, ["default:shovel_steel"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["default:shovel_bronze"] = {bone, pos, {x=rx, y=135, z=rz}}, ["default:shovel_bronze"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["default:shovel_mese"] = {bone, pos, {x=rx, y=135, z=rz}}, ["default:shovel_mese"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["default:shovel_diamond"] = {bone, pos, {x=rx, y=135, z=rz}}, ["default:shovel_diamond"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["bucket:bucket_empty"] = {bone, pos, {x=rx, y=135, z=rz}}, ["bucket:bucket_empty"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["bucket:bucket_water"] = {bone, pos, {x=rx, y=135, z=rz}}, ["bucket:bucket_water"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["bucket:bucket_lava"] = {bone, pos, {x=rx, y=135, z=rz}}, ["bucket:bucket_lava"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["screwdriver:screwdriver"] = {bone, pos, {x=rx, y=135, z=rz}}, ["screwdriver:screwdriver"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["screwdriver:screwdriver1"] = {bone, pos, {x=rx, y=135, z=rz}}, ["screwdriver:screwdriver1"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["screwdriver:screwdriver2"] = {bone, pos, {x=rx, y=135, z=rz}}, ["screwdriver:screwdriver2"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["screwdriver:screwdriver3"] = {bone, pos, {x=rx, y=135, z=rz}}, ["screwdriver:screwdriver3"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["screwdriver:screwdriver4"] = {bone, pos, {x=rx, y=135, z=rz}}, ["screwdriver:screwdriver4"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["vessels:glass_bottle"] = {bone, pos, {x=rx, y=135, z=rz}}, ["vessels:glass_bottle"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["vessels:drinking_glass"] = {bone, pos, {x=rx, y=135, z=rz}}, ["vessels:drinking_glass"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
["vessels:steel_bottle"] = {bone, pos, {x=rx, y=135, z=rz}}, ["vessels:steel_bottle"] = {bone, pos, {x=rx, y=135, z=rz}, scale},
} }