Skip to content

Commit

Permalink
Basic ID cards with job trims can now hold higher level accesses to t…
Browse files Browse the repository at this point in the history
…heir own departments. (tgstation#62275)
  • Loading branch information
Timberpoes authored Oct 26, 2021
1 parent 7be09c1 commit 4d15fbc
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 23 deletions.
42 changes: 24 additions & 18 deletions code/__DEFINES/access.dm
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@
#define REGION_ACCESS_ALL_STATION COMMON_ACCESS + COMMAND_ACCESS + PRIVATE_COMMAND_ACCESS + CAPTAIN_ACCESS
/// Name for the General region.
#define REGION_GENERAL "General"
/// Used to seed the accesses_by_region list in SSid_access. A list of general service accesses that are overseen by the HoP.
#define REGION_ACCESS_GENERAL list( \
/// Access that all members of service and other non-departmental jobs should be able to add to their standard ID cards, regardless of wildcard type.
#define JOB_ACCESS_GENERAL list( \
ACCESS_KITCHEN, \
ACCESS_BAR, \
ACCESS_HYDROPONICS, \
Expand All @@ -367,10 +367,12 @@
ACCESS_THEATRE, \
ACCESS_LAWYER, \
)
/// Used to seed the accesses_by_region list in SSid_access. A list of general service accesses that are overseen by the HoP.
#define REGION_ACCESS_GENERAL JOB_ACCESS_GENERAL
/// Name for the Security region.
#define REGION_SECURITY "Security"
/// Used to seed the accesses_by_region list in SSid_access. A list of all security regional accesses that are overseen by the HoS.
#define REGION_ACCESS_SECURITY list( \
/// Access that all members of security should be able to add to their standard ID cards, regardless of wildcard type.
#define JOB_ACCESS_SECURITY list( \
ACCESS_SEC_DOORS, \
ACCESS_WEAPONS, \
ACCESS_SECURITY, \
Expand All @@ -379,26 +381,28 @@
ACCESS_FORENSICS_LOCKERS, \
ACCESS_COURT, \
ACCESS_MECH_SECURITY, \
ACCESS_HOS, \
)
/// Used to seed the accesses_by_region list in SSid_access. A list of all security regional accesses that are overseen by the HoS.
#define REGION_ACCESS_SECURITY (JOB_ACCESS_SECURITY + list(ACCESS_HOS))
/// Name for the Medbay region.
#define REGION_MEDBAY "Medbay"
/// Used to seed the accesses_by_region list in SSid_access. A list of all medbay regional accesses that are overseen by the CMO.
#define REGION_ACCESS_MEDBAY list( \
/// Access that all members of medical should be able to add to their ID cards, regardless of wildcard type.
#define JOB_ACCESS_MEDBAY list( \
ACCESS_MEDICAL, \
ACCESS_MORGUE, \
ACCESS_CHEMISTRY, \
ACCESS_VIROLOGY, \
ACCESS_SURGERY, \
ACCESS_MECH_MEDICAL, \
ACCESS_CMO, \
ACCESS_PHARMACY, \
ACCESS_PSYCHOLOGY, \
)
/// Used to seed the accesses_by_region list in SSid_access. A list of all medbay regional accesses that are overseen by the CMO.
#define REGION_ACCESS_MEDBAY (JOB_ACCESS_MEDBAY + list(ACCESS_CMO))
/// Name for the Research region.
#define REGION_RESEARCH "Research"
/// Used to seed the accesses_by_region list in SSid_access. A list of all research regional accesses that are overseen by the RD.
#define REGION_ACCESS_RESEARCH list( \
/// Access that all members of research/science should be able to add to their ID cards, regardless of wildcard type.
#define JOB_ACCESS_RESEARCH list( \
ACCESS_RESEARCH, \
ACCESS_RND, \
ACCESS_ORDNANCE, \
Expand All @@ -407,14 +411,14 @@
ACCESS_ROBOTICS, \
ACCESS_XENOBIOLOGY, \
ACCESS_MECH_SCIENCE, \
ACCESS_MINISAT, \
ACCESS_RD, \
ACCESS_NETWORK, \
)
/// Used to seed the accesses_by_region list in SSid_access. A list of all research regional accesses that are overseen by the RD.
#define REGION_ACCESS_RESEARCH (JOB_ACCESS_RESEARCH + list(ACCESS_MINISAT, ACCESS_RD))
/// Name for the Engineering region.
#define REGION_ENGINEERING "Engineering"
/// Used to seed the accesses_by_region list in SSid_access. A list of all engineering regional accesses that are overseen by the CE.
#define REGION_ACCESS_ENGINEERING list( \
/// Access that all members of engineering should be able to add to their ID cards, regardless of wildcard type.
#define JOB_ACCESS_ENGINEERING list( \
ACCESS_CONSTRUCTION, \
ACCESS_AUX_BASE, \
ACCESS_MAINT_TUNNELS, \
Expand All @@ -425,13 +429,13 @@
ACCESS_ATMOSPHERICS, \
ACCESS_MECH_ENGINE, \
ACCESS_TCOMSAT, \
ACCESS_MINISAT, \
ACCESS_CE, \
)
/// Used to seed the accesses_by_region list in SSid_access. A list of all engineering regional accesses that are overseen by the CE.
#define REGION_ACCESS_ENGINEERING (JOB_ACCESS_ENGINEERING + list(ACCESS_MINISAT, ACCESS_CE))
/// Name for the Supply region.
#define REGION_SUPPLY "Supply"
/// Used to seed the accesses_by_region list in SSid_access. A list of all cargo regional accesses that are overseen by the HoP.
#define REGION_ACCESS_SUPPLY list( \
/// Access that all members of supply should be able to add to their ID cards, regardless of wildcard type.
#define JOB_ACCESS_SUPPLY list( \
ACCESS_MAILSORTING, \
ACCESS_MINING, \
ACCESS_MINING_STATION, \
Expand All @@ -441,6 +445,8 @@
ACCESS_QM, \
ACCESS_VAULT, \
)
/// Used to seed the accesses_by_region list in SSid_access. A list of all cargo regional accesses that are overseen by the HoP.
#define REGION_ACCESS_SUPPLY JOB_ACCESS_SUPPLY
/// Name for the Command region.
#define REGION_COMMAND "Command"
/// Used to seed the accesses_by_region list in SSid_access. A list of all command regional accesses that are overseen by the Captain.
Expand Down
4 changes: 4 additions & 0 deletions code/datums/id_trim/_id_trim.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@
var/list/access = list()
/// Accesses that this trim unlocks on a card that require wildcard slots to apply. If a card cannot accept all a trim's wildcard accesses, the card is incompatible with the trim.
var/list/wildcard_access = list()

