From 647dcbf78bb692654ee8536c6ea9f0aa7d774374 Mon Sep 17 00:00:00 2001 From: Andre Louis Issa Date: Mon, 20 May 2024 21:11:45 +1000 Subject: [PATCH 1/3] minor syntax fix in defs comment --- src/src/def.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/src/def.lua b/src/src/def.lua index 2d54987..94e4fdc 100644 --- a/src/src/def.lua +++ b/src/src/def.lua @@ -7,6 +7,6 @@ local public = {} -- ---@param a integer helpful description -- ---@param b string helpful description -- ---@return table c helpful description --- function public.do_stuff(a, b) +-- function public.do_stuff(a, b) end return public \ No newline at end of file From 9163cf2a1c5d121dd9a197ad8000dae82ef890c2 Mon Sep 17 00:00:00 2001 From: Andre Louis Issa Date: Tue, 21 May 2024 16:55:41 +1000 Subject: [PATCH 2/3] fallback to the game's globals --- CHANGELOG.md | 8 ++++++++ src/src/main.lua | 7 +++++-- src/src/ready.lua | 5 +++-- src/src/reload.lua | 5 ++--- src/thunderstore.toml | 4 ++-- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd141a1..78bea7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Template imports the game globals as a fallback. + +### Fixed + +- Fixed typo when defining `_PLUGIN` in the template. + ## [0.6.0] - 2024-05-20 ### Added diff --git a/src/src/main.lua b/src/src/main.lua index 5dd49f3..0e65151 100644 --- a/src/src/main.lua +++ b/src/src/main.lua @@ -15,10 +15,13 @@ mods['SGG_Modding-ENVY'].auto() ---@diagnostic disable-next-line: undefined-global rom = rom ---@diagnostic disable-next-line: undefined-global -_PLUGIN = PLUGIN +_PLUGIN = _PLUGIN ----@module 'SGG_Modding-Hades2GameDef-Globals' +-- get definitions for the game's globals +---@module 'game' game = rom.game +---@module 'game-import' +import_as_fallback(game) ---@module 'SGG_Modding-SJSON' sjson = mods['SGG_Modding-SJSON'] diff --git a/src/src/ready.lua b/src/src/ready.lua index 07cbdce..405abb2 100644 --- a/src/src/ready.lua +++ b/src/src/ready.lua @@ -13,8 +13,9 @@ sjson.hook(file, function(data) return sjson_ShellText(data) end) -modutil.mod.Path.Wrap("SetupMap", function(base) - return wrap_SetupMap(base) +modutil.mod.Path.Wrap("SetupMap", function(base, ...) + prefix_SetupMap() + return base(...) end) game.OnControlPressed({'Gift', function() diff --git a/src/src/reload.lua b/src/src/reload.lua index 69823b2..54933d9 100644 --- a/src/src/reload.lua +++ b/src/src/reload.lua @@ -14,10 +14,9 @@ function sjson_ShellText(data) end end -function wrap_SetupMap(base) +function prefix_SetupMap() print('Map is loading, here we might load some packages.') - -- game.LoadPackages({Name = package_name_string}) - return base() + -- LoadPackages({Name = package_name_string}) end function trigger_Gift() diff --git a/src/thunderstore.toml b/src/thunderstore.toml index 3497339..5004cab 100644 --- a/src/thunderstore.toml +++ b/src/thunderstore.toml @@ -11,8 +11,8 @@ websiteUrl = "https://github.com/AuthorName/ModName" containsNsfwContent = false [package.dependencies] -Hell2Modding-Hell2Modding = "1.0.26" -SGG_Modding-ENVY = "1.0.0" +Hell2Modding-Hell2Modding = "1.0.28" +SGG_Modding-ENVY = "1.0.1" SGG_Modding-Chalk = "2.0.2" SGG_Modding-ReLoad = "1.0.1" SGG_Modding-SJSON = "1.0.0" From 5f8ae1a04534350784abfc089fa00fe8743d8237 Mon Sep 17 00:00:00 2001 From: Andre Louis Issa Date: Mon, 3 Jun 2024 19:48:52 +1000 Subject: [PATCH 3/3] update modutil usage --- CHANGELOG.md | 1 + src/src/main.lua | 2 +- src/thunderstore.toml | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6bfba6..c5c228c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Template uses ModUtil `4.0.0` and `once_loaded.game` instead of `on_ready_final`. - Use annotated tags instead of lightweight tags in release workflow. ## [0.6.1] - 2024-05-23 diff --git a/src/src/main.lua b/src/src/main.lua index 0e65151..2754fca 100644 --- a/src/src/main.lua +++ b/src/src/main.lua @@ -56,6 +56,6 @@ end local loader = reload.auto_single() -- this runs only when modutil and the game's lua is ready -modutil.on_ready_final(function() +modutil.once_loaded.game(function() loader.load(on_ready, on_reload) end) diff --git a/src/thunderstore.toml b/src/thunderstore.toml index 5004cab..9011365 100644 --- a/src/thunderstore.toml +++ b/src/thunderstore.toml @@ -12,11 +12,11 @@ containsNsfwContent = false [package.dependencies] Hell2Modding-Hell2Modding = "1.0.28" -SGG_Modding-ENVY = "1.0.1" +SGG_Modding-ENVY = "1.1.0" SGG_Modding-Chalk = "2.0.2" SGG_Modding-ReLoad = "1.0.1" SGG_Modding-SJSON = "1.0.0" -SGG_Modding-ModUtil = "3.1.0" +SGG_Modding-ModUtil = "4.0.0" [build]