Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created vehicle tuning GUI using new .addonpart mod type #3096

Merged
merged 55 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
f68ed0b
Renamed `GenericDocReader` to `GenericDocContext`
ohlidalp Oct 17, 2023
2ec264e
Codechange: Clarified `SE_ANGELSCRIPT_MANIPULATIONS` a bit.
ohlidalp Oct 17, 2023
eebe42a
:sparkles: `GenericDocument` is now editable.
ohlidalp Oct 18, 2023
4002b54
GenericDocContext: updated angelscript docs
ohlidalp Oct 18, 2023
b79a514
Completed 'example_GenericDoc_editor.as'
ohlidalp Oct 18, 2023
badee1b
:fireworks: ModCache entries are now `RefCountingObject<>`
ohlidalp Oct 18, 2023
a30ace3
:envelope: Added `MSG_EDI_CREATE_PROJECT_REQUESTED`
ohlidalp Oct 19, 2023
d49ecfd
:angel: Truck editing improvements
ohlidalp Oct 19, 2023
cf79a7e
script_editor.as: Added auto-indentation :sparkles:
ohlidalp Oct 19, 2023
3c7926a
:angel:Script: Added mod cache requests, events and queries.
ohlidalp Oct 23, 2023
1046572
script_editor.as: Added code folding :sparkles:
ohlidalp Oct 23, 2023
7e424bd
New :angel: scripts: GridViewer and (alpha) RigEditor
ohlidalp Oct 23, 2023
da0311c
Cleanup: moved `PHYSICS_DT` to 'SimConstants.h' :triangular_ruler:
ohlidalp Oct 23, 2023
12d62c7
Fixed headers causing "use of undefined `Actor`" all around. :wrench:
ohlidalp Oct 23, 2023
4f0ad8d
:video_game: Addon part modding system :sparkles:
ohlidalp Oct 29, 2023
f246d07
:envelope: `MSG_EDI_MODIFY_PROJECT_REQUESTED` and UI.
ohlidalp Oct 29, 2023
e5e53eb
Added 'remove_flexbody' to .tuneup format + GUI
ohlidalp Oct 30, 2023
e4d4718
Made 'managedmaterials' work with addon parts. :sparkles:
ohlidalp Oct 31, 2023
dc9fb83
Fixed crash when .tuneup uses nonexistent .addonpart
ohlidalp Oct 31, 2023
cc57ae9
Fixed crash on truck reload (via menubar or Ctrl+Shift+R)
ohlidalp Oct 31, 2023
77cf801
Tuneup: fixed missing guid, removed "not modded yet" state.
ohlidalp Nov 1, 2023
e1f619b
Tuning: Improved UI, added stub save/load support :construction:
ohlidalp Nov 1, 2023
bf91e78
Tuning: Working save/load/delete of tuneups.
ohlidalp Nov 2, 2023
d22b653
Tuning: added 'unwanted' to addons and 'protected' to tuneups.
ohlidalp Nov 3, 2023
eb78eb6
:video_game: Added node & wheel tweaks to .addonpart system.
ohlidalp Nov 6, 2023
30674d1
Tuning: rim mesh addonparts now work OK.
ohlidalp Nov 13, 2023
ce39e5d
Tuning: fixed vehicle not restoring after removing addonpart.
ohlidalp Nov 13, 2023
8adb666
Tuning: Added prop/flexbody tweaks, UI now displays IDs.
ohlidalp Nov 25, 2023
44a783b
Tuning: fixups of prop/flexbody tweaks.
ohlidalp Nov 27, 2023
4aa5fa7
Tuning: added ability to flip rim meshes via UI
ohlidalp Dec 2, 2023
2e44acf
Tuning: added "kill switch" cvar `sim_tuning_enabled` (bool)
ohlidalp Dec 3, 2023
288d8f2
Tuning: misc fixes
ohlidalp Dec 4, 2023
7cd9ce8
Tuning: improved UI overrides, separated from tuneups/unwants.
ohlidalp Dec 11, 2023
7ab07b7
Tuneup: fixed known bugs of new UI overrides.
ohlidalp Dec 12, 2023
887c8d5
Tuning: Fixed broken flexbodywheels
ohlidalp Dec 16, 2023
56927a5
Tuning: fixed bug causing only 1 addonpart to take effect.
ohlidalp Dec 17, 2023
5870b93
Tuning: Fixed crash during manual cache regen.
ohlidalp Dec 31, 2023
42b9a85
GenericDocument: fixed last token not being flushed
ohlidalp Dec 31, 2023
b4e6299
Tuning: fixed tire radius not applying if rim radius not set
ohlidalp Dec 31, 2023
6e0bc5f
Tuning: fixed mesh RG of props/flexbodies in .addonpart
ohlidalp Jan 9, 2024
a9addb3
Tuning: fixed `forset` not being processed.
ohlidalp Jan 9, 2024
4b51b17
Tuning: fixed menu not showing force-installed parts with mismatching…
ohlidalp Jan 11, 2024
80973b8
Tuning: added `set_managedmaterials_options` to .addonpart
ohlidalp Jan 10, 2024
cf9ff5b
Tuneup: added savegame support, dropped autoloading.
ohlidalp Jan 13, 2024
8e94942
Tuning: fixed savegames not loading correctly
ohlidalp Jan 24, 2024
c57ece0
Tuning: fixed 'SET_MANAGEDMATERIALS_OPTIONS'
ohlidalp Jan 29, 2024
aa030de
Tuning: Fixed glitches of `ImButtonHoldToConfirm()`
ohlidalp Feb 3, 2024
aa790b0
Tuning: Fixed deleting saved tuneup not working
ohlidalp Feb 3, 2024
5e95e38
Tuning: Kill switch `app_tuning_enabled` moved to GameSettings UI.
ohlidalp Feb 4, 2024
515e8f6
GenericDocument: Fixed "-" always being treated as 'minus' (may be na…
ohlidalp Feb 4, 2024
ec31a58
Tuning: recognize '-' placeholders in managedmaterials
ohlidalp Feb 4, 2024
a4e9e67
Tuning: fixed props loading from wrong ZIP
ohlidalp Feb 4, 2024
c929660
Tuning: Fixed failure/crash when overwriting existing saved tuneup
ohlidalp Feb 4, 2024
166477c
Tuning: fixed crash when saving tuneup before it's created.
ohlidalp Feb 4, 2024
002c05c
Tuning: use exact filename lookup for tuneups.
ohlidalp Feb 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ enum TokenType
};

