Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes it possible to view helmet cams of SOs/XOs/COs #5433

Merged
merged 8 commits into from
Feb 21, 2024

Conversation

TheGamerdk
Copy link
Contributor

@TheGamerdk TheGamerdk commented Jan 12, 2024

About the pull request

Going to rework the whole console at some point. Not proud of this code, give me some ideas

Explain why it's good for the game

Helmet cams good! This can already be done by assigning the CO/XO/SO to a squad

Testing Photographs and Procedure

Screenshots & Videos

Put screenshots and videos here with an empty line between the screenshots and the <details> tags.

Changelog

🆑
add: CIC can now view helmet cameras of Command Staff. Literally 1984
/:cl:

@github-actions github-actions bot added the Feature Feature coder badge label Jan 12, 2024
Comment on lines 116 to 183
var/co_text = ""
var/xo_text = ""
var/so_text = ""
var/living_count = 0
var/almayer_count = 0
var/SSD_count = 0
var/helmetless_count = 0

for(var/X in command_marines)
if(!X)
continue //just to be safe
var/mob_name = "unknown"
var/mob_state = ""
var/role = "unknown"
var/area_name = "<b>???</b>"
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 = "<b>Unconscious</b>"
living_count++
else
continue

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

var/marine_infos = "<tr><td><A href='?src=\ref[src];operation=use_cam;cam_target=\ref[H]'>[mob_name]</a></td><td>[role]</td><td>[mob_state]</td><td>[area_name]</td></tr>"
switch(role)
if(JOB_CO)
co_text += marine_infos
if(JOB_XO)
xo_text += marine_infos
if(JOB_SO)
so_text += marine_infos
dat += "<b>Total: [length(command_marines)] Deployed</b><BR>"
dat += "<b>Marines detected: [living_count] ([helmetless_count] no helmet, [SSD_count] SSD, [almayer_count] on Almayer)</b><BR>"
dat += "<center><b>Search:</b> <input type='text' id='filter' value='' onkeyup='updateSearch();' style='width:300px;'></center>"
dat += "<table id='marine_list' border='2px' style='width: 100%; border-collapse: collapse;' align='center'><tr>"
dat += "<th>Name</th><th>Role</th><th>State</th><th>Location</th></tr>"
dat += co_text + xo_text + so_text
dat += "</table>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obviously all of this is copypasta, but i don't see why it couldn't be genericized. make it a proc that accepts a list of humans and returns a formatted html table, give it the squad marinelist in normal usage and the list you make above this for this usecase. the whole co/xo/so text thing can just be replaced by a parameter passed into the proc for a list of jobs

	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))

/obj/structure/machinery/computer/groundside_operations/proc/format_list_of_marines(list/mob/living/carbon/human/marine_list, list/jobs_in_order)
		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

		for(var/X in marine_list)
			if(!X)
				continue //just to be safe
			var/mob_name = "unknown"
			var/mob_state = ""
			var/role = "unknown"
			var/area_name = "<b>???</b>"
			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 = "<b>Unconscious</b>"
						living_count++
					else
						continue

				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

			var/marine_infos = "<tr><td><A href='?src=\ref[src];operation=use_cam;cam_target=\ref[H]'>[mob_name]</a></td><td>[role]</td><td>[mob_state]</td><td>[area_name]</td></tr>"
			if(role in job_order)
				job_order[role] += marine_infos
			else
				misc_text += marine_infos
		dat += "<b>Total: [length(command_marines)] Deployed</b><BR>"
		dat += "<b>Marines detected: [living_count] ([helmetless_count] no helmet, [SSD_count] SSD, [almayer_count] on Almayer)</b><BR>"
		dat += "<center><b>Search:</b> <input type='text' id='filter' value='' onkeyup='updateSearch();' style='width:300px;'></center>"
		dat += "<table id='marine_list' border='2px' style='width: 100%; border-collapse: collapse;' align='center'><tr>"
		dat += "<th>Name</th><th>Role</th><th>State</th><th>Location</th></tr>"
		for(var/job in job_order)
			dat += job_order[job]
		dat += misc_text
		dat += "</table>"

@harryob harryob marked this pull request as draft January 18, 2024 17:29
Copy link
Contributor

This PR has been inactive for long enough to be automatically marked as stale. This means it is at risk of being auto closed in ~ 7 days, please address any outstanding review items and ensure your PR is finished, if these are all true and you are auto-staled anyway, you need to actively ask maintainers if your PR will be merged. Once you have done any of the previous actions then you should request a maintainer remove the stale label on your PR, to reset the stale timer. If you feel no maintainer will respond in that time, you may wish to close this PR youself, while you seek maintainer comment, as you will then be able to reopen the PR yourself

@github-actions github-actions bot added the Stale beg a maintainer to review your PR label Jan 26, 2024
@Wintermote
Copy link

Wintermote commented Jan 30, 2024

Going to rework the whole console at some point. Not proud of this code, give me some ideas

Let us click player icons on the tacmap to instantly overwatch that person (if they're part of the current overwatched squad)

@github-actions github-actions bot removed the Stale beg a maintainer to review your PR label Jan 31, 2024
Copy link
Contributor

github-actions bot commented Feb 8, 2024

This PR has been inactive for long enough to be automatically marked as stale. This means it is at risk of being auto closed in ~ 7 days, please address any outstanding review items and ensure your PR is finished, if these are all true and you are auto-staled anyway, you need to actively ask maintainers if your PR will be merged. Once you have done any of the previous actions then you should request a maintainer remove the stale label on your PR, to reset the stale timer. If you feel no maintainer will respond in that time, you may wish to close this PR youself, while you seek maintainer comment, as you will then be able to reopen the PR yourself

@github-actions github-actions bot added the Stale beg a maintainer to review your PR label Feb 8, 2024
@cm13-github
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@cm13-github cm13-github added the Merge Conflict PR can't be merged because it touched too much code label Feb 13, 2024
@cm13-github cm13-github removed the Merge Conflict PR can't be merged because it touched too much code label Feb 13, 2024
@cm13-github
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@TheGamerdk TheGamerdk marked this pull request as ready for review February 13, 2024 20:07
@github-actions github-actions bot removed the Stale beg a maintainer to review your PR label Feb 14, 2024
@harryob harryob added this pull request to the merge queue Feb 21, 2024
Merged via the queue into cmss13-devs:master with commit bb79497 Feb 21, 2024
27 checks passed
cm13-github added a commit that referenced this pull request Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Feature coder badge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants