M_MoveToGoal.
(SubgameEntity ent, float dist, GameExportsImpl gameExports)
| 182 | * M_MoveToGoal. |
| 183 | */ |
| 184 | public static void M_MoveToGoal(SubgameEntity ent, float dist, GameExportsImpl gameExports) { |
| 185 | SubgameEntity goal = ent.goalentity; |
| 186 | |
| 187 | // if we are (helplessly) falling and cannot fly -> return |
| 188 | if (ent.groundentity == null |
| 189 | && (ent.flags & (GameDefines.FL_FLY | GameDefines.FL_SWIM)) == 0) |
| 190 | return; |
| 191 | |
| 192 | // if the next step hits the enemy, return immediately |
| 193 | if (ent.enemy != null && SV.SV_CloseEnough(ent, ent.enemy, dist)) |
| 194 | return; |
| 195 | |
| 196 | // bump around... |
| 197 | if ((Lib.rand() & 3) == 1 || !SV.SV_StepDirection(ent, ent.ideal_yaw, dist, gameExports)) { |
| 198 | if (ent.inuse) |
| 199 | SV.SV_NewChaseDir(ent, goal, dist, gameExports); |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * M_walkmove. |
no test coverage detected