Skip to content

Commit

Permalink
Fixes predator crew monitor console (#4079)
Browse files Browse the repository at this point in the history
# About the pull request
Fixes the predator crew monitor to work at all.

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>


![image](https://github.com/cmss13-devs/cmss13/assets/41448081/f0928b55-378a-403e-b732-0e3bc2217692)

</details>


# Changelog
:cl:
fix: Predator ship health monitor console now works
/:cl:

Co-authored-by: John Doe <[email protected]>
  • Loading branch information
Zonespace27 and johndoe2013 committed Aug 3, 2023
1 parent 216794e commit 2c85063
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 4 deletions.
57 changes: 55 additions & 2 deletions code/modules/cm_marines/marines_consoles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions maps/predship/huntership.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 2c85063

Please sign in to comment.