Skip to content

Commit

Permalink
Merge branch 'crew_manifest' into 'dev'
Browse files Browse the repository at this point in the history
Bugfix/QoL: crew manifest.

See merge request cmdevs/colonial-warfare!201
  • Loading branch information
Neth Iafin authored and Neth Iafin committed Nov 8, 2020
2 parents e28f633 + dbf9cef commit 2082814
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 104 deletions.
13 changes: 12 additions & 1 deletion code/__DEFINES/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var/global/list/job_command_roles = JOB_COMMAND_ROLES_LIST
. = ..(L);\
}

// Used to add a timelock to a job. Will be passed onto derivates. Will not include the parent's timelocks.
// Used to add a timelock to a job. Will be passed onto derivates. Will not include the parent's timelocks.
#define OverrideTimelock(Path, timelockList) \
##Path/setup_requirements(var/list/L){\
L = timelockList;\
Expand Down Expand Up @@ -176,3 +176,14 @@ var/global/list/job_command_roles = JOB_COMMAND_ROLES_LIST
#define JOB_OBSERVER "Observer" // For monthly time tracking

#define TIMELOCK_JOB(role_id, hours) new/datum/timelock(role_id, hours, role_id)

//For displaying groups of jobs. Used by new player's latejoin menu and by crew manifest.
#define FLAG_SHOW_CIC 1
#define FLAG_SHOW_AUXIL_SUPPORT 2
#define FLAG_SHOW_MISC 4
#define FLAG_SHOW_POLICE 8
#define FLAG_SHOW_ENGINEERING 16
#define FLAG_SHOW_REQUISITION 32
#define FLAG_SHOW_MEDICAL 64
#define FLAG_SHOW_MARINES 128
#define FLAG_SHOW_ALL_JOBS FLAG_SHOW_CIC|FLAG_SHOW_AUXIL_SUPPORT|FLAG_SHOW_MISC|FLAG_SHOW_POLICE|FLAG_SHOW_ENGINEERING|FLAG_SHOW_REQUISITION|FLAG_SHOW_MEDICAL|FLAG_SHOW_MARINES
8 changes: 4 additions & 4 deletions code/__DEFINES/mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
// MUTUALLY EXCLUSIVE TO TOGGLE_AUTO_EJECT_MAGAZINE_TO_HAND
#define TOGGLE_AUTO_EJECT_MAGAZINE_TO_HAND 32 // This toggles whether guns with auto ejectors will cause you to unwield your gun and put the empty magazine in your hand
// MUTUALLY EXCLUSIVE TO TOGGLE_AUTO_EJECT_MAGAZINE
#define TOGGLE_EJECT_MAGAZINE_TO_HAND 64 // This toggles whether manuallyejecting magazines from guns will cause you to unwield your gun
#define TOGGLE_EJECT_MAGAZINE_TO_HAND 64 // This toggles whether manuallyejecting magazines from guns will cause you to unwield your gun
// and put the empty magazine in your hand
#define TOGGLE_AUTOMATIC_PUNCTUATION 128 // Whether your sentences will automatically be punctuated with a period

