Half-Refactors Jobs (#6762)

* Somewhat cleans up a piece of job code, makes new ID computers not be awful.

* Changes ROLE_ defines to DEPARTMENT_ to be clearer. Backports the new ID computer's assignment section of its UI to the old ID computer.

* Swaps back to southern cross map.

* Removes a block of commented code.
This commit is contained in:
Neerti
2020-03-03 16:27:37 -05:00
committed by GitHub
parent 5f33c40356
commit 24fbd0b87e
80 changed files with 653 additions and 590 deletions

View File

@@ -300,7 +300,7 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
output += "<option value=''>--</option>"
for(var/j in get_all_jobs())
output += "<option value='[j]'>[j]</option>"
for(var/j in nonhuman_positions)
for(var/j in SSjob.get_job_titles_in_department(DEPARTMENT_SYNTHETIC))
output += "<option value='[j]'>[j]</option>"
var/list/bantypes = list("traitor","changeling","operative","revolutionary","cultist","wizard") //For legacy bans.
for(var/antag_type in all_antag_types) // Grab other bans.

View File

@@ -394,8 +394,8 @@
//Regular jobs
//Command (Blue)
jobs += "<table cellpadding='1' cellspacing='0' width='100%'>"
jobs += "<tr align='center' bgcolor='ccccff'><th colspan='[length(command_positions)]'><a href='?src=\ref[src];jobban3=commanddept;jobban4=\ref[M]'>Command Positions</a></th></tr><tr align='center'>"
for(var/jobPos in command_positions)
jobs += "<tr align='center' bgcolor='ccccff'><th colspan='[length(SSjob.get_job_titles_in_department(DEPARTMENT_COMMAND))]'><a href='?src=\ref[src];jobban3=commanddept;jobban4=\ref[M]'>Command Positions</a></th></tr><tr align='center'>"
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_COMMAND))
if(!jobPos) continue
var/datum/job/job = job_master.GetJob(jobPos)
if(!job) continue
@@ -415,8 +415,8 @@
//Security (Red)
counter = 0
jobs += "<table cellpadding='1' cellspacing='0' width='100%'>"
jobs += "<tr bgcolor='ffddf0'><th colspan='[length(security_positions)]'><a href='?src=\ref[src];jobban3=securitydept;jobban4=\ref[M]'>Security Positions</a></th></tr><tr align='center'>"
for(var/jobPos in security_positions)
jobs += "<tr bgcolor='ffddf0'><th colspan='[length(SSjob.get_job_titles_in_department(DEPARTMENT_SECURITY))]'><a href='?src=\ref[src];jobban3=securitydept;jobban4=\ref[M]'>Security Positions</a></th></tr><tr align='center'>"
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_SECURITY))
if(!jobPos) continue
var/datum/job/job = job_master.GetJob(jobPos)
if(!job) continue
@@ -436,8 +436,8 @@
//Engineering (Yellow)
counter = 0
jobs += "<table cellpadding='1' cellspacing='0' width='100%'>"
jobs += "<tr bgcolor='fff5cc'><th colspan='[length(engineering_positions)]'><a href='?src=\ref[src];jobban3=engineeringdept;jobban4=\ref[M]'>Engineering Positions</a></th></tr><tr align='center'>"
for(var/jobPos in engineering_positions)
jobs += "<tr bgcolor='fff5cc'><th colspan='[length(SSjob.get_job_titles_in_department(DEPARTMENT_ENGINEERING))]'><a href='?src=\ref[src];jobban3=engineeringdept;jobban4=\ref[M]'>Engineering Positions</a></th></tr><tr align='center'>"
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_ENGINEERING))
if(!jobPos) continue
var/datum/job/job = job_master.GetJob(jobPos)
if(!job) continue
@@ -457,8 +457,8 @@
//Cargo (Yellow)
counter = 0
jobs += "<table cellpadding='1' cellspacing='0' width='100%'>"
jobs += "<tr bgcolor='fff5cc'><th colspan='[length(cargo_positions)]'><a href='?src=\ref[src];jobban3=cargodept;jobban4=\ref[M]'>Cargo Positions</a></th></tr><tr align='center'>"
for(var/jobPos in cargo_positions)
jobs += "<tr bgcolor='fff5cc'><th colspan='[length(SSjob.get_job_titles_in_department(DEPARTMENT_CARGO))]'><a href='?src=\ref[src];jobban3=cargodept;jobban4=\ref[M]'>Cargo Positions</a></th></tr><tr align='center'>"
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_CARGO))
if(!jobPos) continue
var/datum/job/job = job_master.GetJob(jobPos)
if(!job) continue
@@ -478,8 +478,8 @@
//Medical (White)
counter = 0
jobs += "<table cellpadding='1' cellspacing='0' width='100%'>"
jobs += "<tr bgcolor='ffeef0'><th colspan='[length(medical_positions)]'><a href='?src=\ref[src];jobban3=medicaldept;jobban4=\ref[M]'>Medical Positions</a></th></tr><tr align='center'>"
for(var/jobPos in medical_positions)
jobs += "<tr bgcolor='ffeef0'><th colspan='[length(SSjob.get_job_titles_in_department(DEPARTMENT_MEDICAL))]'><a href='?src=\ref[src];jobban3=medicaldept;jobban4=\ref[M]'>Medical Positions</a></th></tr><tr align='center'>"
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_MEDICAL))
if(!jobPos) continue
var/datum/job/job = job_master.GetJob(jobPos)
if(!job) continue
@@ -499,8 +499,8 @@
//Science (Purple)
counter = 0
jobs += "<table cellpadding='1' cellspacing='0' width='100%'>"
jobs += "<tr bgcolor='e79fff'><th colspan='[length(science_positions)]'><a href='?src=\ref[src];jobban3=sciencedept;jobban4=\ref[M]'>Science Positions</a></th></tr><tr align='center'>"
for(var/jobPos in science_positions)
jobs += "<tr bgcolor='e79fff'><th colspan='[length(SSjob.get_job_titles_in_department(DEPARTMENT_RESEARCH))]'><a href='?src=\ref[src];jobban3=sciencedept;jobban4=\ref[M]'>Science Positions</a></th></tr><tr align='center'>"
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_RESEARCH))
if(!jobPos) continue
var/datum/job/job = job_master.GetJob(jobPos)
if(!job) continue
@@ -520,8 +520,8 @@
//Civilian (Grey)
counter = 0
jobs += "<table cellpadding='1' cellspacing='0' width='100%'>"
jobs += "<tr bgcolor='dddddd'><th colspan='[length(civilian_positions)]'><a href='?src=\ref[src];jobban3=civiliandept;jobban4=\ref[M]'>Civilian Positions</a></th></tr><tr align='center'>"
for(var/jobPos in civilian_positions)
jobs += "<tr bgcolor='dddddd'><th colspan='[length(SSjob.get_job_titles_in_department(DEPARTMENT_CIVILIAN))]'><a href='?src=\ref[src];jobban3=civiliandept;jobban4=\ref[M]'>Civilian Positions</a></th></tr><tr align='center'>"
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_CIVILIAN))
if(!jobPos) continue
var/datum/job/job = job_master.GetJob(jobPos)
if(!job) continue
@@ -547,8 +547,8 @@
//Non-Human (Green)
counter = 0
jobs += "<table cellpadding='1' cellspacing='0' width='100%'>"
jobs += "<tr bgcolor='ccffcc'><th colspan='[length(nonhuman_positions)+1]'><a href='?src=\ref[src];jobban3=nonhumandept;jobban4=\ref[M]'>Non-human Positions</a></th></tr><tr align='center'>"
for(var/jobPos in nonhuman_positions)
jobs += "<tr bgcolor='ccffcc'><th colspan='[length(SSjob.get_job_titles_in_department(DEPARTMENT_SYNTHETIC))+1]'><a href='?src=\ref[src];jobban3=nonhumandept;jobban4=\ref[M]'>Non-human Positions</a></th></tr><tr align='center'>"
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_SYNTHETIC))
if(!jobPos) continue
var/datum/job/job = job_master.GetJob(jobPos)
if(!job) continue
@@ -635,50 +635,50 @@
var/list/joblist = list()
switch(href_list["jobban3"])
if("commanddept")
for(var/jobPos in command_positions)
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_COMMAND))
if(!jobPos) continue
var/datum/job/temp = job_master.GetJob(jobPos)
if(!temp) continue
joblist += temp.title
if("securitydept")
for(var/jobPos in security_positions)
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_SECURITY))
if(!jobPos) continue
var/datum/job/temp = job_master.GetJob(jobPos)
if(!temp) continue
joblist += temp.title
if("engineeringdept")
for(var/jobPos in engineering_positions)
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_ENGINEERING))
if(!jobPos) continue
var/datum/job/temp = job_master.GetJob(jobPos)
if(!temp) continue
joblist += temp.title
if("cargodept")
for(var/jobPos in cargo_positions)
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_CARGO))
if(!jobPos) continue
var/datum/job/temp = job_master.GetJob(jobPos)
if(!temp) continue
joblist += temp.title
if("medicaldept")
for(var/jobPos in medical_positions)
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_MEDICAL))
if(!jobPos) continue
var/datum/job/temp = job_master.GetJob(jobPos)
if(!temp) continue
joblist += temp.title
if("sciencedept")
for(var/jobPos in science_positions)
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_RESEARCH))
if(!jobPos) continue
var/datum/job/temp = job_master.GetJob(jobPos)
if(!temp) continue
joblist += temp.title
if("civiliandept")
for(var/jobPos in civilian_positions)
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_CIVILIAN))
if(!jobPos) continue
var/datum/job/temp = job_master.GetJob(jobPos)
if(!temp) continue
joblist += temp.title
if("nonhumandept")
joblist += "pAI"
for(var/jobPos in nonhuman_positions)
for(var/jobPos in SSjob.get_job_titles_in_department(DEPARTMENT_SYNTHETIC))
if(!jobPos) continue
var/datum/job/temp = job_master.GetJob(jobPos)
if(!temp) continue

