|
UFO: Alien Invasion
|
Artificial Intelligence. More...
#include "../shared/cxx.h"#include "g_local.h"#include "g_ai.h"#include "g_actor.h"#include "g_client.h"#include "g_combat.h"#include "g_edicts.h"#include "g_health.h"#include "g_move.h"#include "g_utils.h"#include "g_vis.h"#include <lauxlib.h>
Go to the source code of this file.
Data Structures | |
| struct | aiActor_t |
| Wrapper around edict. More... | |
| struct | AilSortTable< T > |
Macros | |
| #define | POS3_METATABLE "pos3" |
| #define | ACTOR_METATABLE "actor" |
| #define | AI_METATABLE "ai" |
| #define | luaL_dobuffer(L, b, n, s) |
| #define | AIL_invalidparameter(n) |
Enumerations | |
| enum | ailVisType_t { AILVT_ALL , AILVT_SIGHT , AILVT_TEAM , AILVT_DIST } |
| vis check types More... | |
| enum | ailSortCritType_t { AILSC_DIST , AILSC_PATH , AILSC_HP } |
| target sorting criteria (lowest first) More... | |
| enum | ailShootPosType_t { AILSP_FAST , AILSP_NEAR , AILSP_FAR , AILSP_DMG } |
| Shooting position types. More... | |
| enum | ailWanderPosType { AILPW_RAND , AILPW_CW , AILPW_CCW } |
Functions | |
| static const char * | AIL_toTeamString (const int team) |
| Converts integer team representation into string. | |
| static int | AIL_toTeamInt (const char *team, const int param) |
| Converts team string into int representation. | |
| static ailVisType_t | AIL_toVisInt (lua_State *L, const int index) |
| Return visibility mode int representation from the string representation in the lua stack. | |
| static ailSortCritType_t | AIL_toSortInt (lua_State *L, const int index) |
| Return sort type int representation from the string representation in the lua stack. | |
| static ailSortCritType_t | AIL_toDistInt (lua_State *L, const int index) |
| Return distance type int representation from the string representation in the lua stack. | |
| static ailShootPosType_t | AIL_toShotPInt (lua_State *L, const int index) |
| Return shooting position type int representation from the string representation in the lua stack. | |
| static ailWanderPosType | AIL_toWanderPInt (lua_State *L, const int index) |
| Return wander position type int representation from the string representation in the lua stack. | |
| template<typename T> | |
| bool | operator< (AilSortTable< T > i, AilSortTable< T > j) |
| static float | AIL_GetBestShot (const Actor &shooter, const Actor &target, const int tu, const float dist, shoot_types_t &bestType, fireDefIndex_t &bestFd, int &bestShots) |
| static int | actorL_register (lua_State *L) |
| Registers the actor metatable in the lua_State. | |
| static int | lua_isactor (lua_State *L, int index) |
| Checks to see if there is a actor metatable at index in the lua_State. | |
| static aiActor_t * | lua_toactor (lua_State *L, int index) |
| Returns the actor from the metatable at index. | |
| static aiActor_t * | lua_pushactor (lua_State *L, aiActor_t *actor) |
| Pushes a actor as a metatable at the top of the stack. | |
| static int | actorL_tostring (lua_State *L) |
| Pushes the actor as a string. | |
| static int | actorL_pos (lua_State *L) |
| Gets the actors position. | |
| static int | actorL_shoot (lua_State *L) |
| Shoots the actor. | |
| static int | actorL_team (lua_State *L) |
| Gets the actor's team. | |
| static int | actorL_throwgrenade (lua_State *L) |
| Throws a grenade to the actor. | |
| static int | actorL_TU (lua_State *L) |
| Gets the number of usable TU the actor has left. | |
| static int | actorL_HP (lua_State *L) |
| Gets the number of HP the actor has left. | |
| static int | actorL_morale (lua_State *L) |
| Gets the current morale of the actor onto the stack. | |
| static int | actorL_isinjured (lua_State *L) |
| Checks to see if the actor is seriously injured. | |
| static int | actorL_isarmed (lua_State *L) |
| Check if actor has weapons. | |
| static int | actorL_isdead (lua_State *L) |
| Check if the actor is dead. | |
| static int | actorL_isvalidtarget (lua_State *L) |
| Check if the actor is a valid target to attack. | |
| static int | pos3L_register (lua_State *L) |
| Registers the pos3 metatable in the lua_State. | |
| static int | lua_ispos3 (lua_State *L, int index) |
| Checks to see if there is a pos3 metatable at index in the lua_State. | |
| static pos3_t * | lua_topos3 (lua_State *L, int index) |
| Returns the pos3 from the metatable at index. | |
| static pos3_t * | lua_pushpos3 (lua_State *L, pos3_t *pos) |
| Pushes a pos3 as a metatable at the top of the stack. | |
| static int | pos3L_tostring (lua_State *L) |
| Puts the pos3 information in a string. | |
| static int | pos3L_goto (lua_State *L) |
| Makes the actor head to the position. | |
| static int | pos3L_face (lua_State *L) |
| Makes the actor face the position. | |
| static int | pos3L_distance (lua_State *L) |
| Return the distance the position an the AI actor. | |
| static int | AIL_print (lua_State *L) |
| Works more or less like Lua's builtin print. | |
| static int | AIL_squad (lua_State *L) |
| Returns a table with the actors in the current player's team. | |
| static int | AIL_select (lua_State *L) |
| Select an specific AI actor. | |
| static int | AIL_see (lua_State *L) |
| Returns what the actor can see. | |
| static int | AIL_crouch (lua_State *L) |
| Requests a crouch state (with true/false) and returns current crouch state. | |
| static int | AIL_reactionfire (lua_State *L) |
| Sets the actor's reaction fire mode. | |
| static int | AIL_roundsleft (lua_State *L) |
| Checks to see how many rounds the actor has left. | |
| static int | AIL_canreload (lua_State *L) |
| Checks to see if the actor can reload. | |
| static int | AIL_reload (lua_State *L) |
| Actor reloads his weapons. | |
| static int | AIL_positionshoot (lua_State *L) |
| Moves the actor into a position in which he can shoot his target. | |
| static int | AIL_positionhide (lua_State *L) |
| Moves the actor into a position in which he can hide. | |
| static int | AIL_positionherd (lua_State *L) |
| Determine the position where actor is closest to the target and with the target located between the actor and the nemy enemy. | |
| static int | AIL_positionapproach (lua_State *L) |
| Approach to a target actor. | |
| static int | AIL_grabweapon (lua_State *L) |
| Actor tries to grab a weapon from inventory. | |
| static int | AIL_missiontargets (lua_State *L) |
| Returns the positions of the available mission targets. | |
| static int | AIL_waypoints (lua_State *L) |
| Return the positions of the next waypoints. | |
| static int | AIL_positionmission (lua_State *L) |
| Try to find a position nearby to the given position. | |
| static int | AIL_positionwander (lua_State *L) |
| Return a new position to move to. | |
| static int | AIL_findweapons (lua_State *L) |
| Returns a table of the positions of nearby usable weapons on the floor. | |
| static int | AIL_isfighter (lua_State *L) |
| Whether the current AI actor is a fighter or not. | |
| static int | AIL_setwaypoint (lua_State *L) |
| Mark the current waypoint for a civ. | |
| static int | AIL_difficulty (lua_State *L) |
| Return the difficulty number (in case we want different AI for different ones). | |
| static int | AIL_positionflee (lua_State *L) |
| Return a position to flee to. | |
| static int | AIL_weapontype (lua_State *L) |
| Returns the type of the weapons in the actors hands. | |
| static int | AIL_actor (lua_State *L) |
| Returns the currently moving AI actor. | |
| static int | AIL_tusforshooting (lua_State *L) |
| Returns the min TUs the actor needs to fire. | |
| static int | AIL_class (lua_State *L) |
| Returns the AI actor's class. | |
| static int | AIL_hideneeded (lua_State *L) |
| Check if the actor needs wants to hide. | |
| void | AIL_ActorThink (Player &player, Actor *actor) |
| The think function for the ai controlled players. | |
| static const char * | AIL_GetAIType (const int team) |
| Return the AI type for the given team (the lua file the team actors should run). | |
| bool | AIL_TeamThink (Player &player) |
| The team think function for the ai controlled players. | |
| static lua_State * | AIL_InitLua () |
| int | AIL_InitActor (Actor *actor) |
| Initializes the lua AI for an actor. | |
| void | AIL_Init (void) |
| void | AIL_Shutdown (void) |
| void | AIL_Cleanup (void) |
| Closes the LUA AI. | |
Variables | |
| static lua_State * | ailState |
| static Actor * | AIL_ent |
| static Player * | AIL_player |
| static const luaL_Reg | actorL_methods [] |
| static const luaL_Reg | pos3L_methods [] |
| static const luaL_Reg | AIL_methods [] |
Artificial Intelligence.
Definition in file g_ai_lua.cpp.
| #define ACTOR_METATABLE "actor" |
Actor Lua Metable name.
Definition at line 60 of file g_ai_lua.cpp.
Referenced by actorL_register(), lua_isactor(), lua_pushactor(), and lua_toactor().
| #define AI_METATABLE "ai" |
| #define AIL_invalidparameter | ( | n | ) |
Definition at line 69 of file g_ai_lua.cpp.
Referenced by actorL_HP(), actorL_isarmed(), actorL_isdead(), actorL_isinjured(), actorL_morale(), actorL_throwgrenade(), actorL_TU(), AIL_crouch(), AIL_findweapons(), AIL_missiontargets(), AIL_positionapproach(), AIL_positionflee(), AIL_positionherd(), AIL_positionhide(), AIL_positionmission(), AIL_positionwander(), AIL_reactionfire(), AIL_reload(), AIL_see(), AIL_select(), AIL_toDistInt(), AIL_toShotPInt(), AIL_toSortInt(), AIL_toTeamInt(), AIL_toTeamString(), AIL_toVisInt(), AIL_toWanderPInt(), and AIL_waypoints().
| #define luaL_dobuffer | ( | L, | |
| b, | |||
| n, | |||
| s ) |
Provides an api like luaL_dostring for buffers.
Definition at line 67 of file g_ai_lua.cpp.
Referenced by AIL_InitActor().
| #define POS3_METATABLE "pos3" |
Pos3 Lua Metatable name.
Definition at line 59 of file g_ai_lua.cpp.
Referenced by lua_ispos3(), lua_pushpos3(), lua_topos3(), and pos3L_register().
| enum ailShootPosType_t |
Shooting position types.
| Enumerator | |
|---|---|
| AILSP_FAST | |
| AILSP_NEAR | |
| AILSP_FAR | |
| AILSP_DMG | |
Definition at line 88 of file g_ai_lua.cpp.
| enum ailSortCritType_t |
target sorting criteria (lowest first)
| Enumerator | |
|---|---|
| AILSC_DIST | |
| AILSC_PATH | |
| AILSC_HP | |
Definition at line 81 of file g_ai_lua.cpp.
| enum ailVisType_t |
vis check types
| Enumerator | |
|---|---|
| AILVT_ALL | |
| AILVT_SIGHT | |
| AILVT_TEAM | |
| AILVT_DIST | |
Definition at line 73 of file g_ai_lua.cpp.
| enum ailWanderPosType |
| Enumerator | |
|---|---|
| AILPW_RAND | |
| AILPW_CW | |
| AILPW_CCW | |
Definition at line 95 of file g_ai_lua.cpp.
|
static |
Gets the number of HP the actor has left.
Definition at line 725 of file g_ai_lua.cpp.
References aiActor_t::actor, AIL_invalidparameter, Edict::HP, lua_isactor(), and lua_toactor().
|
static |
Check if actor has weapons.
Definition at line 790 of file g_ai_lua.cpp.
References aiActor_t::actor, AIL_invalidparameter, Edict::getLeftHandItem(), Edict::getRightHandItem(), lua_isactor(), and lua_toactor().
|
static |
Check if the actor is dead.
Definition at line 809 of file g_ai_lua.cpp.
References aiActor_t::actor, AIL_invalidparameter, Actor::isDead(), lua_isactor(), and lua_toactor().
|
static |
Checks to see if the actor is seriously injured.
Definition at line 771 of file g_ai_lua.cpp.
References aiActor_t::actor, AIL_invalidparameter, Edict::chr, G_IsActorWounded(), Edict::HP, lua_isactor(), lua_toactor(), and character_t::maxHP.
|
static |
Check if the actor is a valid target to attack.
Definition at line 827 of file g_ai_lua.cpp.
References aiActor_t::actor, AI_IsHostile(), AIL_ent, lua_isactor(), and lua_toactor().
|
static |
Gets the current morale of the actor onto the stack.
Definition at line 743 of file g_ai_lua.cpp.
References aiActor_t::actor, AIL_invalidparameter, Actor::getMorale(), Actor::isInsane(), Actor::isPanicked(), Actor::isRaged(), lua_isactor(), lua_toactor(), and mor_brave.
|
static |
Gets the actors position.
Definition at line 521 of file g_ai_lua.cpp.
References aiActor_t::actor, lua_isactor(), lua_pushpos3(), lua_toactor(), and Edict::pos.
|
static |
Registers the actor metatable in the lua_State.
A C T O R L
| [in,out] | L | State to register the metatable in. |
Definition at line 440 of file g_ai_lua.cpp.
References ACTOR_METATABLE, and actorL_methods.
Referenced by AIL_InitLua().
|
static |
Shoots the actor.
Definition at line 533 of file g_ai_lua.cpp.
References aiActor_t::actor, AIL_ent, AIL_GetBestShot(), AIL_player, G_ClientShoot(), G_IsDead, lua_isactor(), lua_toactor(), NONE, Edict::origin, Edict::pos, and VectorDist.
|
static |
Gets the actor's team.
Definition at line 576 of file g_ai_lua.cpp.
References aiActor_t::actor, AIL_toTeamString(), Edict::getTeam(), lua_isactor(), and lua_toactor().
|
static |
Throws a grenade to the actor.
Definition at line 590 of file g_ai_lua.cpp.
References aiActor_t::actor, AI_CheckLineOfFire(), AI_FighterCheckShoot(), AI_IsHostile(), AI_SearchGrenade(), AIL_ent, AIL_invalidparameter, AIL_player, Item::ammoDef(), CID_LEFT, CID_MAX, CID_RIGHT, fireDef_t::fdIdx, G_ActorGetModifiedTimeForFiredef(), G_ActorInvMove(), G_ClientShoot(), G_EdictsGetNextLivingActor(), Item::getFiredefs(), INVDEF, Item::isHeldTwoHanded(), lua_isactor(), lua_toactor(), NONE, Edict::origin, invDef_t::out, Edict::pos, fireDef_t::splrad, ST_LEFT, ST_RIGHT, UNIT_SIZE, VectorDist, and fireDef_t::weapFdsIdx.
|
static |
Pushes the actor as a string.
Definition at line 505 of file g_ai_lua.cpp.
References aiActor_t::actor, Edict::chr, Com_sprintf(), lua_isactor(), lua_toactor(), MAX_VAR, and character_t::name.
|
static |
Gets the number of usable TU the actor has left.
Definition at line 707 of file g_ai_lua.cpp.
References aiActor_t::actor, AIL_invalidparameter, Actor::getUsableTUs(), lua_isactor(), and lua_toactor().
|
static |
Returns the currently moving AI actor.
Definition at line 2063 of file g_ai_lua.cpp.
References AIL_ent, and lua_pushactor().
The think function for the ai controlled players.
| [in] | player | |
| [in] | actor |
Definition at line 2118 of file g_ai_lua.cpp.
References Edict::AI, AIL_ent, AIL_player, ailState, gi, and AI_t::type.
Referenced by AI_ActorRun().
|
static |
Checks to see if the actor can reload.
Definition at line 1267 of file g_ai_lua.cpp.
References AIL_ent, CID_LEFT, CID_RIGHT, and G_ClientCanReload().
|
static |
Closes the LUA AI.
Definition at line 2321 of file g_ai_lua.cpp.
References ailState.
Referenced by G_MatchDoEnd().
|
static |
Requests a crouch state (with true/false) and returns current crouch state.
Definition at line 1201 of file g_ai_lua.cpp.
References AIL_ent, AIL_invalidparameter, AIL_player, G_ClientStateChange(), and STATE_CROUCHED.
|
static |
Return the difficulty number (in case we want different AI for different ones).
Definition at line 1979 of file g_ai_lua.cpp.
References g_difficulty.
|
static |
Returns a table of the positions of nearby usable weapons on the floor.
Definition at line 1896 of file g_ai_lua.cpp.
References AI_CheckPosition(), AIL_ent, AIL_invalidparameter, CID_FLOOR, CID_RIGHT, AilSortTable< T >::data, data, ET_ITEM, G_ActorMoveLength(), G_EdictsGetNextInUse(), G_FindPath(), Edict::getFloor(), Item::getNext(), i, INVDEF, level, lua_pushpos3(), MAX_EDICTS, Edict::pos, ROUTING_NOT_REACHABLE, AilSortTable< T >::sortLookup, and Edict::type.
|
static |
Return the AI type for the given team (the lua file the team actors should run).
Definition at line 2144 of file g_ai_lua.cpp.
References TEAM_ALIEN, TEAM_CIVILIAN, TEAM_PHALANX, and type.
Referenced by AIL_InitActor(), and AIL_TeamThink().
|
static |
Definition at line 249 of file g_ai_lua.cpp.
References AI_CalcShotDamage(), AI_CheckLineOfFire(), AI_FighterCheckShoot(), AI_GetItemForShootType(), AIL_ent, Item::ammoDef(), G_ActorGetModifiedTimeForFiredef(), Item::getFiredefs(), fireDef_t::gravity, fireDef_t::launched, NONE, fireDef_t::rolled, ST_NUM_SHOOT_TYPES, ST_RIGHT, and fireDef_t::weapFdsIdx.
Referenced by actorL_shoot(), and AIL_positionshoot().
|
static |
Actor tries to grab a weapon from inventory.
Definition at line 1306 of file g_ai_lua.cpp.
References AIL_ent, and G_ClientGetWeaponFromInventory().
|
static |
Check if the actor needs wants to hide.
Definition at line 2107 of file g_ai_lua.cpp.
References AI_HideNeeded(), and AIL_ent.
Definition at line 2258 of file g_ai_lua.cpp.
References AILPW_CCW, AILPW_CW, AILPW_RAND, AILSC_DIST, AILSC_HP, AILSC_PATH, AILSP_DMG, AILSP_FAR, AILSP_FAST, AILSP_NEAR, ailState, AILVT_ALL, AILVT_DIST, AILVT_SIGHT, AILVT_TEAM, gi, TEAM_ALIEN, TEAM_ALL, TEAM_CIVILIAN, and TEAM_PHALANX.
Referenced by G_Init().
Initializes the lua AI for an actor.
| [in] | actor | Pointer to actor to initialize AI for. |
0 on success. Definition at line 2216 of file g_ai_lua.cpp.
References Edict::AI, AIL_GetAIType(), AIL_InitLua(), ailState, Edict::chr, Com_sprintf(), Edict::getTeam(), gi, teamDef_t::id, luaL_dobuffer, MAX_VAR, Q_strncpyz(), AI_t::subtype, character_t::teamDef, and AI_t::type.
Referenced by AI_InitPlayer(), and G_ClientTeamInfo().
|
static |
Initializes a new ai lua state.
Definition at line 2195 of file g_ai_lua.cpp.
References actorL_register(), AI_METATABLE, AIL_methods, and pos3L_register().
Referenced by AIL_InitActor().
|
static |
Whether the current AI actor is a fighter or not.
Definition at line 1945 of file g_ai_lua.cpp.
References AIL_ent.
|
static |
Returns the positions of the available mission targets.
Definition at line 1605 of file g_ai_lua.cpp.
References AIL_ent, AIL_invalidparameter, AIL_toDistInt(), AIL_toTeamInt(), AIL_toVisInt(), AILSC_DIST, AILSC_PATH, AILVT_ALL, AILVT_DIST, AILVT_SIGHT, AilSortTable< T >::data, data, ET_MISSION, G_EdictsGetNextInUse(), G_FindPath(), G_TestLineWithEnts(), G_VisCheckDist(), Edict::getTeam(), gi, i, level, lua_pushpos3(), MAX_EDICTS, Edict::origin, Edict::pos, ROUTING_NOT_REACHABLE, AilSortTable< T >::sortLookup, TEAM_ALL, Edict::type, and VectorDistSqr.
|
static |
Approach to a target actor.
Definition at line 1541 of file g_ai_lua.cpp.
References AI_CheckPosition(), AI_GetHidingTeam(), AIL_ent, AIL_invalidparameter, G_ActorMoveLength(), G_FindPath(), G_TestVis(), gi, length, level, lua_ispos3(), lua_pushpos3(), lua_topos3(), PosSubDV, ROUTING_NOT_REACHABLE, ROUTING_UNREACHABLE, VectorCopy, VS_YES, VT_NOFRUSTUM, and VT_PERISHCHK.
|
static |
Return a position to flee to.
Definition at line 1988 of file g_ai_lua.cpp.
References AI_CheckPosition(), AI_GetHidingTeam(), AI_IsHostile(), AIL_ent, AIL_invalidparameter, G_ActorMoveLength(), G_EdictsGetNextLivingActor(), G_MoveCalc(), G_TestVis(), AiAreaSearch::getNext(), GRID_WIDTH, Edict::isSameTeamAs(), level, lua_pushpos3(), oldPos, Edict::origin, PATHFINDING_HEIGHT, ROUTING_NOT_REACHABLE, TU_MOVE_STRAIGHT, UNIT_SIZE, VectorCopy, VectorDist, VS_YES, VT_NOFRUSTUM, and VT_PERISHCHK.
|
static |
Determine the position where actor is closest to the target and with the target located between the actor and the nemy enemy.
target (parameter is passed through the lua stack) The actor to which AI tries to become closer inverse (passed through the lua stack) Try to shield the target instead of using it as shield Definition at line 1499 of file g_ai_lua.cpp.
References aiActor_t::actor, AI_FindHerdLocation(), AIL_ent, AIL_invalidparameter, lua_isactor(), lua_pushpos3(), lua_toactor(), Edict::origin, and VectorCopy.
|
static |
Moves the actor into a position in which he can hide.
team (parameter is passed through the lua stack) means that the AI tries to find a hide position from the team members, if parameter is empty - from any enemy Definition at line 1443 of file g_ai_lua.cpp.
References AI_FindHidingLocation(), AI_GetHidingTeam(), AIL_ent, AIL_invalidparameter, AIL_toTeamInt(), lua_pushpos3(), TEAM_ALL, and VectorCopy.
|
static |
Try to find a position nearby to the given position.
Definition at line 1771 of file g_ai_lua.cpp.
References AI_FindMissionLocation(), AIL_ent, AIL_invalidparameter, ET_MISSION, G_GetEdictFromPos(), G_MoveCalc(), gi, level, lua_ispos3(), lua_pushpos3(), lua_topos3(), oldPos, Edict::radius, and VectorCopy.
|
static |
Moves the actor into a position in which he can shoot his target.
Definition at line 1315 of file g_ai_lua.cpp.
References aiActor_t::actor, ACTOR_VIS_10, AI_CheckPosition(), AI_GetItemForShootType(), AI_IsHostile(), AIL_ent, AIL_GetBestShot(), AIL_toShotPInt(), AILSP_DMG, AILSP_FAR, AILSP_FAST, AILSP_NEAR, G_ActorGetModifiedTimeForFiredef(), G_ActorMoveLength(), G_ActorVis(), G_IsVisibleForTeam, G_MoveCalc(), Item::getFastestFireDef(), AiAreaSearch::getNext(), Edict::getTeam(), Actor::getUsableTUs(), gi, level, lua_isactor(), lua_pushpos3(), lua_toactor(), NONE, oldPos, Edict::origin, PATHFINDING_HEIGHT, Edict::pos, ROUTING_NOT_REACHABLE, Edict::setOrigin(), ST_LEFT, ST_RIGHT, TU_MOVE_STRAIGHT, VectorCopy, VectorDist, and VectorSet.
|
static |
Return a new position to move to.
Definition at line 1809 of file g_ai_lua.cpp.
References AI_CheckPosition(), AIL_ent, AIL_invalidparameter, AIL_toWanderPInt(), AILPW_CCW, AILPW_CW, AILPW_RAND, AngleToDir(), dvleft, dvright, G_ActorMoveLength(), G_MoveCalc(), AiAreaSearch::getNext(), gi, level, lua_ispos3(), lua_pushpos3(), lua_topos3(), NONE, PATHFINDING_HEIGHT, ROUTING_NOT_REACHABLE, todeg, TU_MOVE_STRAIGHT, VectorCopy, VectorDistSqr, VectorEmpty, and VectorSubtract.
|
static |
Works more or less like Lua's builtin print.
General AI bindings.
A I L
Definition at line 1010 of file g_ai_lua.cpp.
|
static |
Sets the actor's reaction fire mode.
Definition at line 1220 of file g_ai_lua.cpp.
References AIL_ent, AIL_invalidparameter, AIL_player, G_ClientStateChange(), Q_streq, and STATE_REACTION.
|
static |
Actor reloads his weapons.
Definition at line 1277 of file g_ai_lua.cpp.
References AI_TryToReloadWeapon(), AIL_ent, AIL_invalidparameter, CID_LEFT, CID_RIGHT, and Q_streq.
|
static |
Checks to see how many rounds the actor has left.
Definition at line 1245 of file g_ai_lua.cpp.
References AIL_ent, objDef_t::ammo, Item::def(), and Item::getAmmoLeft().
|
static |
Returns what the actor can see.
Definition at line 1109 of file g_ai_lua.cpp.
References aiActor_t::actor, AIL_ent, AIL_invalidparameter, AIL_toSortInt(), AIL_toTeamInt(), AIL_toVisInt(), AILSC_DIST, AILSC_HP, AILSC_PATH, AILVT_ALL, AILVT_DIST, AILVT_SIGHT, AILVT_TEAM, AilSortTable< T >::data, G_CheckVisTeamAll(), G_EdictsGetNextLivingActor(), G_FindPath(), G_IsVisibleForTeam, G_Vis(), G_VisCheckDist(), Edict::getTeam(), gi, Edict::HP, i, level, lua_pushactor(), MAX_EDICTS, Edict::pos, ROUTING_NOT_REACHABLE, AilSortTable< T >::sortLookup, TEAM_ALL, VectorDistSqr, and VT_NOFRUSTUM.
|
static |
Select an specific AI actor.
Definition at line 1085 of file g_ai_lua.cpp.
References aiActor_t::actor, AIL_ent, AIL_invalidparameter, AIL_player, g_ailua, Edict::getPlayerNum(), gi, lua_isactor(), and lua_toactor().
|
static |
Mark the current waypoint for a civ.
Definition at line 1955 of file g_ai_lua.cpp.
References AIL_ent, Edict::count, ET_CIVILIANTARGET, G_GetEdictFromPos(), and lua_ispos3().
|
static |
Returns a table with the actors in the current player's team.
Definition at line 1057 of file g_ai_lua.cpp.
References aiActor_t::actor, AIL_player, g_ailua, G_EdictsGetNextActor(), Edict::getPlayerNum(), gi, i, and lua_pushactor().
| bool AIL_TeamThink | ( | Player & | player | ) |
The team think function for the ai controlled players.
| [in] | player |
Definition at line 2166 of file g_ai_lua.cpp.
References AIL_ent, AIL_GetAIType(), AIL_player, AIL_toTeamString(), ailState, and gi.
Referenced by AI_PlayerRun().
|
static |
Return distance type int representation from the string representation in the lua stack.
| L | The lua state to use |
| index | Index on the lua stack where the string representation is stored |
Definition at line 175 of file g_ai_lua.cpp.
References AIL_invalidparameter, AILSC_DIST, gi, and index.
Referenced by AIL_missiontargets(), AIL_waypoints(), and pos3L_distance().
|
static |
Return shooting position type int representation from the string representation in the lua stack.
| L | The lua state to use |
| index | Index on the lua stack where the string representation is stored |
Definition at line 193 of file g_ai_lua.cpp.
References AIL_invalidparameter, AILSP_FAST, gi, and index.
Referenced by AIL_positionshoot().
|
static |
Return sort type int representation from the string representation in the lua stack.
| L | The lua state to use |
| index | Index on the lua stack where the string representation is stored |
Definition at line 157 of file g_ai_lua.cpp.
References AIL_invalidparameter, AILSC_DIST, gi, and index.
Referenced by AIL_see().
Converts team string into int representation.
| team | The team to convert (alien, phalanx, civilian, ...) |
| param | parameter index for the Lua error message |
Definition at line 125 of file g_ai_lua.cpp.
References AIL_invalidparameter, gi, and TEAM_DEFAULT.
Referenced by AIL_missiontargets(), AIL_positionhide(), and AIL_see().
|
static |
Converts integer team representation into string.
| team | The team to convert to the string representation |
Definition at line 110 of file g_ai_lua.cpp.
References AIL_invalidparameter, and gi.
Referenced by actorL_team(), and AIL_TeamThink().
|
static |
Return visibility mode int representation from the string representation in the lua stack.
| L | The lua state to use |
| index | Index on the lua stack where the string representation is stored |
Definition at line 139 of file g_ai_lua.cpp.
References AIL_invalidparameter, AILVT_ALL, gi, and index.
Referenced by AIL_missiontargets(), and AIL_see().
|
static |
Return wander position type int representation from the string representation in the lua stack.
| L | The lua state to use |
| index | Index on the lua stack where the string representation is stored |
Definition at line 211 of file g_ai_lua.cpp.
References AIL_invalidparameter, AILPW_RAND, gi, and index.
Referenced by AIL_positionwander().
|
static |
Returns the min TUs the actor needs to fire.
Definition at line 2072 of file g_ai_lua.cpp.
References AIL_ent, Item::getFastestFireDef(), and fireDef_t::time.
|
static |
Return the positions of the next waypoints.
Definition at line 1688 of file g_ai_lua.cpp.
References AIL_ent, AIL_invalidparameter, AIL_toDistInt(), AILSC_DIST, AILSC_PATH, AilSortTable< T >::data, data, G_EdictsGetNextLivingActorOfTeam(), G_FindPath(), gi, i, level, lua_pushpos3(), MAX_EDICTS, Edict::origin, ROUTING_NOT_REACHABLE, AilSortTable< T >::sortLookup, TEAM_ALIEN, TU_MOVE_STRAIGHT, UNIT_SIZE, and VectorDist.
|
static |
Returns the type of the weapons in the actors hands.
Definition at line 2049 of file g_ai_lua.cpp.
References AIL_ent, Item::def(), and objDef_t::type.
Checks to see if there is a actor metatable at index in the lua_State.
| [in,out] | L | Lua state to check. |
| [in] | index | Index to check for a actor metatable. |
Definition at line 464 of file g_ai_lua.cpp.
References ACTOR_METATABLE, and index.
Referenced by actorL_HP(), actorL_isarmed(), actorL_isdead(), actorL_isinjured(), actorL_isvalidtarget(), actorL_morale(), actorL_pos(), actorL_shoot(), actorL_team(), actorL_throwgrenade(), actorL_tostring(), actorL_TU(), AIL_positionherd(), AIL_positionshoot(), AIL_select(), and lua_toactor().
Checks to see if there is a pos3 metatable at index in the lua_State.
| [in] | L | Lua state to check. |
| [in] | index | Index to check for a pos3 metatable. |
Definition at line 871 of file g_ai_lua.cpp.
References index, and POS3_METATABLE.
Referenced by AIL_positionapproach(), AIL_positionmission(), AIL_positionwander(), AIL_setwaypoint(), lua_topos3(), pos3L_distance(), pos3L_face(), pos3L_goto(), and pos3L_tostring().
Pushes a actor as a metatable at the top of the stack.
Definition at line 493 of file g_ai_lua.cpp.
References ACTOR_METATABLE.
Referenced by AIL_actor(), AIL_see(), and AIL_squad().
Pushes a pos3 as a metatable at the top of the stack.
Definition at line 900 of file g_ai_lua.cpp.
References POS3_METATABLE.
Referenced by actorL_pos(), AIL_findweapons(), AIL_missiontargets(), AIL_positionapproach(), AIL_positionflee(), AIL_positionherd(), AIL_positionhide(), AIL_positionmission(), AIL_positionshoot(), AIL_positionwander(), and AIL_waypoints().
Returns the actor from the metatable at index.
Definition at line 481 of file g_ai_lua.cpp.
References ACTOR_METATABLE, index, and lua_isactor().
Referenced by actorL_HP(), actorL_isarmed(), actorL_isdead(), actorL_isinjured(), actorL_isvalidtarget(), actorL_morale(), actorL_pos(), actorL_shoot(), actorL_team(), actorL_throwgrenade(), actorL_tostring(), actorL_TU(), AIL_positionherd(), AIL_positionshoot(), and AIL_select().
Returns the pos3 from the metatable at index.
Definition at line 888 of file g_ai_lua.cpp.
References index, lua_ispos3(), and POS3_METATABLE.
Referenced by AIL_positionapproach(), AIL_positionmission(), AIL_positionwander(), pos3L_distance(), pos3L_face(), pos3L_goto(), and pos3L_tostring().
| bool operator< | ( | AilSortTable< T > | i, |
| AilSortTable< T > | j ) |
Definition at line 239 of file g_ai_lua.cpp.
References i, and AilSortTable< T >::sortLookup.
|
static |
Return the distance the position an the AI actor.
Definition at line 971 of file g_ai_lua.cpp.
References AIL_ent, AIL_toDistInt(), AILSC_DIST, AILSC_PATH, G_ActorMoveLength(), G_FindPath(), level, lua_ispos3(), lua_topos3(), PosToVec, ROUTING_NOT_REACHABLE, and VectorDist.
|
static |
Makes the actor face the position.
Definition at line 957 of file g_ai_lua.cpp.
References AI_TurnIntoDirection(), AIL_ent, lua_ispos3(), and lua_topos3().
|
static |
Makes the actor head to the position.
Definition at line 928 of file g_ai_lua.cpp.
References AIL_ent, AIL_player, G_ActorMoveLength(), G_ClientMove(), G_MoveCalc(), gi, length, level, lua_ispos3(), lua_topos3(), and ROUTING_NOT_REACHABLE.
|
static |
Registers the pos3 metatable in the lua_State.
pos3 metatable.
P O S 3 L
| [in] | L | State to register the metatable in. |
Definition at line 847 of file g_ai_lua.cpp.
References POS3_METATABLE, and pos3L_methods.
Referenced by AIL_InitLua().
|
static |
Puts the pos3 information in a string.
Definition at line 912 of file g_ai_lua.cpp.
References Com_sprintf(), lua_ispos3(), lua_topos3(), and MAX_VAR.
|
static |
Lua Actor metatable methods.
Definition at line 321 of file g_ai_lua.cpp.
Referenced by actorL_register().
|
static |
Actor currently running the Lua AI.
Definition at line 246 of file g_ai_lua.cpp.
Referenced by actorL_isvalidtarget(), actorL_shoot(), actorL_throwgrenade(), AIL_actor(), AIL_ActorThink(), AIL_canreload(), AIL_class(), AIL_crouch(), AIL_findweapons(), AIL_GetBestShot(), AIL_grabweapon(), AIL_hideneeded(), AIL_isfighter(), AIL_missiontargets(), AIL_positionapproach(), AIL_positionflee(), AIL_positionherd(), AIL_positionhide(), AIL_positionmission(), AIL_positionshoot(), AIL_positionwander(), AIL_reactionfire(), AIL_reload(), AIL_roundsleft(), AIL_see(), AIL_select(), AIL_setwaypoint(), AIL_TeamThink(), AIL_tusforshooting(), AIL_waypoints(), AIL_weapontype(), pos3L_distance(), pos3L_face(), and pos3L_goto().
|
static |
Lua AI module methods. http://www.lua.org/manual/5.1/manual.html#lua_CFunction
Definition at line 398 of file g_ai_lua.cpp.
Referenced by AIL_InitLua().
|
static |
Player currently running the Lua AI.
Definition at line 247 of file g_ai_lua.cpp.
Referenced by actorL_shoot(), actorL_throwgrenade(), AIL_ActorThink(), AIL_crouch(), AIL_reactionfire(), AIL_select(), AIL_squad(), AIL_TeamThink(), and pos3L_goto().
|
static |
Definition at line 63 of file g_ai_lua.cpp.
Referenced by AIL_ActorThink(), AIL_Cleanup(), AIL_Init(), AIL_InitActor(), and AIL_TeamThink().
|
static |
Lua Pos3 metatable methods.
Definition at line 354 of file g_ai_lua.cpp.
Referenced by pos3L_register().