version bumps, schema tweaks, code tweaks,
This commit is contained in:
parent
b055397d25
commit
a9782a4d90
15 changed files with 954 additions and 59 deletions
|
|
@ -23,7 +23,7 @@ interface EntityData extends FactorioObjectData, FactorioLuaControl {
|
|||
active: boolean;
|
||||
force: uint;
|
||||
health: double | null;
|
||||
healthRatio: double;
|
||||
healthRatio: double | null;
|
||||
name: string;
|
||||
objectName: ObjectName;
|
||||
playerIndex: uint | null;
|
||||
|
|
|
|||
|
|
@ -6,12 +6,6 @@ interface FactorioPrototype {
|
|||
prototypeObjectName: PrototypeObjectName;
|
||||
}
|
||||
|
||||
interface FactorioPrototypes extends KafkatorioPacket {
|
||||
modVersion: string;
|
||||
packetType: PacketType;
|
||||
prototypes: FactorioPrototype[];
|
||||
}
|
||||
|
||||
interface MapTilePrototype extends FactorioPrototype {
|
||||
canBeMined: boolean;
|
||||
collisionMasks: string[];
|
||||
|
|
@ -21,3 +15,9 @@ interface MapTilePrototype extends FactorioPrototype {
|
|||
order: string;
|
||||
prototypeObjectName: PrototypeObjectName;
|
||||
}
|
||||
|
||||
interface FactorioPrototypes extends KafkatorioPacket {
|
||||
modVersion: string;
|
||||
packetType: PacketType;
|
||||
prototypes: FactorioPrototype[];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,14 +7,6 @@ interface KafkatorioPacket {
|
|||
packetType: PacketType;
|
||||
}
|
||||
|
||||
interface FactorioEvent extends KafkatorioPacket {
|
||||
data: FactorioObjectData;
|
||||
eventType: string;
|
||||
modVersion: string;
|
||||
packetType: PacketType;
|
||||
tick: uint;
|
||||
}
|
||||
|
||||
interface MapEntityPosition {
|
||||
x: double;
|
||||
y: double;
|
||||
|
|
@ -54,6 +46,14 @@ interface MapTile {
|
|||
y: int;
|
||||
}
|
||||
|
||||
interface FactorioEvent extends KafkatorioPacket {
|
||||
data: FactorioObjectData;
|
||||
eventType: string;
|
||||
modVersion: string;
|
||||
packetType: PacketType;
|
||||
tick: uint;
|
||||
}
|
||||
|
||||
interface EntityIdentifiers {
|
||||
name: string;
|
||||
type: string;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import {emitPacket} from "../emitKafkatorioPacket";
|
|||
|
||||
/** Every 0.1 seconds */
|
||||
script.on_nth_tick(6, (nthTick: NthTickEventData) => {
|
||||
|
||||
const cachedEvents: Array<FactorioEventUpdate> = EventDataCache.extractExpired()
|
||||
|
||||
if (cachedEvents.length > 0) {
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ commands.add_command(
|
|||
let chunkYMin = chunkPosition.y - radius
|
||||
let chunkYMax = chunkPosition.y + radius
|
||||
|
||||
for (let [, surface] of game.surfaces) {
|
||||
for (let chunk of surface.get_chunks()) {
|
||||
for (const [, surface] of game.surfaces) {
|
||||
for (const chunk of surface.get_chunks()) {
|
||||
if (
|
||||
(chunk.x >= chunkXMin && chunk.x <= chunkXMax)
|
||||
&&
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export namespace Converters {
|
|||
type: entity.type,
|
||||
active: entity.active,
|
||||
health: entity.health ?? null,
|
||||
healthRatio: entity.get_health_ratio(),
|
||||
healthRatio: entity.get_health_ratio() ?? null,
|
||||
surface: entity.surface.index,
|
||||
unitNumber: entity.unit_number ?? null,
|
||||
position: mapEntityPosition(entity.position),
|
||||
|
|
|
|||
|
|
@ -31,19 +31,21 @@ function mapTilesUpdateDebounce(
|
|||
return
|
||||
}
|
||||
|
||||
const key: CacheKey<"MAP_CHUNK"> = {
|
||||
surfaceIndex: surface.index,
|
||||
chunkPosition: chunkPosition,
|
||||
updateType: "MAP_CHUNK",
|
||||
}
|
||||
|
||||
EventDataCache.debounce<"MAP_CHUNK">(
|
||||
{
|
||||
surfaceIndex: surface.index,
|
||||
chunkPosition: chunkPosition,
|
||||
updateType: "MAP_CHUNK",
|
||||
},
|
||||
key,
|
||||
data => {
|
||||
data.tileDictionary ??= <MapTileDictionary>{
|
||||
tilesXY: {},
|
||||
protos: {},
|
||||
}
|
||||
|
||||
for (let tile of tiles) {
|
||||
for (const tile of tiles) {
|
||||
|
||||
const xString = `${tile.position.x}`
|
||||
const yString = `${tile.position.y}`
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
"requires": true,
|
||||
"dependencies": {
|
||||
"enhanced-resolve": {
|
||||
"version": "5.8.3",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz",
|
||||
"integrity": "sha512-EGAbGvH7j7Xt2nc0E7D99La1OiEs8LnyimkRgwExpUMScN6O+3x9tIWs7PLQZVNx4YD+00skHXPXi1yQHpAmZA==",
|
||||
"version": "5.9.2",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.2.tgz",
|
||||
"integrity": "sha512-GIm3fQfwLJ8YZx2smuHpBKkXC1yOk+OBEmKckVyL0i/ea8mqDEykK3ld5dgH1QYPNyT/lIllxV2LULnxCHaHkA==",
|
||||
"requires": {
|
||||
"graceful-fs": "^4.2.4",
|
||||
"tapable": "^2.2.0"
|
||||
|
|
@ -50,11 +50,11 @@
|
|||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.21.1",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.1.tgz",
|
||||
"integrity": "sha512-lfEImVbnolPuaSZuLQ52cAxPBHeI77sPwCOWRdy12UG/CNa8an7oBHH1R+Fp1/mUqSJi4c8TIP6FOIPSZAUrEQ==",
|
||||
"version": "1.22.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz",
|
||||
"integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==",
|
||||
"requires": {
|
||||
"is-core-module": "^2.8.0",
|
||||
"is-core-module": "^2.8.1",
|
||||
"path-parse": "^1.0.7",
|
||||
"supports-preserve-symlinks-flag": "^1.0.0"
|
||||
}
|
||||
|
|
@ -75,9 +75,9 @@
|
|||
"integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ=="
|
||||
},
|
||||
"typed-factorio": {
|
||||
"version": "0.18.1",
|
||||
"resolved": "https://registry.npmjs.org/typed-factorio/-/typed-factorio-0.18.1.tgz",
|
||||
"integrity": "sha512-osjGO4V809tlDnDI7lXTIOPCcDBwBfKfW6o8zFR04S0/uBAzP4eY3X3GXTPzWK/P3HJ9GXDUHV2Nai2ZRicbkA=="
|
||||
"version": "0.19.1",
|
||||
"resolved": "https://registry.npmjs.org/typed-factorio/-/typed-factorio-0.19.1.tgz",
|
||||
"integrity": "sha512-/iLa916Cw33vC6wgmCb4cPLjmvUA2zVviTx/vy80iEvpOHjoNkuHkGSsmvss1aItwUKUlHaLi3k0fK5OPiw1iA=="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.5.5",
|
||||
|
|
@ -85,9 +85,9 @@
|
|||
"integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA=="
|
||||
},
|
||||
"typescript-to-lua": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-1.3.3.tgz",
|
||||
"integrity": "sha512-Fkt0+dLufN5CK0G/qpINY7Sb0+SNmWpov+PHhO/dq0HFoNBzR47M1SJd+hQbG92vTVFLBO4f+Np29LuVvoemMA==",
|
||||
"version": "1.3.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-1.3.4.tgz",
|
||||
"integrity": "sha512-9NkUOSUd9tufvwCGiWJ6Z1edizYcECUfjdZJZfDRKTEXKIddbAdV3IFR6u5gxvYYRfXhfNV6IKvqHS2HxHFs6w==",
|
||||
"requires": {
|
||||
"enhanced-resolve": "^5.8.2",
|
||||
"resolve": "^1.15.1",
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"lua-types": "^2.11.0",
|
||||
"typescript-to-lua": "1.3.3",
|
||||
"typed-factorio": "0.18.1",
|
||||
"typescript-to-lua": "1.3.4",
|
||||
"typed-factorio": "0.19.1",
|
||||
"typescript": "4.5.5"
|
||||
},
|
||||
"// @types/node": "^12.0.8",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue