Skip to content

Commit

Permalink
TGS Test Merge (#8224)
Browse files Browse the repository at this point in the history
  • Loading branch information
cm13-github committed Jan 26, 2025
2 parents d66b38b + 29d5544 commit 021340e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 20 deletions.
4 changes: 2 additions & 2 deletions code/datums/crew_manifest.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ GLOBAL_DATUM_INIT(crew_manifest, /datum/crew_manifest, new)
var/list/data = list()

for(var/datum/data/record/record_entry in GLOB.data_core.general)
if(record_entry.fields["mob_faction"] != FACTION_MARINE)
continue

var/name = record_entry.fields["name"]
var/rank = record_entry.fields["rank"]
var/squad = record_entry.fields["squad"]
if(isnull(name) || isnull(rank))
continue
if(record_entry.fields["mob_faction"] != FACTION_MARINE && rank != JOB_CORPORATE_LIAISON)
continue

var/entry_dept = null
var/list/entry = list(
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/cm_process.dm
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ GLOBAL_VAR_INIT(next_admin_bioscan, 30 MINUTES)
for(var/mob/living/carbon/human/current_human as anything in GLOB.alive_human_list)
if(!(current_human.z && (current_human.z in z_levels) && !istype(current_human.loc, /turf/open/space) && !istype(current_human.loc, /area/adminlevel/ert_station/fax_response_station)))
continue
if((current_human.faction in FACTION_LIST_WY) || current_human.job == "Corporate Liaison") //The CL is assigned the USCM faction for gameplay purposes
if(current_human.faction in FACTION_LIST_WY)
num_WY++
num_headcount++
continue
Expand Down
58 changes: 41 additions & 17 deletions code/modules/cm_marines/marines_consoles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -700,13 +700,15 @@
idle_power_usage = 250
active_power_usage = 500
var/faction = FACTION_MARINE
/// Any extra factions this console should be tracking to.
var/list/extra_factions = list()
/// 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 crewmonitor_type(faction)
GLOB.crewmonitor[faction] = new crewmonitor_type(faction, extra_factions)

/obj/structure/machinery/computer/crew/attack_remote(mob/living/user)
attack_hand(user)
Expand Down Expand Up @@ -756,6 +758,7 @@

/obj/structure/machinery/computer/crew/wey_yu/pmc
faction = FACTION_PMC
extra_factions = list(FACTION_WY)

/obj/structure/machinery/computer/crew/colony
faction = FACTION_COLONIST
Expand Down Expand Up @@ -783,10 +786,12 @@ GLOBAL_LIST_EMPTY_TYPED(crewmonitor, /datum/crewmonitor)
/// Map of job to ID for sorting purposes
var/list/jobs
var/faction = FACTION_MARINE
var/list/extra_factions = list()

/datum/crewmonitor/New(set_faction = FACTION_MARINE)
/datum/crewmonitor/New(set_faction = FACTION_MARINE, extras = list())
..()
faction = set_faction
extra_factions = extras
setup_for_faction(faction)

/datum/crewmonitor/tgui_interact(mob/user, datum/tgui/ui)
Expand Down Expand Up @@ -829,34 +834,34 @@ GLOBAL_LIST_EMPTY_TYPED(crewmonitor, /datum/crewmonitor)

/datum/crewmonitor/proc/update_data()
var/list/results = list()
for(var/mob/living/carbon/human/H in GLOB.human_mob_list)
for(var/mob/living/carbon/human/tracked_mob in GLOB.human_mob_list)
// Predators
if(isyautja(H))
if(isyautja(tracked_mob))
continue
// Check for a uniform
var/obj/item/clothing/under/C = H.w_uniform
var/obj/item/clothing/under/C = tracked_mob.w_uniform
if(!C || !istype(C))
continue
// Check that sensors are present and active
if(!C.has_sensor || !C.sensor_mode || faction != H.faction)
if(!C.has_sensor || !C.sensor_mode || !check_faction(tracked_mob))
continue

// Check if z-level is correct
var/turf/pos = get_turf(H)
var/turf/pos = get_turf(tracked_mob)
if(!pos)
continue
if(should_block_game_interaction(H))
if(should_block_game_interaction(tracked_mob))
continue

// The entry for this human
var/list/entry = list(
"ref" = REF(H),
"ref" = REF(tracked_mob),
"name" = "Unknown",
"ijob" = UNKNOWN_JOB_ID
)

// ID and id-related data
var/obj/item/card/id/id_card = H.get_idcard()
var/obj/item/card/id/id_card = tracked_mob.get_idcard()
if (id_card)
entry["name"] = id_card.registered_name
entry["assignment"] = id_card.assignment
Expand All @@ -865,26 +870,26 @@ GLOBAL_LIST_EMPTY_TYPED(crewmonitor, /datum/crewmonitor)

// Binary living/dead status
if (C.sensor_mode >= SENSOR_LIVING)
entry["life_status"] = !H.stat
entry["life_status"] = !tracked_mob.stat

// Damage
if (C.sensor_mode >= SENSOR_VITALS)
entry += list(
"oxydam" = round(H.getOxyLoss(), 1),
"toxdam" = round(H.getToxLoss(), 1),
"burndam" = round(H.getFireLoss(), 1),
"brutedam" = round(H.getBruteLoss(), 1)
"oxydam" = round(tracked_mob.getOxyLoss(), 1),
"toxdam" = round(tracked_mob.getToxLoss(), 1),
"burndam" = round(tracked_mob.getFireLoss(), 1),
"brutedam" = round(tracked_mob.getBruteLoss(), 1)
)

// Location
if (C.sensor_mode >= SENSOR_COORDS)
if(is_mainship_level(pos.z))
entry["side"] = "Almayer"
var/area/A = get_area(H)
var/area/A = get_area(tracked_mob)
entry["area"] = sanitize_area(A.name)

// Trackability
entry["can_track"] = H.detectable_by_ai()
entry["can_track"] = tracked_mob.detectable_by_ai()

results[++results.len] = entry

Expand All @@ -906,6 +911,25 @@ GLOBAL_LIST_EMPTY_TYPED(crewmonitor, /datum/crewmonitor)
*/

/datum/crewmonitor/proc/check_faction(mob/living/carbon/human/target)
if((target.faction == faction) || (target.faction in extra_factions))
return TRUE
for(var/pos_faction in target.faction_group)
if((pos_faction == faction) || (pos_faction in extra_factions))
return TRUE

var/obj/item/card/id/id_card = target.wear_id
if(!id_card)
return FALSE

if((id_card.faction == faction) || (id_card.faction in extra_factions))
return TRUE
for(var/pos_faction in id_card.faction_group)
if((pos_faction == faction) || (pos_faction in extra_factions))
return TRUE

return FALSE

/datum/crewmonitor/proc/setup_for_faction(set_faction = FACTION_MARINE)
switch(set_faction)
if(FACTION_MARINE)
Expand Down

0 comments on commit 021340e

Please sign in to comment.