Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Flight Director right-click to spawn and order ships. #564

Merged
merged 1 commit into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/components/Starmap/Nebula/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function generateMaterial(primary: boolean, index: number) {
side: BackSide,
transparent: primary,
depthWrite: !primary,
depthTest: false,
depthTest: true,
map: canvasTexture,
userData: {
offscreenCanvas,
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ui/SearchableInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default function SearchableInput<T extends {id: any}>({
<Combobox.Option
key={result.id}
className={({active}) =>
`relative cursor-default select-none py-2 pl-10 pr-4 ${
`relative cursor-default select-none py-2 pl-2 pr-4 ${
active ? "bg-primary text-white" : "text-gray-200"
}`
}
Expand Down
6 changes: 6 additions & 0 deletions client/src/cores/StarmapCore/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ function CanvasWrapper() {
dragRef(gl.domElement);
cameraRef.current = camera as PerspectiveCamera;
}}
onPointerMissed={event => {
if (event.button !== 2) {
// Ignore Right click
useStarmapStore.setState({selectedObjectIds: []});
}
}}
>
<StarmapCoreCanvasHooks />
<ambientLight intensity={0.2} />
Expand Down
5 changes: 3 additions & 2 deletions client/src/data/ship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {t} from "@server/init/t";
import {pubsub} from "@server/init/pubsub";
import {spawnShip} from "@server/spawners/ship";
import {z} from "zod";
import {randomNameGenerator} from "@server/utils/randomNameGenerator";

export const ship = t.router({
get: t.procedure
Expand Down Expand Up @@ -71,12 +72,12 @@ export const ship = t.router({

const {ship: shipEntity, extraEntities} = spawnShip(ctx, shipTemplate, {
// TODO: August 20, 2022 - Generate a name for this ship somehow
name: "Test Ship",
name: randomNameGenerator(),
position: {
x: input.position.x,
y: input.position.y,
z: input.position.z,
type: input.systemId ? "solar" : "interstellar",
type: typeof input.systemId === "number" ? "solar" : "interstellar",
parentId: input.systemId,
},
});
Expand Down