Updated lua documentation.

This commit is contained in:
Walter Julius Hennecke 2013-05-09 19:40:15 +02:00
parent e887081261
commit 4b4fd3c470
3 changed files with 146 additions and 53 deletions

View file

@ -4,12 +4,15 @@
#ifdef G_LUA #ifdef G_LUA
/*** /***
A module for entity movement, especially for mover entities such as doors. Documentation under work. A module for entity movement, especially for mover entities such as doors.
@module mover @module mover
*/ */
// mover.Halt(entity ent) /***
// Stops translational movement on ent immediately. Stops translational movement on ent immediately.
@function Halt
@param ent Entity or entity number.
*/
static int Mover_Halt(lua_State *L) { static int Mover_Halt(lua_State *L) {
lent_t *lent; lent_t *lent;
gentity_t *ent = NULL; gentity_t *ent = NULL;
@ -39,8 +42,11 @@ static int Mover_Halt(lua_State *L) {
return 0; return 0;
} }
// mover.HaltAngles(entity ent) /***
// Stops rotational movement on ent immediately. Stops rotational movement on ent immediately.
@function HaltAngles
@param ent Entity or entity number.
*/
static int Mover_HaltAngles(lua_State * L) static int Mover_HaltAngles(lua_State * L)
{ {
lent_t *lent; lent_t *lent;
@ -74,19 +80,13 @@ extern void Reached_Train(gentity_t *ent);
extern void Think_SetupTrainTargets(gentity_t *ent); extern void Think_SetupTrainTargets(gentity_t *ent);
extern void SetMoverState(gentity_t *ent, moverState_t moverState, int time); extern void SetMoverState(gentity_t *ent, moverState_t moverState, int time);
/* This is an example for a parseable comment that describes a lua function. */ /***
/* Moves an entity like a func_train entity. Targets have to be path_corner entities.
* \function mover.AsTrain(entity mover, entity target, float speed) @function AsTrain
* \param entity mover entity to move. @param mover Entity to move.
* \param entity target path_corner entity to move to. @param target path_corner entity to move to.
* \param float speed Speed to move with to the first path_corner. @param speed Speed to move with to the first path_corner.
* \desc Moves an entity like a func_train entity. Targets have to be path_corner entities.
*/ */
// mover.AsTrain(entity mover, entity target, float speed)
// Moves an entity like a func_train entity. Targets have to be path_corner entities.
// * ent the entity to move
// * target the first path_corner to move to
// * speed speed to move to first path_corner with
static int Mover_AsTrain(lua_State * L) static int Mover_AsTrain(lua_State * L)
{ {
lent_t *lent, *tlent; lent_t *lent, *tlent;
@ -170,11 +170,20 @@ static int Mover_AsTrain(lua_State * L)
return 0; return 0;
} }
// mover.SetAngles(entity ent, vector angles) or /***
// mover.SetAngles(entity ent, float y, float z, float x) Sets the angles of ent to the specified values. Values are sorted Pitch (around Y-Axis), Yaw (around Z-Axis) and Roll (around X-Axis). These can also be stowed in a vector angles.
// Sets the angles of ent to the specified value(s). @function SetAngles
// Values are sorted Pitch (around Y-Axis), Yaw (around Z-Axis) and @param ent Entity or entity number.
// Roll (around X-Axis). These can also be stowed in a vector angles. @param y Pitch.
@param z Yaw.
@param x Roll.
*/
/***
Sets the angles of ent to the specified value.
@function SetAngles
@param ent Entity or entity number.
@param agles Vector containing the new angles.
*/
static int Mover_SetAngles(lua_State * L) static int Mover_SetAngles(lua_State * L)
{ {
vec3_t newAngles; vec3_t newAngles;
@ -216,11 +225,19 @@ static int Mover_SetAngles(lua_State * L)
return 0; return 0;
} }
// mover.SetAngles2(entity ent, vector angles) or /***
// mover.SetAngles2(entity ent, float y, float z, float x) Sets the angles of ent to the specified values. Values are sorted Pitch (around Y-Axis), Yaw (around Z-Axis) and Roll (around X-Axis). These can also be stowed in a vector angles.
// Sets the angles of ent to the specified value(s). @function SetAngles2
// Values are sorted Pitch (around Y-Axis), Yaw (around Z-Axis) and @param ent Entity or entity number.
// Roll (around X-Axis). These can also be stowed in a vector angles. @param y Pitch.
@param z Yaw.
@param x Roll.
*/
/***
Sets the angles of ent to the specified value.
@function SetAngles2
@param vec Vector containing the new angles.
*/
static int Mover_SetAngles2(lua_State * L) static int Mover_SetAngles2(lua_State * L)
{ {
vec3_t newAngles; vec3_t newAngles;
@ -261,9 +278,20 @@ static int Mover_SetAngles2(lua_State * L)
return 0; return 0;
} }
// mover.SetPosition(entity ent, vector pos) or /***
// mover.SetPosition(entity ent, float x, float y, float z) Set the position of ent to the specified value.
// Set the position of ent to the specified value(s). Can also be stowed in a vector pos. @function SetPosition
@param ent Entity or entity number.
@param x X coordinates.
@param y Y coordinates.
@param z Z coordinates.
*/
/***
Set the position of ent to the specified value.
@function SetPosition
@param ent Entity or entity number.
@param vec Vector containing the new position.
*/
static int Mover_SetPosition(lua_State * L) static int Mover_SetPosition(lua_State * L)
{ {
vec3_t newOrigin; vec3_t newOrigin;
@ -318,11 +346,22 @@ static void SetTrajectoryLinear(trajectory_t * tr, const float speed, const vec3
tr->trType = TR_LINEAR_STOP; tr->trType = TR_LINEAR_STOP;
} }
// mover.ToAngles(entity ent, float speed, vector angles) or /***
// mover.ToAngles(entity ent, float speed, float y, float z, float x) Rotates ent with a given speed (in degrees per second) to the specified values. Values are sorted Pitch (around Y-Axis), Yaw (around Z-Axis) and Roll (around X-Axis). These can also be stowed in a vector angles.
// Rotates ent with speed speed (in degrees per second) to the specified value(s). @function ToAngles
// Values are sorted Pitch (around Y-Axis), Yaw (around Z-Axis) and @param ent Entity or entity number.
// Roll (around X-Axis). These can also be stowed in a vector angles. @param speed Speed to rotate with.
@param y Pitch.
@param z Yaw.
@param x Roll.
*/
/***
Rotates ent with a given speed (in degrees per second) to the specified values.
@function ToAngles
@param ent Entity or entity number.
@param speed Speed to rotate with.
@param vec Vector conataining target angles.
*/
static int Mover_ToAngles(lua_State * L) static int Mover_ToAngles(lua_State * L)
{ {
vec3_t newAngles; vec3_t newAngles;
@ -369,9 +408,15 @@ static int Mover_ToAngles(lua_State * L)
return 0; return 0;
} }
// mover.ToPosition(entity ent, vector pos) or /***
// mover.ToPosition(entity ent, float x, float y, float z) Moves ent with a given speed to the specified values. Can also be stowed in a vector pos.
// Moves ent with speed speed to the specified value(s). Can also be stowed in a vector pos. @function ToPosition
@param ent Entity or entity number.
@param speed Speed to move with.
@param x X coordinates.
@param y Y coordinates.
@param z Z coordinates.
*/
static int Mover_ToPosition(lua_State * L) static int Mover_ToPosition(lua_State * L)
{ {
vec3_t newOrigin; vec3_t newOrigin;

View file

@ -5,14 +5,17 @@
#ifdef G_LUA #ifdef G_LUA
/*** /***
A documentation to play sounds. Documentation under work. A documentation to play sounds.
@module sound @module sound
*/ */
// sound.PlaySound(entity ent, string sound, integer chan) /***
// * ent the entity the sound will be played on Play a sound on a given entity.
// * sound the sound file which will be played @function PlaySound
// * chan the sound channel the sound will be played on @param ent The entity the sound will be played on
@param sound The sound file which will be played
@param chan The sound channel the sound will be played on
*/
static int Sound_PlaySound(lua_State *L) { static int Sound_PlaySound(lua_State *L) {
char *sound; char *sound;
int snd; int snd;

View file

@ -37,14 +37,16 @@ static int Trace_ToString(lua_State * L)
return 1; return 1;
} }
// trace.DoTrace(vector start, vector mins, vector maxs, vector end, float passEnt, float contents) /***
// Does a trace. Does a trace.
// * start start-point of trace @function DoTrace
// * mins minimal distance of trace (nil if unused) @param start start-point of the trace.
// * maxs maximal distance of trace (nil if unused) @param mins minimal distance of trace (nil if unused)
// * end end-point of trace @param maxs maximal distance of trace (nil if unused)
// * passEnt Number of ents to pass @param end end-point of trace
// * contents ???????? @param passEnt Number of ents to pass
@param contents Set content flags.
*/
static int Trace_DoTrace(lua_State *L) { static int Trace_DoTrace(lua_State *L) {
trace_t *tr; trace_t *tr;
vec_t *start, *end, *mins = NULL, *maxs = NULL; vec_t *start, *end, *mins = NULL, *maxs = NULL;
@ -73,8 +75,11 @@ static int Trace_DoTrace(lua_State *L) {
return 1; return 1;
} }
// trace.FreeTrace(trace tr) /***
// Ends trace-process for tr. Frees all memory that was allocated for this trace.
@function FreeTrace
@param trace The trace.
*/
static int Trace_FreeTrace(lua_State *L) { static int Trace_FreeTrace(lua_State *L) {
ltrace_t *tr; ltrace_t *tr;
@ -85,6 +90,11 @@ static int Trace_FreeTrace(lua_State *L) {
return 1; return 1;
} }
/***
Check whether the trace has gone only trough solid content (e.g. only inside a wall).
@function GetAllsolid
@return Whether trace was all solid.
*/
static int Trace_GetAllsolid(lua_State *L) { static int Trace_GetAllsolid(lua_State *L) {
ltrace_t *tr; ltrace_t *tr;
@ -94,6 +104,11 @@ static int Trace_GetAllsolid(lua_State *L) {
return 1; return 1;
} }
/***
Check whether the trace has started in solid contents.
@function GetStartsolid
@return Whether trace started solid.
*/
static int Trace_GetStartsolid(lua_State *L) { static int Trace_GetStartsolid(lua_State *L) {
ltrace_t *tr; ltrace_t *tr;
@ -103,6 +118,11 @@ static int Trace_GetStartsolid(lua_State *L) {
return 1; return 1;
} }
/***
Get fraction of trace.
@function GetFraction
@return Fraction.
*/
static int Trace_GetFraction(lua_State *L) { static int Trace_GetFraction(lua_State *L) {
ltrace_t *tr; ltrace_t *tr;
@ -112,6 +132,11 @@ static int Trace_GetFraction(lua_State *L) {
return 1; return 1;
} }
/***
Get end position of the trace.
@function GetEndpos
@return End position of the trace.
*/
static int Trace_GetEndpos(lua_State *L) { static int Trace_GetEndpos(lua_State *L) {
ltrace_t *tr; ltrace_t *tr;
@ -121,6 +146,11 @@ static int Trace_GetEndpos(lua_State *L) {
return 1; return 1;
} }
/***
Get the surface flags for the face the trace hit.
@function GetSurfaceFlags
@return Surface flags.
*/
static int Trace_GetSurfaceFlags(lua_State *L) { static int Trace_GetSurfaceFlags(lua_State *L) {
ltrace_t *tr; ltrace_t *tr;
@ -130,6 +160,11 @@ static int Trace_GetSurfaceFlags(lua_State *L) {
return 1; return 1;
} }
/***
Get content flags for the trace.
@function GetContents
@return Content flags.
*/
static int Trace_GetContents(lua_State *L) { static int Trace_GetContents(lua_State *L) {
ltrace_t *tr; ltrace_t *tr;
@ -139,6 +174,11 @@ static int Trace_GetContents(lua_State *L) {
return 1; return 1;
} }
/***
Get entity number for entity the trace hit.
@function GetEntityNum
@return Entity number.
*/
static int Trace_GetEntityNum(lua_State *L) { static int Trace_GetEntityNum(lua_State *L) {
ltrace_t *tr; ltrace_t *tr;
@ -148,6 +188,11 @@ static int Trace_GetEntityNum(lua_State *L) {
return 1; return 1;
} }
/***
Get entity the trace hit.
@function GetEntity
@return entity the trace hit.
*/
static int Trace_GetEntity(lua_State *L) { static int Trace_GetEntity(lua_State *L) {
ltrace_t *tr; ltrace_t *tr;
gentity_t *ent; gentity_t *ent;