View File

@@ -97,7 +97,7 @@
if((pref.job_civilian_low & ASSISTANT) && job.type != /datum/job/assistant)
. += "<font color=grey>[rank]</font></td><td></td></tr>"
continue
if((rank in command_positions) || (rank == "AI"))//Bold head jobs
if((rank in SSjob.get_job_titles_in_department(DEPARTMENT_COMMAND) ) || (rank == "AI"))//Bold head jobs
. += "<b>[rank]</b>"
else
. += "[rank]"

View File

@@ -206,16 +206,16 @@ var/list/event_last_fired = list()
else if(istype(R.module, /obj/item/weapon/robot_module/robot/research))
active_with_role["Scientist"]++
if(M.mind.assigned_role in engineering_positions)
if(M.mind.assigned_role in SSjob.get_job_titles_in_department(DEPARTMENT_ENGINEERING))
active_with_role["Engineer"]++
if(M.mind.assigned_role in medical_positions)
if(M.mind.assigned_role in SSjob.get_job_titles_in_department(DEPARTMENT_MEDICAL))
active_with_role["Medical"]++
if(M.mind.assigned_role in security_positions)
if(M.mind.assigned_role in SSjob.get_job_titles_in_department(DEPARTMENT_SECURITY))
active_with_role["Security"]++
if(M.mind.assigned_role in science_positions)
if(M.mind.assigned_role in SSjob.get_job_titles_in_department(DEPARTMENT_RESEARCH))
active_with_role["Scientist"]++
if(M.mind.assigned_role == "AI")

View File

@@ -1,6 +1,6 @@
/datum/gm_action/atmos_leak
name = "atmospherics leak"
departments = list(ROLE_ENGINEERING, ROLE_SYNTHETIC)
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_SYNTHETIC)
var/area/target_area // Chosen target area
var/area/target_turf // Chosen target turf in target_area
var/gas_type // Chosen gas to release
@@ -74,4 +74,4 @@
playsound(target_turf, 'sound/effects/smoke.ogg', 50, 1)
/datum/gm_action/atmos_leak/get_weight()
return 15 + (metric.count_people_in_department(ROLE_ENGINEERING) * 10 + metric.count_people_in_department(ROLE_SYNTHETIC) * 30) // Synthetics are counted in higher value because they can wirelessly connect to alarms.
return 15 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 10 + metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 30) // Synthetics are counted in higher value because they can wirelessly connect to alarms.

View File

