correctly lock job when traded

This commit is contained in:
cora 2022-07-07 12:47:27 +02:00
parent 8fe40fcd26
commit bcb76f7bd2

View file

@ -642,6 +642,7 @@ local function check_jobsite(self)
local m = minetest.get_meta(self._jobsite) local m = minetest.get_meta(self._jobsite)
if m:get_string("villager") ~= self._id then if m:get_string("villager") ~= self._id then
self._profession = "unemployed" self._profession = "unemployed"
self._trades = nil
set_textures(self) set_textures(self)
end end
end end
@ -664,7 +665,6 @@ end
local function init_trades(self, inv) local function init_trades(self, inv)
local profession = professions[self._profession] local profession = professions[self._profession]
local trade_tiers = profession.trades local trade_tiers = profession.trades
self._traded = true
if trade_tiers == nil then if trade_tiers == nil then
-- Empty trades -- Empty trades
self._trades = false self._trades = false
@ -1113,6 +1113,7 @@ local trade_inventory = {
local trader = player_trading_with[name] local trader = player_trading_with[name]
local tradenum = player_tradenum[name] local tradenum = player_tradenum[name]
local trades local trades
trader._traded = true
if trader and trader._trades then if trader and trader._trades then
trades = minetest.deserialize(trader._trades) trades = minetest.deserialize(trader._trades)
end end