1
0
Fork 0

Update potions to not hit player feet when thrown.

This commit is contained in:
Brandon 2020-07-12 08:50:48 -04:00
parent 323223e5a1
commit 25d092a95e
3 changed files with 28 additions and 13 deletions

View File

@ -78,7 +78,7 @@ 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,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying")
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")
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})
if not minetest.is_creative_enabled(placer:get_player_name()) then

View File

@ -150,18 +150,33 @@ local function register_potion(def)
local splash_dur_2 = dur_2 * mcl_potions.SPLASH_FACTOR
local ling_dur_2 = dur_2 * mcl_potions.LINGERING_FACTOR
if def.name == "healing" then effect_II = 7 end
local splash_def_2 = {
tt = get_tt(def._tt_2, effect_II, splash_dur_2),
potion_fun = get_splash_fun(effect_II, splash_dur_2),
}
if def.name == "healing" or def.name == "harming" then
effect_II = def.effect*mcl_potions.II_FACTOR*mcl_potions.LINGERING_FACTOR
local splash_def_2
if def.name == "healing" then
splash_def_2 = {
tt = get_tt(def._tt_2, 7, splash_dur_2),
potion_fun = get_splash_fun(7, splash_dur_2),
}
else
splash_def_2 = {
tt = get_tt(def._tt_2, effect_II, splash_dur_2),
potion_fun = get_splash_fun(effect_II, splash_dur_2),
}
end
local ling_def_2 = {
tt = get_tt(def._tt_2, effect_II, ling_dur_2),
potion_fun = get_lingering_fun(effect_II, ling_dur_2),
}
local ling_def_2
if def.name == "healing" or def.name == "harming" then
ling_def_2 = {
tt = get_tt(def._tt_2, effect_II*mcl_potions.LINGERING_FACTOR, ling_dur_2),
potion_fun = get_lingering_fun(effect_II*mcl_potions.LINGERING_FACTOR, ling_dur_2),
}
else
ling_def_2 = {
tt = get_tt(def._tt_2, effect_II, ling_dur_2),
potion_fun = get_lingering_fun(effect_II, ling_dur_2),
}
end
if def.color then
mcl_potions.register_splash(def.name.."_2", S("Splash "..def.description..desc_mod), def.color, splash_def_2)
mcl_potions.register_lingering(def.name.."_2", S("Lingering "..def.description..desc_mod), def.color, ling_def_2)

View File

@ -20,7 +20,7 @@ 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,y=pos.y+2+dir.y,z=pos.z+dir.z}, id.."_flying")
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")
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})
if not minetest.is_creative_enabled(placer:get_player_name()) then