| 1237 | DEFINE_COMMAND_S(Stop) |
| 1238 | |
| 1239 | GameValue VehFollow(const GameState* state, GameValuePar oper1, GameValuePar oper2, bool silent) |
| 1240 | { |
| 1241 | PackedBoolArray list; |
| 1242 | AIGroup* grp = GetUnits(state, oper1, list); |
| 1243 | if (!grp) |
| 1244 | { |
| 1245 | return NOTHING; |
| 1246 | } |
| 1247 | Vector3 pos; |
| 1248 | Object* obj = GetObject(oper2); |
| 1249 | EntityAI* veh = dyn_cast<EntityAI>(obj); |
| 1250 | if (!veh) |
| 1251 | { |
| 1252 | return NOTHING; |
| 1253 | } |
| 1254 | AIUnit* follow = veh->CommanderUnit(); |
| 1255 | if (!follow) |
| 1256 | { |
| 1257 | LOG_DEBUG(Script, "Cannot follow empty vehicle"); |
| 1258 | return NOTHING; |
| 1259 | } |
| 1260 | if (follow->GetGroup() != grp) |
| 1261 | { |
| 1262 | LOG_DEBUG(Script, "Cannot follow unit from other group"); |
| 1263 | return NOTHING; |
| 1264 | } |
| 1265 | Command cmd; |
| 1266 | cmd._message = Command::Join; |
| 1267 | cmd._destination = VZero; |
| 1268 | cmd._discretion = Command::Undefined; |
| 1269 | cmd._context = Command::CtxMission; |
| 1270 | cmd._joinToSubgroup = follow->GetSubgroup(); |
| 1271 | if (silent) |
| 1272 | { |
| 1273 | cmd._id = grp->GetNextCmdId(); |
| 1274 | grp->IssueCommand(cmd, list); |
| 1275 | } |
| 1276 | else |
| 1277 | { |
| 1278 | grp->SendCommand(cmd, list); |
| 1279 | } |
| 1280 | |
| 1281 | return NOTHING; |
| 1282 | } |
| 1283 | |
| 1284 | DEFINE_COMMAND(Follow) |
| 1285 |
nothing calls this directly
no test coverage detected