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
Gadgets are essentially scripts wrapped as modcache entries. The name "gadgets" is inspired by Beyond All Reason RTS (running open source Recoil engine). Usual modcache treatment applies:
* can be zipped or unzipped in directory
* can have preview (aka 'mini') image
* selectable via MainSelectorUI (open from TopMenubarUI, menu Tools, button BrowseGadgets
All methods of loading a script were extended to recognize the .gadget suffix and load the gadget appropriately:
* the 'loadscript' console command
* the cvars 'app_custom_scripts' and 'app_recent_scripts'
* the -runscript command line argument
NOTE that although `ScriptCategory::GADGET` was added, all the above methods still load everything as `ScriptCategory::CUSTOM` and the game adjusts it based on extension.
The ScriptMonitorUI was extended to display .gadget file name for `ScriptCategory::GADGET` script units.
Example .gadget file:
```
; This is a .gadget mod - basically a script wrapped as a modcache entry.
; The .gadget file must be present (even if empty) to get recognized.
; The script must have same base filename, i.e. 'foo.gadget' -> 'foo.as'
; Any extra include scripts or other resources can be bundled.
; -----------------------------------------------------------------------
; Name to display in Selector UI.
gadget_name "Engine Tool"
; Authors (Syntax: <credit>, <forumID>, <name>, [<email>]) - multiple authors can be given.
gadget_author "base script" 351 ohlidalp
; Description to display in Selector UI.
gadget_description "In-game engine diag and adjustment."
; Category for Selector UI (300 = Generic gadgets, 301 = Actor gadgets, 302 = Terrain gadgets).
gadget_category 301
```
Copy file name to clipboardexpand all lines: source/main/scripting/ScriptEngine.h
+7-5
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,8 @@ enum class ScriptCategory
60
60
INVALID,
61
61
ACTOR, //!< Defined in truck file under 'scripts', contains global variable `BeamClass@ thisActor`.
62
62
TERRAIN, //!< Defined in terrn2 file under '[Scripts]', receives terrain eventbox notifications.
63
-
CUSTOM //!< Loaded by user via either: A) ingame console 'loadscript'; B) RoR.cfg 'app_custom_scripts'; C) commandline '-runscript'.
63
+
GADGET, //!< Associated with a .gadget mod file, launched via UI or any method given below for CUSTOM scripts (use .gadget suffix - game will fix up category to `GADGET`).
64
+
CUSTOM //!< Loaded by user via either: A) ingame console 'loadscript'; B) RoR.cfg 'app_custom_scripts'; C) commandline '-runscript'; If used with .gadget file, game will fix up category to `GADGET`.
0 commit comments