@@ -1,6 +1,6 @@
/datum/gm_action/blob
name = "blob infestation"
departments = list(ROLE_ENGINEERING, ROLE_SECURITY, ROLE_MEDICAL)
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_SECURITY, DEPARTMENT_MEDICAL)
chaotic = 25
var/list/area/excluded = list(
@@ -62,9 +62,9 @@
command_announcement.Announce("Confirmed outbreak of level 7 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/outbreak7.ogg')
/datum/gm_action/blob/get_weight()
var/engineers = metric.count_people_in_department(ROLE_ENGINEERING)
var/security = metric.count_people_in_department(ROLE_SECURITY)
var/medical = metric.count_people_in_department(ROLE_MEDICAL)
var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
var/security = metric.count_people_in_department(DEPARTMENT_SECURITY)
var/medical = metric.count_people_in_department(DEPARTMENT_MEDICAL)
var/assigned_staff = engineers + security
if(engineers || security) // Medical only counts if one of the other two exists, and even then they count as half.

View File

@@ -1,7 +1,7 @@
/datum/gm_action/brand_intelligence
name = "rampant vending machines"
length = 30 MINUTES
departments = list(ROLE_ENGINEERING, ROLE_EVERYONE)
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_EVERYONE)
var/list/obj/machinery/vending/vendingMachines = list()
var/list/obj/machinery/vending/infectedVendingMachines = list()
@@ -66,4 +66,4 @@
infectedMachine.shoot_inventory = 0
/datum/gm_action/brand_intelligence/get_weight()
return 60 + (metric.count_people_in_department(ROLE_ENGINEERING) * 20)
return 60 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20)

View File

@@ -1,7 +1,7 @@
/datum/gm_action/camera_damage
name = "random camera damage"
reusable = TRUE
departments = list(ROLE_SYNTHETIC, ROLE_ENGINEERING)
departments = list(DEPARTMENT_SYNTHETIC, DEPARTMENT_ENGINEERING)
/datum/gm_action/camera_damage/start()
var/obj/machinery/camera/C = acquire_random_camera()
@@ -49,4 +49,4 @@
return T && C.can_use() && istype(C.loc, /turf) && (T.z in using_map.player_levels)
/datum/gm_action/camera_damage/get_weight()
return 40 + (metric.count_people_in_department(ROLE_ENGINEERING) * 20) + (metric.count_people_in_department(ROLE_SYNTHETIC) * 40)
return 40 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20) + (metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 40)

View File

@@ -4,11 +4,11 @@
/datum/gm_action/canister_leak
name = "Canister Leak"
departments = list(ROLE_ENGINEERING)
departments = list(DEPARTMENT_ENGINEERING)
chaotic = 20
/datum/gm_action/canister_leak/get_weight()
return metric.count_people_in_department(ROLE_ENGINEERING) * 30
return metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 30
/datum/gm_action/canister_leak/start()
..()

View File

@@ -1,14 +1,14 @@
//carp_migration
/datum/gm_action/carp_migration
name = "carp migration"
departments = list(ROLE_SECURITY, ROLE_EVERYONE)
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_EVERYONE)
chaotic = 50
var/list/spawned_carp = list()
var/carp_amount = 0
length = 20 MINUTES
/datum/gm_action/carp_migration/get_weight()
return 50 + (metric.count_people_in_department(ROLE_SECURITY) * 10) + (metric.count_all_space_mobs() * 20)
return 50 + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 10) + (metric.count_all_space_mobs() * 20)
/datum/gm_action/carp_migration/announce()
var/announcement = "Unknown biological entities have been detected near [station_name()], please stand-by."
@@ -17,12 +17,12 @@
/datum/gm_action/carp_migration/set_up()
// Higher filled roles means more groups of fish.
var/station_strength = 0
station_strength += (metric.count_people_in_department(ROLE_SECURITY) * 3)
station_strength += (metric.count_people_in_department(ROLE_ENGINEERING) * 2)
station_strength += metric.count_people_in_department(ROLE_MEDICAL)
station_strength += (metric.count_people_in_department(DEPARTMENT_SECURITY) * 3)
station_strength += (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 2)
station_strength += metric.count_people_in_department(DEPARTMENT_MEDICAL)
// Less active emergency response departments tones the event down.
var/activeness = ((metric.assess_department(ROLE_SECURITY) + metric.assess_department(ROLE_ENGINEERING) + metric.assess_department(ROLE_MEDICAL)) / 3)
var/activeness = ((metric.assess_department(DEPARTMENT_SECURITY) + metric.assess_department(DEPARTMENT_ENGINEERING) + metric.assess_department(DEPARTMENT_MEDICAL)) / 3)
activeness = max(activeness, 20)
carp_amount = CEILING(station_strength * (activeness / 100) + 1, 1)

View File

@@ -1,10 +1,10 @@
/datum/gm_action/comms_blackout
name = "communications blackout"
departments = list(ROLE_ENGINEERING, ROLE_EVERYONE)
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_EVERYONE)
chaotic = 35
/datum/gm_action/comms_blackout/get_weight()
return 50 + (metric.count_people_in_department(ROLE_ENGINEERING) * 40)
return 50 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 40)
/datum/gm_action/comms_blackout/announce()
if(prob(33))

View File

@@ -1,10 +1,10 @@
/datum/gm_action/security_drill
name = "security drills"
departments = list(ROLE_SECURITY, ROLE_EVERYONE)
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_EVERYONE)
/datum/gm_action/security_drill/announce()
spawn(rand(1 MINUTE, 2 MINUTES))
command_announcement.Announce("[pick("A NanoTrasen security director", "A Vir-Gov correspondant", "Local Sif authoritiy")] has advised the enactment of [pick("a rampant wildlife", "a fire", "a hostile boarding", "a nonstandard", "a bomb", "an emergent intelligence")] drill with the personnel onboard \the [station_name()].", "Security Advisement")
/datum/gm_action/security_drill/get_weight()
return max(-20, 10 + gm.staleness - (gm.danger * 2)) + (metric.count_people_in_department(ROLE_SECURITY) * 5) + (metric.count_people_in_department(ROLE_EVERYONE) * 1.5)
return max(-20, 10 + gm.staleness - (gm.danger * 2)) + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 5) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 1.5)

View File

@@ -1,6 +1,6 @@
/datum/gm_action/dust
name = "dust"
departments = list(ROLE_ENGINEERING)
departments = list(DEPARTMENT_ENGINEERING)
chaotic = 10
reusable = TRUE
@@ -8,7 +8,7 @@
command_announcement.Announce("Debris resulting from activity on another nearby asteroid is approaching your colony.", "Dust Alert")
/datum/gm_action/dust/get_weight()
var/engineers = metric.count_people_in_department(ROLE_ENGINEERING)
var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
var/weight = 30 + (engineers * 25)
return weight

View File

