Skip to content

Commit

Permalink
Fixes the issue where Tac Console TGUI was showing armour quadrants o…
Browse files Browse the repository at this point in the history
…n on crafts that do not have armour quadrants. (#2549)
  • Loading branch information
Bobbanz1 authored Oct 27, 2023
1 parent 5775437 commit 41ded1a
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 78 deletions.
16 changes: 16 additions & 0 deletions nsv13/code/game/machinery/computer/tactical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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"]
Expand Down
92 changes: 53 additions & 39 deletions tgui/packages/tgui/interfaces/GhostTacticalConsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -27,44 +27,58 @@ export const GhostTacticalConsole = (props, context) => {
}} />
</Section>
<Section title="Armour:">
<LabeledList>
<LabeledList.Item label="Forward Port">
<ProgressBar
value={(data.quadrant_fp_armour_current / data.quadrant_fp_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
<LabeledList.Item label="Forward Starboard">
<ProgressBar
value={(data.quadrant_fs_armour_current / data.quadrant_fs_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
<LabeledList.Item label="Aft Port">
<ProgressBar
value={(data.quadrant_ap_armour_current / data.quadrant_ap_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
<LabeledList.Item label="Aft Starboard">
<ProgressBar
value={(data.quadrant_as_armour_current / data.quadrant_as_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
</LabeledList>
{data.has_quadrant && (
<LabeledList>
<LabeledList.Item label="Forward Port">
<ProgressBar
value={(data.quadrant_fp_armour_current / data.quadrant_fp_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
<LabeledList.Item label="Forward Starboard">
<ProgressBar
value={(data.quadrant_fs_armour_current / data.quadrant_fs_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
<LabeledList.Item label="Aft Port">
<ProgressBar
value={(data.quadrant_ap_armour_current / data.quadrant_ap_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
<LabeledList.Item label="Aft Starboard">
<ProgressBar
value={(data.quadrant_as_armour_current / data.quadrant_as_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
</LabeledList>
) || (
<LabeledList>
<LabeledList.Item label="Integrity">
<ProgressBar
value={(data.armour_integrity / data.max_armour_integrity * 100) * 0.01}
ranges={{
good: [0.9, Infinity],
average: [0.15, 0.9],
bad: [-Infinity, 0.15],
}} />
</LabeledList.Item>
</LabeledList>
)}
</Section>
</Section>
<Section title="Armaments:">
Expand Down
92 changes: 53 additions & 39 deletions tgui/packages/tgui/interfaces/TacticalConsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -27,44 +27,58 @@ export const TacticalConsole = (props, context) => {
}} />
</Section>
<Section title="Armour:">
<LabeledList>
<LabeledList.Item label="Forward Port" labelColor="#ffffff">
<ProgressBar
value={(data.quadrant_fp_armour_current / data.quadrant_fp_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
<LabeledList.Item label="Forward Starboard" labelColor="#ffffff">
<ProgressBar
value={(data.quadrant_fs_armour_current / data.quadrant_fs_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
<LabeledList.Item label="Aft Port" labelColor="#ffffff">
<ProgressBar
value={(data.quadrant_ap_armour_current / data.quadrant_ap_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
<LabeledList.Item label="Aft Starboard" labelColor="#ffffff">
<ProgressBar
value={(data.quadrant_as_armour_current / data.quadrant_as_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
</LabeledList>
{data.has_quadrant && (
<LabeledList>
<LabeledList.Item label="Forward Port" labelColor="#ffffff">
<ProgressBar
value={(data.quadrant_fp_armour_current / data.quadrant_fp_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
<LabeledList.Item label="Forward Starboard" labelColor="#ffffff">
<ProgressBar
value={(data.quadrant_fs_armour_current / data.quadrant_fs_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
<LabeledList.Item label="Aft Port" labelColor="#ffffff">
<ProgressBar
value={(data.quadrant_ap_armour_current / data.quadrant_ap_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
<LabeledList.Item label="Aft Starboard" labelColor="#ffffff">
<ProgressBar
value={(data.quadrant_as_armour_current / data.quadrant_as_armour_max)}
ranges={{
good: [0.66, Infinity],
average: [0.33, 0.66],
bad: [-Infinity, 0.33],
}} />
</LabeledList.Item>
</LabeledList>
) || (
<LabeledList>
<LabeledList.Item label="Integrity" labelColor="#ffffff">
<ProgressBar
value={(data.armour_integrity / data.max_armour_integrity * 100) * 0.01}
ranges={{
good: [0.9, Infinity],
average: [0.15, 0.9],
bad: [-Infinity, 0.15],
}} />
</LabeledList.Item>
</LabeledList>
)}
</Section>
</Section>
<Section title="Armaments:">
Expand Down

0 comments on commit 41ded1a

Please sign in to comment.