Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes the issue where Tac Console TGUI was showing armour quadrants on on crafts that do not have armour quadrants. #2549

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading