From 41ded1aca4f0871946db94b9874c847af0963204 Mon Sep 17 00:00:00 2001 From: Bobbanz1 <59128051+Bobbanz1@users.noreply.github.com> Date: Sat, 28 Oct 2023 01:01:05 +0200 Subject: [PATCH] Fixes the issue where Tac Console TGUI was showing armour quadrants on on crafts that do not have armour quadrants. (#2549) --- .../code/game/machinery/computer/tactical.dm | 16 ++++ .../tgui/interfaces/GhostTacticalConsole.js | 92 +++++++++++-------- .../tgui/interfaces/TacticalConsole.js | 92 +++++++++++-------- 3 files changed, 122 insertions(+), 78 deletions(-) diff --git a/nsv13/code/game/machinery/computer/tactical.dm b/nsv13/code/game/machinery/computer/tactical.dm index 1c62171c2ac..ea70855dd8f 100644 --- a/nsv13/code/game/machinery/computer/tactical.dm +++ b/nsv13/code/game/machinery/computer/tactical.dm @@ -78,6 +78,14 @@ data["flakrange"] = linked.get_flak_range(linked.last_target) data["integrity"] = linked.obj_integrity data["max_integrity"] = linked.max_integrity + if(istype(linked, /obj/structure/overmap/small_craft)) + var/obj/structure/overmap/small_craft/small_ship = linked + var/obj/item/fighter_component/armour_plating/A = small_ship.loadout.get_slot(HARDPOINT_SLOT_ARMOUR) + data["has_quadrant"] = FALSE + data["armour_integrity"] = (A) ? A.obj_integrity : 0 + data["max_armour_integrity"] = (A) ? A.max_integrity : 100 + else + data["has_quadrant"] = TRUE data["quadrant_fs_armour_current"] = linked.armour_quadrants["forward_starboard"]["current_armour"] data["quadrant_fs_armour_max"] = linked.armour_quadrants["forward_starboard"]["max_armour"] data["quadrant_as_armour_current"] = linked.armour_quadrants["aft_starboard"]["current_armour"] @@ -157,6 +165,14 @@ data["flakrange"] = linked.get_flak_range(linked.last_target) data["integrity"] = linked.obj_integrity data["max_integrity"] = linked.max_integrity + if(istype(linked, /obj/structure/overmap/small_craft)) + var/obj/structure/overmap/small_craft/small_ship = linked + var/obj/item/fighter_component/armour_plating/A = small_ship.loadout.get_slot(HARDPOINT_SLOT_ARMOUR) + data["has_quadrant"] = FALSE + data["armour_integrity"] = (A) ? A.obj_integrity : 0 + data["max_armour_integrity"] = (A) ? A.max_integrity : 100 + else + data["has_quadrant"] = TRUE // I'm uncertain about whether or not we have ANY small crafts that have armor quadrants so I'm making it like this instead. data["quadrant_fs_armour_current"] = linked.armour_quadrants["forward_starboard"]["current_armour"] data["quadrant_fs_armour_max"] = linked.armour_quadrants["forward_starboard"]["max_armour"] data["quadrant_as_armour_current"] = linked.armour_quadrants["aft_starboard"]["current_armour"] diff --git a/tgui/packages/tgui/interfaces/GhostTacticalConsole.js b/tgui/packages/tgui/interfaces/GhostTacticalConsole.js index 987c93ae832..4a7d4d3f221 100644 --- a/tgui/packages/tgui/interfaces/GhostTacticalConsole.js +++ b/tgui/packages/tgui/interfaces/GhostTacticalConsole.js @@ -2,7 +2,7 @@ import { Fragment } from 'inferno'; import { useBackend, useLocalState } from '../backend'; -import { Box, Button, Section, ProgressBar, Knob, Flex, Tabs, LabeledList } from '../components'; +import { Button, Section, ProgressBar, LabeledList } from '../components'; import { Window } from '../layouts'; export const GhostTacticalConsole = (props, context) => { @@ -27,44 +27,58 @@ export const GhostTacticalConsole = (props, context) => { }} />
- - - - - - - - - - - - - - + {data.has_quadrant && ( + + + + + + + + + + + + + + + ) || ( + + + + + + )}
diff --git a/tgui/packages/tgui/interfaces/TacticalConsole.js b/tgui/packages/tgui/interfaces/TacticalConsole.js index 9018c7562fb..7bf68ce313e 100644 --- a/tgui/packages/tgui/interfaces/TacticalConsole.js +++ b/tgui/packages/tgui/interfaces/TacticalConsole.js @@ -2,7 +2,7 @@ import { Fragment } from 'inferno'; import { useBackend, useLocalState } from '../backend'; -import { Box, Button, Section, ProgressBar, Knob, Flex, Tabs, LabeledList } from '../components'; +import { Button, Section, ProgressBar, LabeledList } from '../components'; import { Window } from '../layouts'; export const TacticalConsole = (props, context) => { @@ -27,44 +27,58 @@ export const TacticalConsole = (props, context) => { }} />
- - - - - - - - - - - - - - + {data.has_quadrant && ( + + + + + + + + + + + + + + + ) || ( + + + + + + )}