forked from VoxeLibre/VoxeLibre
Merge pull request 'Add support for MultiShot enchantment' (#12) from Code-Sploit/MineClone2:master into master
Reviewed-on: #12
This commit is contained in:
commit
cbe5e618a3
|
@ -93,9 +93,17 @@ local player_shoot_arrow = function(itemstack, player, power, damage, is_critica
|
|||
local playerpos = player:get_pos()
|
||||
local dir = player:get_look_dir()
|
||||
local yaw = player:get_look_horizontal()
|
||||
local has_multishot_enchantment = mcl_enchanting.has_enchantment(player:get_wielded_item(), "multishot")
|
||||
|
||||
minetest.sound_play("mcl_bows_crossbow_shoot", {pos=playerpos, max_hear_distance=16}, true)
|
||||
mcl_bows.shoot_arrow("mcl_bows:arrow", {x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, dir, yaw, player, power, damage, is_critical, player:get_wielded_item(), not infinity_used)
|
||||
if has_multishot_enchantment then
|
||||
for times_shot=0,2 do
|
||||
mcl_bows.shoot_arrow("mcl_bows:arrow", {x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, dir, yaw, player, power, damage, is_critical, player:get_wielded_item(), not infinity_used)
|
||||
end
|
||||
else
|
||||
mcl_bows.shoot_arrow("mcl_bows:arrow", {x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, dir, yaw, player, power, damage, is_critical, player:get_wielded_item(), not infinity_used)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -244,6 +252,7 @@ controls.register_on_press(function(player, key)
|
|||
local speed, damage
|
||||
local p_load = bow_load[player:get_player_name()]
|
||||
local charge
|
||||
|
||||
-- Type sanity check
|
||||
if type(p_load) == "number" then
|
||||
charge = minetest.get_us_time() - p_load
|
||||
|
@ -255,7 +264,9 @@ controls.register_on_press(function(player, key)
|
|||
end
|
||||
charge = 1000000
|
||||
|
||||
local charge_ratio = charge / BOW_CHARGE_TIME_FULL
|
||||
local charge_ratio
|
||||
|
||||
charge_ratio = charge / BOW_CHARGE_TIME_FULL
|
||||
charge_ratio = math.max(math.min(charge_ratio, 1), 0)
|
||||
|
||||
-- Calculate damage and speed
|
||||
|
@ -428,4 +439,4 @@ if minetest.get_modpath("doc") then
|
|||
doc.add_entry_alias("tools", "mcl_bows:crossbow", "tools", "mcl_bows:crossbow_0")
|
||||
doc.add_entry_alias("tools", "mcl_bows:crossbow", "tools", "mcl_bows:crossbow_1")
|
||||
doc.add_entry_alias("tools", "mcl_bows:crossbow", "tools", "mcl_bows:crossbow_2")
|
||||
end
|
||||
end
|
|
@ -482,7 +482,7 @@ mcl_enchanting.enchantments.mending = {
|
|||
}
|
||||
|
||||
-- requires missing MineClone2 feature
|
||||
--[[mcl_enchanting.enchantments.multishot = {
|
||||
mcl_enchanting.enchantments.multishot = {
|
||||
name = S("Multishot"),
|
||||
max_level = 1,
|
||||
primary = {crossbow = true},
|
||||
|
@ -498,7 +498,7 @@ mcl_enchanting.enchantments.mending = {
|
|||
power_range_table = {{20, 50}},
|
||||
inv_combat_tab = true,
|
||||
inv_tool_tab = false,
|
||||
}]]--
|
||||
}
|
||||
|
||||
-- requires missing MineClone2 feature
|
||||
--[[mcl_enchanting.enchantments.piercing = {
|
||||
|
|
Loading…
Reference in New Issue