#pragma once
#include "lua.h"

#define MIN_DIR_ERR 5.0*M_PI/180. /**< Minimum direction error. */
#define MAX_DIR_ERR 0.5*M_PI/180. /**< Maximum direction error. */
#define MIN_VEL_ERR 5.0           /**< Minimum velocity error. */

#define FACE_WVEL       0.1       /**< Weight of velocity compared to position to face. */

/* Max number of AI timers. */
#define MAX_AI_TIMERS 2           /**< Max amount of AI timers. */

typedef enum TaskData_ { TYPE_NULL, TYPE_INT, TYPE_PTR } TaskData;

/**
 * @struct Task
 *
 * @brief Basic AI task.
 */
typedef struct Task_ {
  struct Task_* next;   /**< Next task. */
  char* name;           /**< Task name. */

  TaskData dtype;       /**< Data type. */
  union {
    void* target;       /**< Vec2 etc. */
    unsigned int ID;    /**< Pilot ID etc. */
  } dat; /**< Stores the data. */
} Task;

/**
 * @stuct Ai_Profile
 *
 * @brief Basic AI profile.
 */
typedef struct AI_Profile_ {
  char* name;   /**< Name of the profile. */
  lua_State* L; /**< Associated lua State. */
} AI_Profile;

/* Misc. */
AI_Profile* ai_getProfile(char* name);

int ai_init(void);
void ai_exit(void);