@@ -1,6 +1,6 @@
/datum/gm_action/electrical_storm
name = "electrical storm"
departments = list(ROLE_EVERYONE)
departments = list(DEPARTMENT_EVERYONE)
reusable = TRUE
var/lightsoutAmount = 1
var/lightsoutRange = 25
@@ -30,4 +30,4 @@
apc.overload_lighting()
/datum/gm_action/electrical_storm/get_weight()
return 30 + (metric.count_people_in_department(ROLE_ENGINEERING) * 15) + (metric.count_people_in_department(ROLE_EVERYONE) * 5)
return 30 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 15) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5)

View File

@@ -1,6 +1,6 @@
/datum/gm_action/electrified_door
name = "airlock short-circuit"
departments = list(ROLE_ENGINEERING, ROLE_MEDICAL)
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_MEDICAL)
chaotic = 10
var/obj/machinery/door/airlock/chosen_door
var/area/target_area
@@ -72,4 +72,4 @@
chosen_door.update_icon()
/datum/gm_action/electrified_door/get_weight()
return 10 + (metric.count_people_in_department(ROLE_ENGINEERING) * 5 + metric.count_people_in_department(ROLE_MEDICAL) * 10)
return 10 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 5 + metric.count_people_in_department(DEPARTMENT_MEDICAL) * 10)

View File

@@ -1,6 +1,6 @@
/datum/gm_action/gravity
name = "gravity failure"
departments = list(ROLE_EVERYONE)
departments = list(DEPARTMENT_EVERYONE)
length = 600
var/list/zLevels
@@ -33,4 +33,4 @@
command_announcement.Announce("Gravity generators are again functioning within normal parameters. Sorry for any inconvenience.", "Gravity Restored")
/datum/gm_action/gravity/get_weight()
return 30 + (metric.count_people_in_department(ROLE_EVERYONE) * 20)
return 30 + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 20)

View File

@@ -6,11 +6,11 @@
/datum/gm_action/grid_check
name = "grid check"
departments = list(ROLE_ENGINEERING, ROLE_EVERYONE)
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_EVERYONE)
chaotic = 20
/datum/gm_action/grid_check/get_weight()
return 50 + (metric.count_people_in_department(ROLE_ENGINEERING) * 30)
return 50 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 30)
/datum/gm_action/grid_check/start()
..()

View File

@@ -14,7 +14,7 @@
/datum/gm_action/infestation
name = "animal infestation"
departments = list(ROLE_EVERYONE)
departments = list(DEPARTMENT_EVERYONE)
var/location
var/locstring
var/vermin
@@ -100,7 +100,7 @@
command_announcement.Announce("Bioscans indicate that [vermstring] have been breeding in [locstring]. Clear them out, before this starts to affect productivity.", "Vermin infestation")
/datum/gm_action/infestation/get_weight()
return 5 + (metric.count_people_in_department(ROLE_EVERYONE) * 20)
return 5 + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 20)
#undef LOC_KITCHEN
#undef LOC_ATMOS

View File

@@ -1,6 +1,6 @@
/datum/gm_action/ionstorm
name = "ion storm"
departments = list(ROLE_SYNTHETIC)
departments = list(DEPARTMENT_SYNTHETIC)
var/botEmagChance = 0.5
var/list/players = list()
var/active = FALSE
@@ -45,6 +45,6 @@
ion_storm_announcement()
/datum/gm_action/ionstorm/get_weight()
var/bots = metric.count_people_in_department(ROLE_SYNTHETIC)
var/bots = metric.count_people_in_department(DEPARTMENT_SYNTHETIC)
var/weight = 5 + (bots * 20)
return weight

View File

@@ -1,7 +1,7 @@
/datum/gm_action/manifest_malfunction
name = "manifest malfunction"
enabled = TRUE
departments = list(ROLE_SECURITY, ROLE_SYNTHETIC, ROLE_EVERYONE)
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_SYNTHETIC, DEPARTMENT_EVERYONE)
chaotic = 3
reusable = FALSE
length = 0
@@ -21,10 +21,10 @@
/datum/gm_action/manifest_malfunction/get_weight()
. = -10
var/security = metric.count_people_in_department(ROLE_SECURITY)
var/security = metric.count_people_in_department(DEPARTMENT_SECURITY)
if(security && data_core)
. += (metric.count_people_in_department(ROLE_EVERYONE) * 5) - (metric.count_people_in_department(ROLE_SYNTHETIC) * 5)
. += (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5) - (metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 5)
return .

View File

@@ -2,7 +2,7 @@
/datum/gm_action/meteor_defense
name = "meteor defense"
departments = list(ROLE_ENGINEERING, ROLE_CARGO)
departments = list(DEPARTMENT_ENGINEERING, DEPARTMENT_CARGO)
chaotic = 50
var/direction = null
var/dir_text = null
@@ -11,9 +11,9 @@
var/meteor_types
/datum/gm_action/meteor_defense/get_weight()
var/engineers = metric.count_people_in_department(ROLE_ENGINEERING)
var/cargo = metric.count_people_in_department(ROLE_CARGO)
var/bots = metric.count_people_in_department(ROLE_SYNTHETIC)
var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
var/cargo = metric.count_people_in_department(DEPARTMENT_CARGO)
var/bots = metric.count_people_in_department(DEPARTMENT_SYNTHETIC)
var/weight = (max(engineers - 1, 0) * 20) // If only one engineer exists, no meteors for now.
if(engineers >= 2)

View File

@@ -2,7 +2,7 @@
/datum/gm_action/money_hacker
name = "bank account hacker"
departments = list(ROLE_EVERYONE)
departments = list(DEPARTMENT_EVERYONE)
reusable = TRUE
var/datum/money_account/affected_account
var/active

View File

@@ -1,6 +1,6 @@
/datum/gm_action/money_lotto
name = "lottery win"
departments = list(ROLE_EVERYONE)
departments = list(DEPARTMENT_EVERYONE)
var/winner_name = "John Smith"
var/winner_sum = 0
var/deposit_success = 0
@@ -36,4 +36,4 @@
news_network.SubmitArticle(body, author, channel, null, 1)
/datum/gm_action/money_lotto/get_weight()
return 25 * metric.count_people_in_department(ROLE_EVERYONE)
return 25 * metric.count_people_in_department(DEPARTMENT_EVERYONE)

View File

