mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-09-05 14:58:27 +00:00
Remove multiple Script syntax (#1496)
This commit is contained in:
@@ -322,16 +322,18 @@
|
||||
#include "WblRobotCitizen.h"
|
||||
|
||||
namespace {
|
||||
InvalidScript* invalidToReturn = new InvalidScript();
|
||||
// This is in the translation unit instead of the header to prevent wierd linker errors
|
||||
InvalidScript* const InvalidToReturn = new InvalidScript();
|
||||
std::map<std::string, CppScripts::Script*> m_Scripts;
|
||||
};
|
||||
|
||||
CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scriptName) {
|
||||
if (m_Scripts.find(scriptName) != m_Scripts.end()) {
|
||||
return m_Scripts[scriptName];
|
||||
CppScripts::Script* const CppScripts::GetScript(Entity* parent, const std::string& scriptName) {
|
||||
auto itr = m_Scripts.find(scriptName);
|
||||
if (itr != m_Scripts.end()) {
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
Script* script = invalidToReturn;
|
||||
Script* script = InvalidToReturn;
|
||||
|
||||
//VE / AG:
|
||||
if (scriptName == "scripts\\ai\\AG\\L_AG_SHIP_PLAYER_DEATH_TRIGGER.lua")
|
||||
@@ -950,7 +952,7 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
|
||||
|
||||
// handle invalid script reporting if the path is greater than zero and it's not an ignored script
|
||||
// information not really needed for sys admins but is for developers
|
||||
else if (script == invalidToReturn) {
|
||||
else if (script == InvalidToReturn) {
|
||||
if ((scriptName.length() > 0) && !((scriptName == "scripts\\02_server\\Enemy\\General\\L_SUSPEND_LUA_AI.lua") ||
|
||||
(scriptName == "scripts\\02_server\\Enemy\\General\\L_BASE_ENEMY_SPIDERLING.lua") ||
|
||||
(scriptName =="scripts\\ai\\FV\\L_ACT_NINJA_STUDENT.lua") ||
|
||||
@@ -963,13 +965,6 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
|
||||
return script;
|
||||
}
|
||||
|
||||
std::vector<CppScripts::Script*> CppScripts::GetEntityScripts(Entity* entity) {
|
||||
std::vector<CppScripts::Script*> scripts;
|
||||
std::vector<ScriptComponent*> comps = entity->GetScriptComponents();
|
||||
for (ScriptComponent* scriptComp : comps) {
|
||||
if (scriptComp != nullptr) {
|
||||
scripts.push_back(scriptComp->GetScript());
|
||||
}
|
||||
}
|
||||
return scripts;
|
||||
CppScripts::Script* const CppScripts::GetInvalidScript() {
|
||||
return InvalidToReturn;
|
||||
}
|
||||
|
Reference in New Issue
Block a user