Check prog pax load/unload
This commit is contained in:
parent
c394cd4d7b
commit
cbd7d4e0ae
@ -1,7 +1,7 @@
|
|||||||
import { FC, useCallback, useEffect, useState } from 'react';
|
import { FC, useCallback, useEffect, useState } from 'react';
|
||||||
import Pax from './components/pax/Pax';
|
import Pax from './components/pax/Pax';
|
||||||
import {
|
import {
|
||||||
COHERENT_COMBUS_WASM_CALL,
|
COHERENT_COMM_BUS_WASM_CALL,
|
||||||
COMM_BUS_LIVE_DATA_EVENT,
|
COMM_BUS_LIVE_DATA_EVENT,
|
||||||
TFDI_SIMBRIEF_USERNAME_CALL,
|
TFDI_SIMBRIEF_USERNAME_CALL,
|
||||||
TFDI_SIMBRIEF_USERNAME_EVENT,
|
TFDI_SIMBRIEF_USERNAME_EVENT,
|
||||||
@ -32,7 +32,7 @@ const App: FC<IAppProps> = ({ commBus }) => {
|
|||||||
commBus.on(COMM_BUS_LIVE_DATA_EVENT, wasmCallback);
|
commBus.on(COMM_BUS_LIVE_DATA_EVENT, wasmCallback);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Coherent.call(COHERENT_COMBUS_WASM_CALL, TFDI_SIMBRIEF_USERNAME_CALL, 'null');
|
Coherent.call(COHERENT_COMM_BUS_WASM_CALL, TFDI_SIMBRIEF_USERNAME_CALL, 'null');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { FC, useEffect, useRef, useState } from 'react';
|
import { FC, useEffect, useRef, useState } from 'react';
|
||||||
import { unloadAircraft } from '../../configs/shared';
|
|
||||||
import {
|
import {
|
||||||
COHERENT_COMBUS_WASM_CALL,
|
COHERENT_COMM_BUS_WASM_CALL,
|
||||||
COMM_BUS_UPDATE_TARGET_EVENT,
|
COMM_BUS_UPDATE_TARGET_EVENT,
|
||||||
GSX_SERVICE_CALLED,
|
GSX_SERVICE_CALLED,
|
||||||
GSX_SERVICE_FINISHED,
|
GSX_SERVICE_FINISHED,
|
||||||
@ -9,6 +8,7 @@ import {
|
|||||||
import { WASMDataPax } from '../../types/WASMData';
|
import { WASMDataPax } from '../../types/WASMData';
|
||||||
import { LoadingState } from '../../types/general';
|
import { LoadingState } from '../../types/general';
|
||||||
import { ImportFlightPlan } from '../../utils/TFDISBImport';
|
import { ImportFlightPlan } from '../../utils/TFDISBImport';
|
||||||
|
import { inRangeOf, loadAircraft, unloadAircraft } from '../../utils/utils';
|
||||||
import CGSelect from '../CGSelect/CGSelect';
|
import CGSelect from '../CGSelect/CGSelect';
|
||||||
import ActionBar from '../actionbar/ActionBar';
|
import ActionBar from '../actionbar/ActionBar';
|
||||||
|
|
||||||
@ -17,10 +17,9 @@ interface SBEntryProps {
|
|||||||
loadingState: LoadingState;
|
loadingState: LoadingState;
|
||||||
username: string;
|
username: string;
|
||||||
setLoadingState: (newState: LoadingState) => void;
|
setLoadingState: (newState: LoadingState) => void;
|
||||||
loadAircraft: () => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoadingState, loadAircraft }) => {
|
const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoadingState }) => {
|
||||||
const [CGTarget, setCGTarget] = useState(WASMData.targetPayload.CGTarget);
|
const [CGTarget, setCGTarget] = useState(WASMData.targetPayload.CGTarget);
|
||||||
const [fuel, setFuel] = useState(Math.round(WASMData.livePayload.fuel));
|
const [fuel, setFuel] = useState(Math.round(WASMData.livePayload.fuel));
|
||||||
const [fuelEnabled, setFuelEnabled] = useState(true);
|
const [fuelEnabled, setFuelEnabled] = useState(true);
|
||||||
@ -31,7 +30,7 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoa
|
|||||||
const cargo = useRef(0);
|
const cargo = useRef(0);
|
||||||
|
|
||||||
const ZFW = () => {
|
const ZFW = () => {
|
||||||
if (loadingState !== 'loaded') return Math.round(WASMData.targetPayload.total);
|
if (loadingState !== 'loaded' && !GSXActive()) return Math.round(WASMData.targetPayload.total);
|
||||||
|
|
||||||
return Math.round(WASMData.livePayload.total);
|
return Math.round(WASMData.livePayload.total);
|
||||||
};
|
};
|
||||||
@ -101,12 +100,12 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoa
|
|||||||
[WASMData.userData.isER]
|
[WASMData.userData.isER]
|
||||||
);
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setFuelEnabled(Math.round(WASMData.livePayload.fuel) === fuel);
|
setFuelEnabled(inRangeOf(Math.round(WASMData.livePayload.fuel), fuel));
|
||||||
}, [WASMData.livePayload.fuel]);
|
}, [WASMData.livePayload.fuel]);
|
||||||
|
|
||||||
const updateData = (_CGTarget?: number) => {
|
const updateData = (_CGTarget?: number) => {
|
||||||
Coherent.call(
|
Coherent.call(
|
||||||
COHERENT_COMBUS_WASM_CALL,
|
COHERENT_COMM_BUS_WASM_CALL,
|
||||||
COMM_BUS_UPDATE_TARGET_EVENT,
|
COMM_BUS_UPDATE_TARGET_EVENT,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
mode: 0,
|
mode: 0,
|
||||||
@ -200,7 +199,8 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoa
|
|||||||
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
|
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
|
||||||
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
|
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
|
||||||
<label>
|
<label>
|
||||||
{loadingState !== 'loaded' ? 'Expected' : 'Actual'} ZFW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})
|
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
|
||||||
|
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
@ -212,7 +212,8 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, username, setLoa
|
|||||||
</div>
|
</div>
|
||||||
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
|
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
|
||||||
<label>
|
<label>
|
||||||
{loadingState !== 'loaded' ? 'Expected' : 'Actual'} GW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})
|
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
|
||||||
|
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { FC, useState } from 'react';
|
import { FC, useState } from 'react';
|
||||||
import { loadAircraft } from '../../configs/shared';
|
|
||||||
import { GSX_SERVICE_CALLED, GSX_SERVICE_FINISHED } from '../../constants';
|
import { GSX_SERVICE_CALLED, GSX_SERVICE_FINISHED } from '../../constants';
|
||||||
import { LoadingState } from '../../types/general';
|
import { LoadingState } from '../../types/general';
|
||||||
import { WASMDataPax } from '../../types/WASMData';
|
import { WASMDataPax } from '../../types/WASMData';
|
||||||
@ -118,24 +117,13 @@ const Pax: FC<PaxProps> = ({ WASMData, username }) => {
|
|||||||
loadingState={loadingState}
|
loadingState={loadingState}
|
||||||
username={username}
|
username={username}
|
||||||
setLoadingState={setLoadingState}
|
setLoadingState={setLoadingState}
|
||||||
loadAircraft={loadAircraft}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{((username && selectedTab === 1) || (!username && selectedTab === 0)) && (
|
{((username && selectedTab === 1) || (!username && selectedTab === 0)) && (
|
||||||
<ZFWEntryPax
|
<ZFWEntryPax WASMData={WASMData} loadingState={loadingState} setLoadingState={setLoadingState} />
|
||||||
WASMData={WASMData}
|
|
||||||
loadingState={loadingState}
|
|
||||||
setLoadingState={setLoadingState}
|
|
||||||
loadAircraft={loadAircraft}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
{((username && selectedTab === 2) || (!username && selectedTab === 1)) && (
|
{((username && selectedTab === 2) || (!username && selectedTab === 1)) && (
|
||||||
<StationEntryPax
|
<StationEntryPax WASMData={WASMData} loadingState={loadingState} setLoadingState={setLoadingState} />
|
||||||
WASMData={WASMData}
|
|
||||||
loadingState={loadingState}
|
|
||||||
setLoadingState={setLoadingState}
|
|
||||||
loadAircraft={loadAircraft}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,23 +1,22 @@
|
|||||||
import { FC, useEffect, useState } from 'react';
|
import { FC, useEffect, useState } from 'react';
|
||||||
import { unloadAircraft } from '../../configs/shared';
|
|
||||||
import {
|
import {
|
||||||
COHERENT_COMBUS_WASM_CALL,
|
COHERENT_COMM_BUS_WASM_CALL,
|
||||||
COMM_BUS_UPDATE_TARGET_EVENT,
|
COMM_BUS_UPDATE_TARGET_EVENT,
|
||||||
GSX_SERVICE_CALLED,
|
GSX_SERVICE_CALLED,
|
||||||
GSX_SERVICE_FINISHED,
|
GSX_SERVICE_FINISHED,
|
||||||
} from '../../constants';
|
} from '../../constants';
|
||||||
import { LoadingState } from '../../types/general';
|
import { LoadingState } from '../../types/general';
|
||||||
import { WASMDataPax } from '../../types/WASMData';
|
import { WASMDataPax } from '../../types/WASMData';
|
||||||
|
import { inRangeOf, loadAircraft, unloadAircraft } from '../../utils/utils';
|
||||||
import ActionBar from '../actionbar/ActionBar';
|
import ActionBar from '../actionbar/ActionBar';
|
||||||
|
|
||||||
interface StationEntryProps {
|
interface StationEntryProps {
|
||||||
WASMData: WASMDataPax;
|
WASMData: WASMDataPax;
|
||||||
loadingState: LoadingState;
|
loadingState: LoadingState;
|
||||||
setLoadingState: (newState: LoadingState) => void;
|
setLoadingState: (newState: LoadingState) => void;
|
||||||
loadAircraft: () => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const StationEntryPax: FC<StationEntryProps> = ({ WASMData, loadingState, setLoadingState, loadAircraft }) => {
|
const StationEntryPax: FC<StationEntryProps> = ({ WASMData, loadingState, setLoadingState }) => {
|
||||||
const [business1, setBusiness1] = useState(WASMData.targetPayload.business1);
|
const [business1, setBusiness1] = useState(WASMData.targetPayload.business1);
|
||||||
const [business2, setBusiness2] = useState(WASMData.targetPayload.business2);
|
const [business2, setBusiness2] = useState(WASMData.targetPayload.business2);
|
||||||
const [economy1, setEconomy1] = useState(WASMData.targetPayload.economy1);
|
const [economy1, setEconomy1] = useState(WASMData.targetPayload.economy1);
|
||||||
@ -28,7 +27,7 @@ const StationEntryPax: FC<StationEntryProps> = ({ WASMData, loadingState, setLoa
|
|||||||
const [fuelEnabled, setFuelEnabled] = useState(true);
|
const [fuelEnabled, setFuelEnabled] = useState(true);
|
||||||
|
|
||||||
const ZFW = () => {
|
const ZFW = () => {
|
||||||
if (loadingState !== 'loaded') return Math.round(WASMData.targetPayload.total);
|
if (loadingState !== 'loaded' && !GSXActive()) return Math.round(WASMData.targetPayload.total);
|
||||||
|
|
||||||
return Math.round(WASMData.livePayload.total);
|
return Math.round(WASMData.livePayload.total);
|
||||||
};
|
};
|
||||||
@ -73,12 +72,12 @@ const StationEntryPax: FC<StationEntryProps> = ({ WASMData, loadingState, setLoa
|
|||||||
[WASMData.userData.isER]
|
[WASMData.userData.isER]
|
||||||
);
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setFuelEnabled(Math.round(WASMData.livePayload.fuel) === fuel);
|
setFuelEnabled(inRangeOf(Math.round(WASMData.livePayload.fuel), fuel));
|
||||||
}, [WASMData.livePayload.fuel]);
|
}, [WASMData.livePayload.fuel]);
|
||||||
|
|
||||||
const updateData = () => {
|
const updateData = () => {
|
||||||
Coherent.call(
|
Coherent.call(
|
||||||
COHERENT_COMBUS_WASM_CALL,
|
COHERENT_COMM_BUS_WASM_CALL,
|
||||||
COMM_BUS_UPDATE_TARGET_EVENT,
|
COMM_BUS_UPDATE_TARGET_EVENT,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
mode: 2,
|
mode: 2,
|
||||||
@ -196,7 +195,8 @@ const StationEntryPax: FC<StationEntryProps> = ({ WASMData, loadingState, setLoa
|
|||||||
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
|
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
|
||||||
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
|
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
|
||||||
<label>
|
<label>
|
||||||
{loadingState !== 'loaded' ? 'Expected' : 'Actual'} ZFW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})
|
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
|
||||||
|
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
@ -208,7 +208,8 @@ const StationEntryPax: FC<StationEntryProps> = ({ WASMData, loadingState, setLoa
|
|||||||
</div>
|
</div>
|
||||||
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
|
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
|
||||||
<label>
|
<label>
|
||||||
{loadingState !== 'loaded' ? 'Expected' : 'Actual'} GW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})
|
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
|
||||||
|
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
import { FC, useEffect, useState } from 'react';
|
import { FC, useEffect, useState } from 'react';
|
||||||
import { unloadAircraft } from '../../configs/shared';
|
|
||||||
import {
|
import {
|
||||||
COHERENT_COMBUS_WASM_CALL,
|
COHERENT_COMM_BUS_WASM_CALL,
|
||||||
COMM_BUS_UPDATE_TARGET_EVENT,
|
COMM_BUS_UPDATE_TARGET_EVENT,
|
||||||
GSX_SERVICE_CALLED,
|
GSX_SERVICE_CALLED,
|
||||||
GSX_SERVICE_FINISHED,
|
GSX_SERVICE_FINISHED,
|
||||||
} from '../../constants';
|
} from '../../constants';
|
||||||
import { WASMDataPax } from '../../types/WASMData';
|
import { WASMDataPax } from '../../types/WASMData';
|
||||||
import { LoadingState } from '../../types/general';
|
import { LoadingState } from '../../types/general';
|
||||||
|
import { inRangeOf, loadAircraft, unloadAircraft } from '../../utils/utils';
|
||||||
import CGSelect from '../CGSelect/CGSelect';
|
import CGSelect from '../CGSelect/CGSelect';
|
||||||
import ActionBar from '../actionbar/ActionBar';
|
import ActionBar from '../actionbar/ActionBar';
|
||||||
|
|
||||||
@ -15,17 +15,16 @@ interface ZFWEntryProps {
|
|||||||
WASMData: WASMDataPax;
|
WASMData: WASMDataPax;
|
||||||
loadingState: LoadingState;
|
loadingState: LoadingState;
|
||||||
setLoadingState: (newState: LoadingState) => void;
|
setLoadingState: (newState: LoadingState) => void;
|
||||||
loadAircraft: () => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ZFWEntryPax: FC<ZFWEntryProps> = ({ WASMData, loadingState, setLoadingState, loadAircraft }) => {
|
const ZFWEntryPax: FC<ZFWEntryProps> = ({ WASMData, loadingState, setLoadingState }) => {
|
||||||
const [CGTarget, setCGTarget] = useState(WASMData.targetPayload.CGTarget);
|
const [CGTarget, setCGTarget] = useState(WASMData.targetPayload.CGTarget);
|
||||||
const [fuel, setFuel] = useState(Math.round(WASMData.livePayload.fuel));
|
const [fuel, setFuel] = useState(Math.round(WASMData.livePayload.fuel));
|
||||||
const [ZFWTarget, setZFWTarget] = useState(Math.round(WASMData.targetPayload.total));
|
const [ZFWTarget, setZFWTarget] = useState(Math.round(WASMData.targetPayload.total));
|
||||||
const [fuelEnabled, setFuelEnabled] = useState(true);
|
const [fuelEnabled, setFuelEnabled] = useState(true);
|
||||||
|
|
||||||
const ZFW = () => {
|
const ZFW = () => {
|
||||||
if (loadingState !== 'loaded') return ZFWTarget;
|
if (loadingState !== 'loaded' && !GSXActive()) return ZFWTarget;
|
||||||
|
|
||||||
return Math.round(WASMData.livePayload.total);
|
return Math.round(WASMData.livePayload.total);
|
||||||
};
|
};
|
||||||
@ -96,12 +95,12 @@ const ZFWEntryPax: FC<ZFWEntryProps> = ({ WASMData, loadingState, setLoadingStat
|
|||||||
[WASMData.userData.isER]
|
[WASMData.userData.isER]
|
||||||
);
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setFuelEnabled(Math.round(WASMData.livePayload.fuel) === fuel);
|
setFuelEnabled(inRangeOf(Math.round(WASMData.livePayload.fuel), fuel));
|
||||||
}, [WASMData.livePayload.fuel]);
|
}, [WASMData.livePayload.fuel]);
|
||||||
|
|
||||||
const updateData = (_ZFWTarget?: number, _CGTarget?: number) => {
|
const updateData = (_ZFWTarget?: number, _CGTarget?: number) => {
|
||||||
Coherent.call(
|
Coherent.call(
|
||||||
COHERENT_COMBUS_WASM_CALL,
|
COHERENT_COMM_BUS_WASM_CALL,
|
||||||
COMM_BUS_UPDATE_TARGET_EVENT,
|
COMM_BUS_UPDATE_TARGET_EVENT,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
mode: 1,
|
mode: 1,
|
||||||
@ -186,7 +185,8 @@ const ZFWEntryPax: FC<ZFWEntryProps> = ({ WASMData, loadingState, setLoadingStat
|
|||||||
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
|
<div className="block flex w-full flex-col opacity-100 transition-opacity duration-150 ease-linear mb-4">
|
||||||
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
|
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
|
||||||
<label>
|
<label>
|
||||||
{loadingState !== 'loaded' ? 'Expected' : 'Actual'} ZFW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})
|
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} ZFW (
|
||||||
|
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
@ -198,7 +198,8 @@ const ZFWEntryPax: FC<ZFWEntryProps> = ({ WASMData, loadingState, setLoadingStat
|
|||||||
</div>
|
</div>
|
||||||
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
|
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
|
||||||
<label>
|
<label>
|
||||||
{loadingState !== 'loaded' ? 'Expected' : 'Actual'} GW ({WASMData.userData.isImperial ? 'lbs' : 'kg'})
|
{loadingState !== 'loaded' && !GSXActive() ? 'Expected' : 'Actual'} GW (
|
||||||
|
{WASMData.userData.isImperial ? 'lbs' : 'kg'})
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
|||||||
@ -1,21 +0,0 @@
|
|||||||
import { COHERENT_COMBUS_WASM_CALL, COMM_BUS_UPDATE_TARGET_EVENT } from '../constants';
|
|
||||||
|
|
||||||
export const loadAircraft = () => {
|
|
||||||
Coherent.call(
|
|
||||||
COHERENT_COMBUS_WASM_CALL,
|
|
||||||
COMM_BUS_UPDATE_TARGET_EVENT,
|
|
||||||
JSON.stringify({
|
|
||||||
mode: 3,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const unloadAircraft = () => {
|
|
||||||
Coherent.call(
|
|
||||||
COHERENT_COMBUS_WASM_CALL,
|
|
||||||
COMM_BUS_UPDATE_TARGET_EVENT,
|
|
||||||
JSON.stringify({
|
|
||||||
mode: 4,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
export const COHERENT_COMBUS_WASM_CALL = 'COMM_BUS_WASM_CALLBACK';
|
export const COHERENT_COMM_BUS_WASM_CALL = 'COMM_BUS_WASM_CALLBACK';
|
||||||
|
|
||||||
export const TFDI_SIMBRIEF_USERNAME_CALL = 'requestSimBriefUsername';
|
export const TFDI_SIMBRIEF_USERNAME_CALL = 'requestSimBriefUsername';
|
||||||
export const TFDI_SIMBRIEF_USERNAME_EVENT = 'receiveSimBriefUsername';
|
export const TFDI_SIMBRIEF_USERNAME_EVENT = 'receiveSimBriefUsername';
|
||||||
|
|||||||
25
PackageSources/js-bundle/src/utils/utils.ts
Normal file
25
PackageSources/js-bundle/src/utils/utils.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { COHERENT_COMM_BUS_WASM_CALL, COMM_BUS_UPDATE_TARGET_EVENT } from '../constants';
|
||||||
|
|
||||||
|
export const loadAircraft = () => {
|
||||||
|
Coherent.call(
|
||||||
|
COHERENT_COMM_BUS_WASM_CALL,
|
||||||
|
COMM_BUS_UPDATE_TARGET_EVENT,
|
||||||
|
JSON.stringify({
|
||||||
|
mode: 3,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const unloadAircraft = () => {
|
||||||
|
Coherent.call(
|
||||||
|
COHERENT_COMM_BUS_WASM_CALL,
|
||||||
|
COMM_BUS_UPDATE_TARGET_EVENT,
|
||||||
|
JSON.stringify({
|
||||||
|
mode: 4,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const inRangeOf = (value: number, target: number, tolerance: number = 10) => {
|
||||||
|
return Math.abs(value - target) < 10;
|
||||||
|
};
|
||||||
@ -891,13 +891,13 @@ void CALLBACK MyDispatchProc(SIMCONNECT_RECV* pData, DWORD cbData, void* pContex
|
|||||||
memcpy(&localPayload, targetPaxPayloadData, sizeof(localPayload));
|
memcpy(&localPayload, targetPaxPayloadData, sizeof(localPayload));
|
||||||
|
|
||||||
localPayload.paxCount.business1 -= min(targetPaxPayloadData->paxCount.business1, passengersDeboarded);
|
localPayload.paxCount.business1 -= min(targetPaxPayloadData->paxCount.business1, passengersDeboarded);
|
||||||
passengersDeboarded -= localPayload.paxCount.business1;
|
passengersDeboarded -= targetPaxPayloadData->paxCount.business1 - localPayload.paxCount.business1;
|
||||||
localPayload.paxCount.business2 -= min(targetPaxPayloadData->paxCount.business2, passengersDeboarded);
|
localPayload.paxCount.business2 -= min(targetPaxPayloadData->paxCount.business2, passengersDeboarded);
|
||||||
passengersDeboarded -= localPayload.paxCount.business2;
|
passengersDeboarded -= targetPaxPayloadData->paxCount.business2 - localPayload.paxCount.business2;
|
||||||
localPayload.paxCount.economy1 -= min(targetPaxPayloadData->paxCount.economy1, passengersDeboarded);
|
localPayload.paxCount.economy1 -= min(targetPaxPayloadData->paxCount.economy1, passengersDeboarded);
|
||||||
passengersDeboarded -= localPayload.paxCount.economy1;
|
passengersDeboarded -= targetPaxPayloadData->paxCount.economy1 - localPayload.paxCount.economy1;
|
||||||
localPayload.paxCount.economy2 -= min(targetPaxPayloadData->paxCount.economy2, passengersDeboarded);
|
localPayload.paxCount.economy2 -= min(targetPaxPayloadData->paxCount.economy2, passengersDeboarded);
|
||||||
passengersDeboarded -= localPayload.paxCount.economy2;
|
passengersDeboarded -= targetPaxPayloadData->paxCount.economy2 - localPayload.paxCount.economy2;
|
||||||
localPayload.forwardCargo -= targetPaxPayloadData->forwardCargo * (cargoDeboarded / 100);
|
localPayload.forwardCargo -= targetPaxPayloadData->forwardCargo * (cargoDeboarded / 100);
|
||||||
localPayload.rearCargo -= targetPaxPayloadData->rearCargo * (cargoDeboarded / 100);
|
localPayload.rearCargo -= targetPaxPayloadData->rearCargo * (cargoDeboarded / 100);
|
||||||
|
|
||||||
|
|||||||
@ -5,8 +5,6 @@
|
|||||||
- https://www.satco-inc.com/product-pallet/?part_number=31086-595
|
- https://www.satco-inc.com/product-pallet/?part_number=31086-595
|
||||||
- https://www.satco-inc.com/product-container/?part_number=34124-901
|
- https://www.satco-inc.com/product-container/?part_number=34124-901
|
||||||
|
|
||||||
Coherent.call("COMM_BUS_WASM_CALLBACK", "khofmann_tfdi_md-11_load_manager_update_target", '{"mode" : 1, "ZFWTarget": 162000, "CGTarget": 20.5}');
|
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
|
|
||||||
- JS
|
- JS
|
||||||
@ -16,4 +14,3 @@ TODO:
|
|||||||
- WASM
|
- WASM
|
||||||
- Custom pax/bag weights
|
- Custom pax/bag weights
|
||||||
- F loading stuff
|
- F loading stuff
|
||||||
- TEST GSX synced unload
|
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
{
|
{
|
||||||
"folders": [
|
"folders": [
|
||||||
{
|
{
|
||||||
"path": "."
|
"path": "."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"settings": {}
|
"settings": {
|
||||||
}
|
"cSpell.words": ["deboarding", "khofmann", "tfdi", "TFDI", "TOCG", "ZFWCG"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user