master #5

Merged
epCode merged 255 commits from VoxeLibre/VoxeLibre:master into master 2021-02-02 23:20:01 +01:00
2 changed files with 8 additions and 4 deletions
Showing only changes of commit 248272a128 - Show all commits

View File

@ -161,7 +161,7 @@ ARROW_ENTITY.on_step = function(self, dtime)
local objects = minetest.get_objects_inside_radius(pos, 1) local objects = minetest.get_objects_inside_radius(pos, 1)
for _,obj in ipairs(objects) do for _,obj in ipairs(objects) do
if obj:is_player() then if obj:is_player() then
if not minetest.is_creative_enabled(obj:get_player_name()) then if self._collectable and not minetest.is_creative_enabled(obj:get_player_name()) then
if obj:get_inventory():room_for_item("main", "mcl_bows:arrow") then if obj:get_inventory():room_for_item("main", "mcl_bows:arrow") then
obj:get_inventory():add_item("main", "mcl_bows:arrow") obj:get_inventory():add_item("main", "mcl_bows:arrow")
minetest.sound_play("item_drop_pickup", { minetest.sound_play("item_drop_pickup", {

View File

@ -33,7 +33,7 @@ local bow_load = {}
-- Another player table, this one stores the wield index of the bow being charged -- Another player table, this one stores the wield index of the bow being charged
local bow_index = {} local bow_index = {}
mcl_bows.shoot_arrow = function(arrow_item, pos, dir, yaw, shooter, power, damage, is_critical, bow_stack) mcl_bows.shoot_arrow = function(arrow_item, pos, dir, yaw, shooter, power, damage, is_critical, bow_stack, collectable)
local obj = minetest.add_entity({x=pos.x,y=pos.y,z=pos.z}, arrow_item.."_entity") local obj = minetest.add_entity({x=pos.x,y=pos.y,z=pos.z}, arrow_item.."_entity")
if power == nil then if power == nil then
power = BOW_MAX_SPEED --19 power = BOW_MAX_SPEED --19
@ -60,6 +60,7 @@ mcl_bows.shoot_arrow = function(arrow_item, pos, dir, yaw, shooter, power, damag
le._is_critical = is_critical le._is_critical = is_critical
le._startpos = pos le._startpos = pos
le._knockback = knockback le._knockback = knockback
le._collectable = collectable
minetest.sound_play("mcl_bows_bow_shoot", {pos=pos, max_hear_distance=16}, true) minetest.sound_play("mcl_bows_bow_shoot", {pos=pos, max_hear_distance=16}, true)
if shooter ~= nil and shooter:is_player() then if shooter ~= nil and shooter:is_player() then
if obj:get_luaentity().player == "" then if obj:get_luaentity().player == "" then
@ -88,6 +89,7 @@ local player_shoot_arrow = function(itemstack, player, power, damage, is_critica
local arrow_stack, arrow_stack_id = get_arrow(player) local arrow_stack, arrow_stack_id = get_arrow(player)
local arrow_itemstring local arrow_itemstring
local has_infinity_enchantment = mcl_enchanting.has_enchantment(player:get_wielded_item(), "infinity") local has_infinity_enchantment = mcl_enchanting.has_enchantment(player:get_wielded_item(), "infinity")
local infinity_used = false
if minetest.is_creative_enabled(player:get_player_name()) then if minetest.is_creative_enabled(player:get_player_name()) then
if arrow_stack then if arrow_stack then
@ -100,7 +102,9 @@ local player_shoot_arrow = function(itemstack, player, power, damage, is_critica
return false return false
end end
arrow_itemstring = arrow_stack:get_name() arrow_itemstring = arrow_stack:get_name()
if not has_infinity_enchantment or minetest.get_item_group(arrow_itemstring, "ammo_bow_regular") == 0 then if has_infinity_enchantment and minetest.get_item_group(arrow_itemstring, "ammo_bow_regular") > 0 then
infinity_used = true
else
arrow_stack:take_item() arrow_stack:take_item()
end end
local inv = player:get_inventory() local inv = player:get_inventory()
@ -113,7 +117,7 @@ local player_shoot_arrow = function(itemstack, player, power, damage, is_critica
local dir = player:get_look_dir() local dir = player:get_look_dir()
local yaw = player:get_look_horizontal() 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, player:get_wielded_item()) 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(), not infinity_used)
return true return true
end end