Fix compile errors surfaced by actually building against Factorio 2.0.77
typed-factorio 2.0.0+ stopped declaring types as ambient globals - they
now live in virtual modules ("factorio:runtime", "factorio:common",
"factorio:settings") and must be explicitly imported. Adds those imports
throughout events-mod. Also:
- Bumps typescript-to-lua 1.11.1 -> 1.25.2 and typescript 4.9 -> 5.4.2,
since tstl pins an exact peer TypeScript version and typed-factorio
3.x needs a newer one than 4.9 supports (a real compiler bug in
TS 4.9 against the generated defines.segmented_unit_ai_state enum).
- Bumps the pinned isolated Node (14.19.1 -> 24.21.0), since
typescript-to-lua 1.25.2 requires Node >=16.10.0.
- Renames bare uint/int -> uint32/int32 (import aliases), since the
unsized aliases no longer exist.
- Drops OnEntityDestroyedEvent from an unused documentation-only union
type - that event no longer exists in the 2.0 API.
- LuaEntityPrototype.max_health is now get_max_health() (quality-aware).
- Fixes a branded-type mismatch between our generated schema's
ForceIndex and typed-factorio's own ForceIndex.
Verified by actually running tstl end-to-end (clean compile, Lua
emitted) after installing a real JDK and Node toolchain.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
072d1a2845
commit
e296a9aa90
26 changed files with 285 additions and 79 deletions
|
|
@ -8,7 +8,8 @@ import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
|
|||
|
||||
|
||||
object Versions {
|
||||
const val node = "14.19.1"
|
||||
// typescript-to-lua 1.25.2+ (needed for typed-factorio 3.x / Factorio 2.0) requires Node >=16.10.0
|
||||
const val node = "24.21.0"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ nimbusJoseJwt = "9.25.6" # https://search.maven.org/artifact/com.
|
|||
## npm ##
|
||||
|
||||
npm-luaTypes = "2.13.1" # https://www.npmjs.com/package/lua-types
|
||||
npm-typescriptToLua = "1.11.1" # https://www.npmjs.com/package/typescript-to-lua
|
||||
npm-typescriptToLua = "1.25.2" # peer-pins typescript 5.4.2, matching typed-factorio's own dev dependency; https://www.npmjs.com/package/typescript-to-lua
|
||||
npm-typedFactorio = "3.36.0" # targets Factorio 2.0.75 ("factorio-2.0" dist-tag); https://github.com/GlassBricks/typed-factorio/blob/main/Changelog.md https://www.npmjs.com/package/typed-factorio
|
||||
npm-typescript = "4.9" # https://github.com/microsoft/TypeScript/releases
|
||||
npm-typescript = "5.4.2" # https://github.com/microsoft/TypeScript/releases
|
||||
|
||||
npm-bootswatch = "5.2.2" # https://www.jsdelivr.com/package/npm/bootswatch
|
||||
|
||||
|
|
|
|||
232
modules/events-mod/package-lock.json
generated
232
modules/events-mod/package-lock.json
generated
|
|
@ -1,103 +1,199 @@
|
|||
{
|
||||
"name": "kafkatorio-events-mod",
|
||||
"version": "0.10.1",
|
||||
"lockfileVersion": 1,
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@typescript-to-lua/language-extensions": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-to-lua/language-extensions/-/language-extensions-1.0.0.tgz",
|
||||
"integrity": "sha512-GtmhFqyg+txpGgGLM3mlS3R6AEG9MQhKALxxcbr6SBzg9u7YAXcPKqUBaBYd6nH+Pi/eQLcWz4BNOLhz8v4TjQ=="
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "kafkatorio-events-mod",
|
||||
"version": "0.10.1",
|
||||
"license": "GPL-3.0-only",
|
||||
"dependencies": {
|
||||
"lua-types": "2.13.1",
|
||||
"typed-factorio": "3.36.0",
|
||||
"typescript": "5.4.2",
|
||||
"typescript-to-lua": "1.25.2"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"engines": {
|
||||
"node": ">=16.10.0"
|
||||
}
|
||||
},
|
||||
"enhanced-resolve": {
|
||||
"version": "5.12.0",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz",
|
||||
"integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==",
|
||||
"requires": {
|
||||
"node_modules/@typescript-to-lua/language-extensions": {
|
||||
"version": "1.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-to-lua/language-extensions/-/language-extensions-1.19.0.tgz",
|
||||
"integrity": "sha512-Os5wOKwviTD4LeqI29N0btYOjokSJ97iCf45EOjIABlb5IwNQy7AE/AqZJobRw3ywHH8+KzJUMkEirWPzh2tUA=="
|
||||
},
|
||||
"node_modules/enhanced-resolve": {
|
||||
"version": "5.26.0",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.26.0.tgz",
|
||||
"integrity": "sha512-9vhedylFonb2YGogzUKX6+Ja72gOJbN1QHAqdrvqLwhdl/QWbKopzoUC9EbQNVsAns/bx/4uyqalrQAoy1IByw==",
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.2.4",
|
||||
"tapable": "^2.2.0"
|
||||
"tapable": "^2.3.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
|
||||
},
|
||||
"graceful-fs": {
|
||||
"version": "4.2.10",
|
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
|
||||
"integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA=="
|
||||
},
|
||||
"has": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1"
|
||||
"node_modules/es-errors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"is-core-module": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz",
|
||||
"integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==",
|
||||
"requires": {
|
||||
"has": "^1.0.3"
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"lua-types": {
|
||||
"node_modules/graceful-fs": {
|
||||
"version": "4.2.11",
|
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
|
||||
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
|
||||
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/is-core-module": {
|
||||
"version": "2.17.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.17.0.tgz",
|
||||
"integrity": "sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA==",
|
||||
"dependencies": {
|
||||
"hasown": "^2.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/lua-types": {
|
||||
"version": "2.13.1",
|
||||
"resolved": "https://registry.npmjs.org/lua-types/-/lua-types-2.13.1.tgz",
|
||||
"integrity": "sha512-rRwtvX6kS+5MpuO3xpvKsnYjdSDDI064Qq1OqX8gY+r+0l7m3dFLiZPDFoHqH22jaBpEvcHcPs6+WD7qkdmFsA=="
|
||||
},
|
||||
"path-parse": {
|
||||
"node_modules/path-parse": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.22.1",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
|
||||
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
|
||||
"requires": {
|
||||
"is-core-module": "^2.9.0",
|
||||
"path-parse": "^1.0.7",
|
||||
"supports-preserve-symlinks-flag": "^1.0.0"
|
||||
"node_modules/picomatch": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
|
||||
"integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
|
||||
"engines": {
|
||||
"node": ">=8.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.7.4",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz",
|
||||
"integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA=="
|
||||
"node_modules/resolve": {
|
||||
"version": "1.22.13",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.13.tgz",
|
||||
"integrity": "sha512-Dj/cW9zBV2aRj6XzCxuGIs3ESZKv02jixne3q6jFZYZ3/Tg09gHHviSMDL4kObh9pqSahdRHEnDoaP2gn8YLhA==",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"is-core-module": "^2.17.0",
|
||||
"path-parse": "^1.0.7",
|
||||
"supports-preserve-symlinks-flag": "^1.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"resolve": "bin/resolve"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"supports-preserve-symlinks-flag": {
|
||||
"node_modules/source-map": {
|
||||
"version": "0.7.6",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz",
|
||||
"integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==",
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
}
|
||||
},
|
||||
"node_modules/supports-preserve-symlinks-flag": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
||||
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="
|
||||
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"tapable": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
|
||||
"integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ=="
|
||||
"node_modules/tapable": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.3.tgz",
|
||||
"integrity": "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/webpack"
|
||||
}
|
||||
},
|
||||
"typed-factorio": {
|
||||
"version": "1.11.0",
|
||||
"resolved": "https://registry.npmjs.org/typed-factorio/-/typed-factorio-1.11.0.tgz",
|
||||
"integrity": "sha512-RYCEpcECiQ2dw1tj03bPv6fRXCevuAP89ipMBv67FsY09+W7ApZkfjXIJq9RaxoIMtbGkqPUql33O/DYVMtAng=="
|
||||
"node_modules/typed-factorio": {
|
||||
"version": "3.36.0",
|
||||
"resolved": "https://registry.npmjs.org/typed-factorio/-/typed-factorio-3.36.0.tgz",
|
||||
"integrity": "sha512-gUrENjoV8M9H9CDAZrJwU7pRXEuo2voeYgwm6/ZNFVtrCjbQOjwYw1C6Qm3PiEDCGL0FEJobwo3k0XVqtLCIBA==",
|
||||
"peerDependencies": {
|
||||
"lua-types": "^2.13.1",
|
||||
"typescript-to-lua": "^1.10.0"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.9.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz",
|
||||
"integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA=="
|
||||
"node_modules/typescript": {
|
||||
"version": "5.4.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz",
|
||||
"integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"typescript-to-lua": {
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-1.11.1.tgz",
|
||||
"integrity": "sha512-XxGOf0zBRrMocGr4BbVaJdnvnk4yTrUs0BCdamfb/Qg94hKZg8ydRUy17ZtHZfYmnwFupR88R5DZXIpHYP0S5g==",
|
||||
"requires": {
|
||||
"@typescript-to-lua/language-extensions": "1.0.0",
|
||||
"node_modules/typescript-to-lua": {
|
||||
"version": "1.25.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-1.25.2.tgz",
|
||||
"integrity": "sha512-jBPE/6RRm5GZwH3qiqLcecQQ5vwk4jHuNaLyINE95f9pmRAoJ2DeqvgyuZ22luMnAYdZ3Td2dsA0MqGTt8IfBg==",
|
||||
"dependencies": {
|
||||
"@typescript-to-lua/language-extensions": "1.19.0",
|
||||
"enhanced-resolve": "^5.8.2",
|
||||
"picomatch": "^2.3.1",
|
||||
"resolve": "^1.15.1",
|
||||
"source-map": "^0.7.3"
|
||||
},
|
||||
"bin": {
|
||||
"tstl": "dist/tstl.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.10.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "5.4.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@
|
|||
"dev": "tstl --watch"
|
||||
},
|
||||
"engines": {
|
||||
"node": "~14.19.1"
|
||||
"node": ">=16.10.0"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"dependencies": {
|
||||
"lua-types": "2.13.1",
|
||||
"typescript-to-lua": "1.11.1",
|
||||
"typescript-to-lua": "1.25.2",
|
||||
"typed-factorio": "3.36.0",
|
||||
"typescript": "4.9"
|
||||
"typescript": "5.4.2"
|
||||
},
|
||||
"license": "GPL-3.0-only",
|
||||
"peerDependencies": {},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
// Generated by kxs-ts-gen - do not edit this file manually
|
||||
|
||||
import {double, float, int32 as int, int8, PlayerIndex, SurfaceIndex, uint32 as uint, uint8, UnitNumber} from "factorio:runtime"
|
||||
|
||||
export interface KafkatorioPacket {
|
||||
modVersion: string;
|
||||
tick: Tick;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import {initGlobal} from "../global-init";
|
||||
import {emitPrototypes} from "../events/prototypeUpdates";
|
||||
import EventDataQueue from "../emitting/EventDataQueue";
|
||||
import {ChunkPosition, CustomCommandData, OnChunkGeneratedEvent} from "factorio:runtime"
|
||||
|
||||
|
||||
commands.add_command(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import KafkatorioSettings from "../settings/KafkatorioSettings";
|
||||
import {KafkatorioKeyedPacketData} from "../types";
|
||||
import PacketEmitter from "./PacketEmitter";
|
||||
import {uint32 as uint} from "factorio:runtime"
|
||||
|
||||
|
||||
declare const storage: {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
import {EventData, int32 as int, uint32 as uint} from "factorio:runtime"
|
||||
|
||||
|
||||
export class EventDataQueueManager {
|
||||
|
||||
static init(force?: boolean) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import {KafkatorioPacketData} from "../../generated/kafkatorio-schema";
|
||||
import {int32 as int} from "factorio:runtime"
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import {initGlobal} from "../global-init";
|
||||
import {emitPrototypes} from "./prototypeUpdates";
|
||||
import ConfigurationUpdates from "./handlers/ConfigurationUpdateHandler";
|
||||
import {ConfigurationChangedData} from "factorio:runtime"
|
||||
|
||||
|
||||
script.on_configuration_changed((data: ConfigurationChangedData) => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import {KafkatorioPacketData} from "../../generated/kafkatorio-schema";
|
||||
import KafkatorioPacketQueue from "../emitting/KafkatorioPacketQueue";
|
||||
import {OnConsoleChatEvent, OnConsoleCommandEvent} from "factorio:runtime"
|
||||
|
||||
|
||||
script.on_event(defines.events.on_console_chat, (event: OnConsoleChatEvent) => {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,21 @@ import {
|
|||
MinedProduct,
|
||||
PrototypeId,
|
||||
} from "../../generated/kafkatorio-schema";
|
||||
import {
|
||||
BoundingBox,
|
||||
ChunkPosition,
|
||||
CollisionMask,
|
||||
Color,
|
||||
LuaEntity,
|
||||
LuaEntityPrototype,
|
||||
LuaPlayer,
|
||||
LuaSurface,
|
||||
LuaTilePrototype,
|
||||
MapPosition,
|
||||
OldTileAndPosition,
|
||||
Tile,
|
||||
TilePosition,
|
||||
} from "factorio:runtime"
|
||||
|
||||
|
||||
export namespace Converters {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import EntityUpdates from "./handlers/EntityUpdateHandler";
|
||||
import {OnBuiltEntityEvent, OnPlayerMinedEntityEvent, OnRobotBuiltEntityEvent, OnRobotMinedEntityEvent} from "factorio:runtime"
|
||||
|
||||
script.on_event(defines.events.on_built_entity, (e: OnBuiltEntityEvent) => {
|
||||
log(`on_built_entity ${e.tick}`)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import {CustomInputEvent, EventData, EventId} from "factorio:runtime"
|
||||
|
||||
|
||||
export function isEventType<ED extends EventData | CustomInputEvent>(
|
||||
eventData: EventData,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {
|
|||
import PacketEmitter from "../../emitting/PacketEmitter";
|
||||
import ConfigurationUpdate = KafkatorioPacketData.ConfigurationUpdate;
|
||||
import KafkatorioPacketQueue from "../../emitting/KafkatorioPacketQueue";
|
||||
import {ConfigurationChangedData} from "factorio:runtime"
|
||||
|
||||
|
||||
export class ConfigurationUpdateHandler {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,34 @@ import {
|
|||
} from "../../../generated/kafkatorio-schema";
|
||||
import {Converters} from "../converters";
|
||||
import EventDataCache from "../../emitting/EventDataCache";
|
||||
import {
|
||||
BoundingBox,
|
||||
LuaEntity,
|
||||
LuaSurface,
|
||||
MapPosition,
|
||||
OldTileAndPosition,
|
||||
OnBuiltEntityEvent,
|
||||
OnChunkGeneratedEvent,
|
||||
OnEntityClonedEvent,
|
||||
OnEntityDamagedEvent,
|
||||
OnEntityDiedEvent,
|
||||
OnEntityLogisticSlotChangedEvent,
|
||||
OnEntityRenamedEvent,
|
||||
OnEntitySettingsPastedEvent,
|
||||
OnEntitySpawnedEvent,
|
||||
OnPlayerMinedEntityEvent,
|
||||
OnPlayerMinedTileEvent,
|
||||
OnPlayerRepairedEntityEvent,
|
||||
OnPlayerRotatedEntityEvent,
|
||||
OnPostEntityDiedEvent,
|
||||
OnPreEntitySettingsPastedEvent,
|
||||
OnRobotBuiltEntityEvent,
|
||||
OnRobotMinedEntityEvent,
|
||||
OnRobotMinedTileEvent,
|
||||
OnSelectedEntityChangedEvent,
|
||||
OnTriggerCreatedEntityEvent,
|
||||
SurfaceIndex,
|
||||
} from "factorio:runtime"
|
||||
|
||||
|
||||
export class EntityUpdatesHandler {
|
||||
|
|
@ -211,7 +239,6 @@ type EntityUpdateEvent =
|
|||
|
||||
| OnEntityClonedEvent
|
||||
| OnEntityDamagedEvent
|
||||
| OnEntityDestroyedEvent
|
||||
| OnEntityDiedEvent
|
||||
| OnEntityLogisticSlotChangedEvent
|
||||
| OnEntityRenamedEvent
|
||||
|
|
|
|||
|
|
@ -7,6 +7,18 @@ import {
|
|||
} from "../../../generated/kafkatorio-schema";
|
||||
import EventUpdates, {PacketKey} from "../../emitting/EventDataCache";
|
||||
import {MapChunkUpdateEvent, MapTileChangeEvent} from "../mapChunkUpdates";
|
||||
import {
|
||||
LuaSurface,
|
||||
OnChunkGeneratedEvent,
|
||||
OnPlayerBuiltTileEvent,
|
||||
OnPlayerMinedTileEvent,
|
||||
OnPreChunkDeletedEvent,
|
||||
OnRobotBuiltTileEvent,
|
||||
OnRobotMinedTileEvent,
|
||||
ScriptRaisedSetTilesEvent,
|
||||
Tile,
|
||||
uint32 as uint,
|
||||
} from "factorio:runtime"
|
||||
|
||||
|
||||
type MapChunkTileUpdater = (data: KafkatorioPacketData.MapChunkTileUpdate) => void
|
||||
|
|
|
|||
|
|
@ -1,6 +1,19 @@
|
|||
import {KafkatorioPacketData} from "../../../generated/kafkatorio-schema";
|
||||
import {Converters} from "../converters";
|
||||
import EventUpdates from "../../emitting/EventDataCache";
|
||||
import {
|
||||
LuaPlayer,
|
||||
OnPlayerBannedEvent,
|
||||
OnPlayerChangedPositionEvent,
|
||||
OnPlayerChangedSurfaceEvent,
|
||||
OnPlayerDiedEvent,
|
||||
OnPlayerJoinedGameEvent,
|
||||
OnPlayerKickedEvent,
|
||||
OnPlayerRemovedEvent,
|
||||
OnPlayerUnbannedEvent,
|
||||
OnPrePlayerLeftGameEvent,
|
||||
uint32 as uint,
|
||||
} from "factorio:runtime"
|
||||
|
||||
|
||||
export type PlayerUpdater = (player: LuaPlayer, data: KafkatorioPacketData.PlayerUpdate) => void
|
||||
|
|
|
|||
|
|
@ -1,5 +1,16 @@
|
|||
import EntityUpdates from "./handlers/EntityUpdateHandler";
|
||||
import MapChunkUpdate from "./handlers/MapChunkUpdateHandler";
|
||||
import {
|
||||
OnChunkChartedEvent,
|
||||
OnChunkDeletedEvent,
|
||||
OnChunkGeneratedEvent,
|
||||
OnPlayerBuiltTileEvent,
|
||||
OnPlayerMinedTileEvent,
|
||||
OnPreChunkDeletedEvent,
|
||||
OnRobotBuiltTileEvent,
|
||||
OnRobotMinedTileEvent,
|
||||
ScriptRaisedSetTilesEvent,
|
||||
} from "factorio:runtime"
|
||||
|
||||
|
||||
export type MapTileChangeEvent =
|
||||
|
|
|
|||
|
|
@ -2,6 +2,16 @@ import {Converters} from "./converters";
|
|||
import {ForceIndex, KafkatorioPacketData, PlayerUpdateKey} from "../../generated/kafkatorio-schema";
|
||||
import packetEmitter from "../emitting/PacketEmitter";
|
||||
import PlayerUpdates from "./handlers/PlayerUpdateHandler";
|
||||
import {
|
||||
OnPlayerBannedEvent,
|
||||
OnPlayerChangedPositionEvent,
|
||||
OnPlayerChangedSurfaceEvent,
|
||||
OnPlayerDiedEvent,
|
||||
OnPlayerJoinedGameEvent,
|
||||
OnPlayerKickedEvent,
|
||||
OnPlayerRemovedEvent,
|
||||
OnPrePlayerLeftGameEvent,
|
||||
} from "factorio:runtime"
|
||||
|
||||
|
||||
// function playerUpdateDebounce(playerIndex: uint, mutate: PlayerUpdater) {
|
||||
|
|
@ -23,7 +33,7 @@ script.on_event(defines.events.on_player_joined_game, (e: OnPlayerJoinedGameEven
|
|||
data.characterUnitNumber = player.character?.unit_number ?? null
|
||||
data.chatColour = Converters.mapColour(player.chat_color)
|
||||
data.colour = Converters.mapColour(player.color)
|
||||
data.forceIndex = player.force.index as ForceIndex
|
||||
data.forceIndex = player.force.index as unknown as ForceIndex
|
||||
data.name = player.name
|
||||
data.isShowOnMap = player.show_on_map
|
||||
data.isSpectator = player.spectator
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
} from "../../generated/kafkatorio-schema";
|
||||
import {Converters} from "./converters";
|
||||
import KafkatorioPacketQueue from "../emitting/KafkatorioPacketQueue";
|
||||
import {LuaGroup} from "factorio:runtime"
|
||||
|
||||
|
||||
type PrototypesByType<T extends FactorioPrototype> = Record<string, T[]>
|
||||
|
|
@ -70,7 +71,7 @@ function getEntityPrototypes(): PrototypesByType<FactorioPrototype.Entity> {
|
|||
isBuilding: entity.is_building,
|
||||
isEntityWithOwner: entity.is_entity_with_owner,
|
||||
isMilitaryTarget: entity.is_military_target,
|
||||
maxHealth: entity.max_health,
|
||||
maxHealth: entity.get_max_health(),
|
||||
collisionBox: Converters.collisionBox(entity.collision_box),
|
||||
|
||||
tileWidth: entity.tile_width,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import KafkatorioPacketQueue from "../emitting/KafkatorioPacketQueue";
|
|||
import PacketEmitter from "../emitting/PacketEmitter";
|
||||
import {KafkatorioPacketData} from "../../generated/kafkatorio-schema";
|
||||
import EventDataQueue from "../emitting/EventDataQueue";
|
||||
import {EventData, OnTickEvent} from "factorio:runtime"
|
||||
|
||||
|
||||
script.on_event(defines.events.on_tick, (event: OnTickEvent) => {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
import {OnRuntimeModSettingChangedEvent} from "factorio:runtime"
|
||||
|
||||
|
||||
script.on_event(defines.events.on_runtime_mod_setting_changed, (e: OnRuntimeModSettingChangedEvent) => {
|
||||
print(`Settings changed ${e.setting_type}, ${e.player_index}, ${e.setting}`)
|
||||
// KafkatorioSettings.loadSettings()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import PacketEmitter from "../emitting/PacketEmitter";
|
||||
import {KafkatorioPacketData} from "../../generated/kafkatorio-schema";
|
||||
import Type = KafkatorioPacketData.Type;
|
||||
import {LuaSurface, OnTickEvent} from "factorio:runtime"
|
||||
|
||||
|
||||
export function handleSurfaceUpdate(
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import {EventDataQueueManager} from "./emitting/EventDataQueue";
|
|||
export function initGlobal(force: boolean = false) {
|
||||
log(`Initialising Kafkatorio Global variables (force=${force})...`)
|
||||
|
||||
storage.MOD_VERSION = script.active_mods[script.mod_name]
|
||||
storage.FACTORIO_VERSION = script.active_mods["base"]
|
||||
storage.MOD_VERSION = script.active_mods[script.mod_name]!
|
||||
storage.FACTORIO_VERSION = script.active_mods["base"]!
|
||||
|
||||
EventDataQueueManager.init(true)
|
||||
EventUpdates.init(true)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import {SettingsData} from "factorio:common"
|
||||
import {DoubleSettingDefinition} from "factorio:settings"
|
||||
import {KafkatorioKeyedPacketData, KafkatorioKeyedPacketTypes} from "../types";
|
||||
import {double, uint32 as uint} from "factorio:runtime"
|
||||
|
||||
export class KafkatorioSettingsConfig {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue