From ed2aa694447ff5b3fdb7ef58c7f1fdc96bfc249c Mon Sep 17 00:00:00 2001 From: Geeves Date: Wed, 18 Dec 2024 13:30:36 +0200 Subject: [PATCH] Crew Manifest: Shuttle Manifesting (#19922) * Being added to a shuttle manifest will now update the crew manifest to indicate that you're on an away mission on that shuttle. ![image](https://github.com/user-attachments/assets/5ba42070-1101-4e45-825c-9b15231dca39) ![image-1](https://github.com/user-attachments/assets/e2ce81b2-ed42-4c24-bc69-d44095f2f73e) --------- Signed-off-by: Geeves Co-authored-by: Fluffy <65877598+FluffyGhoster@users.noreply.github.com> --- code/__DEFINES/subsystems.dm | 13 +++---- code/controllers/subsystems/records.dm | 34 +++++++++++++++---- .../geeves-shuttle_manifest_manifesting.yml | 6 ++++ .../interfaces/common/ManifestSection.tsx | 5 +-- .../tgui/styles/interfaces/CrewManifest.scss | 1 + 5 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 html/changelogs/geeves-shuttle_manifest_manifesting.yml diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index 5a9790e096b..da7b08a0447 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -138,12 +138,13 @@ // - SSrecords -- -#define RECORD_GENERAL 1 -#define RECORD_MEDICAL 2 -#define RECORD_SECURITY 4 -#define RECORD_LOCKED 8 -#define RECORD_WARRANT 16 -#define RECORD_VIRUS 32 +#define RECORD_GENERAL BITFLAG(0) +#define RECORD_MEDICAL BITFLAG(1) +#define RECORD_SECURITY BITFLAG(2) +#define RECORD_LOCKED BITFLAG(3) +#define RECORD_WARRANT BITFLAG(4) +#define RECORD_VIRUS BITFLAG(5) +#define RECORD_SHUTTLE_MANIFEST BITFLAG(6) // - SSjobs -- diff --git a/code/controllers/subsystems/records.dm b/code/controllers/subsystems/records.dm index f4db33492df..2f10d2de65b 100644 --- a/code/controllers/subsystems/records.dm +++ b/code/controllers/subsystems/records.dm @@ -114,6 +114,7 @@ SUBSYSTEM_DEF(records) viruses += record if(/datum/record/shuttle_manifest) shuttle_manifests += record + reset_manifest() if(/datum/record/shuttle_assignment) shuttle_assignments += record onCreate(record) @@ -131,6 +132,7 @@ SUBSYSTEM_DEF(records) viruses |= record if(/datum/record/shuttle_manifest) shuttle_manifests |= record + reset_manifest() if(/datum/record/shuttle_assignment) shuttle_assignments |= record onModify(record) @@ -148,6 +150,7 @@ SUBSYSTEM_DEF(records) viruses *= record if(/datum/record/shuttle_manifest) shuttle_manifests -= record + reset_manifest() if(/datum/record/shuttle_assignment) shuttle_assignments -= record onDelete(record) @@ -178,6 +181,13 @@ SUBSYSTEM_DEF(records) if(r.vars[field] == value) return r return + if(record_type & RECORD_SHUTTLE_MANIFEST) + for(var/datum/record/shuttle_manifest/manifest as anything in shuttle_manifests) + if(manifest.excluded_fields[field]) + continue + if(manifest.vars[field] == value) + return manifest + return for(var/datum/record/general/r in searchedList) if(r.excluded_fields[field]) continue @@ -243,6 +253,18 @@ SUBSYSTEM_DEF(records) dat += "

[dep]

" return dat +/// gets the activity state, which gets displayed in the crew manifest +/datum/controller/subsystem/records/proc/get_activity_state(var/datum/record/general/general_record) + // by default, we use the physical status as our activity_state + var/activity_state = general_record.physical_status + + // look if we possibly have a manifest record we can use instead + var/datum/record/shuttle_manifest/manifest = find_record("name", general_record.name, RECORD_SHUTTLE_MANIFEST) + if(manifest) + return "Away Mission: " + manifest.shuttle + + return activity_state + /datum/controller/subsystem/records/proc/get_manifest_list() if(manifest.len) return manifest @@ -250,13 +272,13 @@ SUBSYSTEM_DEF(records) log_world("ERROR: SSjobs not available, cannot build manifest") return manifest = DEPARTMENTS_LIST_INIT - for(var/datum/record/general/t in records) - var/name = sanitize(t.name, encode = FALSE) - var/rank = sanitize(t.rank, encode = FALSE) - var/real_rank = make_list_rank(t.real_rank) + for(var/datum/record/general/general_record in records) + var/name = sanitize(general_record.name, encode = FALSE) + var/rank = sanitize(general_record.rank, encode = FALSE) + var/real_rank = make_list_rank(general_record.real_rank) var/datum/job/job = SSjobs.GetJob(real_rank) - var/isactive = t.physical_status + var/activity_state = get_activity_state(general_record) var/list/departments if(istype(job) && job.departments.len > 0 && all_in_list(job.departments, manifest)) @@ -266,7 +288,7 @@ SUBSYSTEM_DEF(records) for(var/department in departments) // add them to their departments var/supervisor = departments[department] & JOBROLE_SUPERVISOR - manifest[department][++manifest[department].len] = list("name" = name, "rank" = rank, "active" = isactive, "head" = supervisor) + manifest[department][++manifest[department].len] = list("name" = name, "rank" = rank, "active" = activity_state, "head" = supervisor) if(supervisor) // they are a supervisor/head, put them on top manifest[department].Swap(1, manifest[department].len) diff --git a/html/changelogs/geeves-shuttle_manifest_manifesting.yml b/html/changelogs/geeves-shuttle_manifest_manifesting.yml new file mode 100644 index 00000000000..43b3e73d002 --- /dev/null +++ b/html/changelogs/geeves-shuttle_manifest_manifesting.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Being added to a shuttle manifest will now update the crew manifest to indicate that you're on an away mission on that shuttle." diff --git a/tgui/packages/tgui/interfaces/common/ManifestSection.tsx b/tgui/packages/tgui/interfaces/common/ManifestSection.tsx index 74e4f457189..7055f42c405 100644 --- a/tgui/packages/tgui/interfaces/common/ManifestSection.tsx +++ b/tgui/packages/tgui/interfaces/common/ManifestSection.tsx @@ -57,8 +57,9 @@ export const ManifestSection = (props, context) => { 'manifest-indicator-' + crewmate.active .toLowerCase() - .replace(/\*/g, '') - .replace(/\s/g, '-') + .replace(/\*/g, '') // removes asterisks + .replace(/\s/g, '-') // replaces spaces with a dash + .replace(/:.*?$/, '') // matches and removes : to the end of the string, so it catches Away Mission(: ShuttleName) } /> diff --git a/tgui/packages/tgui/styles/interfaces/CrewManifest.scss b/tgui/packages/tgui/styles/interfaces/CrewManifest.scss index d9569ba68f8..6c70acf4abc 100644 --- a/tgui/packages/tgui/styles/interfaces/CrewManifest.scss +++ b/tgui/packages/tgui/styles/interfaces/CrewManifest.scss @@ -21,6 +21,7 @@ $status-colors: ( 'deceased': colors.$red, 'physically-unfit': colors.$yellow, 'disabled': colors.$yellow, + 'away-mission': colors.$blue, ); @each $dept, $color in $departmental-colors {