PointFunctions::Vector3List getPointsFromFile3D(std::string filePath) { std::ifstream file; // creates stream myFile file.open(filePath.c_str()); // opens .txt file if (!file.is_open()) { // check file is open, quit if not GRSF_ERRORMSG("Could not open file: " << filePath) } PREC a, b, c; Vector3List v; while (file.good()) { file >> a >> b >> c; v.emplace_back(a, b, c); } std::cout << "Loaded: " << v.size() << " points " << std::endl; file.close(); return v; }
float GetPriority() { const MemoryRecord *pTarget = GetClient()->GetTargetingSystem()->GetCurrentTargetRecord(); if ( !pTarget ) return 0.f; if ( mShootBarrel.IsValid() ) return 1.f; Vector3f vTargetPos = pTarget->PredictPosition( 1.f ); static float fSplashRadius = 256.f; SensoryMemory *sensory = GetClient()->GetSensoryMemory(); // Check for exploding barrels near my target. MemoryRecords records; Vector3List recordpos; FilterAllType filter( GetClient(), AiState::SensoryMemory::EntAny, records ); filter.MemorySpan( Utils::SecondsToMilliseconds( 7.f ) ); filter.AddGroup( ENT_GRP_PROP_EXPLODE ); //filter.AddClass( ENT_CLASS_EXPLODING_BARREL ); sensory->QueryMemory( filter ); sensory->GetRecordInfo( records, &recordpos, NULL ); for ( uint32_t i = 0; i < recordpos.size(); ++i ) { if ( SquaredLength( recordpos[ i ], vTargetPos ) < Mathf::Sqr( fSplashRadius ) ) { MemoryRecord *pRec = sensory->GetMemoryRecord( records[ i ] ); if ( pRec ) { mShootBarrel = pRec->GetEntity(); return 1.f; } } } return 0.f; }