From 3035e9660e981673611baef5c79678761bc7870a Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Thu, 20 Apr 2017 00:05:26 +0200 Subject: [PATCH] [mff_pclasses] Remember to remove hunter bonus - MFF PClasses : Remove hunter armor bonus upon unassigning --- mods/mff/mff_pclasses/hunter.lua | 4 ++++ mods/pclasses/api.lua | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mods/mff/mff_pclasses/hunter.lua b/mods/mff/mff_pclasses/hunter.lua index ec7aaaa3..392408a1 100755 --- a/mods/mff/mff_pclasses/hunter.lua +++ b/mods/mff/mff_pclasses/hunter.lua @@ -19,6 +19,10 @@ pclasses.api.register_class("hunter", { end, on_unassigned = function(pname) sprint.decrease_maxstamina(pname, 10) + if tmp[pname] then + sprint.decrease_maxstamina(pname, 10) + tmp[pname] = nil + end end, on_update = function(pname) local reinforced = pclasses.api.util.does_wear_full_armor(pname, "reinforcedleather", true) diff --git a/mods/pclasses/api.lua b/mods/pclasses/api.lua index f564ccef..58c420d2 100755 --- a/mods/pclasses/api.lua +++ b/mods/pclasses/api.lua @@ -55,8 +55,8 @@ end function pclasses.api.set_player_class(pname, cname, inform) if pclasses.api.get_class_by_name(cname) then if pclasses.api.get_player_class(pname) then - pclasses.api.get_class_by_name(pclasses.api.get_player_class(pname)).on_unassigned(pname) - pclasses.api.get_class_by_name(pclasses.api.get_player_class(pname)).on_update(pname) + pclasses.api.get_class_by_name(pclasses.api.get_player_class(pname)).on_update(pname) + pclasses.api.get_class_by_name(pclasses.api.get_player_class(pname)).on_unassigned(pname) end pclasses.data.players[pname] = cname local newclass = pclasses.api.get_class_by_name(cname)