Skip to content

Commit

Permalink
Merge pull request #433 from Thorium-Sim/develop
Browse files Browse the repository at this point in the history
Alpha release? 🤞
  • Loading branch information
alexanderson1993 authored Dec 2, 2022
2 parents 5a50fb2 + c93cf4e commit 9fe0c0c
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 21 deletions.
2 changes: 1 addition & 1 deletion client/src/cards/Pilot/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function Pilot({cardLoaded}: CardProps) {
</Joystick>
</div>
</div>
<div className="col-span-2 h-full">
<div className="col-span-2 w-full aspect-square self-center">
<Suspense fallback={null}>
<GridCanvas shouldRender={cardLoaded}>
<CircleGrid />
Expand Down
9 changes: 8 additions & 1 deletion client/src/components/QuoteOfTheDay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ const quotes = [
// Steve Jobs
"The most powerful person in the world is the storyteller.",
// Hey Now
"Imagination calling mirrors for you",
"Imagination calling mirrors for you.",
// Albert Einstein
"The only reason for time is so that everything doesn't happen at once.",
"Reality is merely an illusion, albeit a very persistent one.",
Expand All @@ -226,6 +226,7 @@ const quotes = [
"We are autumn children, burdened with memories of sun.",
"Impudent of you to assume I will meet a mortal end.",
"Heaven, are you watching?",
"You're the wind. You're the stars. You are all endless things.",
// Larry Elison
"Choose your competitors carefully, because you'll become a lot like them.",
// William Martin
Expand All @@ -235,6 +236,12 @@ const quotes = [
// Brene Brown
"No one belongs here more than you.",
"When we own the story, we can write a brave new ending.",
// Timothy Dexter
"I am the first in the east. I am the first in the west. I am the first of all things.",
// Václav Havel
"Hope is not the conviction that something will turn out well, but the certainty that something is worth doing no matter how it turns out.",
// Pierre Coubertin
"The important thing in life is not the triumph, but the struggle.",
];

const QuoteOfTheDay = () => {
Expand Down
10 changes: 5 additions & 5 deletions client/src/components/WelcomeButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const WelcomeButtons = ({className}: {className?: string}) => {
>
Start Flight
</NavLink>
<Disclosure>
{/* <Disclosure>
<Disclosure.Button className="btn btn-info btn-outline">
Load a Saved Flight
</Disclosure.Button>
Expand All @@ -56,11 +56,11 @@ export const WelcomeButtons = ({className}: {className?: string}) => {
>
<Flights />
</Suspense>
</Disclosure>
</Disclosure> */}
</>
)}

<Button className="btn btn-warning btn-outline">Join a Server</Button>
{/* <Button className="btn btn-warning btn-outline">Join a Server</Button> */}
{client.isHost && (
<NavLink className="btn btn-notice btn-outline" to="/config">
Configure Plugins
Expand All @@ -69,7 +69,7 @@ export const WelcomeButtons = ({className}: {className?: string}) => {
<NavLink className="btn btn-info btn-outline" to="/docs">
How-to Guides
</NavLink>
{process.env.NODE_ENV === "production" &&
{/* {process.env.NODE_ENV === "production" &&
location.protocol !== "https:" && (
<a
className="btn btn-error btn-outline"
Expand All @@ -79,7 +79,7 @@ export const WelcomeButtons = ({className}: {className?: string}) => {
>
Use HTTPS
</a>
)}
)} */}
</>
)}
</div>
Expand Down
3 changes: 2 additions & 1 deletion desktop/main/electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {initWin} from "./helpers/autoUpdate";

let win: BrowserWindow | null = null;
app.enableSandbox();
app.commandLine.appendSwitch("ignore-certificate-errors");

function loadFile(url: string) {
dialog.showMessageBox({message: url});
Expand Down Expand Up @@ -80,7 +81,7 @@ async function createWindow() {

// We add 1 to the port, since we want to connect to the HTTPS server
// which is 1 more than the default port
win.loadURL(`https://localhost:${port + 1}`);
win.loadURL(`http://localhost:${port}`);
win.on("closed", () => {
win = null;
});
Expand Down
13 changes: 11 additions & 2 deletions server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import {FlightDataModel} from "./classes/FlightDataModel";
import {promises as fs, existsSync} from "fs";
import {unzip} from "./utils/unzipFolder";
import {buildHttpsProxy} from "./init/httpsProxy";
import fastify from "fastify";
import fastify, {RawServerBase} from "fastify";
// @ts-expect-error Importing from untyped file
import symbols from "fastify/lib/symbols.js";

setBasePath(thoriumPath);
const isHeadless = !process.env.FORK;

Expand Down Expand Up @@ -64,11 +67,17 @@ export async function startServer() {
Number(process.env.PORT) ||
(process.env.NODE_ENV === "production" ? 4444 : 3001);
const HTTPSPort = PORT + 1;
const proxy = buildHttpsProxy(PORT);

try {
await app.listen({port: PORT});
// @ts-expect-error can't index with any
app[symbols.kServerBindings].forEach((server: RawServerBase) => {
server.on("upgrade", (...args: any[]) => {
app.server.emit("upgrade", ...args);
});
});
if (process.env.NODE_ENV === "production") {
const proxy = buildHttpsProxy(PORT);
await proxy.listen({port: HTTPSPort});
}
console.info(chalk.greenBright(`Access app at http://localhost:${PORT}`));
Expand Down
6 changes: 4 additions & 2 deletions server/src/systems/PassengerMovementSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class PassengerMovementSystem extends System {
entity.components.passengerMovement && entity.components.position
);
}
frequency = 20;
frequency = 5;
update(entity: Entity, elapsed: number) {
const elapsedRatio = elapsed / (1000 / this.frequency);
const {position, passengerMovement} = entity.components;
Expand All @@ -28,7 +28,9 @@ export class PassengerMovementSystem extends System {
ship.components.shipMap.deckNodeMap?.[
passengerMovement.nodePath[passengerMovement.nextNodeIndex]
];
if (!nextNode) return;
if (!nextNode) {
return;
}
const distanceToNext = Math.hypot(x - nextNode?.x, y - nextNode?.y); // Increment to the next node
if (distanceToNext <= 0.1 && z === nextNode.deckIndex) {
passengerMovement.nextNodeIndex++;
Expand Down
18 changes: 9 additions & 9 deletions server/src/systems/__test__/PassengerMovementSystem.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ describe("PassengerMovementSystem", () => {
PositionComponent {
"parentId": 1,
"type": "ship",
"x": 0.2941564209736038,
"y": 0.2941564209736038,
"x": 0.4378550077971717,
"y": 0.4378550077971716,
"z": 0,
}
`);
Expand All @@ -139,8 +139,8 @@ describe("PassengerMovementSystem", () => {
PositionComponent {
"parentId": 1,
"type": "ship",
"x": 0.9525462151064351,
"y": 0.9525462151064351,
"x": 1.0991613293113442,
"y": 0.9455613293113442,
"z": 0,
}
`);
Expand Down Expand Up @@ -205,7 +205,7 @@ describe("PassengerMovementSystem", () => {
"type": "ship",
"x": 2,
"y": 1,
"z": 0.041600000000000005,
"z": 0.0728,
}
`);
expect(passenger.components.passengerMovement?.nextNodeIndex).toBe(1);
Expand All @@ -214,8 +214,8 @@ describe("PassengerMovementSystem", () => {
PositionComponent {
"parentId": 3,
"type": "ship",
"x": 2,
"y": 1,
"x": 1.5621449922028285,
"y": 0.5621449922028283,
"z": 1,
}
`);
Expand All @@ -224,8 +224,8 @@ describe("PassengerMovementSystem", () => {
PositionComponent {
"parentId": 3,
"type": "ship",
"x": 1.2219398082404278,
"y": 0.22193980824042775,
"x": 1.1480653998204364,
"y": 0.14806539982043648,
"z": 1,
}
`);
Expand Down

0 comments on commit 9fe0c0c

Please sign in to comment.