fix some more glitchy stuff
This commit is contained in:
@@ -8,6 +8,24 @@ using namespace std::placeholders;
|
||||
|
||||
namespace BigThink
|
||||
{
|
||||
BT::Selector* ItemHandling() {
|
||||
constexpr float HpThreshold{ 0.f };
|
||||
|
||||
return
|
||||
new BT::Selector({
|
||||
new BT::Sequence({
|
||||
new BT::Conditional(std::bind(BT_Condition::ItemInInv, _1, eItemType::MEDKIT)),
|
||||
new BT::Conditional(std::bind(BT_Condition::HpUnderThreshold, _1, HpThreshold)),
|
||||
new BT::Action(std::bind(BT_Action::UseItem, _1, eItemType::MEDKIT))
|
||||
}),
|
||||
new BT::Sequence({
|
||||
new BT::Conditional(std::bind(BT_Condition::ItemInInv, _1, eItemType::FOOD)),
|
||||
new BT::Conditional(BT_Condition::CheckMinNeededEnergy),
|
||||
new BT::Action(std::bind(BT_Action::UseItem, _1, eItemType::FOOD))
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
BT::Sequence* ZombieHandling() {
|
||||
constexpr float minShotgunAngleDiff{ .2f };
|
||||
constexpr float minPistolAngleDiff{ .1f };
|
||||
@@ -56,30 +74,12 @@ namespace BigThink
|
||||
constexpr int searchDegree{ 5 };
|
||||
return
|
||||
new BT::Sequence({
|
||||
new BT::Conditional(BT_Condition::SeePurgeZone),
|
||||
new BT::Conditional(BT_Condition::InPurgeZone),
|
||||
new BT::Action(std::bind(BT_Action::FindClosestEdge, _1, searchDegree)),
|
||||
new BT::Action(BT_Action::GoToTarget)
|
||||
});
|
||||
}
|
||||
|
||||
BT::Selector* ItemHandling() {
|
||||
constexpr float HpThreshold{ 0.f };
|
||||
|
||||
return
|
||||
new BT::Selector({
|
||||
new BT::Sequence({
|
||||
new BT::Conditional(std::bind(BT_Condition::ItemInInv, _1, eItemType::MEDKIT)),
|
||||
new BT::Conditional(std::bind(BT_Condition::HpUnderThreshold, _1, HpThreshold)),
|
||||
new BT::Action(std::bind(BT_Action::UseItem, _1, eItemType::MEDKIT))
|
||||
}),
|
||||
new BT::Sequence({
|
||||
new BT::Conditional(std::bind(BT_Condition::ItemInInv, _1, eItemType::FOOD)),
|
||||
new BT::Conditional(BT_Condition::CheckMinNeededEnergy),
|
||||
new BT::Action(std::bind(BT_Action::UseItem, _1, eItemType::FOOD))
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
BT::PartialSequence* PickUpHandling() {
|
||||
return
|
||||
new BT::PartialSequence({
|
||||
@@ -133,13 +133,18 @@ namespace BigThink
|
||||
constexpr float InsideOffset{ 5.f };
|
||||
|
||||
const std::string BeforeLeavingTimer{ "BeforeLeaving" };
|
||||
constexpr bool BeforeLeavingDoOnce{ true };
|
||||
constexpr bool BeforeLeavingDoOnce{ false };
|
||||
|
||||
const std::string NoHouseTimer{ "NoHouse" };
|
||||
constexpr float noHouseTimeout = 5.0f; // Time in seconds before giving up and going random
|
||||
constexpr bool NoHouseDoOnce{ false };
|
||||
|
||||
return
|
||||
new BT::Selector({
|
||||
new BT::Sequence({
|
||||
new BT::Conditional(BT_Condition::SeeHouse),
|
||||
new BT::Action(BT_Action::CheckHouses)
|
||||
new BT::Action(BT_Action::CheckHouses),
|
||||
new BT::Action(std::bind(BT_Action::SetTimer, _1, NoHouseTimer, NoHouseDoOnce)) // Reset timer when we see a house
|
||||
}),
|
||||
new BT::PartialSequence({
|
||||
new BT::Conditional(BT_Condition::InsideTargetHouse),
|
||||
@@ -156,16 +161,21 @@ namespace BigThink
|
||||
new BT::Action(BT_Action::GoToTarget),
|
||||
}),
|
||||
new BT::PartialSequence({
|
||||
new BT::Action(std::bind(BT_Action::TryFindHouse, _1, searchRadius, searchDegree)),
|
||||
new BT::Action(std::bind(BT_Action::FindRandomLocation, _1, randomRadius)),
|
||||
new BT::Action(BT_Action::EnableSpin),
|
||||
new BT::Action(BT_Action::GoToTarget)
|
||||
}),
|
||||
new BT::PartialSequence({
|
||||
/*new BT::PartialSequence({
|
||||
new BT::Action(std::bind(BT_Action::TryFindHouse, _1, searchRadius, searchDegree)),
|
||||
new BT::Action(BT_Action::EnableSpin),
|
||||
new BT::Action(BT_Action::GoToTarget)
|
||||
}),*/
|
||||
/*new BT::PartialSequence({
|
||||
new BT::Conditional(BT_Condition::ReExploreHouse),
|
||||
new BT::Action(std::bind(BT_Action::GetHouseAsTarget, _1, maxTravelDistance)),
|
||||
new BT::Action(BT_Action::EnableSpin),
|
||||
new BT::Action(BT_Action::GoToTarget),
|
||||
}),
|
||||
}),*/
|
||||
new BT::PartialSequence({
|
||||
new BT::Action(std::bind(BT_Action::FindRandomLocation, _1, randomRadius)),
|
||||
new BT::Action(BT_Action::EnableSpin),
|
||||
@@ -192,6 +202,13 @@ namespace BigThink
|
||||
new BT::Action(BT_Action::EnableSpin),
|
||||
new BT::Action(BT_Action::GoToTarget)
|
||||
}),
|
||||
new BT::PartialSequence({
|
||||
new BT::Conditional(std::bind(BT_Condition::CheckTimer, _1, NoHouseTimer, NoHouseDoOnce)), // Check if we haven't seen a house in a while
|
||||
new BT::Action(std::bind(BT_Action::SetTimer, _1, NoHouseTimer, NoHouseDoOnce)), // Reset the timer
|
||||
new BT::Action(std::bind(BT_Action::FindRandomLocation, _1, randomRadius * 2)), // Go further when random walking
|
||||
new BT::Action(BT_Action::EnableSpin),
|
||||
new BT::Action(BT_Action::GoToTarget)
|
||||
}),
|
||||
new BT::PartialSequence({
|
||||
new BT::Conditional(BT_Condition::ReExploreHouse),
|
||||
new BT::Action(std::bind(BT_Action::GetHouseAsTarget, _1, maxTravelDistance)),
|
||||
@@ -199,11 +216,6 @@ namespace BigThink
|
||||
new BT::Action(BT_Action::GoToTarget),
|
||||
})
|
||||
}),
|
||||
new BT::PartialSequence({
|
||||
new BT::Action(std::bind(BT_Action::FindRandomLocation, _1, randomRadius)),
|
||||
new BT::Action(BT_Action::EnableSpin),
|
||||
new BT::Action(BT_Action::GoToTarget)
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user