From 2c85063514bea66df4f865053c70fdbfc1b64979 Mon Sep 17 00:00:00 2001
From: Zonespace <41448081+Zonespace27@users.noreply.github.com>
Date: Thu, 3 Aug 2023 20:06:15 +0200
Subject: [PATCH] Fixes predator crew monitor console (#4079)
# About the pull request
Fixes the predator crew monitor to work at all.
# Testing Photographs and Procedure
Screenshots & Videos
![image](https://github.com/cmss13-devs/cmss13/assets/41448081/f0928b55-378a-403e-b732-0e3bc2217692)
# Changelog
:cl:
fix: Predator ship health monitor console now works
/:cl:
Co-authored-by: John Doe
---
code/modules/cm_marines/marines_consoles.dm | 57 ++++++++++++++++++++-
maps/predship/huntership.dmm | 3 +-
2 files changed, 56 insertions(+), 4 deletions(-)
diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm
index 36535a0b5141..4743034a68f4 100644
--- a/code/modules/cm_marines/marines_consoles.dm
+++ b/code/modules/cm_marines/marines_consoles.dm
@@ -679,11 +679,13 @@
idle_power_usage = 250
active_power_usage = 500
var/faction = FACTION_MARINE
+ /// What type of /datum/crewmonitor this will create
+ var/crewmonitor_type = /datum/crewmonitor
/obj/structure/machinery/computer/crew/Initialize()
. = ..()
if(!GLOB.crewmonitor[faction])
- GLOB.crewmonitor[faction] = new /datum/crewmonitor(faction)
+ GLOB.crewmonitor[faction] = new crewmonitor_type(faction)
/obj/structure/machinery/computer/crew/attack_remote(mob/living/user)
attack_hand(user)
@@ -714,6 +716,12 @@
icon_state = "cmonitor"
density = FALSE
+/obj/structure/machinery/computer/crew/alt/yautja
+ name = "\improper Yautja health monitor"
+ desc = "Used to monitor active health sensors of all Yautja in the system. You can see that the console highlights the human's ship areas with BLUE and the hunting locations with RED."
+ faction = FACTION_YAUTJA
+ crewmonitor_type = /datum/crewmonitor/yautja
+
/obj/structure/machinery/computer/crew/upp
faction = FACTION_UPP
@@ -790,7 +798,7 @@ GLOBAL_LIST_EMPTY_TYPED(crewmonitor, /datum/crewmonitor)
/datum/crewmonitor/ui_data(mob/user)
. = list(
"sensors" = update_data(),
- "link_allowed" = isAI(user)
+ "link_allowed" = isAI(user),
)
/datum/crewmonitor/proc/update_data()
@@ -1102,6 +1110,51 @@ GLOBAL_LIST_EMPTY_TYPED(crewmonitor, /datum/crewmonitor)
else
jobs = list()
+/datum/crewmonitor/yautja
+ faction = FACTION_YAUTJA
+
+/datum/crewmonitor/yautja/update_data()
+ var/list/results = list()
+ for(var/mob/living/carbon/human/human_mob as anything in GLOB.human_mob_list)
+
+ if(!isyautja(human_mob))
+ continue
+
+ if(faction != human_mob.faction)
+ continue
+
+ // Check if z-level is correct
+ var/turf/pos = get_turf(human_mob)
+ if(!pos)
+ continue
+
+ // The entry for this human
+ var/list/entry = list(
+ "ref" = REF(human_mob),
+ "name" = human_mob.real_name,
+ "ijob" = UNKNOWN_JOB_ID,
+ "assignment" = "Hunter",
+ "oxydam" = round(human_mob.getOxyLoss(), 1),
+ "toxdam" = round(human_mob.getToxLoss(), 1),
+ "burndam" = round(human_mob.getFireLoss(), 1),
+ "brutedam" = round(human_mob.getBruteLoss(), 1),
+ "can_track" = TRUE,
+ )
+
+ if(is_mainship_level(pos.z))
+ entry["side"] = "Almayer"
+
+ var/area/mob_area = get_area(human_mob)
+ entry["area"] = sanitize_area(mob_area.name)
+
+ results[++results.len] = entry
+
+ // Cache result
+ data = results
+ last_update = world.time
+
+ return results
+
#undef SENSOR_LIVING
#undef SENSOR_VITALS
#undef SENSOR_COORDS
diff --git a/maps/predship/huntership.dmm b/maps/predship/huntership.dmm
index e6fb4adc1c74..d7dcb49427a0 100644
--- a/maps/predship/huntership.dmm
+++ b/maps/predship/huntership.dmm
@@ -486,8 +486,7 @@
/obj/structure/pipes/standard/simple/hidden{
dir = 4
},
-/obj/structure/machinery/computer/crew/alt{
- faction = "Yautja";
+/obj/structure/machinery/computer/crew/alt/yautja{
pixel_y = 24
},
/turf/open/floor/corsat{