mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-15 09:50:27 +00:00
Merge pull request #632 from Bobblybook/master
Utgarde Pinnacle, CoS & additional value entry
This commit is contained in:
@@ -20,6 +20,15 @@ void NearestNpcsValue::FindUnits(std::list<Unit*>& targets)
|
||||
|
||||
bool NearestNpcsValue::AcceptUnit(Unit* unit) { return !unit->IsHostileTo(bot) && !unit->IsPlayer(); }
|
||||
|
||||
void NearestHostileNpcsValue::FindUnits(std::list<Unit*>& targets)
|
||||
{
|
||||
Acore::AnyUnitInObjectRangeCheck u_check(bot, range);
|
||||
Acore::UnitListSearcher<Acore::AnyUnitInObjectRangeCheck> searcher(bot, targets, u_check);
|
||||
Cell::VisitAllObjects(bot, searcher, range);
|
||||
}
|
||||
|
||||
bool NearestHostileNpcsValue::AcceptUnit(Unit* unit) { return unit->IsHostileTo(bot) && !unit->IsPlayer(); }
|
||||
|
||||
void NearestVehiclesValue::FindUnits(std::list<Unit*>& targets)
|
||||
{
|
||||
Acore::AnyUnitInObjectRangeCheck u_check(bot, range);
|
||||
|
||||
@@ -24,6 +24,19 @@ protected:
|
||||
bool AcceptUnit(Unit* unit) override;
|
||||
};
|
||||
|
||||
class NearestHostileNpcsValue : public NearestUnitsValue
|
||||
{
|
||||
public:
|
||||
NearestHostileNpcsValue(PlayerbotAI* botAI, float range = sPlayerbotAIConfig->sightDistance)
|
||||
: NearestUnitsValue(botAI, "nearest hostile npcs", range)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void FindUnits(std::list<Unit*>& targets) override;
|
||||
bool AcceptUnit(Unit* unit) override;
|
||||
};
|
||||
|
||||
class NearestVehiclesValue : public NearestUnitsValue
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -104,6 +104,7 @@ public:
|
||||
creators["nearest game objects no los"] = &ValueContext::nearest_game_objects_no_los;
|
||||
creators["closest game objects"] = &ValueContext::closest_game_objects;
|
||||
creators["nearest npcs"] = &ValueContext::nearest_npcs;
|
||||
creators["nearest hostile npcs"] = &ValueContext::nearest_hostile_npcs;
|
||||
creators["nearest totems"] = &ValueContext::nearest_totems;
|
||||
creators["nearest vehicles"] = &ValueContext::nearest_vehicles;
|
||||
creators["nearest vehicles far"] = &ValueContext::nearest_vehicles_far;
|
||||
@@ -393,6 +394,7 @@ private:
|
||||
}
|
||||
static UntypedValue* log_level(PlayerbotAI* botAI) { return new LogLevelValue(botAI); }
|
||||
static UntypedValue* nearest_npcs(PlayerbotAI* botAI) { return new NearestNpcsValue(botAI); }
|
||||
static UntypedValue* nearest_hostile_npcs(PlayerbotAI* botAI) { return new NearestHostileNpcsValue(botAI); }
|
||||
static UntypedValue* nearest_totems(PlayerbotAI* botAI) { return new NearestTotemsValue(botAI); }
|
||||
static UntypedValue* nearest_vehicles(PlayerbotAI* botAI) { return new NearestVehiclesValue(botAI); }
|
||||
static UntypedValue* nearest_vehicles_far(PlayerbotAI* botAI) { return new NearestVehiclesValue(botAI, 200.0f); }
|
||||
|
||||
Reference in New Issue
Block a user