diff --git a/CHANGELOG.md b/CHANGELOG.md index 436827f4..66ba7375 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ Many thanks to the following for contributing to this release: ### Major Features - Added support for 2.0 builtin mods during mod pack creation. [#684](https://github.com/clusterio/clusterio/pull/684). +- Added basic 2.0 support to clusterio lua api and 1st party plugins [#685](https://github.com/clusterio/clusterio/pull/685). ### Features diff --git a/packages/host/lua/clusterio_lib/info.json b/packages/host/lua/clusterio_lib/info.json index 7e720756..cd4bbbed 100644 --- a/packages/host/lua/clusterio_lib/info.json +++ b/packages/host/lua/clusterio_lib/info.json @@ -12,6 +12,10 @@ { "version": "0.1.2", "factorio_version": "1.1" + }, + { + "version": "0.1.3", + "factorio_version": "2.0" } ], "title": "Clusterio Library (Alpha)", diff --git a/packages/host/src/patch.ts b/packages/host/src/patch.ts index 9b7f1fb9..9a675e60 100644 --- a/packages/host/src/patch.ts +++ b/packages/host/src/patch.ts @@ -346,9 +346,8 @@ function reorderDependencies(modules: SaveModule[]) { const knownScenarios: Record = { // First seen in 0.17.63 "4e866186ebe297f1038fd325b09df1a1f5e2fdd1": new lib.ModuleInfo("freeplay", "0.17.63", [], ["scenario"]), - // First seen in 2.0 TODO Uncomment once clusterio lib supports 2.0 - // The rest of the code has already been updated to support the new control.lua file for 2.0 - // "bcbdde18ce4ec16ebfd93bd694cd9b12ef969c9a": new lib.ModuleInfo("freeplay", "2.0.0", [], ["scenario"]), + // First seen in 2.0 + "bcbdde18ce4ec16ebfd93bd694cd9b12ef969c9a": new lib.ModuleInfo("freeplay", "2.0.0", [], ["scenario"]), }; /** diff --git a/plugins/inventory_sync/module/inventory_sync.lua b/plugins/inventory_sync/module/inventory_sync.lua index b4fba61a..eaa9d361 100644 --- a/plugins/inventory_sync/module/inventory_sync.lua +++ b/plugins/inventory_sync/module/inventory_sync.lua @@ -359,9 +359,9 @@ end -- Upload inventory when a player leaves the game. Triggers on restart after crash if player was online during crash. inventory_sync.events[defines.events.on_pre_player_left_game] = function(event) - -- for some reason, on_pre_player_left_game gets called before on_server_startup so global isn't ready yet + -- for some reason, on_pre_player_left_game gets called before on_server_startup so script_data isn't ready yet if not compat.script_data().inventory_sync then - log("ERROR: Global inventory sync not defined") + log("ERROR: script data for inventory sync is not defined") return end