diff --git a/code/controllers/subsystems/job.dm b/code/controllers/subsystems/job.dm index 3bdfef5464a..92e4c6adcb6 100644 --- a/code/controllers/subsystems/job.dm +++ b/code/controllers/subsystems/job.dm @@ -97,6 +97,8 @@ SUBSYSTEM_DEF(jobs) return FALSE if(jobban_isbanned(player, rank)) return FALSE + if(!player.IsJobAvailable(rank)) + return FALSE if(!(player.client.prefs.GetPlayerAltTitle(job) in player.client.prefs.GetValidTitles(job))) to_chat(player, "Your character is too young!") @@ -111,6 +113,7 @@ SUBSYSTEM_DEF(jobs) player.mind.role_alt_title = GetPlayerAltTitle(player, rank) unassigned -= player job.current_positions++ + job.pre_spawn(player) return TRUE Debug("AR has failed, Player: [player], Rank: [rank]") return FALSE @@ -119,7 +122,6 @@ SUBSYSTEM_DEF(jobs) var/datum/job/job = GetJob(rank) if(!istype(job)) return - job.current_positions-- /datum/controller/subsystem/jobs/proc/FindOccupationCandidates(datum/job/job, level, flag) @@ -327,7 +329,7 @@ SUBSYSTEM_DEF(jobs) Debug("ER/([H]): Equipping custom loadout.") job.pre_equip(H) job.setup_account(H) - + job.after_spawn(H) EquipCustom(H, job, H.client.prefs, custom_equip_leftovers, spawn_in_storage, custom_equip_slots) job.equip(H) @@ -635,10 +637,10 @@ SUBSYSTEM_DEF(jobs) //Handle job slot/tater cleanup. if (H.mind) - var/job = H.mind.assigned_role - - FreeRole(job) - + var/role = H.mind.assigned_role + var/datum/job/job = GetJob(H.mind.assigned_role) + job.on_despawn(H) + FreeRole(role) if(H.mind.objectives.len) qdel(H.mind.objectives) H.mind.special_role = null diff --git a/code/game/jobs/job/job.dm b/code/game/jobs/job/job.dm index b114fbb5393..c80d71b54dd 100644 --- a/code/game/jobs/job/job.dm +++ b/code/game/jobs/job/job.dm @@ -42,10 +42,17 @@ var/datum/outfit/outfit = null var/list/alt_outfits = null // A list of special outfits for the alt titles list("alttitle" = /datum/outfit) var/list/blacklisted_species = null // A blacklist of species that can't be this job + var/list/blacklisted_citizenship = list() //A blacklist of citizenships that can't be this job //Only override this proc +/datum/job/proc/pre_spawn(mob/abstract/new_player/player) + return + /datum/job/proc/after_spawn(mob/living/carbon/human/H) +/datum/job/proc/on_despawn(mob/living/carbon/human/H) + return + /datum/job/proc/announce(mob/living/carbon/human/H) /datum/job/proc/get_outfit(mob/living/carbon/human/H, alt_title=null) diff --git a/code/game/jobs/job/outsider/representative.dm b/code/game/jobs/job/outsider/representative.dm index 7d491554025..0b01d9ada0c 100644 --- a/code/game/jobs/job/outsider/representative.dm +++ b/code/game/jobs/job/outsider/representative.dm @@ -26,6 +26,18 @@ outfit = /datum/outfit/job/representative blacklisted_species = list(SPECIES_VAURCA_BULWARK, SPECIES_VAURCA_BREEDER) +/datum/job/consular/pre_spawn(mob/abstract/new_player/player) + var/datum/faction/faction = SSjobs.name_factions[player.client.prefs.faction] + LAZYREMOVE(faction.allowed_role_types, REPRESENTATIVE_ROLE) + +/datum/job/representative/after_spawn(mob/living/carbon/human/H) + var/datum/faction/faction = SSjobs.GetFaction(H) + LAZYREMOVE(faction.allowed_role_types, REPRESENTATIVE_ROLE) + +/datum/job/representative/on_despawn(mob/living/carbon/human/H) + var/datum/faction/faction = SSjobs.GetFaction(H) + LAZYADD(faction.allowed_role_types, REPRESENTATIVE_ROLE) + /datum/outfit/job/representative name = "NanoTrasen Corporate Liaison" var/fax_department = "Representative's Office" @@ -116,6 +128,7 @@ minimal_access = list(access_consular) outfit = /datum/outfit/job/representative/consular blacklisted_species = list(SPECIES_VAURCA_BULWARK) + blacklisted_citizenship = list(CITIZENSHIP_SOL, CITIZENSHIP_ERIDANI, CITIZENSHIP_ELYRA_NCP, CITIZENSHIP_NONE, CITIZENSHIP_FREE_COUNCIL) /datum/job/consular/get_outfit(mob/living/carbon/human/H, alt_title = null) var/datum/citizenship/citizenship = SSrecords.citizenships[H.citizenship] @@ -142,3 +155,15 @@ if(citizenship) rep_objectives = citizenship.get_objectives(mission_level, H) return rep_objectives + +/datum/job/consular/pre_spawn(mob/abstract/new_player/player) + var/datum/citizenship/citizenship = SSrecords.citizenships[player.client.prefs.citizenship] + LAZYADD(blacklisted_citizenship, citizenship.name) + +/datum/job/consular/after_spawn(mob/living/carbon/human/H) + var/datum/citizenship/citizenship = SSrecords.citizenships[H.citizenship] + LAZYADD(blacklisted_citizenship, citizenship.name) + +/datum/job/consular/on_despawn(mob/living/carbon/human/H) + var/datum/citizenship/citizenship = SSrecords.citizenships[H.citizenship] + LAZYREMOVE(blacklisted_citizenship, citizenship.name) diff --git a/code/modules/client/preference_setup/occupation/occupation.dm b/code/modules/client/preference_setup/occupation/occupation.dm index 29ec01b41cc..8d48b4a6495 100644 --- a/code/modules/client/preference_setup/occupation/occupation.dm +++ b/code/modules/client/preference_setup/occupation/occupation.dm @@ -196,6 +196,10 @@ if(C.job_species_blacklist[job.title] && (pref.species in C.job_species_blacklist[job.title])) dat += "[dispRank] \[SPECIES RESTRICTED]" continue + if(job.blacklisted_citizenship) + if(C.name in job.blacklisted_citizenship) + dat += "[dispRank] \[BACKGROUND RESTRICTED]" + continue if(job.alt_titles && (LAZYLEN(pref.GetValidTitles(job)) > 1)) dispRank = " \[[pref.GetPlayerAltTitle(job)]\]" if((pref.job_civilian_low & ASSISTANT) && (rank != "Assistant")) diff --git a/code/modules/mob/abstract/new_player/new_player.dm b/code/modules/mob/abstract/new_player/new_player.dm index f2d8a6d56b8..b97bcae9c90 100644 --- a/code/modules/mob/abstract/new_player/new_player.dm +++ b/code/modules/mob/abstract/new_player/new_player.dm @@ -208,6 +208,11 @@ INITIALIZE_IMMEDIATE(/mob/abstract/new_player) if(S.name in job.blacklisted_species) return FALSE + if(job.blacklisted_citizenship) + var/datum/citizenship/C = SSrecords.citizenships[client.prefs.citizenship] + if(C.name in job.blacklisted_citizenship) + return FALSE + var/datum/faction/faction = SSjobs.name_factions[client.prefs.faction] || SSjobs.default_faction var/list/faction_allowed_roles = unpacklist(faction.allowed_role_types) if (!(job.type in faction_allowed_roles)) diff --git a/html/changelogs/RustingWithYou - diplomacy.yml b/html/changelogs/RustingWithYou - diplomacy.yml new file mode 100644 index 00000000000..1934bd19c89 --- /dev/null +++ b/html/changelogs/RustingWithYou - diplomacy.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: RustingWithYou + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - tweak: "Adds framework for multiple consular and liason slots."