Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Don't complain about adding a script that already exists. Also fixed …
Browse files Browse the repository at this point in the history
…up some error message checking.
  • Loading branch information
Causeless committed Nov 15, 2023
1 parent 99c97ee commit 478e255
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Entities/MovableObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,9 @@ int MovableObject::LoadScript(const std::string &scriptPath, bool loadAsEnabledS
}
}

RunFunctionOfScript(scriptPath, "Create");
if (RunFunctionOfScript(scriptPath, "Create") < 0) {
return -5;
}
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion Lua/LuaAdapters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ namespace RTE {
g_ConsoleMan.PrintString("ERROR: The script path " + correctedScriptPath + " did not point to a valid file.");
break;
case -3:
g_ConsoleMan.PrintString("ERROR: The script path " + correctedScriptPath + " is already loaded onto this object.");
// Already have this script. Not an issue, just ignore it.
break;
case -4:
g_ConsoleMan.PrintString("ERROR: Failed to do necessary setup to add scripts while attempting to add the script with path " + correctedScriptPath + ". This has nothing to do with your script, please report it to a developer.");
Expand Down

0 comments on commit 478e255

Please sign in to comment.