/**
* @brief Binding of RoR::GenericDocReader; Traverses document tokens; See 'demo_script.as' for an example.
* @brief Binding of RoR::GenericDocContext; Traverses document tokens; See 'demo_script.as' for an example.
*/
class GenericDocReaderClass
class GenericDocContextClass
{
// PLEASE maintain the same order as in 'GenericFileFormat.h' and 'GenericFileFormatAngelscript.cpp'

GenericDocReader(GenericDocumentPtr@ d);
GenericDocContext(GenericDocumentPtr@ d);

bool moveNext();
uint getPos();
Expand All @@ -46,6 +46,18 @@ class GenericDocReaderClass
bool isTokBool(int offset = 0);
bool isTokKeyword(int offset = 0);
bool isTokComment(int offset = 0);

// Editing functions:

bool insertToken(int offset = 0); //!< Inserts `TokenType::NONE`; @return false if offset is beyond EOF
bool eraseToken(int offset = 0); //!< @return false if offset is beyond EOF

bool setTokString(int offset, const string&in str);
bool setTokFloat(int offset, float val);
bool setTokBool(int offset, bool val);
bool setTokKeyword(int offset, const string&in str);
bool setTokComment(int offset, const string&in str);
bool setTokLineBreak(int offset);
};

/// @} //addtogroup Script2Game
Expand Down
30 changes: 25 additions & 5 deletions doc/angelscript/Script2Game/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,27 @@ void print(const string message);
SE_TRUCK_TELEPORT //!< triggered when the user teleports the truck, the argument refers to the Actor Instance ID (use `game.getTruckByNum()`)
SE_TRUCK_MOUSE_GRAB //!< triggered when the user uses the mouse to interact with the actor, the argument refers to the Actor Instance ID (use `game.getTruckByNum()`)

