MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / GetOutMove

Function GetOutMove

engine/Poseidon/AI/AISubgroupFSM.cpp:2182–2206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2180}
2181
2182static void GetOutMove(AISubgroupContext* context)
2183{
2184 STATE_PREFIX
2185
2186 AIUnit* leader = subgrp->Leader();
2187
2188 LogFSM(subgrp, "GetOut", "Move");
2189
2190 if (!cmd->_target)
2191 {
2192 context->_fsm->SetState(SGetOutDone, context);
2193 return;
2194 }
2195
2196 Vector3Val posL = subgrp->Leader()->Position();
2197 Vector3Val posV = cmd->_target->Position();
2198 float distance = (cmd->_target->GetRadius() * 0.9f + 1.0f);
2199
2200 Vector3 norm = (posL - posV);
2201 Point3 posD = posV + norm.Normalized() * distance;
2202 Vector3 normal;
2203 leader->FindNearestEmpty(posD);
2204
2205 subgrp->GoDirect(posD);
2206}
2207
2208static void CheckGetOutMove(AISubgroupContext* context)
2209{

Callers

nothing calls this directly

Calls 7

LogFSMFunction · 0.85
GoDirectMethod · 0.80
LeaderMethod · 0.45
SetStateMethod · 0.45
PositionMethod · 0.45
NormalizedMethod · 0.45
FindNearestEmptyMethod · 0.45

Tested by

no test coverage detected