@@ -1,6 +1,6 @@
/datum/gm_action/pda_spam
name = "PDA spam"
departments = list(ROLE_EVERYONE)
departments = list(DEPARTMENT_EVERYONE)
reusable = TRUE
var/last_spam_time = 0
var/obj/machinery/message_server/useMS
@@ -126,4 +126,4 @@
to_chat(L, "\icon[P] <b>Message from [sender] (Unknown / spam?), </b>\"[message]\" (Unable to Reply)")
/datum/gm_action/pda_spam/get_weight()
return 25 * metric.count_people_in_department(ROLE_EVERYONE)
return 25 * metric.count_people_in_department(DEPARTMENT_EVERYONE)

View File

@@ -1,7 +1,7 @@
/datum/gm_action/planet_weather_shift
name = "sudden weather shift"
enabled = TRUE
departments = list(ROLE_EVERYONE)
departments = list(DEPARTMENT_EVERYONE)
reusable = TRUE
var/datum/planet/target_planet

View File

@@ -1,6 +1,6 @@
/datum/gm_action/prison_break
name = "prison break"
departments = list(ROLE_SECURITY, ROLE_SYNTHETIC)
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_SYNTHETIC)
var/start_time = 0
var/active = FALSE // Are we doing stuff?
@@ -14,7 +14,7 @@
/datum/gm_action/prison_break/get_weight()
var/afflicted_staff = 0
var/assigned_staff = metric.count_people_in_department(ROLE_ENGINEERING)
var/assigned_staff = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
for(var/department in departments)
afflicted_staff += round(metric.count_people_in_department(department) / 2)
@@ -27,14 +27,14 @@
/datum/gm_action/prison_break/virology
name = "virology breakout"
departments = list(ROLE_MEDICAL, ROLE_SYNTHETIC)
departments = list(DEPARTMENT_MEDICAL, DEPARTMENT_SYNTHETIC)
eventDept = "Medical"
areaName = list("Virology")
areaType = list(/area/medical/virology, /area/medical/virologyaccess)
/datum/gm_action/prison_break/xenobiology
name = "xenobiology breakout"
departments = list(ROLE_RESEARCH, ROLE_SYNTHETIC)
departments = list(DEPARTMENT_RESEARCH, DEPARTMENT_SYNTHETIC)
eventDept = "Science"
areaName = list("Xenobiology")
areaType = list(/area/rnd/xenobiology)
@@ -42,7 +42,7 @@
/datum/gm_action/prison_break/station
name = "station-wide breakout"
departments = list(ROLE_SECURITY, ROLE_MEDICAL, ROLE_RESEARCH, ROLE_SYNTHETIC)
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_MEDICAL, DEPARTMENT_RESEARCH, DEPARTMENT_SYNTHETIC)
eventDept = "Station"
areaName = list("Brig","Virology","Xenobiology")
areaType = list(/area/security/prison, /area/security/brig, /area/medical/virology, /area/medical/virologyaccess, /area/rnd/xenobiology)

View File

@@ -1,6 +1,6 @@
/datum/gm_action/radiation_storm
name = "radiation storm"
departments = list(ROLE_EVERYONE)
departments = list(DEPARTMENT_EVERYONE)
reusable = TRUE
var/enterBelt = 30
@@ -64,4 +64,4 @@
revoke_maint_all_access()
/datum/gm_action/radiation_storm/get_weight()
return 20 + (metric.count_people_in_department(ROLE_MEDICAL) * 10) + (metric.count_all_space_mobs() * 40) + (metric.count_people_in_department(ROLE_EVERYONE) * 20)
return 20 + (metric.count_people_in_department(DEPARTMENT_MEDICAL) * 10) + (metric.count_all_space_mobs() * 40) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 20)

View File

@@ -1,7 +1,7 @@
// The random spawn proc on the antag datum will handle announcing the spawn and whatnot.
/datum/gm_action/random_antag
name = "random antagonist"
departments = list(ROLE_EVERYONE)
departments = list(DEPARTMENT_EVERYONE)
chaotic = 30
reusable = TRUE
@@ -19,5 +19,5 @@
/datum/gm_action/random_antag/get_weight()
. = ..()
if(gm)
var/weight = max(0, (metric.count_people_in_department(ROLE_SECURITY) * 20) + (metric.count_people_in_department(ROLE_EVERYONE) * 5) + gm.staleness)
var/weight = max(0, (metric.count_people_in_department(DEPARTMENT_SECURITY) * 20) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5) + gm.staleness)
return weight

View File

@@ -1,6 +1,6 @@
/datum/gm_action/rogue_drone
name = "rogue drones"
departments = list(ROLE_SECURITY)
departments = list(DEPARTMENT_SECURITY)
chaotic = 60
length = 20 MINUTES
var/list/drones_list = list()
@@ -60,4 +60,4 @@
command_announcement.Announce("We're disappointed at the loss of the drones, but the survivors have been recovered.", "Rogue drone alert")
/datum/gm_action/rogue_drone/get_weight()
return 20 + (metric.count_people_in_department(ROLE_SECURITY) * 10) + (metric.count_all_space_mobs() * 30)
return 20 + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 10) + (metric.count_all_space_mobs() * 30)

View File

@@ -1,6 +1,6 @@
/datum/gm_action/security_screening
name = "security screening"
departments = list(ROLE_SECURITY, ROLE_EVERYONE)
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_EVERYONE)
var/list/species_weights = list(
SPECIES_SKRELL = 9,
@@ -46,4 +46,4 @@
command_announcement.Announce("[pick("A nearby Navy vessel", "A Solar official", "A Vir-Gov official", "A NanoTrasen board director")] has requested the screening of [pick("every other", "every", "suspicious", "willing")] [pickweight(end_weights)] personnel onboard \the [station_name()].", "Security Advisement")
/datum/gm_action/security_screening/get_weight()
return max(-20, 10 + round(gm.staleness * 1.5) - (gm.danger * 2)) + (metric.count_people_in_department(ROLE_SECURITY) * 10) + (metric.count_people_in_department(ROLE_EVERYONE) * 1.5)
return max(-20, 10 + round(gm.staleness * 1.5) - (gm.danger * 2)) + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 10) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 1.5)

View File

@@ -1,10 +1,10 @@
/datum/gm_action/shipping_error
name = "shipping error"
departments = list(ROLE_CARGO)
departments = list(DEPARTMENT_CARGO)
reusable = TRUE
/datum/gm_action/shipping_error/get_weight()
var/cargo = metric.count_people_in_department(ROLE_CARGO)
var/cargo = metric.count_people_in_department(DEPARTMENT_CARGO)
var/weight = (cargo * 40)
return weight

View File

