1
0
Fork 0

Correct potions hitting thrower.

objects
Brandon 2020-07-12 12:16:26 -04:00
parent 9602e0d8af
commit 4a654fccc4
3 changed files with 5 additions and 3 deletions

View File

@ -352,7 +352,7 @@ function mcl_potions.is_obj_hit(self, pos)
if entity._cmi_is_mob then return true end
elseif object:is_player() then
elseif object:is_player() and self._thrower ~= object:get_player_name() then
return true
end

View File

@ -78,9 +78,10 @@ function mcl_potions.register_lingering(name, descr, color, def)
local velocity = 10
local dir = placer:get_look_dir();
local pos = placer:getpos();
local obj = minetest.add_entity({x=pos.x+(dir.x*2),y=pos.y+2+(dir.y*3),z=pos.z+(dir.z*2)}, id.."_flying")
local obj = minetest.add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying")
obj:setvelocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity})
obj:setacceleration({x=dir.x*-3, y=-9.8, z=dir.z*-3})
obj:get_luaentity()._thrower = placer:get_player_name()
if not minetest.is_creative_enabled(placer:get_player_name()) then
item:take_item()
end

View File

@ -20,9 +20,10 @@ function mcl_potions.register_splash(name, descr, color, def)
local velocity = 10
local dir = placer:get_look_dir();
local pos = placer:get_pos();
local obj = minetest.add_entity({x=pos.x+(dir.x*2),y=pos.y+2+(dir.y*3),z=pos.z+(dir.z*2)}, id.."_flying")
local obj = minetest.add_entity({x=pos.x+dir.x,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying")
obj:set_velocity({x=dir.x*velocity,y=dir.y*velocity,z=dir.z*velocity})
obj:set_acceleration({x=dir.x*-3, y=-9.8, z=dir.z*-3})
obj:get_luaentity()._thrower = placer:get_player_name()
if not minetest.is_creative_enabled(placer:get_player_name()) then
item:take_item()
end