Move IpcPlayerData out of inventory_sync/instance.ts

Remove circular dependency between inventory_sync/message.ts and
inventory_sync/instance.ts by moving the IpcPlayerData type from
message.ts to instance.ts.  This solves a problem with the web
build checking types in instance.ts that it dosen't use.
This commit is contained in:
Hornwitser committed 2024-01-08 23:54:12 +01:00
1 parent 7bbb44d4e6
commit 96210373f3
4 files changed
+22 -24

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
import { BaseControllerPlugin, type InstanceInfo } from "@clusterio/controller";
import type { IpcPlayerData } from "./instance";
import type { IpcPlayerData } from "./messages";
import fs from "fs-extra";
import path from "path";
+1 -20
View File
@@ -1,32 +1,13 @@
import * as lib from "@clusterio/lib";
import { BaseInstancePlugin } from "@clusterio/host";
import {
AcquireRequest, AcquireResponse, ReleaseRequest, UploadRequest, DownloadRequest, DownloadResponse,
AcquireRequest, AcquireResponse, ReleaseRequest, UploadRequest, DownloadRequest, DownloadResponse, IpcPlayerData,
} from "./messages";
type IpcPlayerName = {
player_name: string
}
// .\module\serialize.lua:serialize.serialize_player()
export type IpcPlayerData = {
generation: number,
controller: string,
name: string,
color: number[],
chat_color: number[],
tag: string,
force: string,
cheat_mode: boolean,
flashlight: boolean,
ticks_to_respawn?: number,
character?: any,
inventories?: any,
hotbar?: string[],
personal_logistic_slots?: {name:string, min:number, max:number}[],
crafting_queue?: any,
}
type IpcAcquireResponse = {
player_name: string,
status: string,
+19 -2
View File
@@ -1,8 +1,25 @@
import type { IpcPlayerData } from "./instance";
import { Type, Static } from "@sinclair/typebox";
import { StringEnum } from "@clusterio/lib";
// .\module\serialize.lua:serialize.serialize_player()
export type IpcPlayerData = {
generation: number,
controller: string,
name: string,
color: number[],
chat_color: number[],
tag: string,
force: string,
cheat_mode: boolean,
flashlight: boolean,
ticks_to_respawn?: number,
character?: any,
inventories?: any,
hotbar?: string[],
personal_logistic_slots?: {name:string, min:number, max:number}[],
crafting_queue?: any,
}
const jsonPlayerData = Type.Object({
generation: Type.Number(),
name: Type.String(),
+1 -1
View File
@@ -4,7 +4,7 @@
{ "path": "../../packages/lib" },
{ "path": "../../packages/web_ui/tsconfig.web.json" },
],
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "instance.ts", "package.json" ],
"include": [ "web/**/*.tsx", "web/**/*.ts", "messages.ts", "package.json" ],
"compilerOptions": {
"outDir": "dist/web/build",
}