Expand Down Expand Up @@ -95,12 +95,12 @@ var/global/list/ROLES_COMMAND = list(JOB_CO, JOB_XO, JOB_SO, JOB_INTEL, JOB_PI

#define ROLES_OFFICERS list(JOB_CO, JOB_XO, JOB_SO, JOB_INTEL, JOB_PILOT, JOB_CREWMAN, JOB_SEA, JOB_CORPORATE_LIAISON, JOB_SYNTH, JOB_CHIEF_POLICE, JOB_WARDEN, JOB_POLICE)
var/global/list/ROLES_CIC = list(JOB_CO, JOB_XO, JOB_SO, JOB_WO_CO, JOB_WO_XO)
var/global/list/ROLES_AUXIL_SUPPORT = list(JOB_INTEL, JOB_PILOT, JOB_CREWMAN, JOB_WO_CHIEF_POLICE, JOB_WO_SO, JOB_WO_CREWMAN, JOB_WO_POLICE, JOB_WO_PILOT)
var/global/list/ROLES_MISC = list(JOB_SYNTH, JOB_SEA, JOB_CORPORATE_LIAISON, JOB_MESS_SERGEANT, JOB_WO_CORPORATE_LIAISON, JOB_WO_SYNTH)
var/global/list/ROLES_AUXIL_SUPPORT = list(JOB_PILOT, JOB_INTEL, JOB_CREWMAN, JOB_WO_CHIEF_POLICE, JOB_WO_SO, JOB_WO_CREWMAN, JOB_WO_POLICE, JOB_WO_PILOT)
var/global/list/ROLES_MISC = list(JOB_SEA, JOB_MESS_SERGEANT, JOB_CORPORATE_LIAISON, JOB_SYNTH, JOB_WO_CORPORATE_LIAISON, JOB_WO_SYNTH)
var/global/list/ROLES_POLICE = list(JOB_CHIEF_POLICE, JOB_WARDEN, JOB_POLICE)
var/global/list/ROLES_ENGINEERING = list(JOB_CHIEF_ENGINEER, JOB_ORDNANCE_TECH, JOB_MAINT_TECH, JOB_WO_CHIEF_ENGINEER, JOB_WO_ORDNANCE_TECH)
var/global/list/ROLES_REQUISITION = list(JOB_CHIEF_REQUISITION, JOB_CARGO_TECH, JOB_WO_CHIEF_REQUISITION, JOB_WO_REQUISITION)
var/global/list/ROLES_MEDICAL = list(JOB_CMO, JOB_DOCTOR, JOB_NURSE, JOB_RESEARCHER)
var/global/list/ROLES_MEDICAL = list(JOB_CMO, JOB_RESEARCHER, JOB_DOCTOR, JOB_NURSE, JOB_WO_CMO, JOB_WO_RESEARCHER, JOB_WO_DOCTOR)
var/global/list/ROLES_MARINES = list(JOB_SQUAD_LEADER, JOB_SQUAD_SPECIALIST, JOB_SQUAD_SMARTGUN, JOB_SQUAD_MEDIC, JOB_SQUAD_ENGI, JOB_SQUAD_MARINE)
var/global/list/ROLES_SQUAD_ALL = list(SQUAD_NAME_1, SQUAD_NAME_2, SQUAD_NAME_3, SQUAD_NAME_4)

Expand Down
151 changes: 76 additions & 75 deletions code/datums/datacore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ GLOBAL_DATUM_INIT(data_core, /obj/effect/datacore, new)
var/locked[] = list()

/obj/effect/datacore/proc/get_manifest(monochrome, OOC)
var/list/cic = new()
var/list/auxil = new()
var/list/misc = new()
var/list/mp = new()
var/list/eng = new()
var/list/req = new()
var/list/med = new()
var/list/mar = new()
var/list/cic = ROLES_CIC.Copy()
var/list/auxil = ROLES_AUXIL_SUPPORT.Copy()
var/list/misc = ROLES_MISC.Copy()
var/list/mp = ROLES_POLICE.Copy()
var/list/eng = ROLES_ENGINEERING.Copy()
var/list/req = ROLES_REQUISITION.Copy()
var/list/med = ROLES_MEDICAL.Copy()
var/list/marines_by_squad = ROLES_SQUAD_ALL.Copy()
for(var/squad_name in marines_by_squad)
marines_by_squad[squad_name] = ROLES_MARINES.Copy()
var/list/isactive = new()
var/list/squads = new()

var/dat = {"
<div align='center'>
Expand All @@ -35,7 +36,10 @@ GLOBAL_DATUM_INIT(data_core, /obj/effect/datacore, new)
"}

var/even = 0

// sort mobs
var/dept_flags = NO_FLAGS //Is there anybody in the department?.
var/list/squad_sublists = ROLES_SQUAD_ALL.Copy() //Are there any marines in the squad?

for(var/datum/data/record/t in GLOB.data_core.general)
if(t.fields["mob_faction"] != FACTION_MARINE) //we process only USCM humans
Expand All @@ -58,90 +62,87 @@ GLOBAL_DATUM_INIT(data_core, /obj/effect/datacore, new)
//cael - to prevent multiple appearances of a player/job combination, add a continue after each line

if(real_rank in ROLES_CIC)
cic[name] = rank
dept_flags |= FLAG_SHOW_CIC
LAZYSET(cic[real_rank], name, rank)
else if(real_rank in ROLES_AUXIL_SUPPORT)
auxil[name] = rank
dept_flags |= FLAG_SHOW_AUXIL_SUPPORT
LAZYSET(auxil[real_rank], name, rank)
else if(real_rank in ROLES_MISC)
misc[name] = rank
dept_flags |= FLAG_SHOW_MISC
LAZYSET(misc[real_rank], name, rank)
else if(real_rank in ROLES_POLICE)
mp[name] = rank
dept_flags |= FLAG_SHOW_POLICE
LAZYSET(mp[real_rank], name, rank)
else if(real_rank in ROLES_ENGINEERING)
eng[name] = rank
dept_flags |= FLAG_SHOW_ENGINEERING
LAZYSET(eng[real_rank], name, rank)
else if(real_rank in ROLES_REQUISITION)
req[name] = rank
dept_flags |= FLAG_SHOW_REQUISITION
LAZYSET(req[real_rank], name, rank)
else if(real_rank in ROLES_MEDICAL)
med[name] = rank
dept_flags |= FLAG_SHOW_MEDICAL
LAZYSET(med[real_rank], name, rank)
else if(real_rank in ROLES_MARINES)
squads[name] = squad_name
mar[name] = rank

//here we sort marines
var/mar_sl = list()
var/mar_spc = list()
var/mar_sg = list()
var/mar_med = list()
var/mar_eng = list()
var/mar_pfc = list()
for(var/i in mar)
if(mar[i] == JOB_SQUAD_LEADER)
mar_sl[i] = mar[i]
else if(mar[i] == JOB_SQUAD_SPECIALIST)
mar_spc[i] = mar[i]
else if(mar[i] == JOB_SQUAD_SMARTGUN)
mar_sg[i] = mar[i]
else if(mar[i] == JOB_SQUAD_MEDIC)
mar_med[i] = mar[i]
else if(mar[i] == JOB_SQUAD_ENGI)
mar_eng[i] = mar[i]
else if(mar[i] == JOB_SQUAD_MARINE)
mar_pfc[i] = mar[i]
mar.Cut()
mar = mar_sl + mar_spc + mar_sg + mar_med + mar_eng + mar_pfc
dept_flags |= FLAG_SHOW_MARINES
squad_sublists[squad_name] = TRUE
LAZYSET(marines_by_squad[squad_name][real_rank], name, rank)

//here we fill manifest
if(LAZYLEN(cic))
var/name
var/real_rank
if(dept_flags & FLAG_SHOW_CIC)
dat += "<tr><th colspan=3>Command</th></tr>"
for(name in cic)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[cic[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(LAZYLEN(auxil))
for(real_rank in cic)
for(name in cic[real_rank])
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[cic[real_rank][name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(dept_flags & FLAG_SHOW_AUXIL_SUPPORT)
dat += "<tr><th colspan=3>Auxiliary Combat Support</th></tr>"
for(name in auxil)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[auxil[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(LAZYLEN(mar))
for(real_rank in auxil)
for(name in auxil[real_rank])
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[auxil[real_rank][name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(dept_flags & FLAG_SHOW_MARINES)
dat += "<tr><th colspan=3>Marines</th></tr>"
for(var/j in list(SQUAD_NAME_1, SQUAD_NAME_2, SQUAD_NAME_3, SQUAD_NAME_4))
dat += "<tr><th colspan=3>[j]</th></tr>"
for(name in mar)
if(squads[name] == j)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[mar[name]]</td><td>[isactive[name]]</td></tr>"
for(var/squad_name in ROLES_SQUAD_ALL)
if(!squad_sublists[squad_name])
continue
dat += "<tr><th colspan=3>[squad_name]</th></tr>"
for(real_rank in marines_by_squad[squad_name])
for(name in marines_by_squad[squad_name][real_rank])
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[marines_by_squad[squad_name][real_rank][name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(LAZYLEN(mp))
if(dept_flags & FLAG_SHOW_POLICE)
dat += "<tr><th colspan=3>Military Police</th></tr>"
for(name in mp)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[mp[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(LAZYLEN(eng))
for(real_rank in mp)
for(name in mp[real_rank])
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[mp[real_rank][name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(dept_flags & FLAG_SHOW_ENGINEERING)
dat += "<tr><th colspan=3>Engineering</th></tr>"
for(name in eng)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[eng[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(LAZYLEN(req))
for(real_rank in eng)
for(name in eng[real_rank])
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[eng[real_rank][name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(dept_flags & FLAG_SHOW_REQUISITION)
dat += "<tr><th colspan=3>Requisition</th></tr>"
for(name in req)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[req[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(LAZYLEN(med))
for(real_rank in req)
for(name in req[real_rank])
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[req[real_rank][name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(dept_flags & FLAG_SHOW_MEDICAL)
dat += "<tr><th colspan=3>Medbay</th></tr>"
for(name in med)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[med[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(LAZYLEN(misc))
for(real_rank in med)
for(name in med[real_rank])
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[med[real_rank][name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(dept_flags & FLAG_SHOW_MISC)
dat += "<tr><th colspan=3>Other</th></tr>"
for(name in misc)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[misc[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
for(real_rank in misc)
for(name in misc[real_rank])
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[misc[real_rank][name]]</td><td>[isactive[name]]</td></tr>"
even = !even


dat += "</table></div>"
dat = replacetext(dat, "\n", "") // so it can be placed on paper correctly
Expand Down
28 changes: 4 additions & 24 deletions code/modules/mob/new_player/new_player.dm
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
#define FLAG_SHOW_CIC 1
#define FLAG_SHOW_AUXIL_SUPPORT 2
#define FLAG_SHOW_MISC 4
#define FLAG_SHOW_POLICE 8
#define FLAG_SHOW_ENGINEERING 16
#define FLAG_SHOW_REQUISITION 32
#define FLAG_SHOW_MEDICAL 64
#define FLAG_SHOW_MARINES 128
#define FLAG_SHOW_ALL FLAG_SHOW_CIC|FLAG_SHOW_AUXIL_SUPPORT|FLAG_SHOW_MISC|FLAG_SHOW_POLICE|FLAG_SHOW_ENGINEERING|FLAG_SHOW_REQUISITION|FLAG_SHOW_MEDICAL|FLAG_SHOW_MARINES

/mob/new_player
var/ready = FALSE
var/spawning = FALSE//Referenced when you want to delete the new_player later on in the code.
Expand Down Expand Up @@ -250,7 +240,7 @@
close_spawn_windows()

var/turf/T
if(map_tag != MAP_WHISKEY_OUTPOST)
if(map_tag != MAP_WHISKEY_OUTPOST)
T = pick(latejoin)
else if (map_tag == MAP_WHISKEY_OUTPOST)
T = pick(latewhiskey)
Expand Down Expand Up @@ -300,11 +290,11 @@
if(EVACUATION_STATUS_COMPLETE) dat += "<font color='red'>The [MAIN_SHIP_NAME] has undergone evacuation.</font><br>"

dat += "Choose from the following open positions:<br>"
var/roles_show = FLAG_SHOW_ALL
var/roles_show = FLAG_SHOW_ALL_JOBS

for(var/i in RoleAuthority.roles_for_mode)
var/datum/job/J = RoleAuthority.roles_for_mode[i]
if(!RoleAuthority.check_role_entry(src, J, TRUE))
if(!RoleAuthority.check_role_entry(src, J, TRUE))
continue
var/active = 0
// Only players with the job assigned and AFK for less than 10 minutes count as active
Expand Down Expand Up @@ -456,14 +446,4 @@
return

/mob/new_player/hear_radio(var/message, var/verb="says", var/datum/language/language=null, var/part_a, var/part_b, var/mob/speaker = null, var/hard_to_hear = 0)
return

#undef FLAG_SHOW_CIC
#undef FLAG_SHOW_AUXIL_SUPPORT
#undef FLAG_SHOW_MISC
#undef FLAG_SHOW_POLICE
#undef FLAG_SHOW_ENGINEERING
#undef FLAG_SHOW_REQUISITION
#undef FLAG_SHOW_MEDICAL
#undef FLAG_SHOW_MARINES
#undef FLAG_SHOW_ALL
return

0 comments on commit 2082814

Please sign in to comment.