Commit graph

128 commits

Author SHA1 Message Date
509832d26d Fix kxs-ts-gen-core dependency resolution and unblocked compile bugs
The version catalog pointed kxs-ts-gen-core at a JitPack coordinate
(com.github.adamko-dev.kotlinx-serialization-typescript-generator) that
no longer serves real artifacts there, despite JitPack's build-status
API still reporting it as built. The library is properly published to
Maven Central under dev.adamko.kxstsgen - a commented-out line with
that exact coordinate was already sitting in the catalog. Swapping to
it fixes dependency resolution for every module depending on
versions-platform (which previously blocked any Gradle task touching
events-library, including all of its tests).

That unblocked two more pre-existing, unrelated bugs that had never
been caught because this module never previously compiled:

- LuaJsonList<T> : List<T> by list triggered a longstanding Kotlin
  compiler bug (KT-3546, "accidental override" on generic toArray)
  specific to delegating java.util.List via `by`. Replaced with a
  hand-written Collection<T> implementation (no delegation codegen,
  no bug), which still satisfies Kotest's forOne/forAll inspectors -
  the only thing any code actually needs from it.
- The kxs-ts-gen Kotlin->TypeScript generator (kt2ts2.kt) still emitted
  the pre-2.0 bare `uint`/`int` names and no import statement, since it
  predates typed-factorio's move to virtual modules. Updated its
  primitive-type mappings to uint32/int32 and added the "factorio:runtime"
  import to its generated header, so the regenerated schema matches what
  the rest of events-mod now expects.

