From 4c24781a621b3c572a43f24235dbab696dff0b35 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 3 Sep 2013 10:20:56 +0200 Subject: Added cEntity's gravity to the Lua API. --- source/Bindings.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++++++- source/Bindings.h | 2 +- source/Entities/Entity.h | 4 +++ 3 files changed, 73 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 00da10f43..ad9e85ada 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 09/03/13 08:38:38. +** Generated automatically by tolua++-1.0.92 on 09/03/13 10:19:58. */ #ifndef __cplusplus @@ -6654,6 +6654,71 @@ tolua_lerror: } #endif //#ifndef TOLUA_DISABLE +/* method: GetGravity of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetGravity00 +static int tolua_AllToLua_cEntity_GetGravity00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetGravity'", NULL); +#endif + { + float tolua_ret = (float) self->GetGravity(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetGravity'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetGravity of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetGravity00 +static int tolua_AllToLua_cEntity_SetGravity00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + float a_Gravity = ((float) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetGravity'", NULL); +#endif + { + self->SetGravity(a_Gravity); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetGravity'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: GetRawDamageAgainst of class cEntity */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetRawDamageAgainst00 static int tolua_AllToLua_cEntity_GetRawDamageAgainst00(lua_State* tolua_S) @@ -29460,6 +29525,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"TakeDamage",tolua_AllToLua_cEntity_TakeDamage00); tolua_function(tolua_S,"TakeDamage",tolua_AllToLua_cEntity_TakeDamage01); tolua_function(tolua_S,"TakeDamage",tolua_AllToLua_cEntity_TakeDamage02); + tolua_function(tolua_S,"GetGravity",tolua_AllToLua_cEntity_GetGravity00); + tolua_function(tolua_S,"SetGravity",tolua_AllToLua_cEntity_SetGravity00); tolua_function(tolua_S,"GetRawDamageAgainst",tolua_AllToLua_cEntity_GetRawDamageAgainst00); tolua_function(tolua_S,"GetArmorCoverAgainst",tolua_AllToLua_cEntity_GetArmorCoverAgainst00); tolua_function(tolua_S,"GetKnockbackAmountAgainst",tolua_AllToLua_cEntity_GetKnockbackAmountAgainst00); diff --git a/source/Bindings.h b/source/Bindings.h index 86ce70c9a..e214d7ff2 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 09/03/13 08:38:39. +** Generated automatically by tolua++-1.0.92 on 09/03/13 10:19:59. */ /* Exported function */ diff --git a/source/Entities/Entity.h b/source/Entities/Entity.h index f407cd2c1..aa5d8fbd2 100644 --- a/source/Entities/Entity.h +++ b/source/Entities/Entity.h @@ -201,6 +201,10 @@ public: /// Makes this entity take the specified damage. The values are packed into a TDI, knockback calculated, then sent through DoTakeDamage() void TakeDamage(eDamageType a_DamageType, cEntity * a_Attacker, int a_RawDamage, int a_FinalDamage, double a_KnockbackAmount); + float GetGravity(void) const { return m_Gravity; } + + void SetGravity(float a_Gravity) { m_Gravity = a_Gravity; } + // tolua_end /// Makes this entity take damage specified in the a_TDI. The TDI is sent through plugins first, then applied -- cgit v1.2.3