Skip to content

Commit

Permalink
Merge pull request #650 from Thorium-Sim/develop
Browse files Browse the repository at this point in the history
Alpha 16
  • Loading branch information
alexanderson1993 authored Oct 19, 2024
2 parents d84a8b6 + 9be6c21 commit 3ef850f
Show file tree
Hide file tree
Showing 45 changed files with 2,084 additions and 550 deletions.
11 changes: 9 additions & 2 deletions client/app/cards/Pilot/CircleGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ const CameraEffects = () => {

export function CircleGrid({
children,
}: { children: ReactNode; rangeMin?: number; rangeMax?: number }) {
/** Children that are fixed with the ship */
fixedChildren,
}: {
children: ReactNode;
fixedChildren?: ReactNode;
rangeMin?: number;
rangeMax?: number;
}) {
const store = useCircleGridStore();

const tilt = store((store) => store.tilt);
Expand Down Expand Up @@ -108,6 +115,7 @@ export function CircleGrid({
))}

<PlayerArrow />
{fixedChildren}
</group>
<Suspense fallback={null}>{children}</Suspense>
</group>
Expand Down Expand Up @@ -157,7 +165,6 @@ export function GridCanvas({
camera={{
// position: [0, 300000, 0],
far: 200000,
zoom: 165,
}}
className="rounded-full"
orthographic
Expand Down
21 changes: 20 additions & 1 deletion client/app/cards/SystemsMonitor/data.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { pubsub } from "@server/init/pubsub";
import { t } from "@server/init/t";
import { getPowerSupplierPowerNeeded } from "@server/systems/ReactorFuelSystem";
import type { Entity } from "@server/utils/ecs";
import { getShipSystems } from "@server/utils/getShipSystem";
import { getReactorInventory } from "@server/utils/getSystemInventory";
import type { MegaWattHour } from "@server/utils/unitTypes";
Expand Down Expand Up @@ -144,6 +143,11 @@ export const systemsMonitor = t.router({
pubsub.publish.systemsMonitor.systems.get({ shipId });
pubsub.publish.systemsMonitor.reactors.get({ shipId });
pubsub.publish.systemsMonitor.batteries.get({ shipId });

if (system.components.isPhasers) {
// Update the output megawatts of the phasers
pubsub.publish.targeting.phasers.list({ shipId });
}
}),
addPowerSource: t.procedure
.input(
Expand All @@ -163,6 +167,16 @@ export const systemsMonitor = t.router({
throw new Error(
"Invalid power source. Power source must be a reactor or battery.",
);

if (
system.components.isPhasers &&
!powerSource.components.isPhaseCapacitor
) {
throw new Error(
"Invalid power source. Power source must be a phase capacitor.",
);
}

const powerSupplied = getPowerSupplierPowerNeeded(powerSource);

if (
Expand Down Expand Up @@ -200,6 +214,11 @@ export const systemsMonitor = t.router({
pubsub.publish.systemsMonitor.systems.get({ shipId });
pubsub.publish.systemsMonitor.reactors.get({ shipId });
pubsub.publish.systemsMonitor.batteries.get({ shipId });

if (system.components.isPhasers) {
// Update the output megawatts of the phasers
pubsub.publish.targeting.phasers.list({ shipId });
}
}),
}),
stream: t.procedure.dataStream(({ ctx, entity }) => {
Expand Down
Loading

0 comments on commit 3ef850f

Please sign in to comment.