mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-19 01:21:05 +01:00
Power
This commit is contained in:
parent
cdafb1a07e
commit
bbc6db489e
2 changed files with 9 additions and 3 deletions
|
@ -304,7 +304,7 @@ mcl_enchanting.enchantments.mending = {
|
|||
requires_tool = true,
|
||||
}
|
||||
|
||||
-- unimplemented
|
||||
-- implemented in mcl_bows
|
||||
mcl_enchanting.enchantments.power = {
|
||||
name = "Power",
|
||||
max_level = 5,
|
||||
|
|
|
@ -33,7 +33,7 @@ local bow_load = {}
|
|||
-- Another player table, this one stores the wield index of the bow being charged
|
||||
local bow_index = {}
|
||||
|
||||
mcl_bows.shoot_arrow = function(arrow_item, pos, dir, yaw, shooter, power, damage, is_critical)
|
||||
mcl_bows.shoot_arrow = function(arrow_item, pos, dir, yaw, shooter, power, damage, is_critical, bow_stack)
|
||||
local obj = minetest.add_entity({x=pos.x,y=pos.y,z=pos.z}, arrow_item.."_entity")
|
||||
if power == nil then
|
||||
power = BOW_MAX_SPEED --19
|
||||
|
@ -41,6 +41,12 @@ mcl_bows.shoot_arrow = function(arrow_item, pos, dir, yaw, shooter, power, damag
|
|||
if damage == nil then
|
||||
damage = 3
|
||||
end
|
||||
if bow_stack then
|
||||
local power_level = mcl_enchanting.get_enchantment(bow_stack, "power")
|
||||
if power_level > 0 then
|
||||
damage = damage + (power_level + 1) / 4
|
||||
end
|
||||
end
|
||||
obj:set_velocity({x=dir.x*power, y=dir.y*power, z=dir.z*power})
|
||||
obj:set_acceleration({x=0, y=-GRAVITY, z=0})
|
||||
obj:set_yaw(yaw-math.pi/2)
|
||||
|
@ -102,7 +108,7 @@ local player_shoot_arrow = function(itemstack, player, power, damage, is_critica
|
|||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_horizontal()
|
||||
|
||||
mcl_bows.shoot_arrow(arrow_itemstring, {x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, dir, yaw, player, power, damage, is_critical)
|
||||
mcl_bows.shoot_arrow(arrow_itemstring, {x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, dir, yaw, player, power, damage, is_critical, player:get_wielded_item())
|
||||
return true
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue