fix: implement enemy clear threat script (#1678)

* brother

* use some better logic
This commit is contained in:
David Markowitz
2024-12-15 21:44:57 -08:00
committed by GitHub
parent 53242ad5d5
commit 0f8c5b436d
20 changed files with 197 additions and 64 deletions

View File

@@ -327,6 +327,7 @@
#include "VisToggleNotifierServer.h"
#include "LupGenericInteract.h"
#include "WblRobotCitizen.h"
#include "EnemyClearThreat.h"
#include <map>
#include <string>
@@ -686,8 +687,21 @@ namespace {
{"scripts\\zone\\LUPs\\RobotCity Intro\\WBL_RCIntro_RobotCitizenOrange.lua", []() {return new WblRobotCitizen();}},
{"scripts\\zone\\LUPs\\RobotCity Intro\\WBL_RCIntro_RobotCitizenRed.lua", []() {return new WblRobotCitizen();}},
{"scripts\\zone\\LUPs\\RobotCity Intro\\WBL_RCIntro_RobotCitizenYellow.lua", []() {return new WblRobotCitizen();}},
{"scripts\\02_server\\Map\\General\\L_ENEMY_CLEAR_THREAT.lua", []() {return new EnemyClearThreat();}},
};
std::set<std::string> g_ExcludedScripts = {
"scripts\\02_server\\Enemy\\General\\L_SUSPEND_LUA_AI.lua",
"scripts\\02_server\\Enemy\\General\\L_BASE_ENEMY_SPIDERLING.lua",
"scripts\\ai\\AG\\L_AG_SENTINEL_GUARD.lua",
"scripts\\ai\\FV\\L_ACT_NINJA_STUDENT.lua",
"scripts\\ai\\WILD\\L_WILD_GF_FROG.lua",
"scripts\\empty.lua",
"scripts\\zone\\AG\\L_ZONE_AG.lua",
"scripts\\zone\\NS\\L_ZONE_NS.lua",
"scripts\\zone\\GF\\L_ZONE_GF.lua",
};
};
CppScripts::Script* const CppScripts::GetScript(Entity* parent, const std::string& scriptName) {
@@ -699,14 +713,8 @@ CppScripts::Script* const CppScripts::GetScript(Entity* parent, const std::strin
const auto itrTernary = scriptLoader.find(scriptName);
Script* script = itrTernary != scriptLoader.cend() ? itrTernary->second() : &InvalidToReturn;
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") ||
(scriptName == "scripts\\ai\\WILD\\L_WILD_GF_FROG.lua") ||
(scriptName == "scripts\\empty.lua") ||
(scriptName == "scripts\\ai\\AG\\L_AG_SENTINEL_GUARD.lua")
)) LOG_DEBUG("LOT %i attempted to load CppScript for '%s', but returned InvalidScript.", parent->GetLOT(), scriptName.c_str());
if (script == &InvalidToReturn && !scriptName.empty() && !g_ExcludedScripts.contains(scriptName)) {
LOG_DEBUG("LOT %i attempted to load CppScript for '%s', but returned InvalidScript.", parent->GetLOT(), scriptName.c_str());
}
g_Scripts[scriptName] = script;