Verified via real Gradle tasks (not just manual tooling): events-library
compiles and all tests pass; events-mod's full build - Kotlin schema
generation, npm install, tstl compile, and info.json generation (with
factorio_version "2.0" and the space-exploration/Krastorio2 optional
dependencies) - succeeds end-to-end.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-12 15:40:33 +02:00
e296a9aa90 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>
2026-10-12 15:27:50 +02:00
072d1a2845 Port events-mod to Factorio 2.0.77, declare SE/Krastorio 2 compatibility
Bumps the Factorio engine pin and typed-factorio (1.11.0 -> 3.36.0,
targeting 2.0.75) and fixes the resulting breaking API changes:
global -> storage, game.*_prototypes -> prototypes.*, game.table_to_json/
encode_string -> helpers.*, OnBuiltEntityEvent.created_entity -> .entity,
removed TileRead/ColorTable/MapPositionTable-style write-form aliases,
new CollisionMask shape, restructured settings-stage type imports, and
new defines.entity_status values (added to the Status enum, generated
schema, and EntityStatusRecord mapping). Also declares optional mod
dependencies on space-exploration and Krastorio2.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-12 15:06:30 +02:00
Adam
a99ed5bb85 remove generated lua (it's stable - moved it to temp dir) 2022-12-19 16:52:49 +01:00
Adam
9f2b9cbd5c big ol' refactor of the Gradle Factorio Mod
- handle launching in multiple OSes
- specific tasks for specific mod operations
- extension object for settings
- ground work for multiple mods
2022-12-18 01:41:14 +01:00
Adam
2c9c442595 typo dequed -> dequeued 2022-12-06 00:24:17 +01:00
Adam
fcb870072a version bumps 2022-12-06 00:23:52 +01:00
Adam
76a661e444 move logo, add function to auto-init the project logo 2022-10-30 18:44:47 +01:00
Adam
f0b080a7fe optimise logo 2022-10-30 18:44:11 +01:00
Adam
dda48bac78 refactor the KafkatorioPacket tag that the mod logs, and the syslog-server parses 2022-10-18 21:35:49 +02:00
Adam
6fa5c3f488 [mod] re-build lua (I need to get rid of the lua code and keep at as generated... 2022-10-17 00:17:14 +02:00
Adam
895194d576 [mod] add code for writing packets to file (but disable it) 2022-10-17 00:11:45 +02:00
Adam
dadbcdd8d6 version bumps (scrimage, kotlinJsWrappers, ktor, hoplite, tstl, typed-factorio, typescript) 2022-09-10 10:13:48 +02:00
Adam
60d61752b3 update mod generated code (remove unused var) 2022-09-01 23:19:06 +02:00
Adam
b1cf94a8a8 fix item subgroup mapping 2022-09-01 22:57:40 +02:00
Adam
3821996eeb bump some versions (use Kotest in Maven Local b/c plugin isn't available on Sonatype snapshot)
add tile width/height (added in new version of Factorio)
2022-08-28 13:39:34 +02:00
Adam
c9ae17d418 bump versions (kafka, ktor, hoplite, simple-syslog, factorio, tstl, typed-factorio, kotka, gradle-node) and update code to compile 2022-08-13 12:05:17 +02:00
Adam
d006635e49 bump tstl, typed-factorio, ks-js-wrappers 2022-07-23 16:26:11 +02:00
Adam
085776d42b packet size improvements
- change structure resource packets
- make more booleans default to false
- use encode_string - massive decrease in packet size!!
2022-07-17 23:54:53 +02:00
Adam
b507081eac Render buildings and resources
- create LuaJsonList to handle empty Lua JSON lists being sent as empty objects
- fix exporting of resources and entities
- split up map tiles into different layer directories
- add 'chunk size' to MapChunkPosition
- move tests to correct packages
- bump tstl
- decrease tstl logging
- remove some defined, but unused, kafka topics
- syslog, rest, websocket servers & web-map: decrease logging
- webmap: add additional layers for buildings and resources
2022-07-16 23:11:40 +02:00
Adam
90aa086dd4 mod: entity prototype improvements and refactoring
- refactor and move queue & emitter classes for consistency
- don't emit all prototypes at once
- add simple queue for 'instant' packets so the printer doesn't get overwhelmed and mix up the output
2022-07-09 14:03:57 +02:00
Adam
80eb001bbf emit entity prototypes
- mod: refactor event handlers to separate files
- lib: update models for prototypes
2022-07-08 21:06:09 +02:00
Adam
c29b66aada bump tstl 2022-07-06 17:15:42 +02:00
Adam
90dc520d22 massive refactor to export entities (buildings and resources)
- minor version bumps
- new Factorio version
- use both prototype name and type to identify a prototype
- kxs-ts-gen: use BrandTyping, but exclude some identifiers
- kxs-ts-gen: manually create zip dist, so it can run after the project compiles
- mod: use typed-factorio strict types
- mod: refactor event handlers to be a little more consistent and object-oriented
2022-07-05 23:44:23 +02:00
Adam
6c6526eda9 regenerate mod lua (I guess it didn't happen before?) 2022-07-02 10:21:38 +02:00
Adam
a381e01886 move lua to src/generated, and tweak IntelliJ 'mark as excluded/src' 2022-07-02 09:50:11 +02:00
Adam
b0452881bc commit generated lua code (I'm not 100% sure it's generated stably - this way I can see changes) 2022-06-28 21:59:54 +02:00
Adam
23a2ecb0d4 set serial name for MinedProduct and MinedProduct.Type 2022-06-27 22:59:52 +02:00
Adam
1d0b2b8eaa refactor typescript files (mostly moving&renaming for consistency) 2022-06-27 22:57:57 +02:00
Adam
b8c1c57a17 try emitting player disconnects and immediate packet updates immediately (otherwise the server doesn't see the disconnect message and the last player remains online) 2022-06-26 15:30:03 +02:00
Adam
c9df87e5e0 fix NPE for config update event 2022-06-26 14:57:14 +02:00
Adam
9a7ac19cfa update logo 2022-06-24 17:52:24 +02:00
Adam
487d1a91f5 re-gen kafkatorio-schema.ts (no real change, just alphabetically ordered) 2022-06-19 10:32:07 +02:00
Adam
e9a6f99fb8 add some logs to try and figure out if player disconnection can be sent before server shutdown 2022-05-30 20:45:11 +02:00
Adam
9278172412 mod: try immediately outputting player logoff events 2022-05-24 17:40:21 +02:00
Adam
883ed897f5 mod: try fixing settings not loading 2022-05-18 19:38:32 +02:00
Adam
6d9f303226 mod: move npm root dir so node_modules isn't in the src dir, and fix the hack for the bug https://github.com/GlassBricks/typed-factorio/issues/13 2022-05-18 19:37:29 +02:00
Adam
5291ac9484 try to reduce delay when de-queueing events 2022-05-14 23:50:00 +02:00
Adam
f9b078b5a1 when queuing chunks, print the min/max chunk coords 2022-05-14 23:49:37 +02:00
Adam
867e22240b temp fix Type Factorio doc {@link https} bug 2022-05-14 17:59:50 +02:00
Adam
697a00b443 bump kvision, kotlinx serialization, factorio, and a few others 2022-05-14 17:58:14 +02:00
Adam
93444bfe39 try adding tstl language server plugin (I don't think IntelliJ understands it though) 2022-05-07 23:03:43 +02:00
Adam
436b7ba1d4 fix map chunk update prototype clash 2022-05-07 23:02:51 +02:00
Adam
5a000b9327 fix entity position type, fix Entity proto property name clash, and update ts-schema 2022-05-07 23:02:31 +02:00
Adam
688b2c7bcb - add tile deconstruction (concrete tiles can be removed)
- add @SerialName to all packets
- start implementing Entity prototype
- start implementing Entity updates
- clean up some old commented out code
- refactor how debounced events track the triggering events (now include timestamps per event)
- bump tstl
2022-05-07 20:29:24 +02:00
Adam
403ca0dd2e mod: clean up onMapChunkEventListeners.ts 2022-05-01 15:47:28 +02:00
Adam
153747e39c mod: fix checking for existing entries in EventDataCache 2022-05-01 15:43:44 +02:00
Adam
ab9e9d4d66 mod: fix settings names and descriptions 2022-05-01 11:20:54 +02:00
Adam
023fb8b3de mod command: print enqueued chunk count 2022-05-01 09:44:20 +02:00
Adam
4a2c771603 experiment with optimising map-chunk message 2022-04-24 11:32:34 +02:00