From 80fb6484478fcd11412c009aa69f1b55a363ee6b Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 15 Nov 2022 20:23:59 +0100 Subject: [PATCH 1/2] Turn villagers to zombies half the time when killed by zombies --- mods/ENTITIES/mobs_mc/villager.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index 7b7eafda57..55b30337fb 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -2045,7 +2045,7 @@ mcl_mobs:register_mob("mobs_mc:villager", { self._id=minetest.sha1(minetest.get_gametime()..minetest.pos_to_string(self.object:get_pos())..tostring(math.random())) set_textures(self) end, - on_die = function(self, pos) + on_die = function(self, pos, cmi_cause) -- Close open trade formspecs and give input back to players local trading_players = self._trading_players if trading_players then @@ -2070,6 +2070,14 @@ mcl_mobs:register_mob("mobs_mc:villager", { jobsite_meta:set_string("villager", nil) mcl_log("Died, so bye bye jobsite") end + + if cmi_cause and cmi_cause.puncher then + local l = cmi_cause.puncher:get_luaentity() + if l and math.random(2) == 1 and( l.name == "mobs_mc:zombie" or l.name == "mobs_mc:baby_zombie" or l.name == "mobs_mc:zombie_villager") then + mcl_util.replace_mob(self.object,"mobs_mc:zombie") + return true + end + end end, on_lightning_strike = function(self, pos, pos2, objects) mcl_util.replace_mob(self.object, "mobs_mc:witch") From f66a241188723a3da36d55ca33fd821e04b382ea Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 15 Nov 2022 20:31:49 +0100 Subject: [PATCH 2/2] turn villagers to z villagers not normal zs --- mods/ENTITIES/mobs_mc/villager.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index 55b30337fb..a7b7d98522 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -2073,8 +2073,8 @@ mcl_mobs:register_mob("mobs_mc:villager", { if cmi_cause and cmi_cause.puncher then local l = cmi_cause.puncher:get_luaentity() - if l and math.random(2) == 1 and( l.name == "mobs_mc:zombie" or l.name == "mobs_mc:baby_zombie" or l.name == "mobs_mc:zombie_villager") then - mcl_util.replace_mob(self.object,"mobs_mc:zombie") + if l and math.random(2) == 1 and( l.name == "mobs_mc:zombie" or l.name == "mobs_mc:baby_zombie" or l.name == "mobs_mc:villager_zombie" or l.name == "mobs_mc:husk") then + mcl_util.replace_mob(self.object,"mobs_mc:villager_zombie") return true end end