fix polymorphic serialization, and update the names of some schema objects
This commit is contained in:
parent
e5feabf7eb
commit
2208c91652
11 changed files with 109 additions and 55 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// Generated by TypeScriptGenerator - do not edit this file manually
|
||||
|
||||
type ObjectName = "LuaPlayer" | "LuaEntity" | "LuaSurface" | "FactorioMapChunk" | "LuaTile" | "ConsoleChatMessage";
|
||||
type ObjectName = "LuaPlayer" | "LuaEntity" | "LuaSurface" | "MapChunk" | "LuaTile" | "ConsoleChatMessage";
|
||||
|
||||
interface FactorioObjectData {
|
||||
objectName: ObjectName;
|
||||
|
|
@ -45,16 +45,16 @@ interface SurfaceData extends FactorioObjectData {
|
|||
objectName: ObjectName;
|
||||
}
|
||||
|
||||
interface FactorioMapTile extends FactorioObjectData {
|
||||
interface MapTile extends FactorioObjectData {
|
||||
objectName: ObjectName;
|
||||
position: PositionData;
|
||||
prototypeName: string;
|
||||
surfaceIndex: int;
|
||||
}
|
||||
|
||||
interface FactorioMapChunk extends FactorioObjectData {
|
||||
interface MapChunk extends FactorioObjectData {
|
||||
objectName: ObjectName;
|
||||
tiles: FactorioMapTile[];
|
||||
tiles: MapTile[];
|
||||
}
|
||||
|
||||
interface ConsoleChatMessage extends FactorioObjectData {
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ export namespace Converters {
|
|||
}
|
||||
}
|
||||
|
||||
export function convertTile(tile: LuaTile): FactorioMapTile {
|
||||
export function convertTile(tile: LuaTile): MapTile {
|
||||
return {
|
||||
objectName: tile.object_name,
|
||||
|
||||
|
|
|
|||
|
|
@ -70,12 +70,12 @@ export function handleChunkUpdate(
|
|||
}
|
||||
) ?? []
|
||||
|
||||
let convertedTiles: FactorioMapTile[] = tiles.map((tile: LuaTile) => {
|
||||
let convertedTiles: MapTile[] = tiles.map((tile: LuaTile) => {
|
||||
return Converters.convertTile(tile)
|
||||
})
|
||||
|
||||
let mapChunk: FactorioMapChunk = {
|
||||
objectName: "FactorioMapChunk",
|
||||
let mapChunk: MapChunk = {
|
||||
objectName: "MapChunk",
|
||||
tiles: convertedTiles,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue