mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 08:03:13 +09:00
Lint and refactor
This commit is contained in:
1 parent
ae7a1744ad
commit
2bce506d96
7 files changed
+1233
-880
No files matched your search
+65
-65
@@ -35,25 +35,25 @@ export const ChartTagDataSchema = Type.Object({
|
||||
export type ChartTagData = Static<typeof ChartTagDataSchema>;
|
||||
|
||||
export const RecipeDataSchema = Type.Object({
|
||||
start_tick: Type.Optional(Type.Number()),
|
||||
end_tick: Type.Optional(Type.Number()),
|
||||
surface: Type.String(),
|
||||
force: Type.String(),
|
||||
position: Type.Tuple([Type.Number(), Type.Number()]),
|
||||
recipe: Type.Optional(Type.String()),
|
||||
icon: Type.Optional(SignalIDSchema),
|
||||
start_tick: Type.Optional(Type.Number()),
|
||||
end_tick: Type.Optional(Type.Number()),
|
||||
surface: Type.String(),
|
||||
force: Type.String(),
|
||||
position: Type.Tuple([Type.Number(), Type.Number()]),
|
||||
recipe: Type.Optional(Type.String()),
|
||||
icon: Type.Optional(SignalIDSchema),
|
||||
});
|
||||
|
||||
export type RecipeData = Static<typeof RecipeDataSchema>;
|
||||
|
||||
/**
|
||||
* TileDataEvent: Used for both Factorio Instance -> Controller and Controller -> Web Clients
|
||||
*
|
||||
*
|
||||
* Contains compressed RGB565 chart data from Factorio's internal mapping system.
|
||||
* When sent from instance to controller: triggers storage in persistent tile files.
|
||||
* When sent from controller to web clients: enables real-time minimap updates.
|
||||
*
|
||||
* Data flow:
|
||||
*
|
||||
* Data flow:
|
||||
* - Lua module -> Instance plugin -> Controller plugin (for persistence)
|
||||
* - Controller plugin -> Web UI plugin -> Canvas renderer (for live updates)
|
||||
*/
|
||||
@@ -100,12 +100,12 @@ export class TileDataEvent {
|
||||
|
||||
/**
|
||||
* ChartTagDataEvent: Used for both Factorio Instance -> Controller and Controller -> Web Clients
|
||||
*
|
||||
*
|
||||
* Contains chart tag information from Factorio's map tags.
|
||||
* When sent from instance to controller: triggers storage for tag history and timelapse.
|
||||
* When sent from controller to web clients: enables real-time tag updates.
|
||||
*
|
||||
* Data flow:
|
||||
*
|
||||
* Data flow:
|
||||
* - Lua module -> Instance plugin -> Controller plugin (for persistence)
|
||||
* - Controller plugin -> Web UI plugin -> Tag renderer (for live updates)
|
||||
*/
|
||||
@@ -136,34 +136,34 @@ export class ChartTagDataEvent {
|
||||
}
|
||||
|
||||
export class RecipeDataEvent {
|
||||
declare ["constructor"]: typeof RecipeDataEvent;
|
||||
static type = "event" as const;
|
||||
static src = ["instance", "controller"] as const;
|
||||
static dst = ["controller", "control"] as const;
|
||||
static plugin = "minimap" as const;
|
||||
static permission = null;
|
||||
declare ["constructor"]: typeof RecipeDataEvent;
|
||||
static type = "event" as const;
|
||||
static src = ["instance", "controller"] as const;
|
||||
static dst = ["controller", "control"] as const;
|
||||
static plugin = "minimap" as const;
|
||||
static permission = null;
|
||||
|
||||
constructor(
|
||||
constructor(
|
||||
public instance_id: number,
|
||||
public recipe_data: RecipeData,
|
||||
) {}
|
||||
) {}
|
||||
|
||||
static jsonSchema = Type.Object({
|
||||
"instance_id": Type.Number(),
|
||||
"recipe_data": RecipeDataSchema,
|
||||
});
|
||||
static jsonSchema = Type.Object({
|
||||
"instance_id": Type.Number(),
|
||||
"recipe_data": RecipeDataSchema,
|
||||
});
|
||||
|
||||
static fromJSON(json: Static<typeof RecipeDataEvent.jsonSchema>) {
|
||||
return new this(
|
||||
json.instance_id,
|
||||
json.recipe_data
|
||||
);
|
||||
}
|
||||
static fromJSON(json: Static<typeof RecipeDataEvent.jsonSchema>) {
|
||||
return new this(
|
||||
json.instance_id,
|
||||
json.recipe_data
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GetRawTileRequest: Request raw tile data from controller storage
|
||||
*
|
||||
*
|
||||
* Returns base64-encoded tile data that can be processed in timelapse mode
|
||||
* or for initial tile loading when canvas minimap starts up.
|
||||
*/
|
||||
@@ -187,7 +187,7 @@ export class GetRawTileRequest {
|
||||
static jsonSchema = Type.Object({
|
||||
"instance_id": Type.Number(),
|
||||
"surface": Type.String(),
|
||||
"force": Type.String(),
|
||||
"force": Type.String(),
|
||||
"tile_x": Type.Number(),
|
||||
"tile_y": Type.Number(),
|
||||
"tick": Type.Optional(Type.Number()),
|
||||
@@ -211,7 +211,7 @@ export class GetRawTileRequest {
|
||||
|
||||
/**
|
||||
* GetChartTagsRequest: Request existing chart tags from controller storage
|
||||
*
|
||||
*
|
||||
* Returns all saved chart tags for a specific instance/surface/force combination.
|
||||
* Used to load existing chart tags when the web UI starts up or selection changes.
|
||||
*/
|
||||
@@ -246,46 +246,46 @@ export class GetChartTagsRequest {
|
||||
static Response = lib.plainJson(Type.Object({
|
||||
"chart_tags": Type.Array(ChartTagDataSchema),
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
export class GetRawRecipeTileRequest {
|
||||
declare ["constructor"]: typeof GetRawRecipeTileRequest;
|
||||
static type = "request" as const;
|
||||
static src = "control" as const;
|
||||
static dst = "controller" as const;
|
||||
static plugin = "minimap" as const;
|
||||
static permission = "minimap.view";
|
||||
declare ["constructor"]: typeof GetRawRecipeTileRequest;
|
||||
static type = "request" as const;
|
||||
static src = "control" as const;
|
||||
static dst = "controller" as const;
|
||||
static plugin = "minimap" as const;
|
||||
static permission = "minimap.view";
|
||||
|
||||
constructor(
|
||||
constructor(
|
||||
public instance_id: number,
|
||||
public surface: string,
|
||||
public force: string,
|
||||
public tile_x: number,
|
||||
public tile_y: number,
|
||||
public tick?: number,
|
||||
) {}
|
||||
) {}
|
||||
|
||||
static jsonSchema = Type.Object({
|
||||
"instance_id": Type.Number(),
|
||||
"surface": Type.String(),
|
||||
"force": Type.String(),
|
||||
"tile_x": Type.Number(),
|
||||
"tile_y": Type.Number(),
|
||||
"tick": Type.Optional(Type.Number()),
|
||||
});
|
||||
static jsonSchema = Type.Object({
|
||||
"instance_id": Type.Number(),
|
||||
"surface": Type.String(),
|
||||
"force": Type.String(),
|
||||
"tile_x": Type.Number(),
|
||||
"tile_y": Type.Number(),
|
||||
"tick": Type.Optional(Type.Number()),
|
||||
});
|
||||
|
||||
static fromJSON(json: Static<typeof GetRawRecipeTileRequest.jsonSchema>) {
|
||||
return new this(
|
||||
json.instance_id,
|
||||
json.surface,
|
||||
json.force,
|
||||
json.tile_x,
|
||||
json.tile_y,
|
||||
json.tick
|
||||
);
|
||||
}
|
||||
static fromJSON(json: Static<typeof GetRawRecipeTileRequest.jsonSchema>) {
|
||||
return new this(
|
||||
json.instance_id,
|
||||
json.surface,
|
||||
json.force,
|
||||
json.tile_x,
|
||||
json.tile_y,
|
||||
json.tick
|
||||
);
|
||||
}
|
||||
|
||||
static Response = lib.plainJson(Type.Object({
|
||||
"recipe_tile": Type.Union([Type.String(), Type.Null()]),
|
||||
}));
|
||||
}
|
||||
static Response = lib.plainJson(Type.Object({
|
||||
"recipe_tile": Type.Union([Type.String(), Type.Null()]),
|
||||
}));
|
||||
}
|
||||
Reference in new issue
Block a user