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

Function CheckArcadeTalkMove

engine/Poseidon/AI/AIArcade.cpp:1126–1168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1124}
1125
1126static void CheckArcadeTalkMove(AIGroupContext* context)
1127{
1128 STATE_PREFIX
1129 if (group->IsPlayerGroup())
1130 {
1131 context->_fsm->SetState(SArcadeTalkWalk, context);
1132 return;
1133 }
1134
1135 Vector3 posN;
1136 if (!GetTalkTarget(context, posN))
1137 {
1138 context->_fsm->SetState(SArcadeSync, context);
1139 return;
1140 }
1141
1142 if (!group->Leader())
1143 {
1144 return;
1145 }
1146 Vector3Val posL = group->Leader()->Position();
1147 Vector3Val posD = mission->_destination;
1148
1149 float dist2LN = posL.Distance2(posN);
1150 if (dist2LN <= Square(25))
1151 {
1152 context->_fsm->SetState(SArcadeTalkGetOut, context);
1153 return;
1154 }
1155 float dist2DN = posD.Distance2(posN);
1156 if (dist2DN > 0.01 * dist2LN || group->GetAllDone())
1157 {
1158 mission->_destination = posN;
1159
1160 Command cmd;
1161 cmd._message = Command::Move;
1162 cmd._destination = posN;
1163 cmd._discretion = Command::Undefined;
1164 cmd._context = Command::CtxMission;
1165 group->SendCommand(cmd);
1166 return;
1167 }
1168}
1169
1170static void ArcadeTalkGetOut(AIGroupContext* context)
1171{

Callers

nothing calls this directly

Calls 9

GetTalkTargetFunction · 0.85
IsPlayerGroupMethod · 0.80
GetAllDoneMethod · 0.80
SendCommandMethod · 0.80
SquareFunction · 0.50
SetStateMethod · 0.45
LeaderMethod · 0.45
PositionMethod · 0.45
Distance2Method · 0.45

Tested by

no test coverage detected