diff --git a/app/.server/classes/FlightDataModel.ts b/app/.server/classes/FlightDataModel.ts
index fd168924..f0a95dce 100644
--- a/app/.server/classes/FlightDataModel.ts
+++ b/app/.server/classes/FlightDataModel.ts
@@ -3,9 +3,9 @@ import path from "node:path";
import RAPIER from "@thorium-sim/rapier3d-node";
import { initECS } from "@thorium/.server/classes/initECS";
import { DataStore, type DataStoreOptions } from "@thorium/utils/.server/db-fs";
-import { processTriggers } from "@thorium/utils/.server/evaluateEntityQuery";
import { executeBlocks } from "@thorium/utils/.server/executeBlocks";
import { loadGltf } from "@thorium/utils/.server/loadGltf";
+import { processTriggers } from "@thorium/utils/.server/processTriggers";
import { ECS, Entity } from "@thorium/utils/ecs";
import randomWords from "@thorium/utils/random-words";
import { ConvexHull } from "@thorium/utils/starmap/ConvexHull.js";
diff --git a/app/.server/systems/__test__/ExocompSystem.test.ts b/app/.server/systems/__test__/ExocompSystem.test.ts
index 02882bb7..049a5dbd 100644
--- a/app/.server/systems/__test__/ExocompSystem.test.ts
+++ b/app/.server/systems/__test__/ExocompSystem.test.ts
@@ -5,8 +5,8 @@ import { PassengerMovementSystem } from "@thorium/.server/systems/PassengerMovem
import { createMockDataContext } from "@thorium/utils/.server/createMockDataContext";
import { DataStore } from "@thorium/utils/.server/db-fs";
import { testDataStoreProps } from "@thorium/utils/.server/db-fs/testDataStoreProps";
-import { processTriggers } from "@thorium/utils/.server/evaluateEntityQuery";
import { executeBlocks } from "@thorium/utils/.server/executeBlocks";
+import { processTriggers } from "@thorium/utils/.server/processTriggers";
import { Entity } from "@thorium/utils/ecs";
import ECS from "@thorium/utils/ecs/ecs";
import { aroundEach, beforeEach, describe, expect, it } from "vitest";
diff --git a/app/.server/systems/__test__/ReactorHeatSystem.test.ts b/app/.server/systems/__test__/ReactorHeatSystem.test.ts
index 58773aba..fc6abac3 100644
--- a/app/.server/systems/__test__/ReactorHeatSystem.test.ts
+++ b/app/.server/systems/__test__/ReactorHeatSystem.test.ts
@@ -2,8 +2,8 @@ import { DeckNode } from "@thorium/.server/classes/Plugins/Ship/Deck";
import { createMockDataContext } from "@thorium/utils/.server/createMockDataContext";
import { DataStore } from "@thorium/utils/.server/db-fs";
import { testDataStoreProps } from "@thorium/utils/.server/db-fs/testDataStoreProps";
-import { processTriggers } from "@thorium/utils/.server/evaluateEntityQuery";
import { executeBlocks } from "@thorium/utils/.server/executeBlocks";
+import { processTriggers } from "@thorium/utils/.server/processTriggers";
import { ECS, Entity } from "@thorium/utils/ecs";
import { aroundEach, beforeEach, describe, expect, it } from "vitest";
diff --git a/app/bunServer.ts b/app/bunServer.ts
index 3b5d61af..09c47c86 100644
--- a/app/bunServer.ts
+++ b/app/bunServer.ts
@@ -11,8 +11,8 @@ import { router } from "@thorium/.server/init/router";
import { DataStore } from "@thorium/utils/.server/db-fs";
import { bunDataStoreProps, setBasePath } from "@thorium/utils/.server/db-fs/bunDataStoreProps";
import { loadPlugins } from "@thorium/utils/.server/db-fs/loadPlugins";
-import { processTriggers } from "@thorium/utils/.server/evaluateEntityQuery";
import { notifyActions, notifyEvents } from "@thorium/utils/.server/notifyActions";
+import { processTriggers } from "@thorium/utils/.server/processTriggers";
import { snapshot } from "@thorium/utils/.server/snapshot";
import { vanity } from "@thorium/utils/.server/vanity";
import { liveQueryPlugin } from "@thorium/utils/live-query/.server/adapters/hono-adapter";
diff --git a/app/cards/Sensors/data.server.ts b/app/cards/Sensors/data.server.ts
index ec7225fc..ad4fec7c 100644
--- a/app/cards/Sensors/data.server.ts
+++ b/app/cards/Sensors/data.server.ts
@@ -106,6 +106,15 @@ export const sensors = t.router({
type: scanTypes,
}),
)
+ .output(
+ z.object({
+ scanId: z.number(),
+ shipId: z.number(),
+ target: z.number(),
+ type: scanTypes,
+ }),
+ )
+ .meta({ event: true })
.send(({ ctx, input }) => {
const sensorsSystem = getShipSystem(ctx.ecs, {
systemType: "sensors",
@@ -123,6 +132,7 @@ export const sensors = t.router({
});
ctx.flight?.ecs.addEntity(scanEntity);
pubsub.publish.sensors.scans({ shipId: input.shipId });
+ return { ...input, scanId: scanEntity.id };
}),
scanCancel: t.procedure
.input(
@@ -130,6 +140,13 @@ export const sensors = t.router({
scanId: z.number(),
}),
)
+ .output(
+ z.object({
+ scanId: z.number(),
+ shipId: z.number().optional(),
+ }),
+ )
+ .meta({ event: true })
.send(({ ctx, input }) => {
const shipId = ctx.ecs.getEntityById(input.scanId)?.components.scan?.parentId;
if (shipId) {
@@ -143,9 +160,12 @@ export const sensors = t.router({
if (shipId) {
pubsub.publish.sensors.scans({ shipId });
}
+ return { scanId: input.scanId, shipId };
}),
selectContact: t.procedure
.input(z.object({ shipId: z.number(), contactId: z.number().nullable() }))
+ .output(z.object({ shipId: z.number(), contactId: z.number().nullable() }))
+ .meta({ event: true })
.send(({ ctx, input }) => {
const sensors = getShipSystem(ctx.ecs, {
systemType: "sensors",
@@ -158,6 +178,7 @@ export const sensors = t.router({
shipId: input.shipId,
systemId: sensors.id,
});
+ return input;
}),
sendProcessedData: t.procedure
@@ -168,8 +189,16 @@ export const sensors = t.router({
flash: z.boolean().optional(),
}),
)
+ .output(
+ z.object({
+ shipId: z.number(),
+ data: z.string(),
+ flash: z.boolean().optional(),
+ }),
+ )
+ .meta({ event: true, action: true })
.send(({ ctx, input }) => {
- if (!input.data) return;
+ if (!input.data.trim()) throw new Error("Data cannot be empty");
const sensorsSys = getShipSystem(ctx.ecs, {
systemType: "sensors",
shipId: input.shipId,
@@ -209,6 +238,7 @@ export const sensors = t.router({
shipId: input.shipId,
systemId: sensorsSys.id,
});
+ return input;
}),
removeProcessedData: t.procedure
diff --git a/app/cards/Sensors/index.tsx b/app/cards/Sensors/index.tsx
index 2029bc89..a06e7dc2 100644
--- a/app/cards/Sensors/index.tsx
+++ b/app/cards/Sensors/index.tsx
@@ -129,7 +129,7 @@ function Scans({ cardLoaded }: { cardLoaded: boolean }) {
const [scans] = q.sensors.scans.useNetRequest({ shipId });
if (scans.length === 0) return null;
return (
-
+
{scans.map((s) => (
@@ -347,7 +347,7 @@ function SensorsScannableObject({
-
+
{hasWaypoint ? null : (