-- Punishment module -- Here is all logic regarding auto_user and punishment debuff function is_auto_user() local isPunishmentCurseActive = tonumber(get_env("game.punishment_curse")) or 0 if isPunishmentCurseActive == 0 then -- If system is inactive debug_notice("Punishment system is not active, is_auto_user() returning false") return false elseif get_value("auto_user") == 1 then debug_notice("Auto user is true") return true else debug_notice("Auto user is false") return false end end function auto_user_state_remove() local isPunishmentCurseActive = tonumber(get_env("game.punishment_curse")) or 0 if isPunishmentCurseActive == 0 then return end -- Early return in case if system is OFF local checkResult = auto_user_punish_check() if checkResult then -- Check for auto_user and remove the flag if punishment expires local PUNISHMENT_STATE_ID = tonumber(get_env("game.punishment_state_id")) or 5999 -- States list which needs to be removed local banned_states = { 4003, 4102, 4113, 4116, 4119, 9922, 9923, 9924 } local punishmentStateLevel = get_state_level( PUNISHMENT_STATE_ID ) if punishmentStateLevel >= 1 or is_auto_user() then -- If player is punished for i = 1, #banned_states do local bannedStateLevel = tonumber( get_state_level(banned_states[i]) ) if bannedStateLevel > 0 then remove_state(banned_states[i], bannedStateLevel ) end end end end end -- Automatic handler for both checking autouser and applying concequences ( buffs/debuffs/etc ) function check_auto_user() if(is_auto_user()) then local isPunishmentCurseActive = tonumber(get_env("game.punishment_curse")) or 0 if isPunishmentCurseActive == 1 then local PUNISHMENT_STATE_ID = tonumber(get_env("game.punishment_state_id")) or 5999 -- Punishment state ID if get_state_level(PUNISHMENT_STATE_ID) == 0 then return false end set_auto_user(1) debug_notice("Punishment curse is active!") end end end