@@ -35,7 +35,7 @@
radiate()
/datum/gm_action/solar_storm/get_weight()
return 20 + (metric.count_people_in_department(ROLE_ENGINEERING) * 10) + (metric.count_all_space_mobs() * 30)
return 20 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 10) + (metric.count_all_space_mobs() * 30)
/datum/gm_action/solar_storm/proc/radiate()
// Note: Too complicated to be worth trying to use the radiation system for this. Its only in space anyway, so we make an exception in this case.

View File

@@ -1,6 +1,6 @@
/datum/gm_action/spacevine
name = "space-vine infestation"
departments = list(ROLE_ENGINEERING)
departments = list(DEPARTMENT_ENGINEERING)
chaotic = 2
/datum/gm_action/spacevine/start()
@@ -11,4 +11,4 @@
level_seven_announcement()
/datum/gm_action/spacevine/get_weight()
return 20 + (metric.count_people_in_department(ROLE_ENGINEERING) * 20) + (metric.count_people_in_department(ROLE_EVERYONE) * 10)
return 20 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 20) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 10)

View File

@@ -1,6 +1,6 @@
/datum/gm_action/spider_infestation
name = "spider infestation"
departments = list(ROLE_SECURITY, ROLE_MEDICAL, ROLE_EVERYONE)
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_MEDICAL, DEPARTMENT_EVERYONE)
chaotic = 30
severity = 1
@@ -10,9 +10,9 @@
var/spawntype = /obj/effect/spider/spiderling
/datum/gm_action/spider_infestation/set_up()
severity = pickweight(EVENT_LEVEL_MUNDANE = max(1,(12 - (3 * metric.count_people_in_department(ROLE_SECURITY)))),
EVENT_LEVEL_MODERATE = (7 + (2 * metric.count_people_in_department(ROLE_SECURITY))),
EVENT_LEVEL_MAJOR = (1 + (2 * metric.count_people_in_department(ROLE_SECURITY)))
severity = pickweight(EVENT_LEVEL_MUNDANE = max(1,(12 - (3 * metric.count_people_in_department(DEPARTMENT_SECURITY)))),
EVENT_LEVEL_MODERATE = (7 + (2 * metric.count_people_in_department(DEPARTMENT_SECURITY))),
EVENT_LEVEL_MAJOR = (1 + (2 * metric.count_people_in_department(DEPARTMENT_SECURITY)))
)
switch(severity)
@@ -47,9 +47,9 @@
spawncount--
/datum/gm_action/spider_infestation/get_weight()
var/security = metric.count_people_in_department(ROLE_SECURITY)
var/medical = metric.count_people_in_department(ROLE_MEDICAL)
var/engineering = metric.count_people_in_department(ROLE_ENGINEERING)
var/security = metric.count_people_in_department(DEPARTMENT_SECURITY)
var/medical = metric.count_people_in_department(DEPARTMENT_MEDICAL)
var/engineering = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
var/assigned_staff = security + round(medical / 2) + round(engineering / 2)

View File

@@ -1,6 +1,6 @@
/datum/gm_action/spontaneous_appendicitis
name = "appendicitis"
departments = list(ROLE_MEDICAL, ROLE_EVERYONE)
departments = list(DEPARTMENT_MEDICAL, DEPARTMENT_EVERYONE)
chaotic = 1
/datum/gm_action/spontaneous_appendicitis/start()
@@ -10,4 +10,4 @@
break
/datum/gm_action/spontaneous_appendicitis/get_weight()
return max(0, -5 + (metric.count_people_in_department(ROLE_MEDICAL) * 10))
return max(0, -5 + (metric.count_people_in_department(DEPARTMENT_MEDICAL) * 10))

View File

@@ -1,6 +1,6 @@
/datum/gm_action/station_fund_raise
name = "local funding drive"
departments = list(ROLE_SECURITY, ROLE_CARGO, ROLE_EVERYONE)
departments = list(DEPARTMENT_SECURITY, DEPARTMENT_CARGO, DEPARTMENT_EVERYONE)
/datum/gm_action/station_fund_raise/announce()
spawn(rand(1 MINUTE, 2 MINUTES))
@@ -11,4 +11,4 @@
if(station_account.money <= 80000)
weight_modifier = 1
return (max(-20, 10 + gm.staleness) + ((metric.count_people_in_department(ROLE_SECURITY) + (metric.count_people_in_department(ROLE_CARGO))) * 5) + (metric.count_people_in_department(ROLE_EVERYONE) * 3)) * weight_modifier
return (max(-20, 10 + gm.staleness) + ((metric.count_people_in_department(DEPARTMENT_SECURITY) + (metric.count_people_in_department(DEPARTMENT_CARGO))) * 5) + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 3)) * weight_modifier

View File

@@ -1,6 +1,6 @@
/datum/gm_action/stowaway
name = "stowaway pod"
departments = list(ROLE_EVERYONE, ROLE_SECURITY)
departments = list(DEPARTMENT_EVERYONE, DEPARTMENT_SECURITY)
chaotic = 10
observers_used = TRUE
var/area/target_area // Chosen target area
@@ -72,7 +72,7 @@
say_dead_object("A <span class='notice'>[HP.occupant_type]</span> pod is now available in \the [target_area].", HP)
/datum/gm_action/stowaway/get_weight()
return -20 + (metric.count_people_in_department(ROLE_SECURITY) * 15 + metric.count_people_in_department(ROLE_SYNTHETIC) * 5 + metric.count_people_in_department(ROLE_EVERYONE) * 1)
return -20 + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 15 + metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 5 + metric.count_people_in_department(DEPARTMENT_EVERYONE) * 1)
/datum/gm_action/stowaway/announce()
spawn(rand(15 MINUTES, 30 MINUTES))

View File

@@ -1,7 +1,7 @@
/datum/gm_action/nanotrasen_budget_allocation
name = "supply point to cargo budget"
enabled = TRUE
departments = list(ROLE_CARGO)
departments = list(DEPARTMENT_CARGO)
chaotic = 0
reusable = TRUE
@@ -22,8 +22,8 @@
/datum/gm_action/nanotrasen_budget_allocation/get_weight()
. = round(SC.points / 15)
var/cargo = metric.count_people_in_department(ROLE_CARGO)
var/personnel = metric.count_people_in_department(ROLE_EVERYONE)
var/cargo = metric.count_people_in_department(DEPARTMENT_CARGO)
var/personnel = metric.count_people_in_department(DEPARTMENT_EVERYONE)
if(cargo)
. = round(SC.points / (10 + personnel)) + cargo * 10

View File

