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.
// Description: Updates this' AI state with the provided scripted AI Update function.
1309
-
1310
-
boolActor::UpdateAIScripted()
1311
-
{
1312
-
// This preset doesn't seem to have any script file defined, so then just report we couldn't run scripted AI
1313
-
if (!m_ScriptedAIUpdate || m_ScriptPath.empty() || m_ScriptPresetName.empty())
1287
+
boolActor::UpdateAIScripted() {
1288
+
if (!m_ScriptedAIUpdate || (m_LoadedScripts.empty()) || m_ScriptPresetName.empty()) {
1314
1289
returnfalse;
1315
-
1316
-
int error = 0;
1290
+
}
1317
1291
1318
1292
// Check to make sure the preset of this is still defined in the Lua state. If not, re-create it and recover gracefully
1319
-
if (!g_LuaMan.ExpressionIsTrue(m_ScriptPresetName, false))
1320
-
ReloadScripts();
1293
+
if (!g_LuaMan.ExpressionIsTrue(m_ScriptPresetName, false)) {
1294
+
ReloadScripts(); //TODO test if this should be here, I think it's junk cause for any cases where there's AI, update will always be called first. If it shouldn't, change the early return above.
1295
+
}
1321
1296
1322
-
// First see if we even have a representation stored in the Lua state, and if not, create one
1323
-
if (m_ScriptObjectName.empty())
1324
-
{
1325
-
// Get the unique object identifier for this object and construct the object isntance name in Lua that points to this object so we can pass it into the preset functions
1297
+
// If we don't have a Lua representation for this object instance, create one and call the Lua Create function on it
1298
+
if (m_ScriptObjectName.empty()) {
1299
+
//TODO test if this should be here, I think it's junk cause for any cases where there's AI, update will always be called first. If it shouldn't, change the early return above.
/// 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