Skip to content

Commit

Permalink
Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderson1993 committed Sep 6, 2024
1 parent 1a01be7 commit 7127dd9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/app/data/plugins/inventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const inventory = t.router({
if (input.name !== inventory.name && input.name) {
await inventory?.rename(input.name);
}
await fs.mkdir(path.join(thoriumPath, inventory.assetPath), {
await fs.mkdir(path.join(".", thoriumPath, inventory.assetPath), {
recursive: true,
});
if (typeof input.image === "string") {
Expand Down
7 changes: 5 additions & 2 deletions server/src/spawners/ship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ export async function spawnShip(
entity.addComponent("rotationVelocity");

const size = await getMeshSize(
path.join(thoriumPath, template.assets!.model),
template.assets?.model
? path.join(".", thoriumPath, template.assets!.model)
: null,
);
size.multiplyScalar(template.length || 1);
entity.addComponent("size", {
Expand Down Expand Up @@ -364,7 +366,8 @@ export async function spawnShip(
return { ship: entity, extraEntities: systemEntities.concat(extraEntities) };
}

async function getMeshSize(url: string): Promise<Vector3> {
async function getMeshSize(url: string | null): Promise<Vector3> {
if (!url) return new Vector3(1, 1, 1);
const gltf = await loadGltf(url);
if (!gltf) return new Vector3();
const box = new Box3().setFromObject(gltf.scene.children[0]);
Expand Down

0 comments on commit 7127dd9

Please sign in to comment.