From ddc4a0f15fbd177d781d8b42edf077c4d709630a Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Sun, 13 Aug 2023 14:00:25 +0200 Subject: [PATCH] a tiny few changes --- .../subsystem/processing/superfastobj.dm | 5 - code/modules/cm_marines/overwatch.dm | 129 +---------- colonialmarines.dme | 1 - .../tgui/interfaces/OverwatchConsole.js | 203 +++++------------- 4 files changed, 66 insertions(+), 272 deletions(-) delete mode 100644 code/controllers/subsystem/processing/superfastobj.dm diff --git a/code/controllers/subsystem/processing/superfastobj.dm b/code/controllers/subsystem/processing/superfastobj.dm deleted file mode 100644 index 926981f0f377..000000000000 --- a/code/controllers/subsystem/processing/superfastobj.dm +++ /dev/null @@ -1,5 +0,0 @@ -PROCESSING_SUBSYSTEM_DEF(superfastobj) - name = "Super Fast Objects" - priority = SS_PRIORITY_SUPER_FAST_OBJECTS - flags = SS_NO_INIT - wait = 0.1 SECONDS diff --git a/code/modules/cm_marines/overwatch.dm b/code/modules/cm_marines/overwatch.dm index c74631976738..7e04a99c6c58 100644 --- a/code/modules/cm_marines/overwatch.dm +++ b/code/modules/cm_marines/overwatch.dm @@ -35,11 +35,6 @@ var/list/saved_coordinates = list() - ///List of camera datums that we're actively updating and sending to TGUI - var/list/datum/overwatch_camera_holder/camera_holders = list() - - ///List of marines currently being multi-cammed - var/list/multicam_marines = list() ///Currently selected UI theme var/ui_theme = "crtblue" @@ -48,15 +43,6 @@ /obj/structure/machinery/computer/overwatch/Initialize() . = ..() tacmap = new(src, minimap_type) - // Initialize map objects - - camera_holders += new /datum/overwatch_camera_holder(1, src) - camera_holders += new /datum/overwatch_camera_holder(2, src) - camera_holders += new /datum/overwatch_camera_holder(3, src) - camera_holders += new /datum/overwatch_camera_holder(4, src) - - START_PROCESSING(SSsuperfastobj, src) - /obj/structure/machinery/computer/overwatch/Destroy() @@ -294,7 +280,7 @@ if(mob_state != "Dead") marines_alive++ - var/marine_data = list(list("name" = mob_name, "state" = mob_state, "has_helmet" = has_helmet, "role" = role, "acting_sl" = acting_sl, "fteam" = fteam, "distance" = distance, "area_name" = area_name, "multicammed" = (marine in multicam_marines),"ref" = REF(marine))) + var/marine_data = list(list("name" = mob_name, "state" = mob_state, "has_helmet" = has_helmet, "role" = role, "acting_sl" = acting_sl, "fteam" = fteam, "distance" = distance, "area_name" = area_name,"ref" = REF(marine))) data["marines"] += marine_data if(is_squad_leader) if(!data["squad_leader"]) @@ -376,8 +362,6 @@ visible_message("[icon2html(src, viewers(src))] [SPAN_BOLDNOTICE("Overwatch systems deactivated. Goodbye, [ID ? "[ID.rank] ":""][operator ? "[operator.name]":"sysadmin"].")]") operator = null current_squad = null - multicam_marines = list() - clear_multicams() if(cam && !ishighersilicon(user)) user.reset_view(null) user.UnregisterSignal(cam, COMSIG_PARENT_QDELETING) @@ -522,24 +506,6 @@ cam = new_cam user.reset_view(cam) user.RegisterSignal(cam, COMSIG_PARENT_QDELETING, TYPE_PROC_REF(/mob, reset_observer_view_on_deletion)) - if("add_multicam") - if(!params["ref"]) - return - var/mob/living/carbon/human/marine = locate(params["ref"]) in current_squad.marines_list - if(!marine) - return - multicam_marines += marine - if(length(multicam_marines) > 4) - popleft(multicam_marines) - update_multicams() - if("remove_multicam") - if(!params["ref"]) - return - var/mob/living/carbon/human/marine = locate(params["ref"]) in multicam_marines - if(!marine) - return - multicam_marines -= marine - clear_multicams() if("change_operator") if(operator != user) if(operator && ishighersilicon(operator)) @@ -556,23 +522,6 @@ visible_message("[icon2html(src, viewers(src))] [SPAN_BOLDNOTICE("Basic overwatch systems initialized. Welcome, [ID ? "[ID.rank] ":""][operator.name]. Please select a squad.")]") current_squad?.send_squad_message("Attention. Your Overwatch officer is now [ID ? "[ID.rank] ":""][operator.name].", displayed_icon = src) -/obj/structure/machinery/computer/overwatch/proc/update_multicams() - var/index = 1 - for(var/mob/living/carbon/human/marine in multicam_marines) - var/datum/overwatch_camera_holder/holder = camera_holders[index] - holder.update_camera(marine) - index++ - -/obj/structure/machinery/computer/overwatch/proc/clear_multicams() - var/index = 1 - for(var/mob/living/carbon/human/marine in multicam_marines) - var/datum/overwatch_camera_holder/holder = camera_holders[index] - holder.reset_camera() - update_multicams() - -/obj/structure/machinery/computer/overwatch/process() - update_multicams() - /obj/structure/machinery/computer/overwatch/proc/change_lead(mob/user, sl_ref) if(!user) @@ -645,6 +594,13 @@ else if(!cam || !cam.can_use()) //camera doesn't work, is no longer selected or is gone user.unset_interaction() +/obj/structure/machinery/computer/overwatch/on_unset_interaction(mob/user) + ..() + if(!isRemoteControlling(user)) + if(cam) + user.UnregisterSignal(cam, COMSIG_PARENT_QDELETING) + cam = null + user.reset_view(null) /obj/structure/machinery/computer/overwatch/ui_close(mob/user) ..() @@ -963,72 +919,3 @@ #undef HIDE_ALMAYER #undef HIDE_GROUND #undef HIDE_NONE - -/datum/overwatch_camera_holder - var/map_name - var/atom/movable/screen/map_view/cam_screen - var/atom/movable/screen/background/cam_background - - -/datum/overwatch_camera_holder/New(number, originator_console) - . = ..() - map_name = "camera_console_[REF(originator_console)]_map_[number]" - cam_screen = new - cam_screen.icon = null - cam_screen.name = "screen" - cam_screen.assigned_map = map_name - cam_screen.del_on_map_removal = FALSE - cam_screen.screen_loc = "[map_name]:1,1" - cam_background = new - cam_background.assigned_map = map_name - cam_background.del_on_map_removal = FALSE - - -/datum/overwatch_camera_holder/proc/update_camera(mob/living/carbon/human/marine) - if(!marine) - reset_camera() - return - if(!istype(marine.head, /obj/item/clothing/head/helmet/marine)) - reset_camera() - return - - var/obj/structure/machinery/camera/current - if(marine) - var/obj/item/clothing/head/helmet/marine/marine_helmet = marine.head - current = marine_helmet.camera - - if(!current) - reset_camera() - return - var/cam_location = current - if(istype(current.loc, /obj/item/clothing/head/helmet/marine)) - var/obj/item/clothing/head/helmet/marine/helmet = current.loc - cam_location = helmet.loc - - var/list/visible_things = current.isXRay() ? range(current.view_range, cam_location) : view(current.view_range, cam_location) - - var/list/visible_turfs = list() - var/area/area_being_checked - for(var/turf/visible_turf in visible_things) - area_being_checked = visible_turf.loc - if(!area_being_checked.lighting_use_dynamic || visible_turf.lighting_lumcount >= 1) - visible_turfs += visible_turf - - var/list/bbox = get_bbox_of_atoms(visible_turfs) - var/size_x = bbox[3] - bbox[1] + 1 - var/size_y = bbox[4] - bbox[2] + 1 - - cam_screen.vis_contents = visible_turfs - cam_background.icon_state = "clear" - cam_background.fill_rect(1, 1, size_x, size_y) - -/datum/overwatch_camera_holder/proc/reset_camera(mob/living/carbon/human/marine) - var/list/visible_turfs = list() - - var/list/bbox = get_bbox_of_atoms(visible_turfs) - var/size_x = bbox[3] - bbox[1] + 1 - var/size_y = bbox[4] - bbox[2] + 1 - - cam_screen.vis_contents = list() - cam_background.icon_state = "clear" - cam_background.fill_rect(1, 1, size_x, size_y) diff --git a/colonialmarines.dme b/colonialmarines.dme index ff98680cbf8d..2b3b08984dfa 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -304,7 +304,6 @@ #include "code\controllers\subsystem\processing\processing.dm" #include "code\controllers\subsystem\processing\shield_pillar.dm" #include "code\controllers\subsystem\processing\slowobj.dm" -#include "code\controllers\subsystem\processing\superfastobj.dm" #include "code\datums\_atmos_setup.dm" #include "code\datums\action.dm" #include "code\datums\ASRS.dm" diff --git a/tgui/packages/tgui/interfaces/OverwatchConsole.js b/tgui/packages/tgui/interfaces/OverwatchConsole.js index de9c9e3c66df..9df15ade47b2 100644 --- a/tgui/packages/tgui/interfaces/OverwatchConsole.js +++ b/tgui/packages/tgui/interfaces/OverwatchConsole.js @@ -1,5 +1,5 @@ import { useBackend, useLocalState, useSharedState } from '../backend'; -import { Button, Section, Stack, Tabs, Table, Box, Input, ByondUi, NumberInput, LabeledControls, Divider } from '../components'; +import { Button, Section, Stack, Tabs, Table, Box, Input, NumberInput, LabeledControls, Divider, Collapsible } from '../components'; import { Window } from '../layouts'; export const OverwatchConsole = (props, context) => { @@ -7,8 +7,8 @@ export const OverwatchConsole = (props, context) => { return ( {(!data.current_squad && ) || } @@ -64,8 +64,14 @@ const SquadPanel = (props, context) => { return ( <> - - + + + + + + + + { onClick={() => setCategory('monitor')}> Squad Monitor - setCategory('multicam')}> - Multicam - { onClick={() => setCategory('ob')}> Orbital Bombardment - setCategory('map')}> + act('tacmap_unpin')}> Tactical Map {category === 'monitor' && } - {category === 'multicam' && } {category === 'supply' && } {category === 'ob' && } - {category === 'map' && } ); }; @@ -294,6 +289,36 @@ const RoleTable = (props, context) => { const SquadMonitor = (props, context) => { const { act, data } = useBackend(context); + const sortByRole = (a, b) => { + a = a.role; + b = b.role; + const roleValues = { + 'Squad Leader': 10, + 'Fireteam Leader': 9, + 'Weapons Specialist': 8, + 'Smartgunner': 7, + 'Hospital Corpsman': 6, + 'Combat Technician': 5, + 'Rifleman': 4, + }; + let valueA = roleValues[a]; + let valueB = roleValues[b]; + if (a.includes('Weapons Specialist')) { + valueA = roleValues['Weapons Specialist']; + } + if (b.includes('Weapons Specialist')) { + valueB = roleValues['Weapons Specialist']; + } + if (!valueA && !valueB) return 0; // They're both unknown + if (!valueA) return 1; // B is defined but A is not + if (!valueB) return -1; // A is defined but B is not + + if (valueA > valueB) return -1; // A is more important + if (valueA < valueB) return 1; // B is more important + + return 0; // They're equal + }; + let { marines, squad_leader } = data; const [hidden_marines, setHiddenMarines] = useLocalState( @@ -347,11 +372,11 @@ const SquadMonitor = (props, context) => { let location_filter; if (data.z_hidden === 2) { - location_filter = 'groundside marines'; + location_filter = 'groundside'; } else if (data.z_hidden === 1) { - location_filter = 'shipside marines'; + location_filter = 'shipside'; } else { - location_filter = 'all marines'; + location_filter = 'all'; } return ( @@ -364,24 +389,24 @@ const SquadMonitor = (props, context) => { color="yellow" tooltip="Show marines depending on location" onClick={() => act('change_locations_ignored')}> - Showing {location_filter} + Shown: {location_filter} {(showDeadMarines && ( )) || ( )} {(showHiddenMarines && ( )) || ( )}