fix some more glitchy stuff

This commit is contained in:
Bram verhulst
2025-06-01 23:04:37 +02:00
parent 1d2ca4f9ca
commit 1104b12ba8
14 changed files with 1529 additions and 305 deletions

View File

@@ -29,9 +29,9 @@ void SurvivalAgentPlugin::Initialize(IBaseInterface* pInterface, PluginInfo& inf
Blackboard* blackboardPtr{ CreateBlackboard() };
m_BehaviourTree = new BT::BehaviorTree(blackboardPtr,
new BT::Selector({
BigThink::ItemHandling(),
BigThink::ZombieHandling(),
BigThink::PurgeZoneHandling(),
BigThink::ItemHandling(),
BigThink::PickUpHandling(),
BigThink::HouseHandling()
}));
@@ -69,6 +69,10 @@ Blackboard* SurvivalAgentPlugin::CreateBlackboard() {
blackboardPtr->AddData("TimerBeforeLeavingDoOnce", false);
blackboardPtr->AddData("MaxTimeBeforeLeaving", 3.f);
blackboardPtr->AddData("MaxTimeNoHouse", 5.f);
blackboardPtr->AddData("TimerNoHouse", std::chrono::steady_clock::time_point{});
blackboardPtr->AddData("TimerNoHouseDoOnce", false);
return blackboardPtr;
}
@@ -113,7 +117,7 @@ void SurvivalAgentPlugin::InitGameDebugParams(GameDebugParams& params)
params.SpawnPurgeZonesOnMiddleClick = true;
params.PrintDebugMessages = true;
params.ShowDebugItemNames = true;
params.Seed = -1; //-1 = don't set seed. Any other number = fixed seed //TIP: use Seed = int(time(nullptr)) for pure randomness
params.Seed = int(time(nullptr)); //-1 = don't set seed. Any other number = fixed seed //TIP: use Seed = int(time(nullptr)) for pure randomness
}
void SurvivalAgentPlugin::Update_Debug(float dt)
@@ -194,6 +198,16 @@ SteeringPlugin_Output SurvivalAgentPlugin::UpdateSteering(float dt)
m_BehaviourTree->GetBlackboard()->GetData("Steering", steering);
m_BehaviourTree->GetBlackboard()->GetData("Spin", spin);
if (m_pInterface->Agent_GetInfo().Stamina >= 10 || m_Running) {
m_Running = true;
steering.RunMode = true;
}
if (m_pInterface->Agent_GetInfo().Stamina <= 0.1f) {
m_Running = false;
steering.RunMode = false;
}
if (spin) {
steering.AutoOrient = false;
}