@@ -1,11 +1,11 @@
/datum/gm_action/request
name = "general request"
departments = list(ROLE_CARGO)
departments = list(DEPARTMENT_CARGO)
/datum/gm_action/request/announce()
spawn(rand(1 MINUTE, 2 MINUTES))
command_announcement.Announce("[pick("A nearby vessel", "A Solar contractor", "A Skrellian contractor", "A NanoTrasen board director")] has requested the delivery of [pick("one","two","three","several")] [pick("medical","engineering","research","civilian")] supply packages. The [station_name()] has been tasked with completing this request.", "Supply Request")
/datum/gm_action/request/get_weight()
return max(15, 15 + round(gm.staleness / 2) - gm.danger) + (metric.count_people_in_department(ROLE_CARGO) * 10)
return max(15, 15 + round(gm.staleness / 2) - gm.danger) + (metric.count_people_in_department(DEPARTMENT_CARGO) * 10)

View File

@@ -2,7 +2,7 @@
/datum/gm_action/surprise_carp_attack
name = "surprise carp attack"
departments = list(ROLE_EVERYONE)
departments = list(DEPARTMENT_EVERYONE)
reusable = TRUE
chaotic = 10
var/mob/living/victim = null

View File

@@ -2,11 +2,11 @@
/datum/gm_action/surprise_meteors
name = "surprise meteors"
departments = list(ROLE_ENGINEERING)
departments = list(DEPARTMENT_ENGINEERING)
chaotic = 25
/datum/gm_action/surprise_meteors/get_weight()
var/engineers = metric.count_people_in_department(ROLE_ENGINEERING)
var/engineers = metric.count_people_in_department(DEPARTMENT_ENGINEERING)
var/weight = (max(engineers - 1, 0) * 25) // If only one engineer exists, no meteors for now.
return weight

View File

@@ -1,6 +1,6 @@
/datum/gm_action/swarm_boarder
name = "swarmer shell"
departments = list(ROLE_EVERYONE, ROLE_SECURITY, ROLE_ENGINEERING)
departments = list(DEPARTMENT_EVERYONE, DEPARTMENT_SECURITY, DEPARTMENT_ENGINEERING)
chaotic = 60
observers_used = TRUE
var/area/target_area // Chosen target area
@@ -67,7 +67,7 @@
new swarmertype(target_turf)
/datum/gm_action/swarm_boarder/get_weight()
return max(0, -60 + (metric.count_people_in_department(ROLE_SECURITY) * 10 + metric.count_people_in_department(ROLE_SYNTHETIC) * 5))
return max(0, -60 + (metric.count_people_in_department(DEPARTMENT_SECURITY) * 10 + metric.count_people_in_department(DEPARTMENT_SYNTHETIC) * 5))
/datum/gm_action/swarm_boarder/announce()
spawn(rand(5 MINUTES, 15 MINUTES))

View File

@@ -2,7 +2,7 @@
/datum/gm_action/viral_infection
name = "viral infection"
departments = list(ROLE_MEDICAL)
departments = list(DEPARTMENT_MEDICAL)
chaotic = 5
var/list/viruses = list()
severity = 1
@@ -80,4 +80,4 @@
message_admins("Virus event affecting [english_list(used_candidates_links)] started; Viruses: [english_list(used_viruses_links)]")
/datum/gm_action/viral_infection/get_weight()
return (metric.count_people_in_department(ROLE_MEDICAL) * 20)
return (metric.count_people_in_department(DEPARTMENT_MEDICAL) * 20)

View File

@@ -1,6 +1,6 @@
/datum/gm_action/viral_outbreak
name = "viral outbreak"
departments = list(ROLE_MEDICAL, ROLE_EVERYONE)
departments = list(DEPARTMENT_MEDICAL, DEPARTMENT_EVERYONE)
chaotic = 30
severity = 1
var/list/candidates = list()
@@ -29,9 +29,9 @@
severity--
/datum/gm_action/viral_outbreak/get_weight()
var/medical = metric.count_people_in_department(ROLE_MEDICAL)
var/security = metric.count_people_in_department(ROLE_SECURITY)
var/everyone = metric.count_people_in_department(ROLE_EVERYONE)
var/medical = metric.count_people_in_department(DEPARTMENT_MEDICAL)
var/security = metric.count_people_in_department(DEPARTMENT_SECURITY)
var/everyone = metric.count_people_in_department(DEPARTMENT_EVERYONE)
var/assigned_staff = medical + round(security / 2)

View File

@@ -1,6 +1,6 @@
/datum/gm_action/wallrot
name = "wall rot"
departments = list(ROLE_ENGINEERING)
departments = list(DEPARTMENT_ENGINEERING)
reusable = TRUE
var/turf/simulated/wall/center
severity = 1
@@ -40,4 +40,4 @@
break
/datum/gm_action/wallrot/get_weight()
return 60 + (metric.count_people_in_department(ROLE_ENGINEERING) * 35)
return 60 + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) * 35)

View File

@@ -2,8 +2,8 @@
/datum/gm_action/waste_disposal
name = "waste disposal"
departments = list(ROLE_CARGO)
departments = list(DEPARTMENT_CARGO)
chaotic = 0
/datum/gm_action/waste_disposal/get_weight()
return metric.count_people_in_department(ROLE_CARGO) * 50
return metric.count_people_in_department(DEPARTMENT_CARGO) * 50

View File

@@ -1,6 +1,6 @@
/datum/gm_action/window_break
name = "window breach"
departments = list(ROLE_ENGINEERING)
departments = list(DEPARTMENT_ENGINEERING)
chaotic = 5
var/obj/structure/window/chosen_window
var/list/obj/structure/window/collateral_windows
@@ -75,4 +75,4 @@
command_announcement.Announce("Structural integrity of windows at [chosen_location.loc.name] is failing. Immediate repair or replacement is advised.", "Structural Alert")
/datum/gm_action/window_break/get_weight()
return 20 * metric.count_people_in_department(ROLE_ENGINEERING)
return 20 * metric.count_people_in_department(DEPARTMENT_ENGINEERING)

View File

