diff --git a/code/game/jobs/job/command/cic/staffofficer.dm b/code/game/jobs/job/command/cic/staffofficer.dm index 94769de2158f..c73270944c3a 100644 --- a/code/game/jobs/job/command/cic/staffofficer.dm +++ b/code/game/jobs/job/command/cic/staffofficer.dm @@ -23,8 +23,17 @@ total_positions_so_far = positions return positions -/datum/job/command/bridge/generate_entry_message(mob/living/carbon/human/H) - return ..() + +/datum/job/command/bridge/generate_entry_conditions(mob/living/M, whitelist_status) + . = ..() + if(!islist(GLOB.marine_leaders[JOB_SO])) + GLOB.marine_leaders[JOB_SO] = list() + GLOB.marine_leaders[JOB_SO] += M + RegisterSignal(M, COMSIG_PARENT_QDELETING, PROC_REF(cleanup_leader_candidate)) + +/datum/job/command/bridge/proc/cleanup_leader_candidate(mob/M) + SIGNAL_HANDLER + GLOB.marine_leaders[JOB_SO] -= M AddTimelock(/datum/job/command/bridge, list( JOB_SQUAD_LEADER = 1 HOURS, diff --git a/code/game/machinery/computer/groundside_operations.dm b/code/game/machinery/computer/groundside_operations.dm index 95ea46177ca2..52ff558cde89 100644 --- a/code/game/machinery/computer/groundside_operations.dm +++ b/code/game/machinery/computer/groundside_operations.dm @@ -1,3 +1,5 @@ +#define COMMAND_SQUAD "Command" + /obj/structure/machinery/computer/groundside_operations name = "groundside operations console" desc = "This can be used for various important functions." @@ -19,6 +21,7 @@ var/lz_selection = TRUE var/has_squad_overwatch = TRUE var/faction = FACTION_MARINE + var/show_command_squad = FALSE /obj/structure/machinery/computer/groundside_operations/Initialize() if(SSticker.mode && MODE_HAS_FLAG(MODE_FACTION_CLASH)) @@ -69,8 +72,11 @@ dat += "

" if(has_squad_overwatch) - dat += "Current Squad: [!isnull(current_squad) ? "[current_squad.name]" : "----------"]
" - if(current_squad) + if(show_command_squad) + dat += "Current Squad: Command
" + else + dat += "Current Squad: [!isnull(current_squad) ? "[current_squad.name]" : "----------"]
" + if(current_squad || show_command_squad) dat += get_overwatch_info() dat += "
Close" @@ -104,98 +110,94 @@ "} - if(!current_squad) - dat += "No Squad selected!
" + if(show_command_squad) + dat += format_list_of_marines(list(GLOB.marine_leaders[JOB_CO], GLOB.marine_leaders[JOB_XO]) + GLOB.marine_leaders[JOB_SO], list(JOB_CO, JOB_XO, JOB_SO)) + else if(current_squad) + dat += format_list_of_marines(current_squad.marines_list, list(JOB_SQUAD_LEADER, JOB_SQUAD_SPECIALIST, JOB_SQUAD_MEDIC, JOB_SQUAD_ENGI, JOB_SQUAD_SMARTGUN, JOB_SQUAD_MARINE)) else - var/leader_text = "" - var/tl_text = "" - var/spec_text = "" - var/medic_text = "" - var/engi_text = "" - var/smart_text = "" - var/marine_text = "" - var/misc_text = "" - var/living_count = 0 - var/almayer_count = 0 - var/SSD_count = 0 - var/helmetless_count = 0 - - for(var/X in current_squad.marines_list) - if(!X) - continue //just to be safe - var/mob_name = "unknown" - var/mob_state = "" - var/role = "unknown" - var/act_sl = "" - var/area_name = "???" - var/mob/living/carbon/human/H - if(ishuman(X)) - H = X - mob_name = H.real_name - var/area/A = get_area(H) - var/turf/M_turf = get_turf(H) - if(A) - area_name = sanitize_area(A.name) - - if(H.job) - role = H.job - else if(istype(H.wear_id, /obj/item/card/id)) //decapitated marine is mindless, - var/obj/item/card/id/ID = H.wear_id //we use their ID to get their role. - if(ID.rank) - role = ID.rank - - switch(H.stat) - if(CONSCIOUS) - mob_state = "Conscious" - living_count++ - if(UNCONSCIOUS) - mob_state = "Unconscious" - living_count++ - else - continue - - if(!is_ground_level(M_turf.z)) - almayer_count++ - continue + dat += "No Squad selected!
" + dat += "

" + dat += "Refresh
" + return dat - if(!istype(H.head, /obj/item/clothing/head/helmet/marine)) - helmetless_count++ +/obj/structure/machinery/computer/groundside_operations/proc/format_list_of_marines(list/mob/living/carbon/human/marine_list, list/jobs_in_order) + var/dat = "" + var/list/job_order = list() + + for(var/job in jobs_in_order) + job_order[job] = "" + + var/misc_text = "" + + var/living_count = 0 + var/almayer_count = 0 + var/SSD_count = 0 + var/helmetless_count = 0 + var/total_count = 0 + + for(var/X in marine_list) + if(!X) + continue //just to be safe + total_count++ + var/mob_name = "unknown" + var/mob_state = "" + var/role = "unknown" + var/area_name = "???" + var/mob/living/carbon/human/H + var/act_sl = "" + if(ishuman(X)) + H = X + mob_name = H.real_name + var/area/A = get_area(H) + var/turf/M_turf = get_turf(H) + if(A) + area_name = sanitize_area(A.name) + + if(H.job) + role = H.job + else if(istype(H.wear_id, /obj/item/card/id)) //decapitated marine is mindless, + var/obj/item/card/id/ID = H.wear_id //we use their ID to get their role. + if(ID.rank) + role = ID.rank + + switch(H.stat) + if(CONSCIOUS) + mob_state = "Conscious" + living_count++ + if(UNCONSCIOUS) + mob_state = "Unconscious" + living_count++ + else continue - if(!H.key || !H.client) - SSD_count++ - continue - if(H == current_squad.squad_leader && role != JOB_SQUAD_LEADER) - act_sl = "(ASL)" - - var/marine_infos = "[mob_name][role][act_sl][mob_state][area_name]" - switch(role) - if(JOB_SQUAD_LEADER) - leader_text += marine_infos - if(JOB_SQUAD_TEAM_LEADER) - tl_text += marine_infos - if(JOB_SQUAD_SPECIALIST) - spec_text += marine_infos - if(JOB_SQUAD_MEDIC) - medic_text += marine_infos - if(JOB_SQUAD_ENGI) - engi_text += marine_infos - if(JOB_SQUAD_SMARTGUN) - smart_text += marine_infos - if(JOB_SQUAD_MARINE) - marine_text += marine_infos - else - misc_text += marine_infos - - dat += "Total: [current_squad.marines_list.len] Deployed
" - dat += "Marines detected: [living_count] ([helmetless_count] no helmet, [SSD_count] SSD, [almayer_count] on Almayer)
" - dat += "
Search:
" - dat += "" - dat += "" - dat += leader_text + tl_text + spec_text + medic_text + engi_text + smart_text + marine_text + misc_text - dat += "
NameRoleStateLocation
" - dat += "

" - dat += "Refresh
" + if(!is_ground_level(M_turf.z)) + almayer_count++ + continue + + if(!istype(H.head, /obj/item/clothing/head/helmet/marine)) + helmetless_count++ + continue + + if(!H.key || !H.client) + SSD_count++ + continue + if(current_squad) + if(H == current_squad.squad_leader && role != JOB_SQUAD_LEADER) + act_sl = " (ASL)" + var/marine_infos = "[mob_name][role][act_sl][mob_state][area_name]" + if(role in job_order) + job_order[role] += marine_infos + else + misc_text += marine_infos + dat += "Total: [total_count] Deployed
" + dat += "Marines detected: [living_count] ([helmetless_count] no helmet, [SSD_count] SSD, [almayer_count] on Almayer)
" + dat += "
Search:
" + dat += "" + dat += "" + for(var/job in job_order) + dat += job_order[job] + dat += misc_text + dat += "
NameRoleStateLocation
" return dat /obj/structure/machinery/computer/groundside_operations/Topic(href, href_list) @@ -272,23 +274,31 @@ for(var/datum/squad/S in GLOB.RoleAuthority.squads) if(S.active && S.faction == faction) squad_list += S.name + squad_list += COMMAND_SQUAD var/name_sel = tgui_input_list(usr, "Which squad would you like to look at?", "Pick Squad", squad_list) if(!name_sel) return - var/datum/squad/selected = get_squad_by_name(name_sel) - if(selected) - current_squad = selected + if(name_sel == COMMAND_SQUAD) + show_command_squad = TRUE + current_squad = null + else - to_chat(usr, "[icon2html(src, usr)] [SPAN_WARNING("Invalid input. Aborting.")]") + show_command_squad = FALSE + + var/datum/squad/selected = get_squad_by_name(name_sel) + if(selected) + current_squad = selected + else + to_chat(usr, "[icon2html(src, usr)] [SPAN_WARNING("Invalid input. Aborting.")]") if("use_cam") if(isRemoteControlling(usr)) to_chat(usr, "[icon2html(src, usr)] [SPAN_WARNING("Unable to override console camera viewer. Track with camera instead. ")]") return - if(current_squad) + if(current_squad || show_command_squad) var/mob/cam_target = locate(href_list["cam_target"]) var/obj/structure/machinery/camera/new_cam = get_camera_from_target(cam_target) if(!new_cam || !new_cam.can_use()) @@ -379,3 +389,5 @@ lz_selection = FALSE has_squad_overwatch = FALSE minimap_type = MINIMAP_FLAG_PMC + +#undef COMMAND_SQUAD