mirror of https://github.com/AxioDL/metaforce.git
Add ability to disable AI
This commit is contained in:
parent
ddfd9d85ee
commit
01d94367dc
|
@ -59,6 +59,7 @@
|
||||||
#include "Runtime/Particle/CParticleSwooshDataFactory.hpp"
|
#include "Runtime/Particle/CParticleSwooshDataFactory.hpp"
|
||||||
#include "Runtime/Particle/CProjectileWeaponDataFactory.hpp"
|
#include "Runtime/Particle/CProjectileWeaponDataFactory.hpp"
|
||||||
#include "Runtime/Particle/CWeaponDescription.hpp"
|
#include "Runtime/Particle/CWeaponDescription.hpp"
|
||||||
|
#include "Runtime/World/CPatterned.hpp"
|
||||||
#include "Runtime/World/CPlayer.hpp"
|
#include "Runtime/World/CPlayer.hpp"
|
||||||
#include "Runtime/World/CStateMachine.hpp"
|
#include "Runtime/World/CStateMachine.hpp"
|
||||||
#include "Runtime/World/CScriptMazeNode.hpp"
|
#include "Runtime/World/CScriptMazeNode.hpp"
|
||||||
|
@ -412,6 +413,7 @@ void CMain::InitializeSubsystems() {
|
||||||
CAnimData::InitializeCache();
|
CAnimData::InitializeCache();
|
||||||
CDecalManager::Initialize();
|
CDecalManager::Initialize();
|
||||||
CGBASupport::Initialize();
|
CGBASupport::Initialize();
|
||||||
|
CPatterned::Initialize();
|
||||||
CGraphics::g_BooFactory->waitUntilShadersReady();
|
CGraphics::g_BooFactory->waitUntilShadersReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,14 @@
|
||||||
#include "Runtime/World/CScriptWaypoint.hpp"
|
#include "Runtime/World/CScriptWaypoint.hpp"
|
||||||
#include "Runtime/World/CStateMachine.hpp"
|
#include "Runtime/World/CStateMachine.hpp"
|
||||||
|
|
||||||
|
#include <hecl/CVarManager.hpp>
|
||||||
|
|
||||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
|
namespace {
|
||||||
|
hecl::CVar* cv_disableAi = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
constexpr CMaterialList skPatternedGroundMaterialList(EMaterialTypes::Character, EMaterialTypes::Solid,
|
constexpr CMaterialList skPatternedGroundMaterialList(EMaterialTypes::Character, EMaterialTypes::Solid,
|
||||||
EMaterialTypes::Orbit, EMaterialTypes::GroundCollider,
|
EMaterialTypes::Orbit, EMaterialTypes::GroundCollider,
|
||||||
|
@ -195,8 +200,11 @@ void CPatterned::UpdateThermalFrozenState(bool thawed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPatterned::Think(float dt, CStateManager& mgr) {
|
void CPatterned::Think(float dt, CStateManager& mgr) {
|
||||||
if (!GetActive())
|
if (!GetActive() || (cv_disableAi && cv_disableAi->toBoolean())) {
|
||||||
|
Stop();
|
||||||
|
ClearForcesAndTorques();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (x402_30_updateThermalFrozenState)
|
if (x402_30_updateThermalFrozenState)
|
||||||
UpdateThermalFrozenState(x450_bodyController->GetPercentageFrozen() == 0.f);
|
UpdateThermalFrozenState(x450_bodyController->GetPercentageFrozen() == 0.f);
|
||||||
|
@ -1731,4 +1739,11 @@ bool CPatterned::ApplyBoneTracking() const {
|
||||||
return false;
|
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
|
} // namespace urde
|
||||||
|
|
|
@ -416,6 +416,7 @@ public:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Initialize();
|
||||||
// endregion
|
// endregion
|
||||||
};
|
};
|
||||||
} // namespace urde
|
} // namespace urde
|
||||||
|
|
|
@ -3,8 +3,12 @@
|
||||||
#include "Runtime/CStateManager.hpp"
|
#include "Runtime/CStateManager.hpp"
|
||||||
#include "Runtime/World/CAi.hpp"
|
#include "Runtime/World/CAi.hpp"
|
||||||
|
|
||||||
|
#include <hecl/CVarManager.hpp>
|
||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
static logvisor::Module Log("urde::CStateMachine");
|
namespace {
|
||||||
|
logvisor::Module Log("urde::CStateMachine");
|
||||||
|
}
|
||||||
|
|
||||||
CStateMachine::CStateMachine(CInputStream& in) {
|
CStateMachine::CStateMachine(CInputStream& in) {
|
||||||
CAiTrigger* lastTrig = nullptr;
|
CAiTrigger* lastTrig = nullptr;
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit ce85cff3701419a7f9b5376dc784349e2b01bc84
|
Subproject commit 6395cf6cd8304056ff54271c6779d54170237c07
|
Loading…
Reference in New Issue