From 7c3622ab98311710bb12b28ebd5060e479c69b94 Mon Sep 17 00:00:00 2001 From: Bobbanz1 <59128051+Bobbanz1@users.noreply.github.com> Date: Wed, 27 Sep 2023 12:26:49 +0200 Subject: [PATCH 1/2] Fixes the issue where Tac Console TGUI was showing armour quadrants on on crafts that do not have armour quadrants. --- .../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..f35f7c6ddf1 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/transport)) + var/obj/structure/overmap/small_craft/transport/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/transport)) + var/obj/structure/overmap/small_craft/transport/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 && ( + + + + + + + + + + + + + + + ) || ( + + + + + + )}
From b8022d8e57a53e0b4a6f2fe67f27c533ee42216b Mon Sep 17 00:00:00 2001 From: Bobbanz1 Date: Fri, 20 Oct 2023 09:50:48 +0200 Subject: [PATCH 2/2] Fixes the thing in response to review --- nsv13/code/game/machinery/computer/tactical.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nsv13/code/game/machinery/computer/tactical.dm b/nsv13/code/game/machinery/computer/tactical.dm index f35f7c6ddf1..ea70855dd8f 100644 --- a/nsv13/code/game/machinery/computer/tactical.dm +++ b/nsv13/code/game/machinery/computer/tactical.dm @@ -78,8 +78,8 @@ 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/transport)) - var/obj/structure/overmap/small_craft/transport/small_ship = linked + 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 @@ -165,8 +165,8 @@ 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/transport)) - var/obj/structure/overmap/small_craft/transport/small_ship = linked + 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