Skip to content

Commit

Permalink
tracked down bugs which came up during firemission creation and equip…
Browse files Browse the repository at this point in the history
…ment selection
  • Loading branch information
mullenpaul committed Nov 14, 2023
1 parent 5fc4fd4 commit a7eb555
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions tgui/packages/tgui/interfaces/MfdPanels/FiremissionPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { range } from 'common/collections';
import { DropshipEquipment, DropshipProps } from '../DropshipWeaponsConsole';
import { fmEditState, fmState, fmWeaponEditState, mfdState } from './stateManagers';

function sortWeapons(a: DropshipEquipment, b: DropshipEquipment): number {
return (a?.mount_point ?? 0) < (b?.mount_point ?? 0) ? -1 : 1;
}

const CreateFiremissionPanel = (props, context) => {
const { act } = useBackend(context);
const [fmName, setFmName] = useLocalState<string>(context, 'fmname', '');
Expand Down Expand Up @@ -205,7 +209,8 @@ const FiremissionView = (props: MfdProps & { fm: CasFiremission }, context) => {

const weaponData = props.fm.records
.map((x) => data.equipment_data.find((y) => y.mount_point === x.weapon))
.filter((x) => x !== undefined) as Array<DropshipEquipment>;
.filter((x) => x !== undefined)
.sort(sortWeapons) as Array<DropshipEquipment>;

const selectedWeapon = weaponData.find((x) => x.mount_point === editFmWeapon);
const displayDetail = editFm;
Expand Down Expand Up @@ -273,8 +278,8 @@ const FiremissionView = (props: MfdProps & { fm: CasFiremission }, context) => {

const gimbals: GimbalInfo[] = [
{ min: -1, max: -1, values: [] },
{ min: -6, max: 0, values: ['-6', '-5', '-4 ', '-3', '-2', '-1', '0', '-'] },
{ min: -6, max: 0, values: ['-6', '-5', '-4 ', '-3', '-2', '-1', '0', '-'] },
{ min: -6, max: 0, values: ['-6', '-5', '-4', '-3', '-2', '-1', '0', '-'] },
{ min: -6, max: 0, values: ['-6', '-5', '-4', '-3', '-2', '-1', '0', '-'] },
{ min: 0, max: 6, values: ['-', '0', '1', '2', '3', '4', '5', '6'] },
{ min: 0, max: 6, values: ['-', '0', '1', '2', '3', '4', '5', '6'] },
];
Expand Down
6 changes: 3 additions & 3 deletions tgui/packages/tgui/interfaces/MfdPanels/SupportPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { EquipmentContext } from './types';
import { mfdState, useEquipmentState } from './stateManagers';

export const SupportMfdPanel = (props: MfdProps, context) => {
const { equipmentState } = useEquipmentState(props.panelStateId, context);
const { equipmentState } = useEquipmentState(context, props.panelStateId);

const { setPanelState } = mfdState(context, props.panelStateId);

Expand Down Expand Up @@ -39,14 +39,14 @@ export const SupportMfdPanel = (props: MfdProps, context) => {
},
]}>
<Box className="NavigationMenu">
<Stack align="center">
<Stack align="center" vertical>
<Stack.Item>
<h3>Component {result?.shorthand} not found</h3>
</Stack.Item>
<Stack.Item>
<h3>Is this authorised equipment?</h3>
</Stack.Item>
<Stack.Item>
<Stack.Item width="300px">
<h3>
Contact your local WY representative for further upgrade options
</h3>
Expand Down

0 comments on commit a7eb555

Please sign in to comment.