1
0
Fork 0

Merge pull request 'Fix zombie villager curing (crash)' (#2368) from fix_zvillager_curing into master

Reviewed-on: MineClone2/MineClone2#2368
This commit is contained in:
cora 2022-06-26 09:39:17 +00:00
commit 815893a15a
2 changed files with 6 additions and 19 deletions

View File

@ -1362,17 +1362,17 @@ mcl_mobs:register_mob("mobs_mc:villager", {
end, end,
on_spawn = function(self) on_spawn = function(self)
if self._id then
set_textures(self)
return
end
self._id=minetest.sha1(minetest.get_gametime()..minetest.pos_to_string(self.object:get_pos())..tostring(math.random()))
if not self._profession then if not self._profession then
self._profession = "unemployed" self._profession = "unemployed"
if math.random(100) == 1 then if math.random(100) == 1 then
self._profession = "nitwit" self._profession = "nitwit"
end end
end end
if self._id then
set_textures(self)
return
end
self._id=minetest.sha1(minetest.get_gametime()..minetest.pos_to_string(self.object:get_pos())..tostring(math.random()))
set_textures(self) set_textures(self)
end, end,
on_die = function(self, pos) on_die = function(self, pos)

View File

@ -119,20 +119,7 @@ mcl_mobs:register_mob("mobs_mc:villager_zombie", {
villager_obj:set_yaw(yaw) villager_obj:set_yaw(yaw)
villager.target_yaw = yaw villager.target_yaw = yaw
villager.nametag = self.nametag villager.nametag = self.nametag
local texture = self.base_texture[1]:gsub("zombie", "villager") villager._profession = "unemployed"
if texture == "mobs_mc_villager_villager.png" then
texture = "mobs_mc_villager.png"
end
local textures = {texture}
villager.base_texture = textures
villager_obj:set_properties({textures = textures})
local matches = {}
for prof, tex in pairs(professions) do
if texture == tex then
table.insert(matches, prof)
end
end
villager._profession = matches[math.random(#matches)]
self._curing = nil self._curing = nil
mcl_burning.extinguish(obj) mcl_burning.extinguish(obj)
obj:remove() obj:remove()