model updates, and fix tests

This commit is contained in:
Adam 2022-02-20 22:16:09 +01:00
parent e0b9ef9788
commit dd45bece53
6 changed files with 90 additions and 31 deletions

View file

@ -1,12 +1,25 @@
// Generated by TypeScriptGenerator - do not edit this file manually
type PacketType = "EVENT" | "CONFIG" | "PROTOTYPES";
type PacketType = "EVENT" | "CONFIG" | "PROTOTYPES" | "UPDATE";
interface KafkatorioPacket {
modVersion: string;
packetType: PacketType;
}
type FactorioEventUpdateType = "PLAYER" | "MAP_CHUNK" | "ENTITY";
interface FactorioEventUpdate {
updateType: FactorioEventUpdateType;
}
interface FactorioEventUpdatePacket extends KafkatorioPacket {
modVersion: string;
packetType: PacketType;
tick: uint;
update: FactorioEventUpdate;
}
interface FactorioEvent extends KafkatorioPacket {
data: FactorioObjectData;
eventType: string;
@ -80,33 +93,39 @@ interface MapTile {
prototypeName: string;
}
type FactorioEventUpdateType = "PLAYER" | "MAP_CHUNK" | "ENTITY";
interface FactorioEventUpdate {
updateType: FactorioEventUpdateType;
interface EntityIdentifiers {
name: string;
type: string;
unitNumber: uint | null;
}
interface PlayerUpdate extends FactorioEventUpdate {
afkTime: uint | null;
bannedReason: string | null;
characterUnitNumber: uint | null;
chatColour: Colour | null;
colour: Colour | null;
diedCause: EntityIdentifiers | null;
disconnectReason: string | null;
forceIndex: uint | null;
index: uint;
isAdmin: boolean | null;
isConnected: boolean | null;
isRemoved: boolean | null;
isShowOnMap: boolean | null;
isSpectator: boolean | null;
kickedReason: string | null;
lastOnline: uint | null;
name: string | null;
onlineTime: uint | null;
position: MapEntityPosition | null;
surfaceIndex: uint | null;
tag: string | null;
ticksToRespawn: uint | null;
updateType: FactorioEventUpdateType;
}
interface EntityUpdate extends FactorioEventUpdate {
interface EntityUpdate extends FactorioEventUpdate, EntityIdentifiers {
chunkPosition: MapChunkPosition | null;
graphicsVariation: number | null;
health: float | null;
@ -115,17 +134,20 @@ interface EntityUpdate extends FactorioEventUpdate {
lastUser: int | null;
localisedDescription: string | null;
localisedName: string | null;
name: string | null;
name: string;
prototype: string | null;
type: string | null;
type: string;
unitNumber: uint;
updateType: FactorioEventUpdateType;
}
interface MapChunkUpdate extends FactorioEventUpdate {
chunkPosition: MapChunkPosition;
force: uint | null;
isDeleted: boolean | null;
player: uint | null;
robot: EntityIdentifiers | null;
surfaceIndex: uint;
tiles: MapTiles | null;
tiles: Map<MapTilePosition, string> | null;
updateType: FactorioEventUpdateType;
}