public static void M_MoveToGoal(edict_t ent, float dist) { edict_t goal = ent.goalentity; if (ent.groundentity == null && (ent.flags & (Defines.FL_FLY | Defines.FL_SWIM)) == 0) { return; } if (ent.enemy != null && SV.SV_CloseEnough(ent, ent.enemy, dist)) { return; } if ((Lib.Rand() & 3) == 1 || !SV.SV_StepDirection(ent, ent.ideal_yaw, dist)) { if (ent.inuse) { SV.SV_NewChaseDir(ent, goal, dist); } } }
/** * M_MoveToGoal. */ public static void M_MoveToGoal(edict_t ent, float dist) { var goal = ent.goalentity; if (ent.groundentity == null && (ent.flags & (Defines.FL_FLY | Defines.FL_SWIM)) == 0) { return; } // if the next step hits the enemy, return immediately if (ent.enemy != null && SV.SV_CloseEnough(ent, ent.enemy, dist)) { return; } // bump around... if ((Lib.rand() & 3) == 1 || !SV.SV_StepDirection(ent, ent.ideal_yaw, dist)) { if (ent.inuse) { SV.SV_NewChaseDir(ent, goal, dist); } } }