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
{{ message }}
This repository was archived by the owner on Jan 5, 2024. It is now read-only.
Added methods to MovableObject to run scripted functions for them on a given script and on all of their scripts (with the option to run on disabled or not) and moved this out of LuaMan. These methods can optionally take arguments to provide to the functions they run and, if there's more than one script on the MO, will spit out an error telling you want script and function screwed up.
Used these new methods through MovableObject
Renamed some supported script function names and made it so removing and disabling a script call the same function, but with a different value for their 2nd argument
Added details to LoadScript comments, cleaned up some junk
@@ -499,7 +495,6 @@ int MovableObject::LoadScript(std::string const &scriptPath, bool loadAsEnabledS
499
495
// If there's no ScriptPresetName this is the first script being loaded for this preset, or scripts have been reloaded.
500
496
// Generate a ScriptPresetName, setup a table for the preset's functions, and clear the instance object name so it gets created in the first run of UpdateScripts
501
497
if (m_ScriptPresetName.empty()) {
502
-
// TODO WAIT A MINUTE.. is this an original preset????!! .. does it matter? A: not really
returnRunScriptedFunctionInAppropriateScripts("OnPieMenu"); //TODO try passing actor here, see if it works. If it does, maybe quietly refactor this whole thing
/// <param name="scriptPath">The path to the script to load.</param>
185
185
/// <param name="loadAsEnabledScript">Whether or not the script should load as enabled. Defaults to true.</param>
186
-
/// <returns>An error return value signaling sucess or any particular failure. Anything below 0 is an error signal.</returns>
186
+
/// <returns>0 on success. -1 if scriptPath is empty. -2 if the script is already loaded. -3 if setup to load the script or modify the global lua state fails. -4 if the script fails to load.</returns>
/// Runs the given function in all scripts that have it, with the given arguments, with the ability to not run on disabled scripts and to cease running if there's an error.
246
+
/// The first argument to the function will always be 'self'. If either argument list is not emtpy, its entries will be passed into the Lua function in order, with entity arguments first.
247
+
/// </summary>
248
+
/// <param name="functionName">The name of the function to run.</param>
249
+
/// <param name="runOnDisabledScripts">Whether to run the function on disabled scripts. Defaults to false.</param>
250
+
/// <param name="stopOnError">Whether to stop if there's an error running any script, or simply print it to the console and continue. Defaults to false.</param>
251
+
/// <param name="functionEntityArguments">Optional vector of entity pointers that should be passed into the Lua function. Their internal Lua states will not be accessible. Defaults to empty.</param>
252
+
/// <param name="functionLiteralArguments">Optional vector of strings, that should be passed into the Lua function. Entries must be surrounded with escaped quotes (i.e.`\"`) they'll be passed in as-is, allowing them to act as booleans, etc.. Defaults to empty.</param>
253
+
/// <returns>An error return value signaling sucess or any particular failure. Anything below 0 is an error signal.</returns>
/// Runs the given function for the given script, with the given arguments. The first argument to the function will always be 'self'.
258
+
/// If either argument list is not emtpy, its entries will be passed into the Lua function in order, with entity arguments first.
259
+
/// </summary>
260
+
/// <param name="scriptPath">The path to the script to run.</param>
261
+
/// <param name="functionName">The name of the function to run.</param>
262
+
/// <param name="functionEntityArguments">Optional vector of entity pointers that should be passed into the Lua function. Their internal Lua states will not be accessible. Defaults to empty.</param>
263
+
/// <param name="functionLiteralArguments">Optional vector of strings, that should be passed into the Lua function. Entries must be surrounded with escaped quotes (i.e.`\"`) they'll be passed in as-is, allowing them to act as booleans, etc.. Defaults to empty.</param>
264
+
/// <returns>An error return value signaling sucess or any particular failure. Anything below 0 is an error signal.</returns>
/// Helper method to run the given function in all of the given preset instance's scripts on the given object instance. Note that this method does not do any safety checks.
232
-
/// </summary>
233
-
/// <param name="functionName">The name of the function to run.</param>
234
-
/// <param name="scriptPath">The path to the script whose function is being run. Used as an identifier in Lua.</param>
235
-
/// <param name="presetLuaInstanceName">The name of the lua variable that holds the representation of the preset instance whose function is being run.</param>
236
-
/// <param name="objectLuaInstanceName">The name of the lua variable that holds the representation of the object instance the function is being run on.</param>
237
-
/// <returns>Returns less than zero if any errors encountered when running this script. To get the actual error string, call GetLastError.</returns>
0 commit comments