2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-11 13:07:42 +00:00

Add ability to disable AI

This commit is contained in:
2020-10-02 23:28:05 -07:00
parent ddfd9d85ee
commit 01d94367dc
5 changed files with 25 additions and 3 deletions

View File

@@ -21,9 +21,14 @@
#include "Runtime/World/CScriptWaypoint.hpp"
#include "Runtime/World/CStateMachine.hpp"
#include <hecl/CVarManager.hpp>
#include "TCastTo.hpp" // Generated file, do not modify include path
namespace urde {
namespace {
hecl::CVar* cv_disableAi = nullptr;
}
constexpr CMaterialList skPatternedGroundMaterialList(EMaterialTypes::Character, EMaterialTypes::Solid,
EMaterialTypes::Orbit, EMaterialTypes::GroundCollider,
@@ -195,8 +200,11 @@ void CPatterned::UpdateThermalFrozenState(bool thawed) {
}
void CPatterned::Think(float dt, CStateManager& mgr) {
if (!GetActive())
if (!GetActive() || (cv_disableAi && cv_disableAi->toBoolean())) {
Stop();
ClearForcesAndTorques();
return;
}
if (x402_30_updateThermalFrozenState)
UpdateThermalFrozenState(x450_bodyController->GetPercentageFrozen() == 0.f);
@@ -1731,4 +1739,11 @@ bool CPatterned::ApplyBoneTracking() const {
return false;
}
void CPatterned::Initialize() {
if (cv_disableAi == nullptr) {
cv_disableAi = hecl::CVarManager::instance()->findOrMakeCVar("disableAi"sv, "Disables AI state machines", false,
hecl::CVar::EFlags::Cheat | hecl::CVar::EFlags::Game);
}
}
} // namespace urde