You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/lua/tables/definitions/_ENV - Plugin Specific Global Table.lua
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -29,4 +29,5 @@
29
29
---@field_PLUGIN.plugins_data_mod_folder_path string # Path to the mod folder inside `plugins_data`
30
30
---@field_PLUGIN.plugins_mod_folder_path string # Path to the mod folder inside `plugins`
31
31
---@field_PLUGIN.this lua_module*
32
+
---@field_PLUGIN.sjson_data_path string # The absolute path to the plugin's SJSON data directory (plugins_data/<mod-guid>/Hell2Modding-SJSON/).Mod authors can use this to discover or create .sjson files at runtime.
Copy file name to clipboardExpand all lines: docs/lua/tables/definitions/rom.data.lua
+105Lines changed: 105 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
---@meta data
2
2
3
3
---@class (exact) rom.data
4
+
---@fieldSJSON_DATA_DIR_NAMEstring # Value: "Hell2Modding-SJSON"The canonical directory name for the SJSON data overlay.Mods must place .sjson files in plugins_data/<mod-guid>/<SJSON_DATA_DIR_NAME>/Animations/, Text/{lang}/, etc.Hell2Modding scans this directory at startup and injects discovered .sjson files into the engine's loading pipeline.
4
5
5
6
---@paramhash_guidinteger Hash value.
6
7
---@returnstring # Returns the string corresponding to the provided hash value.
@@ -29,10 +30,114 @@ function data.load_package_overrides_get(hash_guid) end
29
30
---@paramhash_guid_table_overridetable<number> List of HashGuid values that should be used instead.
30
31
functiondata.load_package_overrides_set(hash_guid, hash_guid_table_override) end
31
32
33
+
-- Registers a custom GPK file for file-redirection at runtime, allowing
34
+
--hot-loading of GPK assets that were not present during initial scan.
---@paramfilenamestring The PKG or PKG_MANIFEST filename.
51
+
---@paramfull_pathstring The full filesystem path to the file.
52
+
functiondata.add_package_file(filename, full_path) end
53
+
32
54
---@paramfunctionfunction Function called when game data file is read. The function must match signature: (string (file_path_being_read), string (file_content_buffer)) -> returns nothing (nil) or the new file buffer (string)
33
55
---@paramfile_path_being_readstring optional. Use only if you want your lua function to be called for a given file_path.
34
56
functiondata.on_sjson_read_as_string(function, file_path_being_read) end
35
57
36
58
functiondata.reload_game_data() end
37
59
60
+
-- Registers a .sjson file so the engine discovers and loads it as if it were in the game's `Content/Game/` directory.
61
+
--The engine-relative path is inferred automatically: files inside `plugins_data/<mod>/<SJSON_DATA_DIR_NAME>/` map to `Content/Game/`.
62
+
--For example, `plugins_data/<mod-guid>/<SJSON_DATA_DIR_NAME>/Animations/Foo.sjson` is loaded as `Content/Game/Animations/Foo.sjson`.
63
+
--At startup, Hell2Modding automatically scans every mod's <SJSON_DATA_DIR_NAME> directory and registers any .sjson files found.
64
+
--Use this function to dynamically register files created during the current session (e.g. a first-time install placing a file into plugins_data).
65
+
---@paramabsolute_pathstring The absolute filesystem path to a .sjson file inside a <SJSON_DATA_DIR_NAME> directory.
66
+
---@returnboolean # true if registered successfully, false if the file is a duplicate, not a .sjson, or the path does not contain <SJSON_DATA_DIR_NAME>.
67
+
functiondata.register_sjson_file(absolute_path) end
68
+
69
+
-- Scans the directory recursively and registers all .sjson files found. Each file's engine path is derived from its position in the directory tree.
70
+
--This is the same scan that Hell2Modding performs automatically at startup for `plugins_data/*/<SJSON_DATA_DIR_NAME>/`.
71
+
---@paramabsolute_base_pathstring Absolute path to a directory whose structure mirrors `Content/Game/` (e.g. containing `Animations/`, `Text/en/`, etc.)
72
+
functiondata.register_content_directory(absolute_base_path) end
73
+
74
+
-- Registers a file redirect so the engine loads it from an external location instead of Content/.
75
+
--Unlike register_content_file (SJSON-only), this works for any file type that the engine loads via fsAppendPathComponent (maps, etc.).
76
+
--No directory convention is enforced - the caller provides both paths.
77
+
---@paramcontent_relative_pathstring The path relative to Content/, e.g. "Maps/D_Hub.map_text" or "Maps/bin/D_Hub.thing_bin"
78
+
---@paramabsolute_pathstring The absolute filesystem path to the actual file
79
+
---@returnboolean # true if registered, false if duplicate
80
+
functiondata.register_file_redirect(content_relative_path, absolute_path) end
81
+
82
+
-- Registers a file for engine injection and redirect. Routes to the appropriate internal registry.
0 commit comments