prevent NPC from mobs_redo to take environmental dammage

This commit is contained in:
Sokomine 2024-01-17 03:59:03 +01:00
parent 920fbcf062
commit c8d5293df0

View File

@ -112,6 +112,21 @@ function yl_speak_up.do_mobs_after_activate(self, staticdata, def, dtime)
end
-- prevent NPC from getting hurt by special nodes
-- This has another positive side-effect: update_tag doesn't get called constantly
if(not(yl_speak_up.orig_do_env_damate)) then
yl_speak_up.orig_do_env_damate = mobs.mob_class.do_env_damage
end
mobs.mob_class.do_env_damage = function(self)
-- we are only responsible for talking NPC
if(not(self) or not(self.yl_speak_up)) then
return yl_speak_up.orig_mobs_update_tag(self)
end
-- *no* env dammage for NPC
return
end
-- we need to override this function from mobs_redo mod so that color
-- changes to the name tag color are possible
-- BUT: Only do this once. NOT at each reset!