@@ -2,7 +2,7 @@
name = "space-time anomalies"
chaotic = 70
length = 12 MINUTES
departments = list(ROLE_EVERYONE)
departments = list(DEPARTMENT_EVERYONE)
severity = 1
/datum/gm_action/wormholes/set_up() // 1 out of 5 will be full-duration wormholes, meaning up to a minute long.
@@ -17,7 +17,7 @@
wormhole_event(length / 2, (severity / 3))
/datum/gm_action/wormholes/get_weight()
return 10 + max(0, -30 + (metric.count_people_in_department(ROLE_EVERYONE) * 5) + (metric.count_people_in_department(ROLE_ENGINEERING) + 10) + (metric.count_people_in_department(ROLE_MEDICAL) * 20))
return 10 + max(0, -30 + (metric.count_people_in_department(DEPARTMENT_EVERYONE) * 5) + (metric.count_people_in_department(DEPARTMENT_ENGINEERING) + 10) + (metric.count_people_in_department(DEPARTMENT_MEDICAL) * 20))
/datum/gm_action/wormholes/end()
command_announcement.Announce("There are no more space-time anomalies detected on the station.", "Anomaly Alert")

View File

@@ -138,7 +138,7 @@
for(var/datum/gm_action/action in available_actions)
if(!action.enabled)
continue
if(ROLE_EVERYONE in action.departments)
if(DEPARTMENT_EVERYONE in action.departments)
best_actions.Add(action)
log_debug("[action.name] is being considered because it involves everyone.")

View File

@@ -2,7 +2,7 @@
// This proc tries to find the department of an arbitrary mob.
/datum/metric/proc/guess_department(var/mob/M)
var/list/found_roles = list()
. = ROLE_UNKNOWN
. = DEPARTMENT_UNKNOWN
// Records are usually the most reliable way to get what job someone is.
var/datum/data/record/R = find_general_record("name", M.real_name)
@@ -10,7 +10,7 @@
var/recorded_rank = R.fields["real_rank"]
found_roles = role_name_to_department(recorded_rank)
. = found_roles[1]
if(. != ROLE_UNKNOWN) // We found the correct department, so we can stop now.
if(. != DEPARTMENT_UNKNOWN) // We found the correct department, so we can stop now.
return
// They have a custom title, aren't crew, or someone deleted their record, so we need a fallback method.
@@ -18,16 +18,16 @@
if(M.mind)
found_roles = role_name_to_department(M.mind.assigned_role)
. = found_roles[1]
if(. != ROLE_UNKNOWN)
if(. != DEPARTMENT_UNKNOWN)
return
// At this point, they don't have a mind, or for some reason assigned_role didn't work.
found_roles = role_name_to_department(M.job)
. = found_roles[1]
if(. != ROLE_UNKNOWN)
if(. != DEPARTMENT_UNKNOWN)
return
return ROLE_UNKNOWN // Welp.
return DEPARTMENT_UNKNOWN // Welp.
// Feed this proc the name of a job, and it will try to figure out what department they are apart of.
// Note that this returns a list, as some jobs are in more than one department, like Command. The 'primary' department is the first
@@ -35,32 +35,32 @@
/datum/metric/proc/role_name_to_department(var/role_name)
var/list/result = list()
if(role_name in security_positions)
result += ROLE_SECURITY
if(SSjob.is_job_in_department(role_name, DEPARTMENT_SECURITY))
result += DEPARTMENT_SECURITY
if(role_name in engineering_positions)
result += ROLE_ENGINEERING
if(SSjob.is_job_in_department(role_name, DEPARTMENT_ENGINEERING))
result += DEPARTMENT_ENGINEERING
if(role_name in medical_positions)
result += ROLE_MEDICAL
if(SSjob.is_job_in_department(role_name, DEPARTMENT_MEDICAL))
result += DEPARTMENT_MEDICAL
if(role_name in science_positions)
result += ROLE_RESEARCH
if(SSjob.is_job_in_department(role_name, DEPARTMENT_RESEARCH))
result += DEPARTMENT_RESEARCH
if(role_name in cargo_positions)
result += ROLE_CARGO
if(SSjob.is_job_in_department(role_name, DEPARTMENT_CARGO))
result += DEPARTMENT_CARGO
if(role_name in civilian_positions)
result += ROLE_CIVILIAN
if(SSjob.is_job_in_department(role_name, DEPARTMENT_CIVILIAN))
result += DEPARTMENT_CIVILIAN
if(role_name in nonhuman_positions)
result += ROLE_SYNTHETIC
if(SSjob.is_job_in_department(role_name, DEPARTMENT_SYNTHETIC))
result += DEPARTMENT_SYNTHETIC
if(role_name in command_positions) // We do Command last, since we consider command to only be a primary department for hop/admin.
result += ROLE_COMMAND
if(SSjob.is_job_in_department(role_name, DEPARTMENT_COMMAND)) // We do Command last, since we consider command to only be a primary department for hop/admin.
result += DEPARTMENT_COMMAND
if(!result.len) // No department was found.
result += ROLE_UNKNOWN
result += DEPARTMENT_UNKNOWN
return result
/datum/metric/proc/count_people_in_department(var/department)

View File

@@ -3,13 +3,13 @@
/datum/metric
var/list/departments = list(
ROLE_COMMAND,
ROLE_SECURITY,
ROLE_ENGINEERING,
ROLE_MEDICAL,
ROLE_RESEARCH,
ROLE_CARGO,
ROLE_CIVILIAN,
ROLE_SYNTHETIC
DEPARTMENT_COMMAND,
DEPARTMENT_SECURITY,
DEPARTMENT_ENGINEERING,
DEPARTMENT_MEDICAL,
DEPARTMENT_RESEARCH,
DEPARTMENT_CARGO,
DEPARTMENT_CIVILIAN,
DEPARTMENT_SYNTHETIC
)

View File

@@ -44,14 +44,16 @@
data["id_owner"] = id_card && id_card.registered_name ? id_card.registered_name : "-----"
data["id_name"] = id_card ? id_card.name : "-----"
data["command_jobs"] = format_jobs(command_positions)
data["engineering_jobs"] = format_jobs(engineering_positions)
data["medical_jobs"] = format_jobs(medical_positions)
data["science_jobs"] = format_jobs(science_positions)
data["security_jobs"] = format_jobs(security_positions)
data["cargo_jobs"] = format_jobs(cargo_positions)
data["civilian_jobs"] = format_jobs(civilian_positions)
data["centcom_jobs"] = format_jobs(get_all_centcom_jobs())
var/list/departments = list()
for(var/D in SSjob.get_all_department_datums())
var/datum/department/dept = D
if(!dept.assignable) // No AI ID cards for you.
continue
if(dept.centcom_only && !is_centcom)
continue
departments[++departments.len] = list("department_name" = dept.name, "jobs" = format_jobs(SSjob.get_job_titles_in_department(dept.name)) )
data["departments"] = departments
data["all_centcom_access"] = is_centcom ? get_accesses(1) : null
data["regions"] = get_accesses()