forked from VoxeLibre/VoxeLibre
Fix issue with objects/players dying before the effect runs, which won't be applied...
This commit is contained in:
parent
bb5aa33bad
commit
43c4b355ce
|
@ -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
|
-- The radius of 3 is fairly liberal, but anything lower than than will cause
|
||||||
-- arrow to hilariously go through mobs often.
|
-- arrow to hilariously go through mobs often.
|
||||||
-- TODO: Implement an ACTUAL collision detection (engine support needed).
|
-- 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_object
|
||||||
local closest_distance
|
local closest_distance
|
||||||
|
|
||||||
|
@ -419,4 +419,3 @@ end
|
||||||
if minetest.get_modpath("doc_identifier") ~= nil then
|
if minetest.get_modpath("doc_identifier") ~= nil then
|
||||||
doc.sub.identifier.register_object("mcl_bows:arrow_entity", "craftitems", "mcl_bows:arrow")
|
doc.sub.identifier.register_object("mcl_bows:arrow_entity", "craftitems", "mcl_bows:arrow")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ local GRAVITY = 9.81
|
||||||
local BOW_DURABILITY = 385
|
local BOW_DURABILITY = 385
|
||||||
|
|
||||||
-- Charging time in microseconds
|
-- Charging time in microseconds
|
||||||
local BOW_CHARGE_TIME_HALF = 500000 -- bow level 1
|
local BOW_CHARGE_TIME_HALF = 200000 -- bow level 1
|
||||||
local BOW_CHARGE_TIME_FULL = 1000000 -- bow level 2 (full charge)
|
local BOW_CHARGE_TIME_FULL = 500000 -- bow level 2 (full charge)
|
||||||
|
|
||||||
-- Factor to multiply with player speed while player uses bow
|
-- Factor to multiply with player speed while player uses bow
|
||||||
-- This emulates the sneak speed.
|
-- 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)
|
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")
|
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 = 22 --19
|
power = BOW_MAX_SPEED --19
|
||||||
end
|
end
|
||||||
if damage == nil then
|
if damage == nil then
|
||||||
damage = 3
|
damage = 3
|
||||||
|
@ -226,7 +226,7 @@ controls.register_on_hold(function(player, key, time)
|
||||||
local inv = minetest.get_inventory({type="player", name=name})
|
local inv = minetest.get_inventory({type="player", name=name})
|
||||||
local wielditem = player:get_wielded_item()
|
local wielditem = player:get_wielded_item()
|
||||||
local creative = minetest.is_creative_enabled(name)
|
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")
|
wielditem:set_name("mcl_bows:bow_0")
|
||||||
player:set_wielded_item(wielditem)
|
player:set_wielded_item(wielditem)
|
||||||
if minetest.get_modpath("playerphysics") then
|
if minetest.get_modpath("playerphysics") then
|
||||||
|
|
|
@ -365,8 +365,17 @@ function mcl_potions.make_invisible(player, toggle)
|
||||||
|
|
||||||
if not player then return false end
|
if not player then return false end
|
||||||
|
|
||||||
|
local is_player = player:is_player()
|
||||||
|
local entity = player:get_luaentity()
|
||||||
|
|
||||||
if toggle then -- hide player
|
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_properties({visual_size = {x = 0, y = 0}})
|
||||||
player:set_nametag_attributes({color = {a = 0}})
|
player:set_nametag_attributes({color = {a = 0}})
|
||||||
else -- show player
|
else -- show player
|
||||||
|
|
|
@ -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
|
-- The radius of 3 is fairly liberal, but anything lower than than will cause
|
||||||
-- arrow to hilariously go through mobs often.
|
-- arrow to hilariously go through mobs often.
|
||||||
-- TODO: Implement an ACTUAL collision detection (engine support needed).
|
-- 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_object
|
||||||
local closest_distance
|
local closest_distance
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue