move from schema2 to schema
This commit is contained in:
parent
6bfcd30558
commit
b0a6151c36
30 changed files with 256 additions and 318 deletions
|
|
@ -1,37 +1,37 @@
|
||||||
// Generated by kxs-ts-gen - do not edit this file manually
|
// Generated by kxs-ts-gen - do not edit this file manually
|
||||||
|
|
||||||
export interface KafkatorioPacket2 {
|
export interface KafkatorioPacket {
|
||||||
modVersion: string;
|
modVersion: string;
|
||||||
tick: Tick;
|
tick: Tick;
|
||||||
data: KafkatorioPacketData2;
|
data: KafkatorioPacketData;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Tick = UInt;
|
export type Tick = UInt;
|
||||||
|
|
||||||
export type KafkatorioPacketData2 =
|
export type KafkatorioPacketData =
|
||||||
| KafkatorioPacketData2.ConfigurationUpdate
|
| KafkatorioPacketData.ConfigurationUpdate
|
||||||
| KafkatorioPacketData2.ConsoleChatUpdate
|
| KafkatorioPacketData.ConsoleChatUpdate
|
||||||
| KafkatorioPacketData2.ConsoleCommandUpdate
|
| KafkatorioPacketData.ConsoleCommandUpdate
|
||||||
| KafkatorioPacketData2.EntityUpdate
|
| KafkatorioPacketData.EntityUpdate
|
||||||
| KafkatorioPacketData2.MapChunkUpdate
|
| KafkatorioPacketData.MapChunkUpdate
|
||||||
| KafkatorioPacketData2.PlayerUpdate
|
| KafkatorioPacketData.PlayerUpdate
|
||||||
| KafkatorioPacketData2.PrototypesUpdate
|
| KafkatorioPacketData.PrototypesUpdate
|
||||||
| KafkatorioPacketData2.SurfaceUpdate;
|
| KafkatorioPacketData.SurfaceUpdate;
|
||||||
|
|
||||||
export namespace KafkatorioPacketData2 {
|
export namespace KafkatorioPacketData {
|
||||||
export enum Type {
|
export enum Type {
|
||||||
ConfigurationUpdate = "dev.adamko.kafkatorio.schema2.ConfigurationUpdate",
|
ConfigurationUpdate = "dev.adamko.kafkatorio.schema.packets.ConfigurationUpdate",
|
||||||
ConsoleChatUpdate = "dev.adamko.kafkatorio.schema2.ConsoleChatUpdate",
|
ConsoleChatUpdate = "dev.adamko.kafkatorio.schema.packets.ConsoleChatUpdate",
|
||||||
ConsoleCommandUpdate = "dev.adamko.kafkatorio.schema2.ConsoleCommandUpdate",
|
ConsoleCommandUpdate = "dev.adamko.kafkatorio.schema.packets.ConsoleCommandUpdate",
|
||||||
PrototypesUpdate = "dev.adamko.kafkatorio.schema2.PrototypesUpdate",
|
PrototypesUpdate = "dev.adamko.kafkatorio.schema.packets.PrototypesUpdate",
|
||||||
SurfaceUpdate = "dev.adamko.kafkatorio.schema2.SurfaceUpdate",
|
SurfaceUpdate = "dev.adamko.kafkatorio.schema.packets.SurfaceUpdate",
|
||||||
EntityUpdate = "dev.adamko.kafkatorio.schema2.EntityUpdate",
|
EntityUpdate = "dev.adamko.kafkatorio.schema.packets.EntityUpdate",
|
||||||
MapChunkUpdate = "dev.adamko.kafkatorio.schema2.MapChunkUpdate",
|
MapChunkUpdate = "dev.adamko.kafkatorio.schema.packets.MapChunkUpdate",
|
||||||
PlayerUpdate = "dev.adamko.kafkatorio.schema2.PlayerUpdate",
|
PlayerUpdate = "dev.adamko.kafkatorio.schema.packets.PlayerUpdate",
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ConfigurationUpdate {
|
export interface ConfigurationUpdate {
|
||||||
type: KafkatorioPacketData2.Type.ConfigurationUpdate;
|
type: KafkatorioPacketData.Type.ConfigurationUpdate;
|
||||||
factorioData: ConfigurationUpdateGameData;
|
factorioData: ConfigurationUpdateGameData;
|
||||||
allMods: ConfigurationUpdateModData[];
|
allMods: ConfigurationUpdateModData[];
|
||||||
modStartupSettingsChange: boolean;
|
modStartupSettingsChange: boolean;
|
||||||
|
|
@ -39,32 +39,32 @@ export namespace KafkatorioPacketData2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ConsoleChatUpdate {
|
export interface ConsoleChatUpdate {
|
||||||
type: KafkatorioPacketData2.Type.ConsoleChatUpdate;
|
type: KafkatorioPacketData.Type.ConsoleChatUpdate;
|
||||||
authorPlayerIndex: PlayerIndex | null;
|
authorPlayerIndex: PlayerIndex | null;
|
||||||
content: string;
|
content: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ConsoleCommandUpdate {
|
export interface ConsoleCommandUpdate {
|
||||||
type: KafkatorioPacketData2.Type.ConsoleCommandUpdate;
|
type: KafkatorioPacketData.Type.ConsoleCommandUpdate;
|
||||||
authorPlayerIndex: PlayerIndex | null;
|
authorPlayerIndex: PlayerIndex | null;
|
||||||
command: string;
|
command: string;
|
||||||
parameters: string;
|
parameters: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PrototypesUpdate {
|
export interface PrototypesUpdate {
|
||||||
type: KafkatorioPacketData2.Type.PrototypesUpdate;
|
type: KafkatorioPacketData.Type.PrototypesUpdate;
|
||||||
prototypes: FactorioPrototype2[];
|
prototypes: FactorioPrototype[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SurfaceUpdate {
|
export interface SurfaceUpdate {
|
||||||
type: KafkatorioPacketData2.Type.SurfaceUpdate;
|
type: KafkatorioPacketData.Type.SurfaceUpdate;
|
||||||
index: SurfaceIndex;
|
index: SurfaceIndex;
|
||||||
daytime: Double;
|
daytime: Double;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EntityUpdate {
|
export interface EntityUpdate {
|
||||||
type: KafkatorioPacketData2.Type.EntityUpdate;
|
type: KafkatorioPacketData.Type.EntityUpdate;
|
||||||
key: EntityUpdateKey;
|
key: EntityUpdateKey;
|
||||||
eventCounts?: { [key: string]: UInt } | null;
|
eventCounts?: { [key: string]: UInt } | null;
|
||||||
chunkPosition?: MapChunkPosition | null;
|
chunkPosition?: MapChunkPosition | null;
|
||||||
|
|
@ -79,7 +79,7 @@ export namespace KafkatorioPacketData2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MapChunkUpdate {
|
export interface MapChunkUpdate {
|
||||||
type: KafkatorioPacketData2.Type.MapChunkUpdate;
|
type: KafkatorioPacketData.Type.MapChunkUpdate;
|
||||||
key: MapChunkUpdateKey;
|
key: MapChunkUpdateKey;
|
||||||
eventCounts?: { [key: string]: UInt } | null;
|
eventCounts?: { [key: string]: UInt } | null;
|
||||||
player?: PlayerIndex | null;
|
player?: PlayerIndex | null;
|
||||||
|
|
@ -90,7 +90,7 @@ export namespace KafkatorioPacketData2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PlayerUpdate {
|
export interface PlayerUpdate {
|
||||||
type: KafkatorioPacketData2.Type.PlayerUpdate;
|
type: KafkatorioPacketData.Type.PlayerUpdate;
|
||||||
key: PlayerUpdateKey;
|
key: PlayerUpdateKey;
|
||||||
eventCounts?: { [key: string]: UInt } | null;
|
eventCounts?: { [key: string]: UInt } | null;
|
||||||
characterUnitNumber?: UnitNumber | null;
|
characterUnitNumber?: UnitNumber | null;
|
||||||
|
|
@ -191,16 +191,16 @@ export interface ConfigurationUpdateModData {
|
||||||
previousVersion?: string | null;
|
previousVersion?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type FactorioPrototype2 =
|
export type FactorioPrototype =
|
||||||
| FactorioPrototype2.MapTile;
|
| FactorioPrototype.MapTile;
|
||||||
|
|
||||||
export namespace FactorioPrototype2 {
|
export namespace FactorioPrototype {
|
||||||
export enum Type {
|
export enum Type {
|
||||||
MapTile = "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
MapTile = "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MapTile {
|
export interface MapTile {
|
||||||
type: FactorioPrototype2.Type.MapTile;
|
type: FactorioPrototype.Type.MapTile;
|
||||||
name: PrototypeName;
|
name: PrototypeName;
|
||||||
layer: UInt;
|
layer: UInt;
|
||||||
mapColour: Colour;
|
mapColour: Colour;
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
import {
|
import {
|
||||||
KafkatorioPacket2,
|
KafkatorioPacket,
|
||||||
KafkatorioPacketData2
|
KafkatorioPacketData
|
||||||
} from "../generated/kafkatorio-schema/kafkatorio-schema";
|
} from "../generated/kafkatorio-schema/kafkatorio-schema";
|
||||||
import {KafkatorioKeyedPacketData} from "./types";
|
import {KafkatorioKeyedPacketData} from "./types";
|
||||||
|
|
||||||
export class KafkatorioPacketEmitter {
|
export class KafkatorioPacketEmitter {
|
||||||
|
|
||||||
emitInstantPacket<DATA extends KafkatorioPacketData2>(
|
emitInstantPacket<DATA extends KafkatorioPacketData>(
|
||||||
data: DATA,
|
data: DATA,
|
||||||
) {
|
) {
|
||||||
KafkatorioPacketEmitter.emitPacket<KafkatorioPacket2>({
|
KafkatorioPacketEmitter.emitPacket<KafkatorioPacket>({
|
||||||
data: data,
|
data: data,
|
||||||
modVersion: global.MOD_VERSION,
|
modVersion: global.MOD_VERSION,
|
||||||
tick: game.tick,
|
tick: game.tick,
|
||||||
|
|
@ -19,7 +19,7 @@ export class KafkatorioPacketEmitter {
|
||||||
emitKeyedPacket<DATA extends KafkatorioKeyedPacketData>(
|
emitKeyedPacket<DATA extends KafkatorioKeyedPacketData>(
|
||||||
data: DATA,
|
data: DATA,
|
||||||
) {
|
) {
|
||||||
KafkatorioPacketEmitter.emitPacket<KafkatorioPacket2>({
|
KafkatorioPacketEmitter.emitPacket<KafkatorioPacket>({
|
||||||
data: data,
|
data: data,
|
||||||
modVersion: global.MOD_VERSION,
|
modVersion: global.MOD_VERSION,
|
||||||
tick: game.tick,
|
tick: game.tick,
|
||||||
|
|
@ -27,7 +27,7 @@ export class KafkatorioPacketEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Emit a serialised KafkatorioPacket */
|
/** Emit a serialised KafkatorioPacket */
|
||||||
private static emitPacket<T extends KafkatorioPacket2>(packet: T) {
|
private static emitPacket<T extends KafkatorioPacket>(packet: T) {
|
||||||
let data = game.table_to_json(packet)
|
let data = game.table_to_json(packet)
|
||||||
localised_print(`KafkatorioPacket: ${data}`)
|
localised_print(`KafkatorioPacket: ${data}`)
|
||||||
// rcon.print(`KafkatorioPacket: ${data}`)
|
// rcon.print(`KafkatorioPacket: ${data}`)
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@ import PacketEmitter from "../PacketEmitter";
|
||||||
import {
|
import {
|
||||||
ConfigurationUpdateGameData,
|
ConfigurationUpdateGameData,
|
||||||
ConfigurationUpdateModData,
|
ConfigurationUpdateModData,
|
||||||
KafkatorioPacketData2
|
KafkatorioPacketData
|
||||||
} from "../../generated/kafkatorio-schema/kafkatorio-schema";
|
} from "../../generated/kafkatorio-schema/kafkatorio-schema";
|
||||||
import Type = KafkatorioPacketData2.Type;
|
import Type = KafkatorioPacketData.Type;
|
||||||
import ConfigurationUpdate = KafkatorioPacketData2.ConfigurationUpdate;
|
import ConfigurationUpdate = KafkatorioPacketData.ConfigurationUpdate;
|
||||||
|
|
||||||
export function emitConfigurationUpdate(changeData: ConfigurationChangedData) {
|
export function emitConfigurationUpdate(changeData: ConfigurationChangedData) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import {Converters} from "../events/converters";
|
import {Converters} from "../events/converters";
|
||||||
import PacketEmitter from "../PacketEmitter";
|
import PacketEmitter from "../PacketEmitter";
|
||||||
import {
|
import {
|
||||||
FactorioPrototype2,
|
FactorioPrototype,
|
||||||
KafkatorioPacketData2
|
KafkatorioPacketData
|
||||||
} from "../../generated/kafkatorio-schema/kafkatorio-schema";
|
} from "../../generated/kafkatorio-schema/kafkatorio-schema";
|
||||||
import Type = KafkatorioPacketData2.Type;
|
import Type = KafkatorioPacketData.Type;
|
||||||
import PrototypesUpdate = KafkatorioPacketData2.PrototypesUpdate;
|
import PrototypesUpdate = KafkatorioPacketData.PrototypesUpdate;
|
||||||
|
|
||||||
|
|
||||||
export function emitPrototypes() {
|
export function emitPrototypes() {
|
||||||
|
|
@ -18,20 +18,20 @@ export function emitPrototypes() {
|
||||||
PacketEmitter.emitInstantPacket(data)
|
PacketEmitter.emitInstantPacket(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
function prototypes(): FactorioPrototype2[] {
|
function prototypes(): FactorioPrototype[] {
|
||||||
let prototypes: FactorioPrototype2[] = []
|
let prototypes: FactorioPrototype[] = []
|
||||||
|
|
||||||
prototypes.push(...getMapTilePrototypes())
|
prototypes.push(...getMapTilePrototypes())
|
||||||
|
|
||||||
return prototypes
|
return prototypes
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMapTilePrototypes(): FactorioPrototype2.MapTile[] {
|
function getMapTilePrototypes(): FactorioPrototype.MapTile[] {
|
||||||
let tiles: FactorioPrototype2.MapTile[] = []
|
let tiles: FactorioPrototype.MapTile[] = []
|
||||||
for (let [, tile] of game.tile_prototypes) {
|
for (let [, tile] of game.tile_prototypes) {
|
||||||
tiles.push(
|
tiles.push(
|
||||||
<FactorioPrototype2.MapTile>{
|
<FactorioPrototype.MapTile>{
|
||||||
type: FactorioPrototype2.Type.MapTile,
|
type: FactorioPrototype.Type.MapTile,
|
||||||
|
|
||||||
name: tile.name,
|
name: tile.name,
|
||||||
order: tile.order,
|
order: tile.order,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import PacketEmitter from "../PacketEmitter";
|
import PacketEmitter from "../PacketEmitter";
|
||||||
import {KafkatorioPacketData2} from "../../generated/kafkatorio-schema/kafkatorio-schema";
|
import {KafkatorioPacketData} from "../../generated/kafkatorio-schema/kafkatorio-schema";
|
||||||
import Type = KafkatorioPacketData2.Type;
|
import Type = KafkatorioPacketData.Type;
|
||||||
|
|
||||||
// export function handlePlayerUpdate(tick: uint, eventType: string, playerIndex: uint) {
|
// export function handlePlayerUpdate(tick: uint, eventType: string, playerIndex: uint) {
|
||||||
// let player: LuaPlayer = game.players[playerIndex]
|
// let player: LuaPlayer = game.players[playerIndex]
|
||||||
|
|
@ -36,7 +36,7 @@ export function handleSurfaceUpdate(
|
||||||
eventType: string,
|
eventType: string,
|
||||||
surface: LuaSurface,
|
surface: LuaSurface,
|
||||||
) {
|
) {
|
||||||
const update: KafkatorioPacketData2.SurfaceUpdate = {
|
const update: KafkatorioPacketData.SurfaceUpdate = {
|
||||||
type: Type.SurfaceUpdate,
|
type: Type.SurfaceUpdate,
|
||||||
|
|
||||||
name: surface.name,
|
name: surface.name,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import PacketEmitter from "../PacketEmitter";
|
import PacketEmitter from "../PacketEmitter";
|
||||||
import {KafkatorioPacketData2} from "../../generated/kafkatorio-schema/kafkatorio-schema";
|
import {KafkatorioPacketData} from "../../generated/kafkatorio-schema/kafkatorio-schema";
|
||||||
import Type = KafkatorioPacketData2.Type;
|
import Type = KafkatorioPacketData.Type;
|
||||||
|
|
||||||
script.on_event(
|
script.on_event(
|
||||||
defines.events.on_console_chat,
|
defines.events.on_console_chat,
|
||||||
(event: OnConsoleChatEvent) => {
|
(event: OnConsoleChatEvent) => {
|
||||||
const update: KafkatorioPacketData2.ConsoleChatUpdate = {
|
const update: KafkatorioPacketData.ConsoleChatUpdate = {
|
||||||
type: Type.ConsoleChatUpdate,
|
type: Type.ConsoleChatUpdate,
|
||||||
|
|
||||||
authorPlayerIndex: event.player_index ?? null,
|
authorPlayerIndex: event.player_index ?? null,
|
||||||
|
|
@ -18,7 +18,7 @@ script.on_event(
|
||||||
script.on_event(
|
script.on_event(
|
||||||
defines.events.on_console_command,
|
defines.events.on_console_command,
|
||||||
(event: OnConsoleCommandEvent) => {
|
(event: OnConsoleCommandEvent) => {
|
||||||
const update: KafkatorioPacketData2.ConsoleCommandUpdate = {
|
const update: KafkatorioPacketData.ConsoleCommandUpdate = {
|
||||||
type: Type.ConsoleCommandUpdate,
|
type: Type.ConsoleCommandUpdate,
|
||||||
|
|
||||||
authorPlayerIndex: event.player_index ?? null,
|
authorPlayerIndex: event.player_index ?? null,
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,15 @@ import {isEventType} from "./eventTypeCheck";
|
||||||
import {Converters} from "./converters";
|
import {Converters} from "./converters";
|
||||||
import EventUpdatesManager, {EventUpdates} from "../cache/EventDataCache";
|
import EventUpdatesManager, {EventUpdates} from "../cache/EventDataCache";
|
||||||
import {
|
import {
|
||||||
KafkatorioPacketData2,
|
KafkatorioPacketData,
|
||||||
MapChunkPosition,
|
MapChunkPosition,
|
||||||
MapTileDictionary
|
MapTileDictionary
|
||||||
} from "../../generated/kafkatorio-schema/kafkatorio-schema";
|
} from "../../generated/kafkatorio-schema/kafkatorio-schema";
|
||||||
import CacheKey = EventUpdates.PacketKey;
|
import CacheKey = EventUpdates.PacketKey;
|
||||||
import Type = KafkatorioPacketData2.Type;
|
import Type = KafkatorioPacketData.Type;
|
||||||
|
|
||||||
|
|
||||||
type MapChunkUpdater = (data: KafkatorioPacketData2.MapChunkUpdate) => void
|
type MapChunkUpdater = (data: KafkatorioPacketData.MapChunkUpdate) => void
|
||||||
|
|
||||||
|
|
||||||
const mapProtoNameToKey: { [key: string]: uint } = {}
|
const mapProtoNameToKey: { [key: string]: uint } = {}
|
||||||
|
|
@ -38,12 +38,12 @@ function mapTilesUpdateDebounce(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const key: KafkatorioPacketData2.MapChunkUpdate["key"] = {
|
const key: KafkatorioPacketData.MapChunkUpdate["key"] = {
|
||||||
surfaceIndex: surface.index,
|
surfaceIndex: surface.index,
|
||||||
chunkPosition: chunkPosition,
|
chunkPosition: chunkPosition,
|
||||||
}
|
}
|
||||||
|
|
||||||
EventUpdatesManager.debounce<KafkatorioPacketData2.MapChunkUpdate>(
|
EventUpdatesManager.debounce<KafkatorioPacketData.MapChunkUpdate>(
|
||||||
key,
|
key,
|
||||||
Type.MapChunkUpdate,
|
Type.MapChunkUpdate,
|
||||||
data => {
|
data => {
|
||||||
|
|
@ -267,12 +267,12 @@ script.on_event(
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const position of e.positions) {
|
for (const position of e.positions) {
|
||||||
const key: CacheKey<KafkatorioPacketData2.MapChunkUpdate> = {
|
const key: CacheKey<KafkatorioPacketData.MapChunkUpdate> = {
|
||||||
surfaceIndex: surface.index,
|
surfaceIndex: surface.index,
|
||||||
chunkPosition: [position.x, position.y],
|
chunkPosition: [position.x, position.y],
|
||||||
}
|
}
|
||||||
|
|
||||||
EventUpdatesManager.debounce<KafkatorioPacketData2.MapChunkUpdate>(
|
EventUpdatesManager.debounce<KafkatorioPacketData.MapChunkUpdate>(
|
||||||
key,
|
key,
|
||||||
Type.MapChunkUpdate,
|
Type.MapChunkUpdate,
|
||||||
data => data.isDeleted = true,
|
data => data.isDeleted = true,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import {Converters} from "./converters";
|
import {Converters} from "./converters";
|
||||||
import EventUpdatesManager from "../cache/EventDataCache";
|
import EventUpdatesManager from "../cache/EventDataCache";
|
||||||
import {KafkatorioPacketData2} from "../../generated/kafkatorio-schema/kafkatorio-schema";
|
import {KafkatorioPacketData} from "../../generated/kafkatorio-schema/kafkatorio-schema";
|
||||||
import Type = KafkatorioPacketData2.Type;
|
import Type = KafkatorioPacketData.Type;
|
||||||
|
|
||||||
|
|
||||||
type PlayerUpdater = (player: LuaPlayer, data: KafkatorioPacketData2.PlayerUpdate) => void
|
type PlayerUpdater = (player: LuaPlayer, data: KafkatorioPacketData.PlayerUpdate) => void
|
||||||
|
|
||||||
function playerUpdateThrottle(
|
function playerUpdateThrottle(
|
||||||
playerIndex: uint,
|
playerIndex: uint,
|
||||||
|
|
@ -12,7 +12,7 @@ function playerUpdateThrottle(
|
||||||
mutate: PlayerUpdater,
|
mutate: PlayerUpdater,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
EventUpdatesManager.throttle<KafkatorioPacketData2.PlayerUpdate>(
|
EventUpdatesManager.throttle<KafkatorioPacketData.PlayerUpdate>(
|
||||||
{index: playerIndex},
|
{index: playerIndex},
|
||||||
Type.PlayerUpdate,
|
Type.PlayerUpdate,
|
||||||
data => {
|
data => {
|
||||||
|
|
@ -39,7 +39,7 @@ function playerUpdateThrottle(
|
||||||
// )
|
// )
|
||||||
// }
|
// }
|
||||||
|
|
||||||
function playerOnlineInfo(player: LuaPlayer, data: KafkatorioPacketData2.PlayerUpdate) {
|
function playerOnlineInfo(player: LuaPlayer, data: KafkatorioPacketData.PlayerUpdate) {
|
||||||
data.lastOnline = player.last_online
|
data.lastOnline = player.last_online
|
||||||
data.onlineTime = player.online_time
|
data.onlineTime = player.online_time
|
||||||
data.afkTime = player.afk_time
|
data.afkTime = player.afk_time
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,24 @@
|
||||||
import {Data, DoubleSettingDefinition} from "typed-factorio/settings/types"
|
import {Data, DoubleSettingDefinition} from "typed-factorio/settings/types"
|
||||||
import {KafkatorioKeyedPacketData, KafkatorioKeyedPacketTypes} from "../types";
|
import {KafkatorioKeyedPacketData, KafkatorioKeyedPacketTypes} from "../types";
|
||||||
import {KafkatorioPacketData2} from "../../generated/kafkatorio-schema/kafkatorio-schema";
|
import {KafkatorioPacketData} from "../../generated/kafkatorio-schema/kafkatorio-schema";
|
||||||
|
|
||||||
export class KafkatorioSettingsConfig {
|
export class KafkatorioSettingsConfig {
|
||||||
|
|
||||||
|
|
||||||
private static eventCacheExpirationDefaultSeconds: Record<KafkatorioKeyedPacketTypes, double> = {
|
private static eventCacheExpirationDefaultSeconds: Record<KafkatorioKeyedPacketTypes, double> = {
|
||||||
"dev.adamko.kafkatorio.schema2.PlayerUpdate": 0.5,
|
"dev.adamko.kafkatorio.schema.packets.PlayerUpdate": 0.5,
|
||||||
"dev.adamko.kafkatorio.schema2.MapChunkUpdate": 30,
|
"dev.adamko.kafkatorio.schema.packets.MapChunkUpdate": 30,
|
||||||
"dev.adamko.kafkatorio.schema2.EntityUpdate": 5,
|
"dev.adamko.kafkatorio.schema.packets.EntityUpdate": 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private eventCacheExpirationTicks: Record<KafkatorioKeyedPacketTypes, double> = {
|
private eventCacheExpirationTicks: Record<KafkatorioKeyedPacketTypes, double> = {
|
||||||
"dev.adamko.kafkatorio.schema2.PlayerUpdate":
|
"dev.adamko.kafkatorio.schema.packets.PlayerUpdate":
|
||||||
KafkatorioSettingsConfig.eventCacheExpirationDefaultSeconds[KafkatorioPacketData2.Type.PlayerUpdate],
|
KafkatorioSettingsConfig.eventCacheExpirationDefaultSeconds[KafkatorioPacketData.Type.PlayerUpdate],
|
||||||
"dev.adamko.kafkatorio.schema2.MapChunkUpdate":
|
"dev.adamko.kafkatorio.schema.packets.MapChunkUpdate":
|
||||||
KafkatorioSettingsConfig.eventCacheExpirationDefaultSeconds[KafkatorioPacketData2.Type.MapChunkUpdate],
|
KafkatorioSettingsConfig.eventCacheExpirationDefaultSeconds[KafkatorioPacketData.Type.MapChunkUpdate],
|
||||||
"dev.adamko.kafkatorio.schema2.EntityUpdate":
|
"dev.adamko.kafkatorio.schema.packets.EntityUpdate":
|
||||||
KafkatorioSettingsConfig.eventCacheExpirationDefaultSeconds[KafkatorioPacketData2.Type.EntityUpdate],
|
KafkatorioSettingsConfig.eventCacheExpirationDefaultSeconds[KafkatorioPacketData.Type.EntityUpdate],
|
||||||
}
|
}
|
||||||
|
|
||||||
public getEventCacheExpirationTicks(packet: KafkatorioKeyedPacketData): uint {
|
public getEventCacheExpirationTicks(packet: KafkatorioKeyedPacketData): uint {
|
||||||
|
|
@ -26,9 +26,9 @@ export class KafkatorioSettingsConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static types: KafkatorioKeyedPacketTypes[] = [
|
private static types: KafkatorioKeyedPacketTypes[] = [
|
||||||
KafkatorioPacketData2.Type.PlayerUpdate,
|
KafkatorioPacketData.Type.PlayerUpdate,
|
||||||
KafkatorioPacketData2.Type.MapChunkUpdate,
|
KafkatorioPacketData.Type.MapChunkUpdate,
|
||||||
KafkatorioPacketData2.Type.EntityUpdate,
|
KafkatorioPacketData.Type.EntityUpdate,
|
||||||
]
|
]
|
||||||
|
|
||||||
public loadSettings(): void {
|
public loadSettings(): void {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {KafkatorioPacketData2} from "../generated/kafkatorio-schema/kafkatorio-schema";
|
import {KafkatorioPacketData} from "../generated/kafkatorio-schema/kafkatorio-schema";
|
||||||
|
|
||||||
export type EventName = keyof typeof defines.events
|
export type EventName = keyof typeof defines.events
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ type NonNullableKeys<TYPE> = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type KafkatorioKeyedPacketData = Extract<KafkatorioPacketData2, { key: object }>
|
type KafkatorioKeyedPacketData = Extract<KafkatorioPacketData, { key: object }>
|
||||||
|
|
||||||
type KafkatorioKeyedPacketTypes = KafkatorioKeyedPacketData["type"];
|
type KafkatorioKeyedPacketTypes = KafkatorioKeyedPacketData["type"];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "~14.19.1"
|
"node": "~14.19.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lua-types": "^2.11.0",
|
"lua-types": "^2.11.0",
|
||||||
"typescript-to-lua": "1.4.3",
|
"typescript-to-lua": "1.4.3",
|
||||||
|
|
@ -18,7 +19,10 @@
|
||||||
},
|
},
|
||||||
"// @types/node": "^12.0.8",
|
"// @types/node": "^12.0.8",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"peerDependencies": {},
|
"peerDependencies": {
|
||||||
"optionalDependencies": {},
|
},
|
||||||
"bundledDependencies": []
|
"optionalDependencies": {
|
||||||
|
},
|
||||||
|
"bundledDependencies": [
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
package dev.adamko.kafkatorio.schema2
|
package dev.adamko.kafkatorio.schema.packets
|
||||||
|
|
||||||
import dev.adamko.kafkatorio.schema.common.Tick
|
import dev.adamko.kafkatorio.schema.common.Tick
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class KafkatorioPacket2(
|
data class KafkatorioPacket(
|
||||||
val modVersion: String,
|
val modVersion: String,
|
||||||
val tick: Tick,
|
val tick: Tick,
|
||||||
val data: KafkatorioPacketData2,
|
val data: KafkatorioPacketData,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
sealed class KafkatorioPacketData2
|
sealed class KafkatorioPacketData
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
package dev.adamko.kafkatorio.schema2
|
package dev.adamko.kafkatorio.schema.packets
|
||||||
|
|
||||||
import dev.adamko.kafkatorio.schema.common.PlayerIndex
|
import dev.adamko.kafkatorio.schema.common.PlayerIndex
|
||||||
import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
||||||
import dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2
|
import dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
|
||||||
/** No key, no caching. Must be sent instantly. */
|
/** No key, no caching. Must be sent instantly. */
|
||||||
@Serializable
|
@Serializable
|
||||||
sealed class KafkatorioInstantPacketData2 : KafkatorioPacketData2()
|
sealed class KafkatorioInstantPacketData : KafkatorioPacketData()
|
||||||
|
|
||||||
|
|
||||||
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||||
|
|
@ -20,7 +20,7 @@ data class ConfigurationUpdate(
|
||||||
val allMods: List<ConfigurationUpdateModData>,
|
val allMods: List<ConfigurationUpdateModData>,
|
||||||
val modStartupSettingsChange: Boolean,
|
val modStartupSettingsChange: Boolean,
|
||||||
val migrationApplied: Boolean,
|
val migrationApplied: Boolean,
|
||||||
) : KafkatorioInstantPacketData2() {
|
) : KafkatorioInstantPacketData() {
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class ConfigurationUpdateGameData(
|
data class ConfigurationUpdateGameData(
|
||||||
|
|
@ -41,7 +41,7 @@ data class ConfigurationUpdate(
|
||||||
data class ConsoleChatUpdate(
|
data class ConsoleChatUpdate(
|
||||||
val authorPlayerIndex: PlayerIndex?,
|
val authorPlayerIndex: PlayerIndex?,
|
||||||
val content: String,
|
val content: String,
|
||||||
) : KafkatorioInstantPacketData2()
|
) : KafkatorioInstantPacketData()
|
||||||
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
|
@ -49,13 +49,13 @@ data class ConsoleCommandUpdate(
|
||||||
val authorPlayerIndex: PlayerIndex?,
|
val authorPlayerIndex: PlayerIndex?,
|
||||||
val command: String,
|
val command: String,
|
||||||
val parameters: String,
|
val parameters: String,
|
||||||
) : KafkatorioInstantPacketData2()
|
) : KafkatorioInstantPacketData()
|
||||||
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class PrototypesUpdate(
|
data class PrototypesUpdate(
|
||||||
val prototypes: List<FactorioPrototype2>,
|
val prototypes: List<FactorioPrototype>,
|
||||||
) : KafkatorioInstantPacketData2()
|
) : KafkatorioInstantPacketData()
|
||||||
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
|
@ -63,7 +63,7 @@ data class SurfaceUpdate(
|
||||||
val index: SurfaceIndex,
|
val index: SurfaceIndex,
|
||||||
val daytime: Double,
|
val daytime: Double,
|
||||||
val name: String,
|
val name: String,
|
||||||
) : KafkatorioInstantPacketData2()
|
) : KafkatorioInstantPacketData()
|
||||||
|
|
||||||
|
|
||||||
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package dev.adamko.kafkatorio.schema2
|
package dev.adamko.kafkatorio.schema.packets
|
||||||
|
|
||||||
import dev.adamko.kafkatorio.schema.common.Colour
|
import dev.adamko.kafkatorio.schema.common.Colour
|
||||||
import dev.adamko.kafkatorio.schema.common.EntityIdentifiers
|
import dev.adamko.kafkatorio.schema.common.EntityIdentifiers
|
||||||
|
|
@ -17,7 +17,7 @@ import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
/** Has a key, so it can be debounced */
|
/** Has a key, so it can be debounced */
|
||||||
@Serializable
|
@Serializable
|
||||||
sealed class KafkatorioKeyedPacketData2 : KafkatorioPacketData2() {
|
sealed class KafkatorioKeyedPacketData : KafkatorioPacketData() {
|
||||||
/** Count how many events this packet is aggregating data from */
|
/** Count how many events this packet is aggregating data from */
|
||||||
abstract val key: KafkatorioKeyedPacketKey2
|
abstract val key: KafkatorioKeyedPacketKey2
|
||||||
abstract val eventCounts: Map<String, UInt>?
|
abstract val eventCounts: Map<String, UInt>?
|
||||||
|
|
@ -54,7 +54,7 @@ data class EntityUpdate(
|
||||||
val localisedDescription: String? = null,
|
val localisedDescription: String? = null,
|
||||||
val localisedName: String? = null,
|
val localisedName: String? = null,
|
||||||
val prototype: PrototypeName? = null,
|
val prototype: PrototypeName? = null,
|
||||||
) : KafkatorioKeyedPacketData2()
|
) : KafkatorioKeyedPacketData()
|
||||||
|
|
||||||
|
|
||||||
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||||
|
|
@ -79,7 +79,7 @@ data class MapChunkUpdate(
|
||||||
/** updated tiles - might be partial and not all tiles in the chunk */
|
/** updated tiles - might be partial and not all tiles in the chunk */
|
||||||
val tileDictionary: MapTileDictionary? = null,
|
val tileDictionary: MapTileDictionary? = null,
|
||||||
val isDeleted: Boolean? = null,
|
val isDeleted: Boolean? = null,
|
||||||
) : KafkatorioKeyedPacketData2()
|
) : KafkatorioKeyedPacketData()
|
||||||
|
|
||||||
|
|
||||||
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||||
|
|
@ -120,7 +120,7 @@ data class PlayerUpdate(
|
||||||
val disconnectReason: String? = null,
|
val disconnectReason: String? = null,
|
||||||
/** `true` when a player is removed (deleted) from the game */
|
/** `true` when a player is removed (deleted) from the game */
|
||||||
val isRemoved: Boolean? = null,
|
val isRemoved: Boolean? = null,
|
||||||
) : KafkatorioKeyedPacketData2()
|
) : KafkatorioKeyedPacketData()
|
||||||
|
|
||||||
|
|
||||||
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||||
|
|
@ -7,7 +7,7 @@ import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
sealed class FactorioPrototype2 {
|
sealed class FactorioPrototype {
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class MapTile(
|
data class MapTile(
|
||||||
|
|
@ -19,5 +19,5 @@ sealed class FactorioPrototype2 {
|
||||||
val order: String,
|
val order: String,
|
||||||
/** Can the tile be mined for resources? */
|
/** Can the tile be mined for resources? */
|
||||||
val canBeMined: Boolean,
|
val canBeMined: Boolean,
|
||||||
) : FactorioPrototype2()
|
) : FactorioPrototype()
|
||||||
}
|
}
|
||||||
|
|
@ -6,14 +6,12 @@ import dev.adamko.kafkatorio.schema.common.PrototypeName
|
||||||
import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
||||||
import dev.adamko.kafkatorio.schema.common.Tick
|
import dev.adamko.kafkatorio.schema.common.Tick
|
||||||
import dev.adamko.kafkatorio.schema.jsonMapperKafkatorio
|
import dev.adamko.kafkatorio.schema.jsonMapperKafkatorio
|
||||||
import dev.adamko.kafkatorio.schema2.KafkatorioPacket2
|
import dev.adamko.kafkatorio.schema.packets.KafkatorioPacket
|
||||||
import dev.adamko.kafkatorio.schema2.MapChunkUpdate
|
import dev.adamko.kafkatorio.schema.packets.MapChunkUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.MapChunkUpdateKey
|
import dev.adamko.kafkatorio.schema.packets.MapChunkUpdateKey
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
import kotlin.math.exp
|
|
||||||
import kotlinx.serialization.decodeFromString
|
import kotlinx.serialization.decodeFromString
|
||||||
import kotlinx.serialization.encodeToString
|
|
||||||
|
|
||||||
class MapChunkUpdateTest : FunSpec({
|
class MapChunkUpdateTest : FunSpec({
|
||||||
|
|
||||||
|
|
@ -22,7 +20,7 @@ class MapChunkUpdateTest : FunSpec({
|
||||||
val json = """
|
val json = """
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"type": "dev.adamko.kafkatorio.schema2.MapChunkUpdate",
|
"type": "dev.adamko.kafkatorio.schema.packets.MapChunkUpdate",
|
||||||
"key": {
|
"key": {
|
||||||
"surfaceIndex": 1,
|
"surfaceIndex": 1,
|
||||||
"chunkPosition": [
|
"chunkPosition": [
|
||||||
|
|
@ -57,7 +55,7 @@ class MapChunkUpdateTest : FunSpec({
|
||||||
}
|
}
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
|
|
||||||
val expected = KafkatorioPacket2(
|
val expected = KafkatorioPacket(
|
||||||
tick = Tick(36u),
|
tick = Tick(36u),
|
||||||
modVersion = "0.4.0",
|
modVersion = "0.4.0",
|
||||||
data = MapChunkUpdate(
|
data = MapChunkUpdate(
|
||||||
|
|
@ -86,7 +84,7 @@ class MapChunkUpdateTest : FunSpec({
|
||||||
)
|
)
|
||||||
|
|
||||||
test("decode") {
|
test("decode") {
|
||||||
val packet: KafkatorioPacket2 = jsonMapperKafkatorio.decodeFromString(json)
|
val packet: KafkatorioPacket = jsonMapperKafkatorio.decodeFromString(json)
|
||||||
packet shouldBe expected
|
packet shouldBe expected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ package dev.adamko.kafkatorio.events.schema
|
||||||
import dev.adamko.kafkatorio.schema.common.Colour
|
import dev.adamko.kafkatorio.schema.common.Colour
|
||||||
import dev.adamko.kafkatorio.schema.common.PrototypeName
|
import dev.adamko.kafkatorio.schema.common.PrototypeName
|
||||||
import dev.adamko.kafkatorio.schema.jsonMapperKafkatorio
|
import dev.adamko.kafkatorio.schema.jsonMapperKafkatorio
|
||||||
import dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2
|
import dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype
|
||||||
import dev.adamko.kafkatorio.schema2.KafkatorioPacket2
|
import dev.adamko.kafkatorio.schema.packets.KafkatorioPacket
|
||||||
import dev.adamko.kafkatorio.schema2.PrototypesUpdate
|
import dev.adamko.kafkatorio.schema.packets.PrototypesUpdate
|
||||||
import io.kotest.core.spec.style.BehaviorSpec
|
import io.kotest.core.spec.style.BehaviorSpec
|
||||||
import io.kotest.inspectors.forOne
|
import io.kotest.inspectors.forOne
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
|
|
@ -20,10 +20,10 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"modVersion": "0.2.4",
|
"modVersion": "0.2.4",
|
||||||
"tick": 534,
|
"tick": 534,
|
||||||
"data": {
|
"data": {
|
||||||
"type": "dev.adamko.kafkatorio.schema2.PrototypesUpdate",
|
"type": "dev.adamko.kafkatorio.schema.packets.PrototypesUpdate",
|
||||||
"prototypes": [
|
"prototypes": [
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "tile-unknown",
|
"name": "tile-unknown",
|
||||||
"order": "z-a",
|
"order": "z-a",
|
||||||
"layer": 0,
|
"layer": 0,
|
||||||
|
|
@ -37,7 +37,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
|
|
||||||
Then("expect can be parsed") {
|
Then("expect can be parsed") {
|
||||||
val data = jsonMapperKafkatorio.decodeFromString<KafkatorioPacket2>(raw)
|
val data = jsonMapperKafkatorio.decodeFromString<KafkatorioPacket>(raw)
|
||||||
println(data)
|
println(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,10 +50,10 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"modVersion": "0.3.2",
|
"modVersion": "0.3.2",
|
||||||
"tick": 534,
|
"tick": 534,
|
||||||
"data": {
|
"data": {
|
||||||
"type": "dev.adamko.kafkatorio.schema2.PrototypesUpdate",
|
"type": "dev.adamko.kafkatorio.schema.packets.PrototypesUpdate",
|
||||||
"prototypes": [
|
"prototypes": [
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "stone-path",
|
"name": "stone-path",
|
||||||
"order": "a[artificial]-a[tier-1]-a[stone-path]",
|
"order": "a[artificial]-a[tier-1]-a[stone-path]",
|
||||||
"layer": 60,
|
"layer": 60,
|
||||||
|
|
@ -64,7 +64,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": true
|
"canBeMined": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "concrete",
|
"name": "concrete",
|
||||||
"order": "a[artificial]-b[tier-2]-a[concrete]",
|
"order": "a[artificial]-b[tier-2]-a[concrete]",
|
||||||
"layer": 61,
|
"layer": 61,
|
||||||
|
|
@ -75,7 +75,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": true
|
"canBeMined": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "hazard-concrete-left",
|
"name": "hazard-concrete-left",
|
||||||
"order": "a[artificial]-b[tier-2]-b[hazard-concrete-left]",
|
"order": "a[artificial]-b[tier-2]-b[hazard-concrete-left]",
|
||||||
"layer": 62,
|
"layer": 62,
|
||||||
|
|
@ -86,7 +86,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": true
|
"canBeMined": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "hazard-concrete-right",
|
"name": "hazard-concrete-right",
|
||||||
"order": "a[artificial]-b[tier-2]-c[hazard-concrete-right]",
|
"order": "a[artificial]-b[tier-2]-c[hazard-concrete-right]",
|
||||||
"layer": 62,
|
"layer": 62,
|
||||||
|
|
@ -97,7 +97,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": true
|
"canBeMined": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "refined-concrete",
|
"name": "refined-concrete",
|
||||||
"order": "a[artificial]-c[tier-3]-a[refined-concrete]",
|
"order": "a[artificial]-c[tier-3]-a[refined-concrete]",
|
||||||
"layer": 64,
|
"layer": 64,
|
||||||
|
|
@ -108,7 +108,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": true
|
"canBeMined": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "refined-hazard-concrete-left",
|
"name": "refined-hazard-concrete-left",
|
||||||
"order": "a[artificial]-c[tier-3]-b[refined-hazard-concrete-left]",
|
"order": "a[artificial]-c[tier-3]-b[refined-hazard-concrete-left]",
|
||||||
"layer": 65,
|
"layer": 65,
|
||||||
|
|
@ -119,7 +119,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": true
|
"canBeMined": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "refined-hazard-concrete-right",
|
"name": "refined-hazard-concrete-right",
|
||||||
"order": "a[artificial]-c[tier-3]-c[refined-hazard-concrete-right]",
|
"order": "a[artificial]-c[tier-3]-c[refined-hazard-concrete-right]",
|
||||||
"layer": 65,
|
"layer": 65,
|
||||||
|
|
@ -130,7 +130,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": true
|
"canBeMined": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "landfill",
|
"name": "landfill",
|
||||||
"order": "a[artificial]-d[utility]-a[landfill]",
|
"order": "a[artificial]-d[utility]-a[landfill]",
|
||||||
"layer": 57,
|
"layer": 57,
|
||||||
|
|
@ -141,7 +141,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "acid-refined-concrete",
|
"name": "acid-refined-concrete",
|
||||||
"order": "a[artificial]-e[color-concrete]-acid",
|
"order": "a[artificial]-e[color-concrete]-acid",
|
||||||
"layer": 97,
|
"layer": 97,
|
||||||
|
|
@ -152,7 +152,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "black-refined-concrete",
|
"name": "black-refined-concrete",
|
||||||
"order": "a[artificial]-e[color-concrete]-black",
|
"order": "a[artificial]-e[color-concrete]-black",
|
||||||
"layer": 88,
|
"layer": 88,
|
||||||
|
|
@ -163,7 +163,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "blue-refined-concrete",
|
"name": "blue-refined-concrete",
|
||||||
"order": "a[artificial]-e[color-concrete]-blue",
|
"order": "a[artificial]-e[color-concrete]-blue",
|
||||||
"layer": 73,
|
"layer": 73,
|
||||||
|
|
@ -174,7 +174,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "brown-refined-concrete",
|
"name": "brown-refined-concrete",
|
||||||
"order": "a[artificial]-e[color-concrete]-brown",
|
"order": "a[artificial]-e[color-concrete]-brown",
|
||||||
"layer": 91,
|
"layer": 91,
|
||||||
|
|
@ -185,7 +185,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "cyan-refined-concrete",
|
"name": "cyan-refined-concrete",
|
||||||
"order": "a[artificial]-e[color-concrete]-cyan",
|
"order": "a[artificial]-e[color-concrete]-cyan",
|
||||||
"layer": 94,
|
"layer": 94,
|
||||||
|
|
@ -196,7 +196,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "green-refined-concrete",
|
"name": "green-refined-concrete",
|
||||||
"order": "a[artificial]-e[color-concrete]-green",
|
"order": "a[artificial]-e[color-concrete]-green",
|
||||||
"layer": 70,
|
"layer": 70,
|
||||||
|
|
@ -207,7 +207,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "orange-refined-concrete",
|
"name": "orange-refined-concrete",
|
||||||
"order": "a[artificial]-e[color-concrete]-orange",
|
"order": "a[artificial]-e[color-concrete]-orange",
|
||||||
"layer": 76,
|
"layer": 76,
|
||||||
|
|
@ -218,7 +218,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "pink-refined-concrete",
|
"name": "pink-refined-concrete",
|
||||||
"order": "a[artificial]-e[color-concrete]-pink",
|
"order": "a[artificial]-e[color-concrete]-pink",
|
||||||
"layer": 82,
|
"layer": 82,
|
||||||
|
|
@ -229,7 +229,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "purple-refined-concrete",
|
"name": "purple-refined-concrete",
|
||||||
"order": "a[artificial]-e[color-concrete]-purple",
|
"order": "a[artificial]-e[color-concrete]-purple",
|
||||||
"layer": 85,
|
"layer": 85,
|
||||||
|
|
@ -240,7 +240,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "red-refined-concrete",
|
"name": "red-refined-concrete",
|
||||||
"order": "a[artificial]-e[color-concrete]-red",
|
"order": "a[artificial]-e[color-concrete]-red",
|
||||||
"layer": 67,
|
"layer": 67,
|
||||||
|
|
@ -251,7 +251,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "yellow-refined-concrete",
|
"name": "yellow-refined-concrete",
|
||||||
"order": "a[artificial]-e[color-concrete]-yellow",
|
"order": "a[artificial]-e[color-concrete]-yellow",
|
||||||
"layer": 79,
|
"layer": 79,
|
||||||
|
|
@ -262,7 +262,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "grass-1",
|
"name": "grass-1",
|
||||||
"order": "b[natural]-a[grass]-a[grass-1]",
|
"order": "b[natural]-a[grass]-a[grass-1]",
|
||||||
"layer": 26,
|
"layer": 26,
|
||||||
|
|
@ -273,7 +273,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "grass-2",
|
"name": "grass-2",
|
||||||
"order": "b[natural]-a[grass]-b[grass-2]",
|
"order": "b[natural]-a[grass]-b[grass-2]",
|
||||||
"layer": 28,
|
"layer": 28,
|
||||||
|
|
@ -284,7 +284,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "grass-3",
|
"name": "grass-3",
|
||||||
"order": "b[natural]-a[grass]-c[grass-3]",
|
"order": "b[natural]-a[grass]-c[grass-3]",
|
||||||
"layer": 29,
|
"layer": 29,
|
||||||
|
|
@ -295,7 +295,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "grass-4",
|
"name": "grass-4",
|
||||||
"order": "b[natural]-a[grass]-d[grass-4]",
|
"order": "b[natural]-a[grass]-d[grass-4]",
|
||||||
"layer": 30,
|
"layer": 30,
|
||||||
|
|
@ -306,7 +306,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "dry-dirt",
|
"name": "dry-dirt",
|
||||||
"order": "b[natural]-b[dirt]-a[dry-dirt]",
|
"order": "b[natural]-b[dirt]-a[dry-dirt]",
|
||||||
"layer": 18,
|
"layer": 18,
|
||||||
|
|
@ -317,7 +317,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "dirt-1",
|
"name": "dirt-1",
|
||||||
"order": "b[natural]-b[dirt]-b[dirt-1]",
|
"order": "b[natural]-b[dirt]-b[dirt-1]",
|
||||||
"layer": 19,
|
"layer": 19,
|
||||||
|
|
@ -328,7 +328,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "dirt-2",
|
"name": "dirt-2",
|
||||||
"order": "b[natural]-b[dirt]-c[dirt-2]",
|
"order": "b[natural]-b[dirt]-c[dirt-2]",
|
||||||
"layer": 20,
|
"layer": 20,
|
||||||
|
|
@ -339,7 +339,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "dirt-3",
|
"name": "dirt-3",
|
||||||
"order": "b[natural]-b[dirt]-d[dirt-3]",
|
"order": "b[natural]-b[dirt]-d[dirt-3]",
|
||||||
"layer": 21,
|
"layer": 21,
|
||||||
|
|
@ -350,7 +350,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "dirt-4",
|
"name": "dirt-4",
|
||||||
"order": "b[natural]-b[dirt]-e[dirt-4]",
|
"order": "b[natural]-b[dirt]-e[dirt-4]",
|
||||||
"layer": 22,
|
"layer": 22,
|
||||||
|
|
@ -361,7 +361,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "dirt-5",
|
"name": "dirt-5",
|
||||||
"order": "b[natural]-b[dirt]-f[dirt-5]",
|
"order": "b[natural]-b[dirt]-f[dirt-5]",
|
||||||
"layer": 23,
|
"layer": 23,
|
||||||
|
|
@ -372,7 +372,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "dirt-6",
|
"name": "dirt-6",
|
||||||
"order": "b[natural]-b[dirt]-g[dirt-6]",
|
"order": "b[natural]-b[dirt]-g[dirt-6]",
|
||||||
"layer": 24,
|
"layer": 24,
|
||||||
|
|
@ -383,7 +383,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "dirt-7",
|
"name": "dirt-7",
|
||||||
"order": "b[natural]-b[dirt]-h[dirt-7]",
|
"order": "b[natural]-b[dirt]-h[dirt-7]",
|
||||||
"layer": 25,
|
"layer": 25,
|
||||||
|
|
@ -394,7 +394,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "sand-1",
|
"name": "sand-1",
|
||||||
"order": "b[natural]-c[sand]-a[sand-1]",
|
"order": "b[natural]-c[sand]-a[sand-1]",
|
||||||
"layer": 8,
|
"layer": 8,
|
||||||
|
|
@ -405,7 +405,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "sand-2",
|
"name": "sand-2",
|
||||||
"order": "b[natural]-c[sand]-b[sand-2]",
|
"order": "b[natural]-c[sand]-b[sand-2]",
|
||||||
"layer": 9,
|
"layer": 9,
|
||||||
|
|
@ -416,7 +416,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "sand-3",
|
"name": "sand-3",
|
||||||
"order": "b[natural]-c[sand]-c[sand-3]",
|
"order": "b[natural]-c[sand]-c[sand-3]",
|
||||||
"layer": 10,
|
"layer": 10,
|
||||||
|
|
@ -427,7 +427,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "red-desert-0",
|
"name": "red-desert-0",
|
||||||
"order": "b[natural]-d[red-desert]-a[red-desert-0]",
|
"order": "b[natural]-d[red-desert]-a[red-desert-0]",
|
||||||
"layer": 31,
|
"layer": 31,
|
||||||
|
|
@ -438,7 +438,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "red-desert-1",
|
"name": "red-desert-1",
|
||||||
"order": "b[natural]-d[red-desert]-b[red-desert-1]",
|
"order": "b[natural]-d[red-desert]-b[red-desert-1]",
|
||||||
"layer": 14,
|
"layer": 14,
|
||||||
|
|
@ -449,7 +449,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "red-desert-2",
|
"name": "red-desert-2",
|
||||||
"order": "b[natural]-d[red-desert]-c[red-desert-2]",
|
"order": "b[natural]-d[red-desert]-c[red-desert-2]",
|
||||||
"layer": 15,
|
"layer": 15,
|
||||||
|
|
@ -460,7 +460,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "red-desert-3",
|
"name": "red-desert-3",
|
||||||
"order": "b[natural]-d[red-desert]-d[red-desert-3]",
|
"order": "b[natural]-d[red-desert]-d[red-desert-3]",
|
||||||
"layer": 16,
|
"layer": 16,
|
||||||
|
|
@ -471,7 +471,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "water",
|
"name": "water",
|
||||||
"order": "c[water]-a[water]",
|
"order": "c[water]-a[water]",
|
||||||
"layer": 3,
|
"layer": 3,
|
||||||
|
|
@ -486,7 +486,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "deepwater",
|
"name": "deepwater",
|
||||||
"order": "c[water]-b[deep-water]",
|
"order": "c[water]-b[deep-water]",
|
||||||
"layer": 3,
|
"layer": 3,
|
||||||
|
|
@ -501,7 +501,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "water-green",
|
"name": "water-green",
|
||||||
"order": "c[water]-c[water-green]",
|
"order": "c[water]-c[water-green]",
|
||||||
"layer": 3,
|
"layer": 3,
|
||||||
|
|
@ -516,7 +516,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "deepwater-green",
|
"name": "deepwater-green",
|
||||||
"order": "c[water]-d[deepwater-green]",
|
"order": "c[water]-d[deepwater-green]",
|
||||||
"layer": 3,
|
"layer": 3,
|
||||||
|
|
@ -531,7 +531,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "water-shallow",
|
"name": "water-shallow",
|
||||||
"order": "c[water]-e[water-shallow]",
|
"order": "c[water]-e[water-shallow]",
|
||||||
"layer": 6,
|
"layer": 6,
|
||||||
|
|
@ -545,7 +545,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "water-mud",
|
"name": "water-mud",
|
||||||
"order": "c[water]-g[water-mud]",
|
"order": "c[water]-g[water-mud]",
|
||||||
"layer": 7,
|
"layer": 7,
|
||||||
|
|
@ -559,7 +559,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "nuclear-ground",
|
"name": "nuclear-ground",
|
||||||
"order": "d[destruction]-a[nuclear]-a[nuclear-ground]",
|
"order": "d[destruction]-a[nuclear]-a[nuclear-ground]",
|
||||||
"layer": 33,
|
"layer": 33,
|
||||||
|
|
@ -570,7 +570,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "water-wube",
|
"name": "water-wube",
|
||||||
"order": "x[wube]-a[water-wube]",
|
"order": "x[wube]-a[water-wube]",
|
||||||
"layer": 2,
|
"layer": 2,
|
||||||
|
|
@ -585,7 +585,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "tile-unknown",
|
"name": "tile-unknown",
|
||||||
"order": "z-a",
|
"order": "z-a",
|
||||||
"layer": 0,
|
"layer": 0,
|
||||||
|
|
@ -595,7 +595,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "out-of-map",
|
"name": "out-of-map",
|
||||||
"order": "z[other]-a[out-of-map]",
|
"order": "z[other]-a[out-of-map]",
|
||||||
"layer": 0,
|
"layer": 0,
|
||||||
|
|
@ -613,7 +613,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "lab-dark-1",
|
"name": "lab-dark-1",
|
||||||
"order": "z[other]-b[lab]-a[lab-dark-1]",
|
"order": "z[other]-b[lab]-a[lab-dark-1]",
|
||||||
"layer": 70,
|
"layer": 70,
|
||||||
|
|
@ -624,7 +624,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "lab-dark-2",
|
"name": "lab-dark-2",
|
||||||
"order": "z[other]-b[lab]-b[lab-dark-2]",
|
"order": "z[other]-b[lab]-b[lab-dark-2]",
|
||||||
"layer": 70,
|
"layer": 70,
|
||||||
|
|
@ -635,7 +635,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "lab-white",
|
"name": "lab-white",
|
||||||
"order": "z[other]-b[lab]-c[lab-white]",
|
"order": "z[other]-b[lab]-c[lab-white]",
|
||||||
"layer": 70,
|
"layer": 70,
|
||||||
|
|
@ -646,7 +646,7 @@ class PrototypesTest : BehaviorSpec({
|
||||||
"canBeMined": false
|
"canBeMined": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2.MapTile",
|
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||||
"name": "tutorial-grid",
|
"name": "tutorial-grid",
|
||||||
"order": "z[other]-c[tutorial]-a[tutorial-grid]",
|
"order": "z[other]-c[tutorial]-a[tutorial-grid]",
|
||||||
"layer": 55,
|
"layer": 55,
|
||||||
|
|
@ -662,13 +662,13 @@ class PrototypesTest : BehaviorSpec({
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
|
|
||||||
Then("expect can be parsed") {
|
Then("expect can be parsed") {
|
||||||
val packet: KafkatorioPacket2 = jsonMapperKafkatorio.decodeFromString(raw)
|
val packet: KafkatorioPacket = jsonMapperKafkatorio.decodeFromString(raw)
|
||||||
// println(packet)
|
// println(packet)
|
||||||
|
|
||||||
packet.data.shouldBeInstanceOf<PrototypesUpdate>()
|
packet.data.shouldBeInstanceOf<PrototypesUpdate>()
|
||||||
.prototypes
|
.prototypes
|
||||||
.forOne {
|
.forOne {
|
||||||
it.shouldBeInstanceOf<FactorioPrototype2.MapTile>()
|
it.shouldBeInstanceOf<FactorioPrototype.MapTile>()
|
||||||
it.name shouldBe PrototypeName("tutorial-grid")
|
it.name shouldBe PrototypeName("tutorial-grid")
|
||||||
it.order shouldBe "z[other]-c[tutorial]-a[tutorial-grid]"
|
it.order shouldBe "z[other]-c[tutorial]-a[tutorial-grid]"
|
||||||
it.layer shouldBe 55u
|
it.layer shouldBe 55u
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@ import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
||||||
import dev.adamko.kafkatorio.schema.common.Tick
|
import dev.adamko.kafkatorio.schema.common.Tick
|
||||||
import dev.adamko.kafkatorio.schema.common.UnitNumber
|
import dev.adamko.kafkatorio.schema.common.UnitNumber
|
||||||
import dev.adamko.kafkatorio.schema.jsonMapperKafkatorio
|
import dev.adamko.kafkatorio.schema.jsonMapperKafkatorio
|
||||||
import dev.adamko.kafkatorio.schema2.KafkatorioPacket2
|
import dev.adamko.kafkatorio.schema.packets.KafkatorioPacket
|
||||||
import dev.adamko.kafkatorio.schema2.PlayerUpdate
|
import dev.adamko.kafkatorio.schema.packets.PlayerUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.PlayerUpdateKey
|
import dev.adamko.kafkatorio.schema.packets.PlayerUpdateKey
|
||||||
import dev.adamko.kafkatorio.schema2.SurfaceUpdate
|
import dev.adamko.kafkatorio.schema.packets.SurfaceUpdate
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
import io.kotest.matchers.shouldBe
|
import io.kotest.matchers.shouldBe
|
||||||
import kotlinx.serialization.decodeFromString
|
import kotlinx.serialization.decodeFromString
|
||||||
|
|
@ -27,7 +27,7 @@ class UpdatePacketsTest : FunSpec({
|
||||||
"tick": 66,
|
"tick": 66,
|
||||||
"modVersion": "0.3.2",
|
"modVersion": "0.3.2",
|
||||||
"data": {
|
"data": {
|
||||||
"type": "dev.adamko.kafkatorio.schema2.PlayerUpdate",
|
"type": "dev.adamko.kafkatorio.schema.packets.PlayerUpdate",
|
||||||
"key": {"index": 1},
|
"key": {"index": 1},
|
||||||
"afkTime": 0,
|
"afkTime": 0,
|
||||||
"chatColour": [1, 0.4, 0.6, 1],
|
"chatColour": [1, 0.4, 0.6, 1],
|
||||||
|
|
@ -54,9 +54,9 @@ class UpdatePacketsTest : FunSpec({
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
|
|
||||||
test("decode") {
|
test("decode") {
|
||||||
val packet: KafkatorioPacket2 = jsonMapperKafkatorio.decodeFromString(json)
|
val packet: KafkatorioPacket = jsonMapperKafkatorio.decodeFromString(json)
|
||||||
|
|
||||||
packet shouldBe KafkatorioPacket2(
|
packet shouldBe KafkatorioPacket(
|
||||||
modVersion = "0.3.2",
|
modVersion = "0.3.2",
|
||||||
tick = Tick(66u),
|
tick = Tick(66u),
|
||||||
data = PlayerUpdate(
|
data = PlayerUpdate(
|
||||||
|
|
@ -88,7 +88,7 @@ class UpdatePacketsTest : FunSpec({
|
||||||
}
|
}
|
||||||
|
|
||||||
test("encode") {
|
test("encode") {
|
||||||
val v = KafkatorioPacket2(
|
val v = KafkatorioPacket(
|
||||||
modVersion = "0.3.2",
|
modVersion = "0.3.2",
|
||||||
tick = Tick(66u),
|
tick = Tick(66u),
|
||||||
data = PlayerUpdate(
|
data = PlayerUpdate(
|
||||||
|
|
@ -124,7 +124,7 @@ class UpdatePacketsTest : FunSpec({
|
||||||
"modVersion": "0.3.2",
|
"modVersion": "0.3.2",
|
||||||
"tick": 66,
|
"tick": 66,
|
||||||
"data": {
|
"data": {
|
||||||
"type": "dev.adamko.kafkatorio.schema2.PlayerUpdate",
|
"type": "dev.adamko.kafkatorio.schema.packets.PlayerUpdate",
|
||||||
"key": {
|
"key": {
|
||||||
"index": 1
|
"index": 1
|
||||||
},
|
},
|
||||||
|
|
@ -151,7 +151,7 @@ class UpdatePacketsTest : FunSpec({
|
||||||
"tick": 227934,
|
"tick": 227934,
|
||||||
"modVersion": "0.3.2",
|
"modVersion": "0.3.2",
|
||||||
"data": {
|
"data": {
|
||||||
"type": "dev.adamko.kafkatorio.schema2.PlayerUpdate",
|
"type": "dev.adamko.kafkatorio.schema.packets.PlayerUpdate",
|
||||||
"key": {
|
"key": {
|
||||||
"index": 1
|
"index": 1
|
||||||
},
|
},
|
||||||
|
|
@ -172,9 +172,9 @@ class UpdatePacketsTest : FunSpec({
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
|
|
||||||
test("decode") {
|
test("decode") {
|
||||||
val packet: KafkatorioPacket2 = jsonMapperKafkatorio.decodeFromString(json)
|
val packet: KafkatorioPacket = jsonMapperKafkatorio.decodeFromString(json)
|
||||||
|
|
||||||
packet shouldBe KafkatorioPacket2(
|
packet shouldBe KafkatorioPacket(
|
||||||
modVersion = "0.3.2",
|
modVersion = "0.3.2",
|
||||||
tick = Tick(227934u),
|
tick = Tick(227934u),
|
||||||
data = PlayerUpdate(
|
data = PlayerUpdate(
|
||||||
|
|
@ -215,7 +215,7 @@ class UpdatePacketsTest : FunSpec({
|
||||||
val json = """
|
val json = """
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"type": "dev.adamko.kafkatorio.schema2.SurfaceUpdate",
|
"type": "dev.adamko.kafkatorio.schema.packets.SurfaceUpdate",
|
||||||
"name": "nauvis",
|
"name": "nauvis",
|
||||||
"index": 1,
|
"index": 1,
|
||||||
"daytime": 0.73
|
"daytime": 0.73
|
||||||
|
|
@ -225,7 +225,7 @@ class UpdatePacketsTest : FunSpec({
|
||||||
}
|
}
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
|
|
||||||
val expected = KafkatorioPacket2(
|
val expected = KafkatorioPacket(
|
||||||
tick = Tick(176000u),
|
tick = Tick(176000u),
|
||||||
modVersion = "0.3.2",
|
modVersion = "0.3.2",
|
||||||
data = SurfaceUpdate(
|
data = SurfaceUpdate(
|
||||||
|
|
@ -238,7 +238,7 @@ class UpdatePacketsTest : FunSpec({
|
||||||
println(jsonMapperKafkatorio.encodeToString(expected))
|
println(jsonMapperKafkatorio.encodeToString(expected))
|
||||||
|
|
||||||
test("decode") {
|
test("decode") {
|
||||||
val packet: KafkatorioPacket2 = jsonMapperKafkatorio.decodeFromString(json)
|
val packet: KafkatorioPacket = jsonMapperKafkatorio.decodeFromString(json)
|
||||||
packet shouldBe expected
|
packet shouldBe expected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package dev.adamko.kafkatorio.events.schema
|
package dev.adamko.kafkatorio.events.schema
|
||||||
|
|
||||||
import dev.adamko.kafkatorio.schema2.KafkatorioPacket2
|
import dev.adamko.kafkatorio.schema.packets.KafkatorioPacket
|
||||||
import dev.adamko.kxstsgen.KxsTsConfig
|
import dev.adamko.kxstsgen.KxsTsConfig
|
||||||
import dev.adamko.kxstsgen.KxsTsGenerator
|
import dev.adamko.kxstsgen.KxsTsGenerator
|
||||||
import dev.adamko.kxstsgen.core.TsDeclaration.TsTypeAlias
|
import dev.adamko.kxstsgen.core.TsDeclaration.TsTypeAlias
|
||||||
|
|
@ -36,7 +36,7 @@ fun main(args: Array<String>) {
|
||||||
)
|
)
|
||||||
|
|
||||||
val definitions = gen2.generate(
|
val definitions = gen2.generate(
|
||||||
KafkatorioPacket2.serializer(),
|
KafkatorioPacket.serializer(),
|
||||||
// KafkatorioKeyedPacketKey2.serializer(),
|
// KafkatorioKeyedPacketKey2.serializer(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
package dev.adamko.kafkatorio.processor.admin
|
package dev.adamko.kafkatorio.processor.admin
|
||||||
|
|
||||||
import dev.adamko.kafkatorio.schema2.ConfigurationUpdate
|
import dev.adamko.kafkatorio.schema.packets.ConfigurationUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.ConsoleChatUpdate
|
import dev.adamko.kafkatorio.schema.packets.ConsoleChatUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.ConsoleCommandUpdate
|
import dev.adamko.kafkatorio.schema.packets.ConsoleCommandUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.EntityUpdate
|
import dev.adamko.kafkatorio.schema.packets.EntityUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.KafkatorioPacketData2
|
import dev.adamko.kafkatorio.schema.packets.KafkatorioPacketData
|
||||||
import dev.adamko.kafkatorio.schema2.MapChunkUpdate
|
import dev.adamko.kafkatorio.schema.packets.MapChunkUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.PlayerUpdate
|
import dev.adamko.kafkatorio.schema.packets.PlayerUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.PrototypesUpdate
|
import dev.adamko.kafkatorio.schema.packets.PrototypesUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.SurfaceUpdate
|
import dev.adamko.kafkatorio.schema.packets.SurfaceUpdate
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ private const val DOMAIN = "kafkatorio"
|
||||||
|
|
||||||
|
|
||||||
const val TOPIC_SRC_SERVER_LOG = "$DOMAIN.src.server-log"
|
const val TOPIC_SRC_SERVER_LOG = "$DOMAIN.src.server-log"
|
||||||
// "factorio-server-log"
|
|
||||||
const val TOPIC_GROUPED_MAP_CHUNKS_STATE = "$DOMAIN.state.map-chunks.grouped"
|
const val TOPIC_GROUPED_MAP_CHUNKS_STATE = "$DOMAIN.state.map-chunks.grouped"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -27,12 +27,7 @@ fun allTopics(): Set<String> = buildSet {
|
||||||
addAll(packetTopicNames.values)
|
addAll(packetTopicNames.values)
|
||||||
}
|
}
|
||||||
|
|
||||||
//fun KafkatorioPacket2.topicName(): String = data.topicName()
|
val KafkatorioPacketData.topicName: String
|
||||||
|
|
||||||
//fun KafkatorioPacketData2.topicName(): String = "$DOMAIN.packet.${topicName}"
|
|
||||||
|
|
||||||
|
|
||||||
val KafkatorioPacketData2.topicName: String
|
|
||||||
get() = when (this) {
|
get() = when (this) {
|
||||||
is ConfigurationUpdate -> packetTopicNames.getValue(ConfigurationUpdate::class)
|
is ConfigurationUpdate -> packetTopicNames.getValue(ConfigurationUpdate::class)
|
||||||
is ConsoleChatUpdate -> packetTopicNames.getValue(ConsoleChatUpdate::class)
|
is ConsoleChatUpdate -> packetTopicNames.getValue(ConsoleChatUpdate::class)
|
||||||
|
|
@ -45,7 +40,7 @@ val KafkatorioPacketData2.topicName: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private val packetTopicNames: Map<KClass<out KafkatorioPacketData2>, String> = mapOf(
|
private val packetTopicNames: Map<KClass<out KafkatorioPacketData>, String> = mapOf(
|
||||||
ConfigurationUpdate::class to "configuration",
|
ConfigurationUpdate::class to "configuration",
|
||||||
ConsoleChatUpdate::class to "console-chat",
|
ConsoleChatUpdate::class to "console-chat",
|
||||||
ConsoleCommandUpdate::class to "console-command",
|
ConsoleCommandUpdate::class to "console-command",
|
||||||
|
|
@ -58,47 +53,5 @@ private val packetTopicNames: Map<KClass<out KafkatorioPacketData2>, String> = m
|
||||||
"$DOMAIN.packet.$v"
|
"$DOMAIN.packet.$v"
|
||||||
}
|
}
|
||||||
|
|
||||||
val KClass<out KafkatorioPacketData2>.topicName: String
|
val KClass<out KafkatorioPacketData>.topicName: String
|
||||||
get() = packetTopicNames.getValue(this)
|
get() = packetTopicNames.getValue(this)
|
||||||
|
|
||||||
//fun packetTopic(
|
|
||||||
// dataType: KafkatorioKeyedPacketData.KafkatorioKeyedPacketDataType,
|
|
||||||
//): String = packetTopic(KafkatorioPacketType.KEYED, dataType.name.lowercase())
|
|
||||||
//
|
|
||||||
//private fun packetTopic(
|
|
||||||
// packetType: KafkatorioPacketType,
|
|
||||||
// dataType: String,
|
|
||||||
//): String {
|
|
||||||
// return "$DOMAIN.packet.$packetType.$dataType"
|
|
||||||
//}
|
|
||||||
|
|
||||||
//sealed interface KafkatorioTopic {
|
|
||||||
//
|
|
||||||
// val type: String
|
|
||||||
// val entity: String
|
|
||||||
// val description: String
|
|
||||||
//
|
|
||||||
// companion object {
|
|
||||||
// private const val DOMAIN = "kafkatorio"
|
|
||||||
//
|
|
||||||
// val KafkatorioTopic.topic
|
|
||||||
// get() = listOf(DOMAIN, type, entity, description).joinToString(".")
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// data class Event(
|
|
||||||
// override val entity: String,
|
|
||||||
// override val description: String,
|
|
||||||
// ) : KafkatorioTopic {
|
|
||||||
// override val type: String = "event"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// data class State(
|
|
||||||
// override val entity: String,
|
|
||||||
// override val description: String,
|
|
||||||
// ) : KafkatorioTopic {
|
|
||||||
// override val type: String = "state"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,11 @@
|
||||||
package dev.adamko.kafkatorio.processor.serdes
|
package dev.adamko.kafkatorio.processor.serdes
|
||||||
|
|
||||||
import dev.adamko.kafkatorio.schema.jsonMapperKafkatorio
|
import dev.adamko.kafkatorio.schema.jsonMapperKafkatorio
|
||||||
import dev.adamko.kafkatorio.schema2.KafkatorioPacket2
|
|
||||||
import kotlinx.serialization.decodeFromString
|
|
||||||
import kotlinx.serialization.encodeToString
|
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import org.apache.kafka.common.serialization.Deserializer
|
|
||||||
import org.apache.kafka.common.serialization.Serde
|
|
||||||
import org.apache.kafka.common.serialization.Serializer
|
|
||||||
import org.http4k.format.ConfigurableKotlinxSerialization
|
import org.http4k.format.ConfigurableKotlinxSerialization
|
||||||
import org.http4k.format.asConfigurable
|
import org.http4k.format.asConfigurable
|
||||||
import org.http4k.format.withStandardMappings
|
import org.http4k.format.withStandardMappings
|
||||||
|
|
||||||
|
|
||||||
//object KafkatorioPacketSerde : Serde<KafkatorioPacket2> {
|
|
||||||
// override fun serializer() = Serializer<KafkatorioPacket> { _, message ->
|
|
||||||
// jsonMapper.encodeToString<KafkatorioPacket>(message).encodeToByteArray()
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// override fun deserializer() = Deserializer<KafkatorioPacket> { _, bytes ->
|
|
||||||
// jsonMapper.decodeFromString(bytes.decodeToString())
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
val jsonMapper: Json = Json {
|
val jsonMapper: Json = Json {
|
||||||
prettyPrint = true
|
prettyPrint = true
|
||||||
prettyPrintIndent = " "
|
prettyPrintIndent = " "
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ package dev.adamko.kafkatorio.processor.topology
|
||||||
import dev.adamko.kafkatorio.processor.admin.TOPIC_SRC_SERVER_LOG
|
import dev.adamko.kafkatorio.processor.admin.TOPIC_SRC_SERVER_LOG
|
||||||
import dev.adamko.kafkatorio.processor.admin.topicName
|
import dev.adamko.kafkatorio.processor.admin.topicName
|
||||||
import dev.adamko.kafkatorio.processor.serdes.jsonMapper
|
import dev.adamko.kafkatorio.processor.serdes.jsonMapper
|
||||||
import dev.adamko.kafkatorio.schema2.KafkatorioPacket2
|
import dev.adamko.kafkatorio.schema.packets.KafkatorioPacket
|
||||||
import dev.adamko.kotka.extensions.consumedAs
|
import dev.adamko.kotka.extensions.consumedAs
|
||||||
import dev.adamko.kotka.extensions.producedAs
|
import dev.adamko.kotka.extensions.producedAs
|
||||||
import dev.adamko.kotka.extensions.streams.map
|
import dev.adamko.kotka.extensions.streams.map
|
||||||
|
|
@ -19,7 +19,7 @@ import org.apache.kafka.streams.processor.RecordContext
|
||||||
|
|
||||||
fun factorioServerPacketStream(
|
fun factorioServerPacketStream(
|
||||||
builder: StreamsBuilder = StreamsBuilder(),
|
builder: StreamsBuilder = StreamsBuilder(),
|
||||||
): KStream<FactorioServerId, KafkatorioPacket2> {
|
): KStream<FactorioServerId, KafkatorioPacket> {
|
||||||
|
|
||||||
return builder.stream(
|
return builder.stream(
|
||||||
TOPIC_SRC_SERVER_LOG,
|
TOPIC_SRC_SERVER_LOG,
|
||||||
|
|
@ -29,14 +29,14 @@ fun factorioServerPacketStream(
|
||||||
Serdes.String(),
|
Serdes.String(),
|
||||||
)
|
)
|
||||||
).map("decode-packets") { serverId: String, value: String ->
|
).map("decode-packets") { serverId: String, value: String ->
|
||||||
val packet = jsonMapper.decodeFromString<KafkatorioPacket2>(value)
|
val packet = jsonMapper.decodeFromString<KafkatorioPacket>(value)
|
||||||
FactorioServerId(serverId) to packet
|
FactorioServerId(serverId) to packet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun splitFactorioServerPacketStream(
|
fun splitFactorioServerPacketStream(
|
||||||
factorioServerPacketStream: KStream<FactorioServerId, KafkatorioPacket2>
|
factorioServerPacketStream: KStream<FactorioServerId, KafkatorioPacket>
|
||||||
) {
|
) {
|
||||||
factorioServerPacketStream
|
factorioServerPacketStream
|
||||||
.to(
|
.to(
|
||||||
|
|
@ -45,7 +45,7 @@ fun splitFactorioServerPacketStream(
|
||||||
jsonMapper.serde(),
|
jsonMapper.serde(),
|
||||||
jsonMapper.serde(),
|
jsonMapper.serde(),
|
||||||
)
|
)
|
||||||
) { _: FactorioServerId, value: KafkatorioPacket2, _: RecordContext ->
|
) { _: FactorioServerId, value: KafkatorioPacket, _: RecordContext ->
|
||||||
// println("[$key] sending event:${value.eventType} to topic:${value.data.objectName()}")
|
// println("[$key] sending event:${value.eventType} to topic:${value.data.objectName()}")
|
||||||
value.data.topicName
|
value.data.topicName
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ import dev.adamko.kafkatorio.schema.common.MapTilePosition
|
||||||
import dev.adamko.kafkatorio.schema.common.MapTiles
|
import dev.adamko.kafkatorio.schema.common.MapTiles
|
||||||
import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
||||||
import dev.adamko.kafkatorio.schema.common.toMapChunkPosition
|
import dev.adamko.kafkatorio.schema.common.toMapChunkPosition
|
||||||
import dev.adamko.kafkatorio.schema2.MapChunkUpdate
|
import dev.adamko.kafkatorio.schema.packets.MapChunkUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.PrototypesUpdate
|
import dev.adamko.kafkatorio.schema.packets.PrototypesUpdate
|
||||||
import dev.adamko.kotka.extensions.groupedAs
|
import dev.adamko.kotka.extensions.groupedAs
|
||||||
import dev.adamko.kotka.extensions.materializedWith
|
import dev.adamko.kotka.extensions.materializedWith
|
||||||
import dev.adamko.kotka.extensions.producedAs
|
import dev.adamko.kotka.extensions.producedAs
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ package dev.adamko.kafkatorio.processor.topology
|
||||||
|
|
||||||
import dev.adamko.kafkatorio.processor.admin.topicName
|
import dev.adamko.kafkatorio.processor.admin.topicName
|
||||||
import dev.adamko.kafkatorio.processor.serdes.jsonMapper
|
import dev.adamko.kafkatorio.processor.serdes.jsonMapper
|
||||||
import dev.adamko.kafkatorio.schema2.KafkatorioPacket2
|
import dev.adamko.kafkatorio.schema.packets.KafkatorioPacket
|
||||||
import dev.adamko.kafkatorio.schema2.KafkatorioPacketData2
|
import dev.adamko.kafkatorio.schema.packets.KafkatorioPacketData
|
||||||
import dev.adamko.kotka.extensions.consumedAs
|
import dev.adamko.kotka.extensions.consumedAs
|
||||||
import dev.adamko.kotka.extensions.streams.mapValues
|
import dev.adamko.kotka.extensions.streams.mapValues
|
||||||
import dev.adamko.kotka.kxs.serde
|
import dev.adamko.kotka.kxs.serde
|
||||||
|
|
@ -11,17 +11,17 @@ import org.apache.kafka.streams.StreamsBuilder
|
||||||
import org.apache.kafka.streams.kstream.KStream
|
import org.apache.kafka.streams.kstream.KStream
|
||||||
|
|
||||||
|
|
||||||
inline fun <reified T : KafkatorioPacketData2> StreamsBuilder.streamPacketData(): KStream<FactorioServerId, T> {
|
inline fun <reified T : KafkatorioPacketData> StreamsBuilder.streamPacketData(): KStream<FactorioServerId, T> {
|
||||||
|
|
||||||
val simpleName = T::class.simpleName!!
|
val simpleName = T::class.simpleName!!
|
||||||
val topicName = T::class.topicName
|
val topicName = T::class.topicName
|
||||||
|
|
||||||
return stream<FactorioServerId, KafkatorioPacket2>(
|
return stream<FactorioServerId, KafkatorioPacket>(
|
||||||
topicName,
|
topicName,
|
||||||
consumedAs("consume.${simpleName}", jsonMapper.serde(), jsonMapper.serde())
|
consumedAs("consume.${simpleName}", jsonMapper.serde(), jsonMapper.serde())
|
||||||
).filter { key: FactorioServerId?, value: KafkatorioPacket2? ->
|
).filter { key: FactorioServerId?, value: KafkatorioPacket? ->
|
||||||
key != null && value?.data is T
|
key != null && value?.data is T
|
||||||
}.mapValues("consume.map-values.${simpleName}") { _: FactorioServerId, packet: KafkatorioPacket2 ->
|
}.mapValues("consume.map-values.${simpleName}") { _: FactorioServerId, packet: KafkatorioPacket ->
|
||||||
packet.data as T
|
packet.data as T
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ package dev.adamko.kafkatorio.processor.topology
|
||||||
import dev.adamko.kafkatorio.processor.WebsocketServer
|
import dev.adamko.kafkatorio.processor.WebsocketServer
|
||||||
import dev.adamko.kafkatorio.processor.admin.topicName
|
import dev.adamko.kafkatorio.processor.admin.topicName
|
||||||
import dev.adamko.kafkatorio.processor.serdes.jsonMapper
|
import dev.adamko.kafkatorio.processor.serdes.jsonMapper
|
||||||
import dev.adamko.kafkatorio.schema2.KafkatorioPacket2
|
import dev.adamko.kafkatorio.schema.packets.KafkatorioPacket
|
||||||
import dev.adamko.kafkatorio.schema2.PlayerUpdate
|
import dev.adamko.kafkatorio.schema.packets.PlayerUpdate
|
||||||
import dev.adamko.kotka.extensions.consumedAs
|
import dev.adamko.kotka.extensions.consumedAs
|
||||||
import dev.adamko.kotka.kxs.serde
|
import dev.adamko.kotka.kxs.serde
|
||||||
import kotlinx.serialization.encodeToString
|
import kotlinx.serialization.encodeToString
|
||||||
|
|
@ -15,7 +15,7 @@ fun playerUpdatesToWsServer(
|
||||||
websocketServer: WebsocketServer,
|
websocketServer: WebsocketServer,
|
||||||
builder: StreamsBuilder = StreamsBuilder(),
|
builder: StreamsBuilder = StreamsBuilder(),
|
||||||
) {
|
) {
|
||||||
builder.stream<FactorioServerId, KafkatorioPacket2>(
|
builder.stream<FactorioServerId, KafkatorioPacket>(
|
||||||
PlayerUpdate::class.topicName,
|
PlayerUpdate::class.topicName,
|
||||||
consumedAs("EventUpdate.Player-updates-for-ws-server", jsonMapper.serde(), jsonMapper.serde()),
|
consumedAs("EventUpdate.Player-updates-for-ws-server", jsonMapper.serde(), jsonMapper.serde()),
|
||||||
).foreach { _, value ->
|
).foreach { _, value ->
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import dev.adamko.kafkatorio.processor.serdes.kxsBinary
|
||||||
import dev.adamko.kafkatorio.schema.common.ColourHex
|
import dev.adamko.kafkatorio.schema.common.ColourHex
|
||||||
import dev.adamko.kafkatorio.schema.common.MapTile
|
import dev.adamko.kafkatorio.schema.common.MapTile
|
||||||
import dev.adamko.kafkatorio.schema.common.toHex
|
import dev.adamko.kafkatorio.schema.common.toHex
|
||||||
import dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2
|
import dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype
|
||||||
import dev.adamko.kafkatorio.schema2.PrototypesUpdate
|
import dev.adamko.kafkatorio.schema.packets.PrototypesUpdate
|
||||||
import dev.adamko.kotka.extensions.materializedAs
|
import dev.adamko.kotka.extensions.materializedAs
|
||||||
import dev.adamko.kotka.extensions.streams.filter
|
import dev.adamko.kotka.extensions.streams.filter
|
||||||
import dev.adamko.kotka.extensions.streams.mapValues
|
import dev.adamko.kotka.extensions.streams.mapValues
|
||||||
|
|
@ -21,7 +21,7 @@ import org.apache.kafka.streams.kstream.KTable
|
||||||
@Serializable
|
@Serializable
|
||||||
value class TileProtoHashCode private constructor(val code: Int) {
|
value class TileProtoHashCode private constructor(val code: Int) {
|
||||||
constructor(tile: MapTile) : this(tile.proto.hashCode())
|
constructor(tile: MapTile) : this(tile.proto.hashCode())
|
||||||
constructor(tile: FactorioPrototype2.MapTile) : this(tile.name.hashCode())
|
constructor(tile: FactorioPrototype.MapTile) : this(tile.name.hashCode())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ fun tileProtoColourDictionary(
|
||||||
return factorioServerPacketStream.mapValues("server-map-data.tile-prototypes.map-values") { _, protoPacket: PrototypesUpdate ->
|
return factorioServerPacketStream.mapValues("server-map-data.tile-prototypes.map-values") { _, protoPacket: PrototypesUpdate ->
|
||||||
val map = protoPacket
|
val map = protoPacket
|
||||||
.prototypes
|
.prototypes
|
||||||
.filterIsInstance<FactorioPrototype2.MapTile>()
|
.filterIsInstance<FactorioPrototype.MapTile>()
|
||||||
.associate { TileProtoHashCode(it) to it.mapColour.toHex() }
|
.associate { TileProtoHashCode(it) to it.mapColour.toHex() }
|
||||||
|
|
||||||
TileColourDict(map)
|
TileColourDict(map)
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,11 @@ import dev.adamko.kafkatorio.schema.common.MapTilePosition
|
||||||
import dev.adamko.kafkatorio.schema.common.PrototypeName
|
import dev.adamko.kafkatorio.schema.common.PrototypeName
|
||||||
import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
||||||
import dev.adamko.kafkatorio.schema.common.Tick
|
import dev.adamko.kafkatorio.schema.common.Tick
|
||||||
import dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype2
|
import dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype
|
||||||
import dev.adamko.kafkatorio.schema2.KafkatorioPacket2
|
import dev.adamko.kafkatorio.schema.packets.KafkatorioPacket
|
||||||
import dev.adamko.kafkatorio.schema2.MapChunkUpdate
|
import dev.adamko.kafkatorio.schema.packets.MapChunkUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.MapChunkUpdateKey
|
import dev.adamko.kafkatorio.schema.packets.MapChunkUpdateKey
|
||||||
import dev.adamko.kafkatorio.schema2.PrototypesUpdate
|
import dev.adamko.kafkatorio.schema.packets.PrototypesUpdate
|
||||||
import dev.adamko.kotka.kxs.serde
|
import dev.adamko.kotka.kxs.serde
|
||||||
import io.kotest.assertions.withClue
|
import io.kotest.assertions.withClue
|
||||||
import io.kotest.core.spec.style.FunSpec
|
import io.kotest.core.spec.style.FunSpec
|
||||||
|
|
@ -42,23 +42,23 @@ class GroupMapChunksTest : FunSpec({
|
||||||
|
|
||||||
val testDriver = TopologyTestDriver(topology)
|
val testDriver = TopologyTestDriver(topology)
|
||||||
|
|
||||||
val prototypesTestInputTopic: TestInputTopic<FactorioServerId, KafkatorioPacket2> =
|
val prototypesTestInputTopic: TestInputTopic<FactorioServerId, KafkatorioPacket> =
|
||||||
testDriver.createInputTopic(
|
testDriver.createInputTopic(
|
||||||
prototypesTopicName,
|
prototypesTopicName,
|
||||||
jsonMapper.serde<FactorioServerId>().serializer(),
|
jsonMapper.serde<FactorioServerId>().serializer(),
|
||||||
jsonMapper.serde<KafkatorioPacket2>().serializer(),
|
jsonMapper.serde<KafkatorioPacket>().serializer(),
|
||||||
)
|
)
|
||||||
|
|
||||||
val serverId = FactorioServerId("test-server-id")
|
val serverId = FactorioServerId("test-server-id")
|
||||||
|
|
||||||
prototypesTestInputTopic.pipeInput(
|
prototypesTestInputTopic.pipeInput(
|
||||||
serverId,
|
serverId,
|
||||||
KafkatorioPacket2(
|
KafkatorioPacket(
|
||||||
modVersion = "1.2.3",
|
modVersion = "1.2.3",
|
||||||
tick = Tick(22u),
|
tick = Tick(22u),
|
||||||
PrototypesUpdate(
|
PrototypesUpdate(
|
||||||
listOf(
|
listOf(
|
||||||
FactorioPrototype2.MapTile(
|
FactorioPrototype.MapTile(
|
||||||
PrototypeName("fake-proto"),
|
PrototypeName("fake-proto"),
|
||||||
layer = 1u,
|
layer = 1u,
|
||||||
mapColour = Colour(0.3f, 0.2f, 0.1f, 1.0f),
|
mapColour = Colour(0.3f, 0.2f, 0.1f, 1.0f),
|
||||||
|
|
@ -71,16 +71,16 @@ class GroupMapChunksTest : FunSpec({
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val mapChunkUpdatesInputTopic: TestInputTopic<FactorioServerId, KafkatorioPacket2> =
|
val mapChunkUpdatesInputTopic: TestInputTopic<FactorioServerId, KafkatorioPacket> =
|
||||||
testDriver.createInputTopic(
|
testDriver.createInputTopic(
|
||||||
mapChunkUpdatesTopicName,
|
mapChunkUpdatesTopicName,
|
||||||
jsonMapper.serde<FactorioServerId>().serializer(),
|
jsonMapper.serde<FactorioServerId>().serializer(),
|
||||||
jsonMapper.serde<KafkatorioPacket2>().serializer(),
|
jsonMapper.serde<KafkatorioPacket>().serializer(),
|
||||||
)
|
)
|
||||||
|
|
||||||
mapChunkUpdatesInputTopic.pipeInput(
|
mapChunkUpdatesInputTopic.pipeInput(
|
||||||
serverId,
|
serverId,
|
||||||
KafkatorioPacket2(
|
KafkatorioPacket(
|
||||||
modVersion = "1.2.3",
|
modVersion = "1.2.3",
|
||||||
tick = Tick(44u),
|
tick = Tick(44u),
|
||||||
MapChunkUpdate(
|
MapChunkUpdate(
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package dev.adamko.kafkatorio.webmap
|
package dev.adamko.kafkatorio.webmap
|
||||||
|
|
||||||
import dev.adamko.kafkatorio.schema.common.MapEntityPosition
|
import dev.adamko.kafkatorio.schema.common.MapEntityPosition
|
||||||
import dev.adamko.kafkatorio.schema2.PlayerUpdate
|
import dev.adamko.kafkatorio.schema.packets.PlayerUpdate
|
||||||
import io.kvision.maps.Maps
|
import io.kvision.maps.Maps
|
||||||
import io.kvision.maps.externals.leaflet.geo.LatLng
|
import io.kvision.maps.externals.leaflet.geo.LatLng
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import dev.adamko.kafkatorio.schema.common.PlayerIndex
|
||||||
import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
||||||
import dev.adamko.kafkatorio.schema.common.Tick
|
import dev.adamko.kafkatorio.schema.common.Tick
|
||||||
import dev.adamko.kafkatorio.schema.common.toHexString
|
import dev.adamko.kafkatorio.schema.common.toHexString
|
||||||
import dev.adamko.kafkatorio.schema2.PlayerUpdate
|
import dev.adamko.kafkatorio.schema.packets.PlayerUpdate
|
||||||
import io.kvision.maps.Maps
|
import io.kvision.maps.Maps
|
||||||
import io.kvision.maps.Maps.Companion.L
|
import io.kvision.maps.Maps.Companion.L
|
||||||
import io.kvision.maps.externals.leaflet.geo.LatLng
|
import io.kvision.maps.externals.leaflet.geo.LatLng
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
package dev.adamko.kafkatorio.webmap
|
package dev.adamko.kafkatorio.webmap
|
||||||
|
|
||||||
import dev.adamko.kafkatorio.schema2.ConfigurationUpdate
|
import dev.adamko.kafkatorio.schema.packets.ConfigurationUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.ConsoleChatUpdate
|
import dev.adamko.kafkatorio.schema.packets.ConsoleChatUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.ConsoleCommandUpdate
|
import dev.adamko.kafkatorio.schema.packets.ConsoleCommandUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.EntityUpdate
|
import dev.adamko.kafkatorio.schema.packets.EntityUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.KafkatorioPacket2
|
import dev.adamko.kafkatorio.schema.packets.KafkatorioPacket
|
||||||
import dev.adamko.kafkatorio.schema2.MapChunkUpdate
|
import dev.adamko.kafkatorio.schema.packets.MapChunkUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.PlayerUpdate
|
import dev.adamko.kafkatorio.schema.packets.PlayerUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.PrototypesUpdate
|
import dev.adamko.kafkatorio.schema.packets.PrototypesUpdate
|
||||||
import dev.adamko.kafkatorio.schema2.SurfaceUpdate
|
import dev.adamko.kafkatorio.schema.packets.SurfaceUpdate
|
||||||
import io.kvision.redux.ReduxStore
|
import io.kvision.redux.ReduxStore
|
||||||
import kotlinx.serialization.decodeFromString
|
import kotlinx.serialization.decodeFromString
|
||||||
import org.w3c.dom.MessageEvent
|
import org.w3c.dom.MessageEvent
|
||||||
|
|
@ -36,7 +36,7 @@ class WebsocketService(
|
||||||
|
|
||||||
println(data.replace('\n', ' '))
|
println(data.replace('\n', ' '))
|
||||||
|
|
||||||
val packet: KafkatorioPacket2 = jsonMapper.decodeFromString(data)
|
val packet: KafkatorioPacket = jsonMapper.decodeFromString(data)
|
||||||
|
|
||||||
when (val packetData = packet.data) {
|
when (val packetData = packet.data) {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue