update events schema
- unwrap value classes when generating TS - add value classes for some data types - add FactorioEventUpdates (for new incremental event updates) - use static lists for enum values (better performance) - add LuaControl for sharing Player/Entity fields
This commit is contained in:
parent
e989d25a3c
commit
8f9ebdb1e1
13 changed files with 396 additions and 67 deletions
|
|
@ -6,30 +6,6 @@ interface FactorioObjectData {
|
|||
objectName: ObjectName;
|
||||
}
|
||||
|
||||
interface PlayerData extends FactorioObjectData {
|
||||
associatedCharactersUnitNumbers: uint[];
|
||||
characterUnitNumber: uint | null;
|
||||
chatColour: Colour;
|
||||
colour: Colour;
|
||||
lastOnline: uint;
|
||||
name: string;
|
||||
objectName: ObjectName;
|
||||
position: MapEntityPosition;
|
||||
}
|
||||
|
||||
interface EntityData extends FactorioObjectData {
|
||||
active: boolean;
|
||||
health: double | null;
|
||||
healthRatio: double;
|
||||
name: string;
|
||||
objectName: ObjectName;
|
||||
playerIndex: uint | null;
|
||||
position: MapEntityPosition;
|
||||
surfaceIndex: int;
|
||||
type: string;
|
||||
unitNumber: uint | null;
|
||||
}
|
||||
|
||||
interface SurfaceData extends FactorioObjectData {
|
||||
daytime: double;
|
||||
index: uint;
|
||||
|
|
@ -39,7 +15,7 @@ interface SurfaceData extends FactorioObjectData {
|
|||
|
||||
interface MapTiles extends FactorioObjectData {
|
||||
objectName: ObjectName;
|
||||
surfaceIndex: int;
|
||||
surfaceIndex: uint;
|
||||
tiles: MapTile[];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ interface FactorioPrototypes extends KafkatorioPacket {
|
|||
interface MapTilePrototype extends FactorioPrototype {
|
||||
canBeMined: boolean;
|
||||
collisionMasks: string[];
|
||||
layer: uint;
|
||||
layer: int;
|
||||
mapColour: Colour;
|
||||
name: string;
|
||||
order: string;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,17 @@ interface FactorioEvent extends KafkatorioPacket {
|
|||
tick: uint;
|
||||
}
|
||||
|
||||
interface MapEntityPosition {
|
||||
x: double;
|
||||
y: double;
|
||||
}
|
||||
|
||||
interface FactorioLuaControl {
|
||||
force: uint;
|
||||
position: MapEntityPosition;
|
||||
surface: uint;
|
||||
}
|
||||
|
||||
interface Colour {
|
||||
alpha: float;
|
||||
blue: float;
|
||||
|
|
@ -22,9 +33,31 @@ interface Colour {
|
|||
red: float;
|
||||
}
|
||||
|
||||
interface MapEntityPosition {
|
||||
x: double;
|
||||
y: double;
|
||||
interface PlayerData extends FactorioObjectData, FactorioLuaControl {
|
||||
associatedCharactersUnitNumbers: uint[];
|
||||
characterUnitNumber: uint | null;
|
||||
chatColour: Colour;
|
||||
colour: Colour;
|
||||
force: uint;
|
||||
lastOnline: uint;
|
||||
name: string;
|
||||
objectName: ObjectName;
|
||||
position: MapEntityPosition;
|
||||
surface: uint;
|
||||
}
|
||||
|
||||
interface EntityData extends FactorioObjectData, FactorioLuaControl {
|
||||
active: boolean;
|
||||
force: uint;
|
||||
health: double | null;
|
||||
healthRatio: double;
|
||||
name: string;
|
||||
objectName: ObjectName;
|
||||
playerIndex: uint | null;
|
||||
position: MapEntityPosition;
|
||||
surface: uint;
|
||||
type: string;
|
||||
unitNumber: uint | null;
|
||||
}
|
||||
|
||||
interface MapTilePosition {
|
||||
|
|
@ -46,3 +79,53 @@ interface MapTile {
|
|||
position: MapTilePosition;
|
||||
prototypeName: string;
|
||||
}
|
||||
|
||||
type FactorioEventUpdateType = "PLAYER" | "MAP_CHUNK" | "ENTITY";
|
||||
|
||||
interface FactorioEventUpdate {
|
||||
updateType: FactorioEventUpdateType;
|
||||
}
|
||||
|
||||
interface PlayerUpdate extends FactorioEventUpdate {
|
||||
characterUnitNumber: uint | null;
|
||||
chatColour: Colour | null;
|
||||
colour: Colour | null;
|
||||
disconnectReason: string | null;
|
||||
forceIndex: uint | null;
|
||||
index: uint;
|
||||
isAdmin: boolean | null;
|
||||
isConnected: boolean | null;
|
||||
isShowOnMap: boolean | null;
|
||||
isSpectator: boolean | null;
|
||||
lastOnline: uint | null;
|
||||
name: string | null;
|
||||
onlineTime: uint | null;
|
||||
position: MapEntityPosition | null;
|
||||
surfaceIndex: uint | null;
|
||||
tag: string | null;
|
||||
updateType: FactorioEventUpdateType;
|
||||
}
|
||||
|
||||
interface EntityUpdate extends FactorioEventUpdate {
|
||||
chunkPosition: MapChunkPosition | null;
|
||||
graphicsVariation: number | null;
|
||||
health: float | null;
|
||||
isActive: boolean | null;
|
||||
isRotatable: boolean | null;
|
||||
lastUser: int | null;
|
||||
localisedDescription: string | null;
|
||||
localisedName: string | null;
|
||||
name: string | null;
|
||||
prototype: string | null;
|
||||
type: string | null;
|
||||
unitNumber: uint;
|
||||
updateType: FactorioEventUpdateType;
|
||||
}
|
||||
|
||||
interface MapChunkUpdate extends FactorioEventUpdate {
|
||||
chunkPosition: MapChunkPosition;
|
||||
isDeleted: boolean | null;
|
||||
surfaceIndex: uint;
|
||||
tiles: MapTiles | null;
|
||||
updateType: FactorioEventUpdateType;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue