0
0
Fork 0

More flexible wield rotation determination

This commit is contained in:
Lizzy Fleckenstein 2021-02-18 09:28:12 +01:00
parent 69959fe816
commit 9b349a1684
6 changed files with 34 additions and 4 deletions

View File

@ -98,10 +98,11 @@ armor.update_player_visuals = function(self, player)
return
end
local player_holding = player:get_wielded_item():get_name()
if string.find(player_holding,"mcl_tools:") or player_holding == "mcl_mobitems:bone" or player_holding == "mcl_fishing:fishing_rod" then
local wielditem = player:get_wielded_item()
local def = wielditem:get_definition()
if def and def._mcl_toollike_wield then
player:set_bone_position("Wield_Item", vector.new(0,3.9,1.3), vector.new(90,0,0))
elseif string.find(player_holding, "mcl_bows:bow") then
elseif string.find(wielditem:get_name(), "mcl_bows:bow") then
player:set_bone_position("Wield_Item", vector.new(.5,4.5,-1.6), vector.new(90,0,20))
else
player:set_bone_position("Wield_Item", vector.new(-1.5,4.9,1.8), vector.new(135,0,90))

View File

@ -13,6 +13,7 @@ minetest.register_craftitem("mcl_core:stick", {
inventory_image = "default_stick.png",
stack_max = 64,
groups = { craftitem=1, stick=1 },
_mcl_toollike_wield = true,
})
minetest.register_craftitem("mcl_core:paper", {

View File

@ -77,6 +77,7 @@ minetest.register_tool("mcl_farming:hoe_wood", {
punch_attack_uses = uses.wood,
},
_repair_material = "group:wood",
_mcl_toollike_wield = true,
})
minetest.register_craft({
@ -116,6 +117,7 @@ minetest.register_tool("mcl_farming:hoe_stone", {
punch_attack_uses = uses.stone,
},
_repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true,
})
minetest.register_craft({
@ -151,6 +153,7 @@ minetest.register_tool("mcl_farming:hoe_iron", {
punch_attack_uses = uses.iron,
},
_repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true,
})
minetest.register_craft({
@ -192,6 +195,7 @@ minetest.register_tool("mcl_farming:hoe_gold", {
punch_attack_uses = uses.gold,
},
_repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true,
})
minetest.register_craft({
@ -235,6 +239,7 @@ minetest.register_tool("mcl_farming:hoe_diamond", {
punch_attack_uses = uses.diamond,
},
_repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true,
})
minetest.register_craft({

View File

@ -348,6 +348,7 @@ minetest.register_tool("mcl_fishing:fishing_rod", {
on_secondary_use = fish,
sound = { breaks = "default_tool_breaks" },
_mcl_uses = 65,
_mcl_toollike_wield = true,
})
minetest.register_craft({

View File

@ -178,6 +178,7 @@ minetest.register_craftitem("mcl_mobitems:bone", {
inventory_image = "mcl_mobitems_bone.png",
stack_max = 64,
groups = { craftitem=1 },
_mcl_toollike_wield = true,
})
minetest.register_craftitem("mcl_mobitems:string",{
@ -323,9 +324,9 @@ minetest.register_tool("mcl_mobitems:carrot_on_a_stick", {
wield_image = "mcl_mobitems_carrot_on_a_stick.png",
inventory_image = "mcl_mobitems_carrot_on_a_stick.png",
groups = { transport = 1 },
_mcl_toollike_wield = true,
})
-----------
-- Crafting
-----------

View File

@ -94,6 +94,7 @@ minetest.register_tool("mcl_tools:pick_wood", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "group:wood",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:pick_stone", {
description = S("Stone Pickaxe"),
@ -113,6 +114,7 @@ minetest.register_tool("mcl_tools:pick_stone", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:pick_iron", {
description = S("Iron Pickaxe"),
@ -132,6 +134,7 @@ minetest.register_tool("mcl_tools:pick_iron", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:pick_gold", {
description = S("Golden Pickaxe"),
@ -151,6 +154,7 @@ minetest.register_tool("mcl_tools:pick_gold", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:pick_diamond", {
description = S("Diamond Pickaxe"),
@ -170,6 +174,7 @@ minetest.register_tool("mcl_tools:pick_diamond", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true,
})
local get_shovel_dig_group = function(itemstack)
@ -292,6 +297,7 @@ minetest.register_tool("mcl_tools:shovel_wood", {
on_place = make_grass_path,
sound = { breaks = "default_tool_breaks" },
_repair_material = "group:wood",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:shovel_stone", {
description = S("Stone Shovel"),
@ -312,6 +318,7 @@ minetest.register_tool("mcl_tools:shovel_stone", {
on_place = make_grass_path,
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:shovel_iron", {
description = S("Iron Shovel"),
@ -332,6 +339,7 @@ minetest.register_tool("mcl_tools:shovel_iron", {
on_place = make_grass_path,
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:shovel_gold", {
description = S("Golden Shovel"),
@ -352,6 +360,7 @@ minetest.register_tool("mcl_tools:shovel_gold", {
on_place = make_grass_path,
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:shovel_diamond", {
description = S("Diamond Shovel"),
@ -372,6 +381,7 @@ minetest.register_tool("mcl_tools:shovel_diamond", {
on_place = make_grass_path,
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true,
})
-- Axes
@ -393,6 +403,7 @@ minetest.register_tool("mcl_tools:axe_wood", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "group:wood",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:axe_stone", {
description = S("Stone Axe"),
@ -411,6 +422,7 @@ minetest.register_tool("mcl_tools:axe_stone", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:axe_iron", {
description = S("Iron Axe"),
@ -430,6 +442,7 @@ minetest.register_tool("mcl_tools:axe_iron", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:axe_gold", {
description = S("Golden Axe"),
@ -448,6 +461,7 @@ minetest.register_tool("mcl_tools:axe_gold", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:axe_diamond", {
description = S("Diamond Axe"),
@ -466,6 +480,7 @@ minetest.register_tool("mcl_tools:axe_diamond", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true,
})
-- Swords
@ -488,6 +503,7 @@ minetest.register_tool("mcl_tools:sword_wood", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "group:wood",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:sword_stone", {
description = S("Stone Sword"),
@ -507,6 +523,7 @@ minetest.register_tool("mcl_tools:sword_stone", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:sword_iron", {
description = S("Iron Sword"),
@ -526,6 +543,7 @@ minetest.register_tool("mcl_tools:sword_iron", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:sword_gold", {
description = S("Golden Sword"),
@ -545,6 +563,7 @@ minetest.register_tool("mcl_tools:sword_gold", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true,
})
minetest.register_tool("mcl_tools:sword_diamond", {
description = S("Diamond Sword"),
@ -564,6 +583,7 @@ minetest.register_tool("mcl_tools:sword_diamond", {
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true,
})
--Shears
@ -585,6 +605,7 @@ minetest.register_tool("mcl_tools:shears", {
},
on_place = carve_pumpkin,
sound = { breaks = "default_tool_breaks" },
_mcl_toollike_wield = true,
})