mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
391 lines
14 KiB
Plaintext
391 lines
14 KiB
Plaintext
|
|
//returns TRUE if this mob has sufficient access to use this object
|
|
/obj/proc/allowed(mob/M)
|
|
//check if it doesn't require any access at all
|
|
if(src.check_access(null))
|
|
return TRUE
|
|
if(issilicon(M))
|
|
if(ispAI(M))
|
|
return FALSE
|
|
return TRUE //AI can do whatever it wants
|
|
if(IsAdminGhost(M))
|
|
//Access can't stop the abuse
|
|
return TRUE
|
|
else if(istype(M) && SEND_SIGNAL(M, COMSIG_MOB_ALLOWED, src))
|
|
return TRUE
|
|
else if(ishuman(M))
|
|
var/mob/living/carbon/human/H = M
|
|
//if they are holding or wearing a card that has access, that works
|
|
if(check_access(H.get_active_held_item()) || src.check_access(H.wear_id))
|
|
return TRUE
|
|
else if(ismonkey(M) || isalienadult(M))
|
|
var/mob/living/carbon/george = M
|
|
//they can only hold things :(
|
|
if(check_access(george.get_active_held_item()))
|
|
return TRUE
|
|
else if(isanimal(M))
|
|
var/mob/living/simple_animal/A = M
|
|
if(check_access(A.get_active_held_item()) || check_access(A.access_card))
|
|
return TRUE
|
|
return FALSE
|
|
|
|
/obj/item/proc/GetAccess()
|
|
return list()
|
|
|
|
/obj/item/proc/GetID()
|
|
return null
|
|
|
|
/obj/proc/text2access(access_text)
|
|
. = list()
|
|
if(!access_text)
|
|
return
|
|
var/list/split = splittext(access_text,";")
|
|
for(var/x in split)
|
|
var/n = text2num(x)
|
|
if(n)
|
|
. += n
|
|
|
|
//Call this before using req_access or req_one_access directly
|
|
/obj/proc/gen_access()
|
|
//These generations have been moved out of /obj/New() because they were slowing down the creation of objects that never even used the access system.
|
|
if(!req_access)
|
|
req_access = list()
|
|
for(var/a in text2access(req_access_txt))
|
|
req_access += a
|
|
if(!req_one_access)
|
|
req_one_access = list()
|
|
for(var/b in text2access(req_one_access_txt))
|
|
req_one_access += b
|
|
|
|
// Check if an item has access to this object
|
|
/obj/proc/check_access(obj/item/I)
|
|
return check_access_list(I ? I.GetAccess() : null)
|
|
|
|
/obj/proc/check_access_list(list/access_list)
|
|
gen_access()
|
|
|
|
if(!islist(req_access)) //something's very wrong
|
|
return TRUE
|
|
|
|
if(!req_access.len && !length(req_one_access))
|
|
return TRUE
|
|
|
|
if(!length(access_list) || !islist(access_list))
|
|
return FALSE
|
|
|
|
for(var/req in req_access)
|
|
if(!(req in access_list)) //doesn't have this access
|
|
return FALSE
|
|
|
|
if(length(req_one_access))
|
|
for(var/req in req_one_access)
|
|
if(req in access_list) //has an access from the single access list
|
|
return TRUE
|
|
return FALSE
|
|
return TRUE
|
|
|
|
/obj/proc/check_access_ntnet(datum/netdata/data)
|
|
return check_access_list(data.passkey)
|
|
|
|
/proc/get_centcom_access(job)
|
|
switch(job)
|
|
if("VIP Guest")
|
|
return list(ACCESS_CENT_GENERAL)
|
|
if("Custodian")
|
|
return list(ACCESS_CENT_GENERAL, ACCESS_CENT_LIVING, ACCESS_CENT_STORAGE)
|
|
if("Thunderdome Overseer")
|
|
return list(ACCESS_CENT_GENERAL, ACCESS_CENT_THUNDER)
|
|
if("CentCom Official")
|
|
return list(ACCESS_CENT_GENERAL, ACCESS_CENT_LIVING)
|
|
if("Medical Officer")
|
|
return list(ACCESS_CENT_GENERAL, ACCESS_CENT_LIVING, ACCESS_CENT_MEDICAL)
|
|
if("Death Commando")
|
|
return list(ACCESS_CENT_GENERAL, ACCESS_CENT_SPECOPS, ACCESS_CENT_LIVING, ACCESS_CENT_STORAGE)
|
|
if("Research Officer")
|
|
return list(ACCESS_CENT_GENERAL, ACCESS_CENT_SPECOPS, ACCESS_CENT_MEDICAL, ACCESS_CENT_TELEPORTER, ACCESS_CENT_STORAGE)
|
|
if("Special Ops Officer")
|
|
return list(ACCESS_CENT_GENERAL, ACCESS_CENT_THUNDER, ACCESS_CENT_SPECOPS, ACCESS_CENT_LIVING, ACCESS_CENT_STORAGE)
|
|
if("Admiral")
|
|
return get_all_centcom_access()
|
|
if("CentCom Commander")
|
|
return get_all_centcom_access()
|
|
if("Emergency Response Team Commander")
|
|
return get_ert_access("commander")
|
|
if("Security Response Officer")
|
|
return get_ert_access("sec")
|
|
if("Engineer Response Officer")
|
|
return get_ert_access("eng")
|
|
if("Medical Response Officer")
|
|
return get_ert_access("med")
|
|
if("CentCom Bartender")
|
|
return list(ACCESS_CENT_GENERAL, ACCESS_CENT_LIVING, ACCESS_CENT_BAR)
|
|
|
|
/proc/get_all_accesses()
|
|
return list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_FORENSICS_LOCKERS, ACCESS_COURT,
|
|
ACCESS_MEDICAL, ACCESS_GENETICS, ACCESS_MORGUE, ACCESS_RD,
|
|
ACCESS_TOX, ACCESS_TOX_STORAGE, ACCESS_CHEMISTRY, ACCESS_ENGINE, ACCESS_ENGINE_EQUIP, ACCESS_MAINT_TUNNELS,
|
|
ACCESS_EXTERNAL_AIRLOCKS, ACCESS_CHANGE_IDS, ACCESS_AI_UPLOAD,
|
|
ACCESS_TELEPORTER, ACCESS_EVA, ACCESS_HEADS, ACCESS_CAPTAIN, ACCESS_ALL_PERSONAL_LOCKERS,
|
|
ACCESS_TECH_STORAGE, ACCESS_CHAPEL_OFFICE, ACCESS_ATMOSPHERICS, ACCESS_KITCHEN,
|
|
ACCESS_BAR, ACCESS_JANITOR, ACCESS_CREMATORIUM, ACCESS_ROBOTICS, ACCESS_CARGO, ACCESS_CARGO_BOT, ACCESS_CONSTRUCTION,
|
|
ACCESS_HYDROPONICS, ACCESS_LIBRARY, ACCESS_LAWYER, ACCESS_VIROLOGY, ACCESS_CMO, ACCESS_QM, ACCESS_SURGERY,
|
|
ACCESS_THEATRE, ACCESS_RESEARCH, ACCESS_MINING, ACCESS_MAILSORTING, ACCESS_WEAPONS,
|
|
ACCESS_MECH_MINING, ACCESS_MECH_ENGINE, ACCESS_MECH_SCIENCE, ACCESS_MECH_SECURITY, ACCESS_MECH_MEDICAL,
|
|
ACCESS_VAULT, ACCESS_MINING_STATION, ACCESS_XENOBIOLOGY, ACCESS_CE, ACCESS_HOP, ACCESS_HOS, ACCESS_RC_ANNOUNCE,
|
|
ACCESS_KEYCARD_AUTH, ACCESS_TCOMSAT, ACCESS_GATEWAY, ACCESS_MINERAL_STOREROOM, ACCESS_MINISAT, ACCESS_NETWORK, ACCESS_CLONING, ACCESS_TCOM_ADMIN, ACCESS_PARAMEDIC, ACCESS_MANUFACTURING) //YOGS - yogs jobs
|
|
|
|
/proc/get_all_centcom_access()
|
|
return list(ACCESS_CENT_GENERAL, ACCESS_CENT_THUNDER, ACCESS_CENT_SPECOPS, ACCESS_CENT_MEDICAL, ACCESS_CENT_LIVING, ACCESS_CENT_STORAGE, ACCESS_CENT_TELEPORTER, ACCESS_CENT_CAPTAIN)
|
|
|
|
/proc/get_ert_access(class)
|
|
switch(class)
|
|
if("commander")
|
|
return get_all_centcom_access()
|
|
if("sec")
|
|
return list(ACCESS_CENT_GENERAL, ACCESS_CENT_SPECOPS, ACCESS_CENT_LIVING)
|
|
if("eng")
|
|
return list(ACCESS_CENT_GENERAL, ACCESS_CENT_SPECOPS, ACCESS_CENT_LIVING, ACCESS_CENT_STORAGE)
|
|
if("med")
|
|
return list(ACCESS_CENT_GENERAL, ACCESS_CENT_SPECOPS, ACCESS_CENT_MEDICAL, ACCESS_CENT_LIVING)
|
|
|
|
/proc/get_all_syndicate_access()
|
|
return list(ACCESS_SYNDICATE, ACCESS_SYNDICATE)
|
|
|
|
/proc/get_region_accesses(code)
|
|
switch(code)
|
|
if(0)
|
|
return get_all_accesses()
|
|
if(1) //station general
|
|
return list(ACCESS_KITCHEN,ACCESS_BAR, ACCESS_HYDROPONICS, ACCESS_JANITOR, ACCESS_CHAPEL_OFFICE, ACCESS_CREMATORIUM, ACCESS_LIBRARY, ACCESS_THEATRE, ACCESS_LAWYER)
|
|
if(2) //security
|
|
return list(ACCESS_SEC_DOORS, ACCESS_WEAPONS, ACCESS_SECURITY, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_FORENSICS_LOCKERS, ACCESS_COURT, ACCESS_MECH_SECURITY, ACCESS_HOS)
|
|
if(3) //medbay
|
|
return list(ACCESS_MEDICAL, ACCESS_GENETICS, ACCESS_CLONING, ACCESS_MORGUE, ACCESS_CHEMISTRY, ACCESS_VIROLOGY, ACCESS_SURGERY, ACCESS_MECH_MEDICAL, ACCESS_CMO, ACCESS_PARAMEDIC) // yogs - Yog jobs
|
|
if(4) //research
|
|
return list(ACCESS_RESEARCH, ACCESS_TOX, ACCESS_TOX_STORAGE, ACCESS_GENETICS, ACCESS_ROBOTICS, ACCESS_XENOBIOLOGY, ACCESS_MECH_SCIENCE, ACCESS_MINISAT, ACCESS_RD, ACCESS_NETWORK)
|
|
if(5) //engineering and maintenance
|
|
return list(ACCESS_CONSTRUCTION, ACCESS_MAINT_TUNNELS, ACCESS_ENGINE, ACCESS_ENGINE_EQUIP, ACCESS_EXTERNAL_AIRLOCKS, ACCESS_TECH_STORAGE, ACCESS_ATMOSPHERICS, ACCESS_MECH_ENGINE, ACCESS_TCOMSAT, ACCESS_MINISAT, ACCESS_CE, ACCESS_TCOM_ADMIN, ACCESS_RC_ANNOUNCE) // yogs - Yog jobs
|
|
if(6) //supply
|
|
return list(ACCESS_MAILSORTING, ACCESS_MINING, ACCESS_MINING_STATION, ACCESS_MECH_MINING, ACCESS_MINERAL_STOREROOM, ACCESS_CARGO, ACCESS_QM, ACCESS_VAULT)
|
|
if(7) //command
|
|
return list(ACCESS_HEADS, ACCESS_RC_ANNOUNCE, ACCESS_KEYCARD_AUTH, ACCESS_CHANGE_IDS, ACCESS_AI_UPLOAD, ACCESS_TELEPORTER, ACCESS_EVA, ACCESS_GATEWAY, ACCESS_ALL_PERSONAL_LOCKERS, ACCESS_HOP, ACCESS_CAPTAIN, ACCESS_VAULT)
|
|
|
|
/proc/get_region_accesses_name(code)
|
|
switch(code)
|
|
if(0)
|
|
return "All"
|
|
if(1) //station general
|
|
return "General"
|
|
if(2) //security
|
|
return "Security"
|
|
if(3) //medbay
|
|
return "Medbay"
|
|
if(4) //research
|
|
return "Research"
|
|
if(5) //engineering and maintenance
|
|
return "Engineering"
|
|
if(6) //supply
|
|
return "Supply"
|
|
if(7) //command
|
|
return "Command"
|
|
|
|
/proc/get_access_desc(A)
|
|
switch(A)
|
|
if(ACCESS_CARGO)
|
|
return "Cargo Bay"
|
|
if(ACCESS_CARGO_BOT)
|
|
return "Delivery Chutes"
|
|
if(ACCESS_SECURITY)
|
|
return "Security"
|
|
if(ACCESS_BRIG)
|
|
return "Holding Cells"
|
|
if(ACCESS_COURT)
|
|
return "Courtroom"
|
|
if(ACCESS_FORENSICS_LOCKERS)
|
|
return "Forensics"
|
|
if(ACCESS_MEDICAL)
|
|
return "Medical"
|
|
if(ACCESS_GENETICS)
|
|
return "Genetics Lab"
|
|
if(ACCESS_MORGUE)
|
|
return "Morgue"
|
|
if(ACCESS_TOX)
|
|
return "R&D Lab"
|
|
if(ACCESS_TOX_STORAGE)
|
|
return "Toxins Lab"
|
|
if(ACCESS_CHEMISTRY)
|
|
return "Chemistry Lab"
|
|
if(ACCESS_RD)
|
|
return "RD Office"
|
|
if(ACCESS_BAR)
|
|
return "Bar"
|
|
if(ACCESS_JANITOR)
|
|
return "Custodial Closet"
|
|
if(ACCESS_ENGINE)
|
|
return "Engineering"
|
|
if(ACCESS_ENGINE_EQUIP)
|
|
return "Power and Engineering Equipment"
|
|
if(ACCESS_MAINT_TUNNELS)
|
|
return "Maintenance"
|
|
if(ACCESS_EXTERNAL_AIRLOCKS)
|
|
return "External Airlocks"
|
|
if(ACCESS_EMERGENCY_STORAGE)
|
|
return "Emergency Storage"
|
|
if(ACCESS_CHANGE_IDS)
|
|
return "ID Console"
|
|
if(ACCESS_AI_UPLOAD)
|
|
return "AI Chambers"
|
|
if(ACCESS_TELEPORTER)
|
|
return "Teleporter"
|
|
if(ACCESS_EVA)
|
|
return "EVA"
|
|
if(ACCESS_HEADS)
|
|
return "Bridge"
|
|
if(ACCESS_CAPTAIN)
|
|
return "Captain"
|
|
if(ACCESS_ALL_PERSONAL_LOCKERS)
|
|
return "Personal Lockers"
|
|
if(ACCESS_CHAPEL_OFFICE)
|
|
return "Chapel Office"
|
|
if(ACCESS_TECH_STORAGE)
|
|
return "Technical Storage"
|
|
if(ACCESS_ATMOSPHERICS)
|
|
return "Atmospherics"
|
|
if(ACCESS_CREMATORIUM)
|
|
return "Crematorium"
|
|
if(ACCESS_ARMORY)
|
|
return "Armory"
|
|
if(ACCESS_CONSTRUCTION)
|
|
return "Construction"
|
|
if(ACCESS_KITCHEN)
|
|
return "Kitchen"
|
|
if(ACCESS_HYDROPONICS)
|
|
return "Hydroponics"
|
|
if(ACCESS_LIBRARY)
|
|
return "Library"
|
|
if(ACCESS_LAWYER)
|
|
return "Law Office"
|
|
if(ACCESS_ROBOTICS)
|
|
return "Robotics"
|
|
if(ACCESS_VIROLOGY)
|
|
return "Virology"
|
|
if(ACCESS_CMO)
|
|
return "CMO Office"
|
|
if(ACCESS_QM)
|
|
return "Quartermaster"
|
|
if(ACCESS_SURGERY)
|
|
return "Surgery"
|
|
if(ACCESS_THEATRE)
|
|
return "Theatre"
|
|
if(ACCESS_MANUFACTURING)
|
|
return "Manufacturing"
|
|
if(ACCESS_RESEARCH)
|
|
return "Science"
|
|
if(ACCESS_MINING)
|
|
return "Mining"
|
|
if(ACCESS_MINING_OFFICE)
|
|
return "Mining Office"
|
|
if(ACCESS_MAILSORTING)
|
|
return "Cargo Office"
|
|
if(ACCESS_MINT)
|
|
return "Mint"
|
|
if(ACCESS_MINT_VAULT)
|
|
return "Mint Vault"
|
|
if(ACCESS_VAULT)
|
|
return "Main Vault"
|
|
if(ACCESS_MINING_STATION)
|
|
return "Mining EVA"
|
|
if(ACCESS_XENOBIOLOGY)
|
|
return "Xenobiology Lab"
|
|
if(ACCESS_HOP)
|
|
return "HoP Office"
|
|
if(ACCESS_HOS)
|
|
return "HoS Office"
|
|
if(ACCESS_CE)
|
|
return "CE Office"
|
|
if(ACCESS_RC_ANNOUNCE)
|
|
return "RC Announcements"
|
|
if(ACCESS_KEYCARD_AUTH)
|
|
return "Keycode Auth."
|
|
if(ACCESS_TCOMSAT)
|
|
return "Telecommunications"
|
|
if(ACCESS_GATEWAY)
|
|
return "Gateway"
|
|
if(ACCESS_SEC_DOORS)
|
|
return "Brig"
|
|
if(ACCESS_MINERAL_STOREROOM)
|
|
return "Mineral Storage"
|
|
if(ACCESS_MINISAT)
|
|
return "AI Satellite"
|
|
if(ACCESS_WEAPONS)
|
|
return "Weapon Permit"
|
|
if(ACCESS_NETWORK)
|
|
return "Network Access"
|
|
if(ACCESS_CLONING)
|
|
return "Cloning Room"
|
|
if(ACCESS_MECH_MINING)
|
|
return "Mining Mech Access"
|
|
if(ACCESS_MECH_MEDICAL)
|
|
return "Medical Mech Access"
|
|
if(ACCESS_MECH_SECURITY)
|
|
return "Security Mech Access"
|
|
if(ACCESS_MECH_SCIENCE)
|
|
return "Science Mech Access"
|
|
if(ACCESS_MECH_ENGINE)
|
|
return "Engineering Mech Access"
|
|
// yogs start - Yog jobs
|
|
if(ACCESS_PARAMEDIC)
|
|
return "Paramedic"
|
|
if(ACCESS_TCOM_ADMIN)
|
|
return "Tcomms Admin"
|
|
if(ACCESS_MANUFACTURING)
|
|
return "Clerk"
|
|
// yogs end
|
|
|
|
/proc/get_centcom_access_desc(A)
|
|
switch(A)
|
|
if(ACCESS_CENT_GENERAL)
|
|
return "Code Grey"
|
|
if(ACCESS_CENT_THUNDER)
|
|
return "Code Yellow"
|
|
if(ACCESS_CENT_STORAGE)
|
|
return "Code Orange"
|
|
if(ACCESS_CENT_LIVING)
|
|
return "Code Green"
|
|
if(ACCESS_CENT_MEDICAL)
|
|
return "Code White"
|
|
if(ACCESS_CENT_TELEPORTER)
|
|
return "Code Blue"
|
|
if(ACCESS_CENT_SPECOPS)
|
|
return "Code Black"
|
|
if(ACCESS_CENT_CAPTAIN)
|
|
return "Code Gold"
|
|
if(ACCESS_CENT_BAR)
|
|
return "Code Scotch"
|
|
|
|
/proc/get_all_jobs()
|
|
return list("Assistant", "Captain", "Head of Personnel", "Bartender", "Cook", "Botanist", "Quartermaster", "Cargo Technician",
|
|
"Shaft Miner", "Clown", "Mime", "Janitor", "Curator", "Lawyer", "Chaplain", "Chief Engineer", "Station Engineer",
|
|
"Atmospheric Technician", "Chief Medical Officer", "Medical Doctor", "Chemist", "Geneticist", "Virologist",
|
|
// yogs start - Yog jobs
|
|
"Research Director", "Scientist", "Roboticist", "Head of Security", "Warden", "Detective", "Security Officer",
|
|
"Signal Tech", "Mining Medic", "Paramedic", "Psychiatrist", "Clerk", "Tourist", "Space Bartender")
|
|
// yogs end
|
|
|
|
/proc/get_all_job_icons() //For all existing HUD icons
|
|
return get_all_jobs() + list("Prisoner")
|
|
|
|
/proc/get_all_centcom_jobs()
|
|
return list("VIP Guest","Custodian","Thunderdome Overseer","CentCom Official","Medical Officer","Death Commando","Research Officer","Special Ops Officer","Admiral","CentCom Commander","Emergency Response Team Commander","Security Response Officer","Engineer Response Officer", "Medical Response Officer","CentCom Bartender")
|
|
|
|
/obj/item/proc/GetJobName() //Used in secHUD icon generation
|
|
var/obj/item/card/id/I = GetID()
|
|
if(!I)
|
|
return
|
|
var/jobName = I.assignment
|
|
if(jobName in get_all_job_icons()) //Check if the job has a hud icon
|
|
return jobName
|
|
if(jobName in get_all_centcom_jobs()) //Return with the NT logo if it is a CentCom job
|
|
return "CentCom"
|
|
return "Unknown" //Return unknown if none of the above apply
|