SE_ANGELSCRIPT_MANIPULATIONS //!< triggered when the user tries to dynamically use the scripting capabilities (prevent cheating)
SE_ANGELSCRIPT_MANIPULATIONS //!< triggered when the user tries to dynamically use the scripting capabilities (prevent cheating) args: #1 angelScriptManipulationType, #2 ScriptUnitId_t, #3 RoR::ScriptCategory, #4 unused, #5 script file name (*.as), #6 associated file name (i.e. *.mission), #7 associated file resource group (i.e. *.mission).
SE_ANGELSCRIPT_MSGCALLBACK //!< The diagnostic info directly from AngelScript engine (see `asSMessageInfo`), args: #1 ScriptUnitID, #2 asEMsgType, #3 row, #4 col, #5 sectionName, #6 message
SE_ANGELSCRIPT_LINECALLBACK //!< The diagnostic info directly from AngelScript engine (see `SetLineCallback()`), args: #1 ScriptUnitID, #2 LineNumber, #3 CallstackSize, #4 unused, #5 FunctionName, #6 FunctionObjectTypeName #7 ObjectName
SE_ANGELSCRIPT_EXCEPTIONCALLBACK //!< The diagnostic info directly from AngelScript engine (see `SetExceptionCallback()`), args: #1 ScriptUnitID, #2 unused, #3 row (`GetExceptionLineNumber()`), #4 unused, #5 funcName, #6 message (`GetExceptionString()`)
SE_ANGELSCRIPT_THREAD_STATUS //!< Sent by background threads (i.e. CURL) when there's something important (like finishing a download). args: #1 type, see `Script2Game::angelScriptThreadStatus`.

SE_GENERIC_MESSAGEBOX_CLICK //!< triggered when the user clicks on a message box button, the argument refers to the button pressed
SE_GENERIC_EXCEPTION_CAUGHT //!< Triggered when C++ exception (usually Ogre::Exception) is thrown; #1 ScriptUnitID, #5 originFuncName, #6 type, #7 message.
SE_GENERIC_MODCACHE_ACTIVITY //!< Triggered when status of modcache changes, args: #1 type, #2 entry number, for other args see `RoR::modCacheActivityType`

SE_ALL_EVENTS = 0xffffffff,
SE_NO_EVENTS = 0

};

/// Argument #2 of script event `SE_ANGELSCRIPT_MANIPULATIONS`
enum angelScriptManipulationType
{
MANIP_CONSOLE_SNIPPET_EXECUTED = 0, // Backwards compat
MANIP_SCRIPT_LOADED,
MANIP_SCRIPT_UNLOADED
ASMANIP_CONSOLE_SNIPPET_EXECUTED = 0, // 0 for Backwards compatibility.
ASMANIP_SCRIPT_LOADED, //!< Triggered after the script's `main()` completed; may trigger additional processing (for example, it delivers the *.mission file to mission system script).
ASMANIP_SCRIPT_UNLOADING //!< Triggered before unloading the script to let it clean up (important for missions).
};

enum angelScriptThreadStatus
Expand All @@ -94,6 +98,19 @@ enum angelScriptThreadStatus
ASTHREADSTATUS_CURLSTRING_FAILURE, //!< Args of `RoR::SE_ANGELSCRIPT_THREAD_STATUS`: arg#1 type, arg#2 HTTP code, arg#3 CURLcode, arg#4 unused, arg#5 message from `curl_easy_strerror()`
};

