mirror of
https://github.com/9ParsonsB/Pulsar.git
synced 2025-07-03 17:13:43 -04:00
Journals Now processed in own thread
Some invalid journal data is now handled Journals now use polymorphic deserialization Added Event names to all journal events Remove unused controllers
This commit is contained in:
@ -20,18 +20,10 @@
|
||||
let fuelDown = $state(false);
|
||||
|
||||
onMount(async () => {
|
||||
|
||||
if ($connection.state === HubConnectionState.Disconnected)
|
||||
{
|
||||
await $connection.start();
|
||||
}
|
||||
|
||||
loading = false;
|
||||
|
||||
$connection.on("StatusUpdated", (message) => {
|
||||
statusStore.update((s) => {
|
||||
return { ...s, ...message };
|
||||
});
|
||||
$statusStore = { ...$statusStore, ...message };
|
||||
|
||||
// only 3 in array
|
||||
if (last.length >= 3) {
|
||||
@ -66,16 +58,13 @@
|
||||
}
|
||||
});
|
||||
|
||||
if ($connection.state === HubConnectionState.Disconnected)
|
||||
{
|
||||
await $connection.start();
|
||||
}
|
||||
|
||||
if (!$statusStore.pips) {
|
||||
const value = (await (
|
||||
await fetch("http://localhost:5000/api/status")
|
||||
).json()) as Status;
|
||||
|
||||
console.log(value);
|
||||
|
||||
statusStore.set({
|
||||
...value,
|
||||
});
|
||||
await $connection.invoke("Status");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -98,10 +87,13 @@
|
||||
{/if}
|
||||
|
||||
<div>
|
||||
{#if $statusStore}
|
||||
{#if $statusStore}
|
||||
<span
|
||||
>Fuel%: {((($statusStore.fuel?.fuelMain ?? 0) / 32) * 100).toFixed(2)}% est{fuelDown ? ' REMAINING' : ' to fill'}: {timeToMax.toFixed(2 )}s</span
|
||||
>
|
||||
>Fuel%: {((($statusStore.fuel?.fuelMain ?? 0) / 32) * 100).toFixed(2)}%
|
||||
{#if $statusStore.flags! & StatusFlags.FuelScooping}
|
||||
<span>est{fuelDown ? ' REMAINING' : ' to fill'}: {timeToMax.toFixed(2 )}s</span>
|
||||
{/if}
|
||||
</span>
|
||||
<div class="power">
|
||||
<div class="sys">
|
||||
<div>{$statusStore?.pips?.sys ?? "?"}</div>
|
||||
@ -129,8 +121,8 @@
|
||||
<span>dest?: {$statusStore?.destination?.name}</span>
|
||||
<span>gui focus: {getEnumNameFromValue(FocusStatus, $statusStore.guiFocus!)}</span>
|
||||
<span>cargo: {$statusStore.cargo}</span>
|
||||
<span>flag1: {getEnumNamesFromFlag(StatusFlags, $statusStore.flags!)}</span>
|
||||
<span>flag2: {getEnumNamesFromFlag(StatusFlags2, $statusStore.flags2!)}</span>
|
||||
<span>flag1: {getEnumNamesFromFlag(StatusFlags, $statusStore.flags!)} ({$statusStore.flags})</span>
|
||||
<span>flag2: {getEnumNamesFromFlag(StatusFlags2, $statusStore.flags2!)} ({$statusStore.flags2})</span>
|
||||
{:else}
|
||||
<span>No data :(</span>
|
||||
{/if}
|
||||
|
@ -3,6 +3,7 @@
|
||||
import type { FSSDiscoveryScan } from "../../types/api/FSSDiscoveryScan";
|
||||
import type { Scan } from "../../types/api/Scan";
|
||||
import type JournalBase from "../../types/api/JournalBase";
|
||||
import type { FSSBodySignals } from "../../types/api/Signals";
|
||||
|
||||
const data: Partial<Scan>[] = [{}, {}, {}, {}];
|
||||
// total bodies in the current system (FSSDiscovery event)
|
||||
@ -10,6 +11,13 @@
|
||||
let currentSystem = $state("");
|
||||
// accumulated list of bodies in the current system (Scan events)
|
||||
let scans = $state([] as Scan[]);
|
||||
let signals = $state([] as FSSBodySignals[]);
|
||||
|
||||
const filterImportantScans = (scans: Scan[], signals: FSSBodySignals[]) => {
|
||||
return [] as Scan[];
|
||||
};
|
||||
|
||||
const importantScans = $derived(filterImportantScans(scans, signals));
|
||||
|
||||
const targetEvents = ["Scan", "FSSScanBaryCenter", "FSSDiscoveryScan"];
|
||||
|
||||
@ -59,11 +67,17 @@
|
||||
case "High metal content":
|
||||
case "High metal content body":
|
||||
return "HMC";
|
||||
case "Metal rich body":
|
||||
return "MRB";
|
||||
case "Sudarsky class I gas giant":
|
||||
case "Sudarsky class II gas giant":
|
||||
case "Sudarsky class III gas giant":
|
||||
case "Sudarsky class IV gas giant":
|
||||
return "GAS";
|
||||
case "Icy body":
|
||||
return "ICE";
|
||||
case "Rocky body":
|
||||
return "ROC";
|
||||
default:
|
||||
return planetClass;
|
||||
}
|
||||
|
28
Pulsar/WebApp/src/types/api/Signals.ts
Normal file
28
Pulsar/WebApp/src/types/api/Signals.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import type JournalBase from "./JournalBase";
|
||||
|
||||
export interface Signal {
|
||||
type: string;
|
||||
type_Localised: string;
|
||||
count: number;
|
||||
}
|
||||
|
||||
export interface GenusType {
|
||||
Genus: string;
|
||||
Genus_Localised: string;
|
||||
}
|
||||
|
||||
interface BodySignalBase extends JournalBase {
|
||||
SystemAddress: bigint;
|
||||
BodyName: string;
|
||||
BodyID: bigint;
|
||||
Signals: Signal[];
|
||||
Genuses: GenusType[];
|
||||
}
|
||||
|
||||
export interface SAASignalsFound extends BodySignalBase {
|
||||
event: "SAASignalsFound";
|
||||
}
|
||||
|
||||
export interface FSSBodySignals extends BodySignalBase {
|
||||
event: "FSSBodySignals";
|
||||
}
|
Reference in New Issue
Block a user