diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua index 09877ac2a1..99dca9911a 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/ai.lua @@ -695,7 +695,14 @@ mobs.mob_step = function(self, dtime) self.object:remove() return false end - + + + --color modifier which coincides with the pause_timer + if self.old_health and self.health < self.old_health then + self.object:set_texture_mod("^[colorize:red:120") + end + self.old_health = self.health + --do death logic (animation, poof, explosion, etc) if self.health <= 0 then @@ -724,8 +731,9 @@ mobs.mob_step = function(self, dtime) if self.pause_timer > 0 then self.pause_timer = self.pause_timer - dtime --perfectly reset pause_timer - if self.pause_timer < 0 then + if self.pause_timer <= 0 then self.pause_timer = 0 + self.object:set_texture_mod("") end end --this overrides internal lua collision detection @@ -783,8 +791,9 @@ mobs.mob_step = function(self, dtime) end --perfectly reset pause_timer - if self.pause_timer < 0 then + if self.pause_timer <= 0 then self.pause_timer = 0 + self.object:set_texture_mod("") end --stop projectile mobs from being completely disabled while stunned diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua index 6cbc48b0bc..00ad066f07 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua @@ -187,35 +187,14 @@ mobs.mob_punch = function(self, hitter, tflp, tool_capabilities, dir) -- only play hit sound and show blood effects if damage is 1 or over; lower to 0.1 to ensure armor works appropriately. if damage >= 0.1 then - -- weapon sounds - --this doesn't work right for nodes - --[[ - if weapon:get_definition().sounds ~= nil then - - local s = math_random(1, #weapon:get_definition().sounds) - - minetest_sound_play(weapon:get_definition().sounds[s], { - object = self.object, --hitter, - max_hear_distance = 16 - }, true) - else - ]]-- minetest_sound_play("default_punch", { object = self.object, max_hear_distance = 16 }, true) - --end - - --damage_effect(self, damage) -- do damage self.health = self.health - damage - -- skip future functions if dead, except alerting others - --if check_for_death(self, "hit", {type = "punch", puncher = hitter}) then - -- die = true - --end - -- knock back effect local velocity = self.object:get_velocity() @@ -244,27 +223,19 @@ mobs.mob_punch = function(self, hitter, tflp, tool_capabilities, dir) multiplier = knockback_enchant + 1 --(starts from 1, 1 would be no change) end + if self.hostile then + multiplier = multiplier + 2 + end + local luaentity - --[[ --why does this multiply it again??? - if hitter then - luaentity = hitter:get_luaentity() - end - if hitter and is_player then - local wielditem = hitter:get_wielded_item() - kb = kb + 3 * mcl_enchanting.get_enchantment(wielditem, "knockback") - elseif luaentity and luaentity._knockback then - kb = kb + luaentity._knockback - end - ]]-- - dir = vector_multiply(dir,multiplier) dir.y = up - --add velocity breaks momentum - use set velocity - self.object:set_velocity(dir) + --add the velocity + self.object:add_velocity(dir) --0.4 seconds until you can hurt the mob again self.pause_timer = 0.4