/// Overridable proc. A list of wildcard accesses that this trim is overriding to force them to be considered ACCESS_FLAG_COMMON if applied to an ID card holding this trim.
/datum/id_trim/proc/get_common_wildcard_overrides()
return list()
39 changes: 39 additions & 0 deletions code/datums/id_trim/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
var/list/template_access
/// The typepath to the job datum from the id_trim.
var/datum/job/job
/// List of job accesses that this trim overrides as common. If an access is in this list, it will always be added as a common wildcard to ID cards holding this trim.
var/list/common_access = list()

/datum/id_trim/job/New()
if(isnull(job_changes))
Expand All @@ -49,6 +51,9 @@

refresh_trim_access()

/datum/id_trim/job/get_common_wildcard_overrides()
return common_access.Copy()

/**
* Goes through various non-map config settings and modifies the trim's access based on this.
*
Expand Down Expand Up @@ -83,6 +88,7 @@
config_job = "assistant"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOP, ACCESS_CHANGE_IDS)
job = /datum/job/assistant
common_access = JOB_ACCESS_GENERAL

/datum/id_trim/job/assistant/refresh_trim_access()
. = ..()
Expand All @@ -103,6 +109,7 @@
config_job = "atmospheric_technician"
template_access = list(ACCESS_CAPTAIN, ACCESS_CE, ACCESS_CHANGE_IDS)
job = /datum/job/atmospheric_technician
common_access = JOB_ACCESS_ENGINEERING

/datum/id_trim/job/bartender
assignment = "Bartender"
Expand All @@ -112,6 +119,7 @@
config_job = "bartender"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOP, ACCESS_CHANGE_IDS)
job = /datum/job/bartender
common_access = JOB_ACCESS_GENERAL

/datum/id_trim/job/botanist
assignment = "Botanist"
Expand All @@ -121,6 +129,7 @@
config_job = "botanist"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOP, ACCESS_CHANGE_IDS)
job = /datum/job/botanist
common_access = JOB_ACCESS_GENERAL

/datum/id_trim/job/captain
assignment = "Captain"
Expand All @@ -146,6 +155,7 @@
config_job = "cargo_technician"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOP, ACCESS_CHANGE_IDS)
job = /datum/job/cargo_technician
common_access = JOB_ACCESS_SUPPLY

/datum/id_trim/job/chaplain
assignment = "Chaplain"
Expand All @@ -155,6 +165,7 @@
config_job = "chaplain"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOP, ACCESS_CHANGE_IDS)
job = /datum/job/chaplain
common_access = JOB_ACCESS_GENERAL

/datum/id_trim/job/chemist
assignment = "Chemist"
Expand All @@ -164,6 +175,7 @@
config_job = "chemist"
template_access = list(ACCESS_CAPTAIN, ACCESS_CMO, ACCESS_CHANGE_IDS)
job = /datum/job/chemist
common_access = JOB_ACCESS_MEDBAY

/datum/id_trim/job/chief_engineer
assignment = "Chief Engineer"
Expand All @@ -177,6 +189,7 @@
config_job = "chief_engineer"
template_access = list(ACCESS_CAPTAIN, ACCESS_CHANGE_IDS)
job = /datum/job/chief_engineer
common_access = JOB_ACCESS_ENGINEERING

/datum/id_trim/job/chief_medical_officer
assignment = "Chief Medical Officer"
Expand All @@ -190,6 +203,7 @@
config_job = "chief_medical_officer"
template_access = list(ACCESS_CAPTAIN, ACCESS_CHANGE_IDS)
job = /datum/job/chief_medical_officer
common_access = JOB_ACCESS_MEDBAY

/datum/id_trim/job/clown
assignment = "Clown"
Expand All @@ -199,6 +213,7 @@
config_job = "clown"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOP, ACCESS_CHANGE_IDS)
job = /datum/job/clown
common_access = JOB_ACCESS_GENERAL

/datum/id_trim/job/cook
assignment = "Cook"
Expand All @@ -208,6 +223,7 @@
config_job = "cook"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOP, ACCESS_CHANGE_IDS)
job = /datum/job/cook
common_access = JOB_ACCESS_GENERAL

/datum/id_trim/job/curator
assignment = "Curator"
Expand All @@ -217,6 +233,7 @@
config_job = "curator"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOP, ACCESS_CHANGE_IDS)
job = /datum/job/curator
common_access = JOB_ACCESS_GENERAL

/datum/id_trim/job/detective
assignment = "Detective"
Expand All @@ -227,6 +244,7 @@
config_job = "detective"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOS, ACCESS_CHANGE_IDS)
job = /datum/job/detective
common_access = JOB_ACCESS_SECURITY

/datum/id_trim/job/detective/refresh_trim_access()
. = ..()
Expand All @@ -246,6 +264,7 @@
config_job = "geneticist"
template_access = list(ACCESS_CAPTAIN, ACCESS_RD, ACCESS_CHANGE_IDS)
job = /datum/job/geneticist
common_access = JOB_ACCESS_RESEARCH

/datum/id_trim/job/head_of_personnel
assignment = "Head of Personnel"
Expand All @@ -264,6 +283,10 @@
template_access = list(ACCESS_CAPTAIN, ACCESS_CHANGE_IDS)
job = /datum/job/head_of_personnel

/datum/id_trim/job/head_of_personnel/New()
common_access = JOB_ACCESS_GENERAL | JOB_ACCESS_SUPPLY
return ..()

/datum/id_trim/job/head_of_security
assignment = "Head of Security"
trim_state = "trim_headofsecurity"
Expand All @@ -277,6 +300,7 @@
config_job = "head_of_security"
template_access = list(ACCESS_CAPTAIN, ACCESS_CHANGE_IDS)
job = /datum/job/head_of_security
common_access = JOB_ACCESS_SECURITY

/datum/id_trim/job/head_of_security/refresh_trim_access()
. = ..()
Expand All @@ -296,6 +320,7 @@
config_job = "janitor"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOP, ACCESS_CHANGE_IDS)
job = /datum/job/janitor
common_access = JOB_ACCESS_GENERAL

/datum/id_trim/job/lawyer
assignment = "Lawyer"
Expand All @@ -305,6 +330,7 @@
config_job = "lawyer"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOP, ACCESS_HOS, ACCESS_CHANGE_IDS)
job = /datum/job/lawyer
common_access = JOB_ACCESS_GENERAL

/datum/id_trim/job/medical_doctor
assignment = "Medical Doctor"
Expand All @@ -314,6 +340,7 @@
config_job = "medical_doctor"
template_access = list(ACCESS_CAPTAIN, ACCESS_CMO, ACCESS_CHANGE_IDS)
job = /datum/job/doctor
common_access = JOB_ACCESS_MEDBAY

/datum/id_trim/job/mime
assignment = "Mime"
Expand All @@ -323,6 +350,7 @@
config_job = "mime"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOP, ACCESS_CHANGE_IDS)
job = /datum/job/mime
common_access = JOB_ACCESS_GENERAL

/datum/id_trim/job/paramedic
assignment = "Paramedic"
Expand All @@ -333,6 +361,7 @@
config_job = "paramedic"
template_access = list(ACCESS_CAPTAIN, ACCESS_CMO, ACCESS_CHANGE_IDS)
job = /datum/job/paramedic
common_access = JOB_ACCESS_MEDBAY

/datum/id_trim/job/prisoner
assignment = "Prisoner"
Expand Down Expand Up @@ -377,6 +406,7 @@
config_job = "psychologist"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOP, ACCESS_CMO, ACCESS_CHANGE_IDS)
job = /datum/job/psychologist
common_access = JOB_ACCESS_GENERAL

/datum/id_trim/job/quartermaster
assignment = "Quartermaster"
Expand All @@ -387,6 +417,7 @@
config_job = "quartermaster"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOP, ACCESS_CHANGE_IDS)
job = /datum/job/quartermaster
common_access = JOB_ACCESS_SUPPLY

/datum/id_trim/job/research_director
assignment = "Research Director"
Expand All @@ -402,6 +433,7 @@
config_job = "research_director"
template_access = list(ACCESS_CAPTAIN, ACCESS_CHANGE_IDS)
job = /datum/job/research_director
common_access = JOB_ACCESS_RESEARCH

/datum/id_trim/job/roboticist
assignment = "Roboticist"
Expand All @@ -412,6 +444,7 @@
config_job = "roboticist"
template_access = list(ACCESS_CAPTAIN, ACCESS_RD, ACCESS_CHANGE_IDS)
job = /datum/job/roboticist
common_access = JOB_ACCESS_RESEARCH

/datum/id_trim/job/scientist
assignment = "Scientist"
Expand All @@ -422,6 +455,7 @@
config_job = "scientist"
template_access = list(ACCESS_CAPTAIN, ACCESS_RD, ACCESS_CHANGE_IDS)
job = /datum/job/scientist
common_access = JOB_ACCESS_RESEARCH

/// Sec officers have departmental variants. They each have their own trims with bonus departmental accesses.
/datum/id_trim/job/security_officer
Expand All @@ -435,6 +469,7 @@
config_job = "security_officer"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOS, ACCESS_CHANGE_IDS)
job = /datum/job/security_officer
common_access = JOB_ACCESS_SECURITY

/datum/id_trim/job/security_officer/refresh_trim_access()
. = ..()
Expand Down Expand Up @@ -477,6 +512,7 @@
config_job = "shaft_miner"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOP, ACCESS_CHANGE_IDS)
job = /datum/job/shaft_miner
common_access = JOB_ACCESS_SUPPLY

/// ID card obtained from the mining Disney dollar points vending machine.
/datum/id_trim/job/shaft_miner/spare
Expand All @@ -493,6 +529,7 @@
config_job = "station_engineer"
template_access = list(ACCESS_CAPTAIN, ACCESS_CE, ACCESS_CHANGE_IDS)
job = /datum/job/station_engineer
common_access = JOB_ACCESS_ENGINEERING

/datum/id_trim/job/virologist
assignment = "Virologist"
Expand All @@ -502,6 +539,7 @@
config_job = "virologist"
template_access = list(ACCESS_CAPTAIN, ACCESS_CMO, ACCESS_CHANGE_IDS)
job = /datum/job/virologist
common_access = JOB_ACCESS_MEDBAY

/datum/id_trim/job/warden
assignment = "Warden"
Expand All @@ -512,6 +550,7 @@
config_job = "warden"
template_access = list(ACCESS_CAPTAIN, ACCESS_HOS, ACCESS_CHANGE_IDS)
job = /datum/job/warden
common_access = JOB_ACCESS_SECURITY

/datum/id_trim/job/warden/refresh_trim_access()
. = ..()
Expand Down
Loading

0 comments on commit 4d15fbc

Please sign in to comment.