Skip to content

Commit

Permalink
fix: Plugins now load in the correct order.
Browse files Browse the repository at this point in the history
This should address issues with ships not moving correctly in the starmap.
  • Loading branch information
alexanderson1993 committed Feb 25, 2025
1 parent 6ebd7c7 commit 6b9dec4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 0 additions & 2 deletions app/.server/classes/Plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ export default class BasePlugin extends FSDataStore {
this.active = data.active ?? true;
this.default = data.default ?? false;
storedServer = server;

this.loadAspects();
}
get server() {
return storedServer;
Expand Down
4 changes: 3 additions & 1 deletion app/.server/classes/ServerDataModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ export class ServerDataModel extends FSDataStore {
for await (const plugin of plugins) {
const name = pluginRegex.exec(plugin)![1];
try {
this.plugins.push(new BasePlugin({ name }, this));
const plugin = new BasePlugin({ name }, this);
await plugin.loadAspects();
this.plugins.push(plugin);
} catch (err) {
console.error(`Error loading plugin ${name}:`, err);
}
Expand Down
3 changes: 2 additions & 1 deletion app/.server/data/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ export const plugin = t.router({
}),
create: t.procedure
.input(z.object({ name: z.string() }))
.send(({ ctx, input }) => {
.send(async ({ ctx, input }) => {
inputAuth(ctx);
const plugin = new BasePlugin(input, ctx.server);
await plugin.loadAspects();
ctx.server.plugins.push(plugin);
publish(plugin.id);
return { pluginId: plugin.id };
Expand Down

0 comments on commit 6b9dec4

Please sign in to comment.