From 31289f5686262d29606c9867e3c4ea1f8e886993 Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 4 Jul 2022 00:15:50 +0200 Subject: [PATCH] villagers that haven't traded loose job on js gone --- mods/ENTITIES/mobs_mc/villager.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index 86d84044a..e447192c3 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -636,6 +636,16 @@ local function get_a_job(self) if self.state ~= "gowp" then look_for_job(self) end end +local function check_jobsite(self) + if self._traded or not self._jobsite then return end + local n = mcl_vars.get_node(self._jobsite) + local m = minetest.get_meta(self._jobsite) + if m:get_string("villager") ~= self._id then + self._profession = "unemployed" + set_textures(self) + end +end + local function update_max_tradenum(self) if not self._trades then return @@ -654,6 +664,7 @@ end local function init_trades(self, inv) local profession = professions[self._profession] local trade_tiers = profession.trades + self._traded = true if trade_tiers == nil then -- Empty trades self._trades = false @@ -1355,6 +1366,8 @@ mcl_mobs:register_mob("mobs_mc:villager", { end if self._profession == "unemployed" then get_a_job(self) + else + check_jobsite(self) end end end,