From 43c4b355cea0f63da9b699d7584e5d3bc9a80808 Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 20 Jul 2020 19:07:10 -0400 Subject: [PATCH] Fix issue with objects/players dying before the effect runs, which won't be applied... --- mods/ITEMS/mcl_bows/arrow.lua | 3 +-- mods/ITEMS/mcl_bows/bow.lua | 8 ++++---- mods/ITEMS/mcl_potions/functions.lua | 11 ++++++++++- mods/ITEMS/mcl_potions/tipped_arrow.lua | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_bows/arrow.lua b/mods/ITEMS/mcl_bows/arrow.lua index 6c0dae5728..ad65eb1226 100644 --- a/mods/ITEMS/mcl_bows/arrow.lua +++ b/mods/ITEMS/mcl_bows/arrow.lua @@ -159,7 +159,7 @@ ARROW_ENTITY.on_step = function(self, dtime) -- The radius of 3 is fairly liberal, but anything lower than than will cause -- arrow to hilariously go through mobs often. -- TODO: Implement an ACTUAL collision detection (engine support needed). - local objs = minetest.get_objects_inside_radius(pos, 3) + local objs = minetest.get_objects_inside_radius(pos, 1.5) local closest_object local closest_distance @@ -419,4 +419,3 @@ end if minetest.get_modpath("doc_identifier") ~= nil then doc.sub.identifier.register_object("mcl_bows:arrow_entity", "craftitems", "mcl_bows:arrow") end - diff --git a/mods/ITEMS/mcl_bows/bow.lua b/mods/ITEMS/mcl_bows/bow.lua index eb8fbfcf80..e8610bc97c 100644 --- a/mods/ITEMS/mcl_bows/bow.lua +++ b/mods/ITEMS/mcl_bows/bow.lua @@ -10,8 +10,8 @@ local GRAVITY = 9.81 local BOW_DURABILITY = 385 -- Charging time in microseconds -local BOW_CHARGE_TIME_HALF = 500000 -- bow level 1 -local BOW_CHARGE_TIME_FULL = 1000000 -- bow level 2 (full charge) +local BOW_CHARGE_TIME_HALF = 200000 -- bow level 1 +local BOW_CHARGE_TIME_FULL = 500000 -- bow level 2 (full charge) -- Factor to multiply with player speed while player uses bow -- This emulates the sneak speed. @@ -36,7 +36,7 @@ local bow_index = {} mcl_bows.shoot_arrow = function(arrow_item, pos, dir, yaw, shooter, power, damage) local obj = minetest.add_entity({x=pos.x,y=pos.y,z=pos.z}, arrow_item.."_entity") if power == nil then - power = 22 --19 + power = BOW_MAX_SPEED --19 end if damage == nil then damage = 3 @@ -226,7 +226,7 @@ controls.register_on_hold(function(player, key, time) local inv = minetest.get_inventory({type="player", name=name}) local wielditem = player:get_wielded_item() local creative = minetest.is_creative_enabled(name) - if bow_load[name] == nil and wielditem:get_name()=="mcl_bows:bow" and (creative or #get_arrow(player)) then --inv:contains_item("main", "mcl_bows:arrow")) then + if bow_load[name] == nil and wielditem:get_name()=="mcl_bows:bow" and (creative or get_arrow(player)) then --inv:contains_item("main", "mcl_bows:arrow")) then wielditem:set_name("mcl_bows:bow_0") player:set_wielded_item(wielditem) if minetest.get_modpath("playerphysics") then diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 810f072ce6..0df42b813f 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -365,8 +365,17 @@ function mcl_potions.make_invisible(player, toggle) if not player then return false end + local is_player = player:is_player() + local entity = player:get_luaentity() + if toggle then -- hide player - is_invisible[player].old_size = player:get_properties().visual_size + if player:is_player() then + is_invisible[player].old_size = player:get_properties().visual_size + elseif entity then + is_invisible[player].old_size = entity.visual_size + else -- if not a player or entity, do nothing + return + end player:set_properties({visual_size = {x = 0, y = 0}}) player:set_nametag_attributes({color = {a = 0}}) else -- show player diff --git a/mods/ITEMS/mcl_potions/tipped_arrow.lua b/mods/ITEMS/mcl_potions/tipped_arrow.lua index 533cd390fa..d587638c39 100644 --- a/mods/ITEMS/mcl_potions/tipped_arrow.lua +++ b/mods/ITEMS/mcl_potions/tipped_arrow.lua @@ -176,7 +176,7 @@ function mcl_potions.register_arrow(name, desc, color, def) -- The radius of 3 is fairly liberal, but anything lower than than will cause -- arrow to hilariously go through mobs often. -- TODO: Implement an ACTUAL collision detection (engine support needed). - local objs = minetest.get_objects_inside_radius(pos, 3) + local objs = minetest.get_objects_inside_radius(pos, 1.5) local closest_object local closest_distance