MCPcopy Create free account
hub / github.com/demoth/jake2 / M_MoveToGoal

Method M_MoveToGoal

game/src/main/java/jake2/game/M.java:184–201  ·  view source on GitHub ↗

M_MoveToGoal.

(SubgameEntity ent, float dist, GameExportsImpl gameExports)

Source from the content-addressed store, hash-verified

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.

Callers 1

aiMethod · 0.95

Calls 4

SV_CloseEnoughMethod · 0.95
randMethod · 0.95
SV_StepDirectionMethod · 0.95
SV_NewChaseDirMethod · 0.95

Tested by

no test coverage detected