~starkingdoms/starkingdoms

ref: d3abb6e42428870b69e238f4b6c57ad4ffd440ea starkingdoms/starkingdoms-client/src/protocol.ts -rw-r--r-- 989 bytes
d3abb6e4 — core final! final! deployment! fix! 200001.0! 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
export interface ProtoTransform {
    x: number,
    y: number,
    rot: number
}
export enum PlanetType {
    Earth = "Earth"
}
export enum PartType {
    Hearty = "Hearty"
}
export interface Planet {
    planet_type: PlanetType,
    transform: ProtoTransform
}
export interface Part {
    part_type: PartType,
    transform: ProtoTransform
}
export interface ClientLoginPacket {
    username: string,
    jwt: string | null,
}
export interface SpawnPlayerPacket {
    id: number,
    username: string,
    position: ProtoTransform
}
export interface PlanetPositionsPacket {
    planets: [number, Planet][]
}
export interface PartPositionsPacket {
    parts: [number, Part][]
}

export enum PacketType {
    ClientLogin = "ClientLogin",
    SpawnPlayer = "SpawnPlayer",
    PlanetPositions = "PlanetPositions",
    PartPositions = "PartPositions"
}

export interface Packet {
    t: PacketType,
    c: ClientLoginPacket | SpawnPlayerPacket | PlanetPositionsPacket | PartPositionsPacket
}