/// Argument #2 of script event `RoR::SE_GENERIC_MODCACHE_ACTIVITY`
enum modCacheActivityType
{
MODCACHEACTIVITY_NONE,

MODCACHEACTIVITY_ENTRY_ADDED, //!< Args of `RoR::SE_GENERIC_MODCACHE_NOTIFICATION`: #1 type, #2 entry number, --, --, #5 fname, #6 fext
MODCACHEACTIVITY_ENTRY_DELETED, //!< Flagged as `deleted`, remains in memory until shared pointers expire; Args of `RoR::SE_GENERIC_MODCACHE_NOTIFICATION`: #1 type, #2 entry number, --, --, #5 fname, #6 fext

MODCACHEACTIVITY_BUNDLE_LOADED, //!< Args of `RoR::SE_GENERIC_MODCACHE_NOTIFICATION`: #1 type, #2 entry number, --, --, #5 rg name
MODCACHEACTIVITY_BUNDLE_RELOADED, //!< Args of `RoR::SE_GENERIC_MODCACHE_NOTIFICATION`: #1 type, #2 entry number, --, --, #5 rg name
MODCACHEACTIVITY_BUNDLE_UNLOADED //!< Args of `RoR::SE_GENERIC_MODCACHE_NOTIFICATION`: #1 type, #2 entry number
};

enum inputEvents
{
EV_AIRPLANE_AIRBRAKES_FULL=0,
Expand Down Expand Up @@ -639,7 +656,10 @@ enum MsgType
MSG_EDI_MODIFY_GROUNDMODEL_REQUESTED, //!< Used by Friction UI, DO NOT PUSH MANUALLY.
MSG_EDI_ENTER_TERRN_EDITOR_REQUESTED, //!< No params.
MSG_EDI_LEAVE_TERRN_EDITOR_REQUESTED, //!< No params.
MSG_EDI_RELOAD_BUNDLE_REQUESTED, //!< Used internally for full reload of terrain/actor from disk, DO NOT PUSH MANUALLY.
MSG_EDI_LOAD_BUNDLE_REQUESTED, //!< Load a resource bundle (= ZIP or directory) for a given cache entry. Params: 'cache_entry' (CacheEntryClass@)
MSG_EDI_RELOAD_BUNDLE_REQUESTED, //!< This deletes all actors using that bundle (= ZIP or directory)! Params: 'cache_entry' (CacheEntryClass@)
MSG_EDI_UNLOAD_BUNDLE_REQUESTED, //!< This deletes all actors using that bundle (= ZIP or directory)! Params: 'cache_entry' (CacheEntryClass@)
MSG_EDI_CREATE_PROJECT_REQUESTED, //!< Creates a subdir under 'projects/', pre-populates it and adds to modcache. Params: 'name' (string), 'ext' (string, optional), 'source_entry' (CacheEntryClass@)
};

} // namespace Script2Game
Expand Down
4 changes: 2 additions & 2 deletions resources/scripts/demo_script.as
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ void drawTerrainButtons()
// Fetch TOBJ filenames
if (g_terrain_tobj_files.length() == 0)
{
GenericDocReaderClass@ reader = GenericDocReaderClass(doc);
GenericDocContextClass@ reader = GenericDocContextClass(doc);
bool in_section_objects = false;
while (!reader.endOfFile())
{
Expand Down Expand Up @@ -338,7 +338,7 @@ void drawDocumentWindow()
string caption = "Document view (" + g_displayed_doc_filename + ")";
ImGui::Begin(caption, /*open:*/true, /*flags:*/0);

GenericDocReaderClass reader(g_displayed_document);
GenericDocContextClass reader(g_displayed_document);
while (!reader.endOfFile())
{
switch (reader.tokenType())
Expand Down
Loading