From 78768c3dab391f6ec20484e62603cce784e08ead Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 6 Jul 2020 20:23:59 -0400 Subject: [PATCH] Correct splash harming, remove double damage to entity, and add harming to armor bypass --- mods/ITEMS/mcl_armor/armor.lua | 3 ++- mods/ITEMS/mcl_potions/functions.lua | 6 ------ mods/ITEMS/mcl_potions/splash.lua | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/mods/ITEMS/mcl_armor/armor.lua b/mods/ITEMS/mcl_armor/armor.lua index d0bce25e..326aad6e 100644 --- a/mods/ITEMS/mcl_armor/armor.lua +++ b/mods/ITEMS/mcl_armor/armor.lua @@ -499,7 +499,8 @@ minetest.register_on_player_hpchange(function(player, hp_change, reason) return hp_change end - if reason.other == "poison" then + -- Account for potion effects (armor doesn't save the target) + if reason.other == "poison" or reason.other == "harming" then return hp_change end diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index df86ffcd..a076e3d1 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -481,12 +481,6 @@ function mcl_potions.healing_func(player, hp) end - -- adjust mob health - obj = player:get_luaentity() - if obj and obj._cmi_is_mob then - obj.health = obj.health + hp - end - end function mcl_potions.swiftness_func(player, factor, duration) diff --git a/mods/ITEMS/mcl_potions/splash.lua b/mods/ITEMS/mcl_potions/splash.lua index fae1deae..186c331a 100644 --- a/mods/ITEMS/mcl_potions/splash.lua +++ b/mods/ITEMS/mcl_potions/splash.lua @@ -123,12 +123,12 @@ register_splash("healing_2", "Splash Healing II", "#DD0000", { }) register_splash("harming", "Splash Harming", "#660099", { - potion_fun = function(player, redx) mcl_potions.healing_func(player, -4*redx) end, + potion_fun = function(player, redx) mcl_potions.healing_func(player, -6*redx) end, tt = "-2 hearts" }) register_splash("harming_2", "Splash Harming II", "#330066", { - potion_fun = function(player, redx) mcl_potions.healing_func(player, -6*redx) end, + potion_fun = function(player, redx) mcl_potions.healing_func(player, -12*redx) end, tt = "-3 hearts" })