mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-19 09:31:07 +01:00
Correct potions hitting thrower.
This commit is contained in:
parent
9602e0d8af
commit
4a654fccc4
3 changed files with 5 additions and 3 deletions
|
@ -352,7 +352,7 @@ function mcl_potions.is_obj_hit(self, pos)
|
||||||
|
|
||||||
if entity._cmi_is_mob then return true end
|
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
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -78,9 +78,10 @@ function mcl_potions.register_lingering(name, descr, color, def)
|
||||||
local velocity = 10
|
local velocity = 10
|
||||||
local dir = placer:get_look_dir();
|
local dir = placer:get_look_dir();
|
||||||
local pos = placer:getpos();
|
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: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: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
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,9 +20,10 @@ function mcl_potions.register_splash(name, descr, color, def)
|
||||||
local velocity = 10
|
local velocity = 10
|
||||||
local dir = placer:get_look_dir();
|
local dir = placer:get_look_dir();
|
||||||
local pos = placer:get_pos();
|
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_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: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
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
item:take_item()
|
item:take_item()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue