From 95be80cdb5322720e7c9fbd13ec2692288afd931 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 14 Dec 2013 16:52:22 +0000 Subject: Implemented note block playing and fixed wire Game of Thrones music in Minecraft, here I come! --- src/Bindings/ManualBindings.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Bindings') diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 4f7e1470a..2e19c2581 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -18,6 +18,7 @@ #include "../BlockEntities/DropperEntity.h" #include "../BlockEntities/FurnaceEntity.h" #include "../BlockEntities/HopperEntity.h" +#include "../BlockEntities/NoteEntity.h" #include "md5/md5.h" #include "../LineBlockTracer.h" @@ -2217,6 +2218,7 @@ void ManualBindings::Bind(lua_State * tolua_S) tolua_function(tolua_S, "DoWithDropperAt", tolua_DoWithXYZ); tolua_function(tolua_S, "DoWithEntityByID", tolua_DoWithID< cWorld, cEntity, &cWorld::DoWithEntityByID>); tolua_function(tolua_S, "DoWithFurnaceAt", tolua_DoWithXYZ); + tolua_function(tolua_S, "DoWithNoteBlockAt", tolua_DoWithXYZ); tolua_function(tolua_S, "DoWithPlayer", tolua_DoWith< cWorld, cPlayer, &cWorld::DoWithPlayer>); tolua_function(tolua_S, "FindAndDoWithPlayer", tolua_DoWith< cWorld, cPlayer, &cWorld::FindAndDoWithPlayer>); tolua_function(tolua_S, "ForEachBlockEntityInChunk", tolua_ForEachInChunk); -- cgit v1.2.3 From 8c04afe18a3420574942501a30e3151e89217acd Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 14 Dec 2013 22:34:49 +0100 Subject: Exported E_EFFECTS_ to lua. Forgot to commit Globals.h. --- src/Bindings/AllToLua.pkg | 1 + src/Bindings/Bindings.cpp | 28 ++++++++++++++++++++++++++-- src/Bindings/Bindings.h | 2 +- 3 files changed, 28 insertions(+), 3 deletions(-) (limited to 'src/Bindings') diff --git a/src/Bindings/AllToLua.pkg b/src/Bindings/AllToLua.pkg index 6db7b2b0e..e9a5ea0c6 100644 --- a/src/Bindings/AllToLua.pkg +++ b/src/Bindings/AllToLua.pkg @@ -37,6 +37,7 @@ $cfile "../Entities/Player.h" $cfile "../Entities/Pickup.h" $cfile "../Entities/ProjectileEntity.h" $cfile "../Entities/TNTEntity.h" +$cfile "../Entities/Effects.h" $cfile "../Server.h" $cfile "../World.h" $cfile "../Inventory.h" diff --git a/src/Bindings/Bindings.cpp b/src/Bindings/Bindings.cpp index 090d8047a..f4fb3f791 100644 --- a/src/Bindings/Bindings.cpp +++ b/src/Bindings/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/14/13 16:22:45. +** Generated automatically by tolua++-1.0.92 on 12/14/13 22:33:52. */ #ifndef __cplusplus @@ -8,7 +8,7 @@ #endif #include "string.h" -#include "tolua++/include/tolua++.h" +#include "tolua++.h" /* Exported function */ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S); @@ -35,6 +35,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S); #include "../Entities/Pickup.h" #include "../Entities/ProjectileEntity.h" #include "../Entities/TNTEntity.h" +#include "../Entities/Effects.h" #include "../Server.h" #include "../World.h" #include "../Inventory.h" @@ -31064,6 +31065,29 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"GetCounterTime",tolua_AllToLua_cTNTEntity_GetCounterTime00); tolua_function(tolua_S,"GetMaxFuseTime",tolua_AllToLua_cTNTEntity_GetMaxFuseTime00); tolua_endmodule(tolua_S); + tolua_constant(tolua_S,"E_EFFECT_SPEED",E_EFFECT_SPEED); + tolua_constant(tolua_S,"E_EFFECT_SLOWNESS",E_EFFECT_SLOWNESS); + tolua_constant(tolua_S,"E_EFFECT_HASTE",E_EFFECT_HASTE); + tolua_constant(tolua_S,"E_EFFECT_MINING_FATIGUE",E_EFFECT_MINING_FATIGUE); + tolua_constant(tolua_S,"E_EFFECT_STENGTH",E_EFFECT_STENGTH); + tolua_constant(tolua_S,"E_EFFECT_INSTANT_HEALTH",E_EFFECT_INSTANT_HEALTH); + tolua_constant(tolua_S,"E_EFFECT_INSTANT_DAMAGE",E_EFFECT_INSTANT_DAMAGE); + tolua_constant(tolua_S,"E_EFFECT_JUMP_BOOST",E_EFFECT_JUMP_BOOST); + tolua_constant(tolua_S,"E_EFFECT_NAUSEA",E_EFFECT_NAUSEA); + tolua_constant(tolua_S,"E_EFFECT_REGENERATION",E_EFFECT_REGENERATION); + tolua_constant(tolua_S,"E_EFFECT_RESISTANCE",E_EFFECT_RESISTANCE); + tolua_constant(tolua_S,"E_EFFECT_FIRE_RESISTANCE",E_EFFECT_FIRE_RESISTANCE); + tolua_constant(tolua_S,"E_EFFECT_WATER_BREATHING",E_EFFECT_WATER_BREATHING); + tolua_constant(tolua_S,"E_EFFECT_INVISIBILITY",E_EFFECT_INVISIBILITY); + tolua_constant(tolua_S,"E_EFFECT_BLINDNESS",E_EFFECT_BLINDNESS); + tolua_constant(tolua_S,"E_EFFECT_NIGHT_VISION",E_EFFECT_NIGHT_VISION); + tolua_constant(tolua_S,"E_EFFECT_HUNGER",E_EFFECT_HUNGER); + tolua_constant(tolua_S,"E_EFFECT_WEAKNESS",E_EFFECT_WEAKNESS); + tolua_constant(tolua_S,"E_EFFECT_POISON",E_EFFECT_POISON); + tolua_constant(tolua_S,"E_EFFECT_WITHER",E_EFFECT_WITHER); + tolua_constant(tolua_S,"E_EFFECT_HEALTH_BOOST",E_EFFECT_HEALTH_BOOST); + tolua_constant(tolua_S,"E_EFFECT_ABSORPTION",E_EFFECT_ABSORPTION); + tolua_constant(tolua_S,"E_EFFECT_SATURATION",E_EFFECT_SATURATION); tolua_cclass(tolua_S,"cServer","cServer","",NULL); tolua_beginmodule(tolua_S,"cServer"); tolua_function(tolua_S,"GetDescription",tolua_AllToLua_cServer_GetDescription00); diff --git a/src/Bindings/Bindings.h b/src/Bindings/Bindings.h index 73cf3c7d8..e8f766b43 100644 --- a/src/Bindings/Bindings.h +++ b/src/Bindings/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/14/13 16:22:46. +** Generated automatically by tolua++-1.0.92 on 12/14/13 22:33:53. */ /* Exported function */ -- cgit v1.2.3 From 812ea39a5c373f5870562cf24c7282e1cf231599 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 14 Dec 2013 23:34:37 +0100 Subject: Added tolua++ redirection include. This is needed because ToLua++ regenerates the Bindings file with bad #include, and it would be too difficult to fix ToLua++; this is an easier solution. Should fix PR #431. --- src/Bindings/tolua++.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/Bindings/tolua++.h (limited to 'src/Bindings') diff --git a/src/Bindings/tolua++.h b/src/Bindings/tolua++.h new file mode 100644 index 000000000..4dfd06318 --- /dev/null +++ b/src/Bindings/tolua++.h @@ -0,0 +1,13 @@ + +// tolua++.h + +// Redirection file, needed because ToLua++ generates the Bindings.cpp file with >> #include "tolua++.h" << + + + + +#include "tolua++/include/tolua++.h" + + + + -- cgit v1.2.3 From 9fe06af598b7e298c0df315f6bdcd65fd1c9b0c4 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 15 Dec 2013 14:52:17 +0100 Subject: Exported Set and Get functions to Lua. --- src/Bindings/Bindings.cpp | 136 +++++++++++++++++++++++++++++++++++++++++++++- src/Bindings/Bindings.h | 2 +- 2 files changed, 136 insertions(+), 2 deletions(-) (limited to 'src/Bindings') diff --git a/src/Bindings/Bindings.cpp b/src/Bindings/Bindings.cpp index f4fb3f791..46f8c8f40 100644 --- a/src/Bindings/Bindings.cpp +++ b/src/Bindings/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/14/13 22:33:52. +** Generated automatically by tolua++-1.0.92 on 12/15/13 14:19:12. */ #ifndef __cplusplus @@ -10460,6 +10460,38 @@ static int tolua_AllToLua_cPlayer_IsEating00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: IsFlying of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsFlying00 +static int tolua_AllToLua_cPlayer_IsFlying00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsFlying'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsFlying(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsFlying'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: Respawn of class cPlayer */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_Respawn00 static int tolua_AllToLua_cPlayer_Respawn00(lua_State* tolua_S) @@ -10849,6 +10881,72 @@ static int tolua_AllToLua_cPlayer_SetSprint00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: SetFlying of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetFlying00 +static int tolua_AllToLua_cPlayer_SetFlying00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + bool a_IsFlying = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetFlying'", NULL); +#endif + { + self->SetFlying(a_IsFlying); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetFlying'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetCanFly of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetCanFly00 +static int tolua_AllToLua_cPlayer_SetCanFly00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + bool a_CanFly = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetCanFly'", NULL); +#endif + { + self->SetCanFly(a_CanFly); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetCanFly'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: IsSwimming of class cPlayer */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsSwimming00 static int tolua_AllToLua_cPlayer_IsSwimming00(lua_State* tolua_S) @@ -10913,6 +11011,38 @@ static int tolua_AllToLua_cPlayer_IsSubmerged00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: CanFly of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_CanFly00 +static int tolua_AllToLua_cPlayer_CanFly00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CanFly'", NULL); +#endif + { + bool tolua_ret = (bool) self->CanFly(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CanFly'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: new of class cPickup */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_new00 static int tolua_AllToLua_cPickup_new00(lua_State* tolua_S) @@ -30978,6 +31108,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"AddFoodExhaustion",tolua_AllToLua_cPlayer_AddFoodExhaustion00); tolua_function(tolua_S,"FoodPoison",tolua_AllToLua_cPlayer_FoodPoison00); tolua_function(tolua_S,"IsEating",tolua_AllToLua_cPlayer_IsEating00); + tolua_function(tolua_S,"IsFlying",tolua_AllToLua_cPlayer_IsFlying00); tolua_function(tolua_S,"Respawn",tolua_AllToLua_cPlayer_Respawn00); tolua_function(tolua_S,"SetVisible",tolua_AllToLua_cPlayer_SetVisible00); tolua_function(tolua_S,"IsVisible",tolua_AllToLua_cPlayer_IsVisible00); @@ -30990,8 +31121,11 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"SetSprintingMaxSpeed",tolua_AllToLua_cPlayer_SetSprintingMaxSpeed00); tolua_function(tolua_S,"SetCrouch",tolua_AllToLua_cPlayer_SetCrouch00); tolua_function(tolua_S,"SetSprint",tolua_AllToLua_cPlayer_SetSprint00); + tolua_function(tolua_S,"SetFlying",tolua_AllToLua_cPlayer_SetFlying00); + tolua_function(tolua_S,"SetCanFly",tolua_AllToLua_cPlayer_SetCanFly00); tolua_function(tolua_S,"IsSwimming",tolua_AllToLua_cPlayer_IsSwimming00); tolua_function(tolua_S,"IsSubmerged",tolua_AllToLua_cPlayer_IsSubmerged00); + tolua_function(tolua_S,"CanFly",tolua_AllToLua_cPlayer_CanFly00); tolua_endmodule(tolua_S); #ifdef __cplusplus tolua_cclass(tolua_S,"cPickup","cPickup","cEntity",tolua_collect_cPickup); diff --git a/src/Bindings/Bindings.h b/src/Bindings/Bindings.h index e8f766b43..4805c260e 100644 --- a/src/Bindings/Bindings.h +++ b/src/Bindings/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/14/13 22:33:53. +** Generated automatically by tolua++-1.0.92 on 12/15/13 14:19:13. */ /* Exported function */ -- cgit v1.2.3 From 0efd74f114dad98c4fadc0318718f2e0203bca8b Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 15 Dec 2013 18:54:54 +0100 Subject: This adds a function that allows you to 'shoot' a player towards a direction. --- src/Bindings/Bindings.cpp | 36 +++++++++++++++++++++++++++++++++++- src/Bindings/Bindings.h | 2 +- 2 files changed, 36 insertions(+), 2 deletions(-) (limited to 'src/Bindings') diff --git a/src/Bindings/Bindings.cpp b/src/Bindings/Bindings.cpp index 46f8c8f40..219f7c31a 100644 --- a/src/Bindings/Bindings.cpp +++ b/src/Bindings/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/15/13 14:19:12. +** Generated automatically by tolua++-1.0.92 on 12/15/13 18:47:13. */ #ifndef __cplusplus @@ -9395,6 +9395,39 @@ static int tolua_AllToLua_cPlayer_GetIP00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: ShootTo of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_ShootTo00 +static int tolua_AllToLua_cPlayer_ShootTo00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + Vector3d Vector = *((Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ShootTo'", NULL); +#endif + { + self->ShootTo(Vector); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ShootTo'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: MoveTo of class cPlayer */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_MoveTo00 static int tolua_AllToLua_cPlayer_MoveTo00(lua_State* tolua_S) @@ -31076,6 +31109,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"IsGameModeSurvival",tolua_AllToLua_cPlayer_IsGameModeSurvival00); tolua_function(tolua_S,"IsGameModeAdventure",tolua_AllToLua_cPlayer_IsGameModeAdventure00); tolua_function(tolua_S,"GetIP",tolua_AllToLua_cPlayer_GetIP00); + tolua_function(tolua_S,"ShootTo",tolua_AllToLua_cPlayer_ShootTo00); tolua_function(tolua_S,"MoveTo",tolua_AllToLua_cPlayer_MoveTo00); tolua_function(tolua_S,"GetWindow",tolua_AllToLua_cPlayer_GetWindow00); tolua_function(tolua_S,"CloseWindow",tolua_AllToLua_cPlayer_CloseWindow00); diff --git a/src/Bindings/Bindings.h b/src/Bindings/Bindings.h index 4805c260e..0b555e66c 100644 --- a/src/Bindings/Bindings.h +++ b/src/Bindings/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/15/13 14:19:13. +** Generated automatically by tolua++-1.0.92 on 12/15/13 18:47:14. */ /* Exported function */ -- cgit v1.2.3 From a2612fa68adacada92874c58b56f2646adda39eb Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 15 Dec 2013 20:25:53 +0100 Subject: Exported to Lua --- src/Bindings/Bindings.cpp | 18 +++++++++--------- src/Bindings/Bindings.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/Bindings') diff --git a/src/Bindings/Bindings.cpp b/src/Bindings/Bindings.cpp index 219f7c31a..5536ab2b0 100644 --- a/src/Bindings/Bindings.cpp +++ b/src/Bindings/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/15/13 18:47:13. +** Generated automatically by tolua++-1.0.92 on 12/15/13 20:25:06. */ #ifndef __cplusplus @@ -9395,9 +9395,9 @@ static int tolua_AllToLua_cPlayer_GetIP00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: ShootTo of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_ShootTo00 -static int tolua_AllToLua_cPlayer_ShootTo00(lua_State* tolua_S) +/* method: ForceSetSpeed of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_ForceSetSpeed00 +static int tolua_AllToLua_cPlayer_ForceSetSpeed00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; @@ -9411,18 +9411,18 @@ static int tolua_AllToLua_cPlayer_ShootTo00(lua_State* tolua_S) #endif { cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - Vector3d Vector = *((Vector3d*) tolua_tousertype(tolua_S,2,0)); + Vector3d a_Direction = *((Vector3d*) tolua_tousertype(tolua_S,2,0)); #ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ShootTo'", NULL); + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ForceSetSpeed'", NULL); #endif { - self->ShootTo(Vector); + self->ForceSetSpeed(a_Direction); } } return 0; #ifndef TOLUA_RELEASE tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ShootTo'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'ForceSetSpeed'.",&tolua_err); return 0; #endif } @@ -31109,7 +31109,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"IsGameModeSurvival",tolua_AllToLua_cPlayer_IsGameModeSurvival00); tolua_function(tolua_S,"IsGameModeAdventure",tolua_AllToLua_cPlayer_IsGameModeAdventure00); tolua_function(tolua_S,"GetIP",tolua_AllToLua_cPlayer_GetIP00); - tolua_function(tolua_S,"ShootTo",tolua_AllToLua_cPlayer_ShootTo00); + tolua_function(tolua_S,"ForceSetSpeed",tolua_AllToLua_cPlayer_ForceSetSpeed00); tolua_function(tolua_S,"MoveTo",tolua_AllToLua_cPlayer_MoveTo00); tolua_function(tolua_S,"GetWindow",tolua_AllToLua_cPlayer_GetWindow00); tolua_function(tolua_S,"CloseWindow",tolua_AllToLua_cPlayer_CloseWindow00); diff --git a/src/Bindings/Bindings.h b/src/Bindings/Bindings.h index 0b555e66c..ef3b6b49e 100644 --- a/src/Bindings/Bindings.h +++ b/src/Bindings/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/15/13 18:47:14. +** Generated automatically by tolua++-1.0.92 on 12/15/13 20:25:06. */ /* Exported function */ -- cgit v1.2.3 From daade8ddee96eee7bfe74c75f2de1d2994258b74 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 16 Dec 2013 22:02:28 +0100 Subject: Fixed multiple inheritance in ToLua++. This fixes #422. --- src/Bindings/Bindings.cpp | 113 +++++++++++++++++++++++++++++++++++++++++----- src/Bindings/Bindings.h | 2 +- src/Bindings/LuaWindow.h | 8 ++-- 3 files changed, 107 insertions(+), 16 deletions(-) (limited to 'src/Bindings') diff --git a/src/Bindings/Bindings.cpp b/src/Bindings/Bindings.cpp index 5536ab2b0..e46e42aa4 100644 --- a/src/Bindings/Bindings.cpp +++ b/src/Bindings/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/15/13 20:25:06. +** Generated automatically by tolua++-1.0.92 on 12/16/13 21:57:34. */ #ifndef __cplusplus @@ -220,45 +220,46 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"cItemGrid"); tolua_usertype(tolua_S,"cHTTPServer::cCallbacks"); tolua_usertype(tolua_S,"cLuaWindow"); - tolua_usertype(tolua_S,"cInventory"); + tolua_usertype(tolua_S,"cServer"); tolua_usertype(tolua_S,"cHopperEntity"); tolua_usertype(tolua_S,"std::vector"); - tolua_usertype(tolua_S,"cBlockEntityWithItems"); tolua_usertype(tolua_S,"cWindow"); + tolua_usertype(tolua_S,"cBlockEntityWithItems"); tolua_usertype(tolua_S,"cCraftingGrid"); tolua_usertype(tolua_S,"cBlockArea"); tolua_usertype(tolua_S,"cGroup"); tolua_usertype(tolua_S,"cTracer"); - tolua_usertype(tolua_S,"cItem"); tolua_usertype(tolua_S,"cBoundingBox"); + tolua_usertype(tolua_S,"cItem"); + tolua_usertype(tolua_S,"cCuboid"); tolua_usertype(tolua_S,"cArrowEntity"); tolua_usertype(tolua_S,"cDropSpenserEntity"); - tolua_usertype(tolua_S,"cCuboid"); tolua_usertype(tolua_S,"Vector3i"); tolua_usertype(tolua_S,"Vector3d"); + tolua_usertype(tolua_S,"cTNTEntity"); tolua_usertype(tolua_S,"cNoteEntity"); - tolua_usertype(tolua_S,"cServer"); + tolua_usertype(tolua_S,"cWebAdmin"); tolua_usertype(tolua_S,"cBlockEntity"); tolua_usertype(tolua_S,"cCriticalSection"); tolua_usertype(tolua_S,"HTTPTemplateRequest"); tolua_usertype(tolua_S,"cPickup"); tolua_usertype(tolua_S,"cItems"); tolua_usertype(tolua_S,"cClientHandle"); - tolua_usertype(tolua_S,"cWebAdmin"); - tolua_usertype(tolua_S,"cChatColor"); tolua_usertype(tolua_S,"HTTPRequest"); - tolua_usertype(tolua_S,"cIniFile"); + tolua_usertype(tolua_S,"cChatColor"); tolua_usertype(tolua_S,"HTTPFormData"); + tolua_usertype(tolua_S,"cIniFile"); tolua_usertype(tolua_S,"cSignEntity"); + tolua_usertype(tolua_S,"cDropperEntity"); tolua_usertype(tolua_S,"cPawn"); tolua_usertype(tolua_S,"cThrownEggEntity"); tolua_usertype(tolua_S,"cGroupManager"); + tolua_usertype(tolua_S,"cBlockEntityWindowOwner"); tolua_usertype(tolua_S,"cPluginManager"); - tolua_usertype(tolua_S,"cDropperEntity"); tolua_usertype(tolua_S,"cProjectileEntity"); tolua_usertype(tolua_S,"cItemGrid::cListener"); + tolua_usertype(tolua_S,"cInventory"); tolua_usertype(tolua_S,"cPlayer"); - tolua_usertype(tolua_S,"cTNTEntity"); } /* method: new of class cIniFile */ @@ -3279,6 +3280,23 @@ static int tolua_AllToLua_cLuaWindow_GetContents00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* get function: __cItemGrid of class cLuaWindow */ +#ifndef TOLUA_DISABLE_tolua_get_cLuaWindow___cItemGrid__cListener__ +static int tolua_get_cLuaWindow___cItemGrid__cListener__(lua_State* tolua_S) +{ + cLuaWindow* self = (cLuaWindow*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable '__cItemGrid'",NULL); +#endif +#ifdef __cplusplus + tolua_pushusertype(tolua_S,(void*)static_cast(self), "cItemGrid::cListener"); +#else + tolua_pushusertype(tolua_S,(void*)((cItemGrid::cListener*)self), "cItemGrid::cListener"); +#endif + return 1; +} +#endif //#ifndef TOLUA_DISABLE + /* function: BlockStringToType */ #ifndef TOLUA_DISABLE_tolua_AllToLua_BlockStringToType00 static int tolua_AllToLua_BlockStringToType00(lua_State* tolua_S) @@ -18791,6 +18809,23 @@ static int tolua_AllToLua_cBlockEntityWithItems_GetContents00(lua_State* tolua_S } #endif //#ifndef TOLUA_DISABLE +/* get function: __cBlockEntityWindowOwner__ of class cChestEntity */ +#ifndef TOLUA_DISABLE_tolua_get_cChestEntity___cBlockEntityWindowOwner__ +static int tolua_get_cChestEntity___cBlockEntityWindowOwner__(lua_State* tolua_S) +{ + cChestEntity* self = (cChestEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable '__cBlockEntityWindowOwner__'",NULL); +#endif +#ifdef __cplusplus + tolua_pushusertype(tolua_S,(void*)static_cast(self), "cBlockEntityWindowOwner"); +#else + tolua_pushusertype(tolua_S,(void*)((cBlockEntityWindowOwner*)self), "cBlockEntityWindowOwner"); +#endif + return 1; +} +#endif //#ifndef TOLUA_DISABLE + /* method: AddDropSpenserDir of class cDropSpenserEntity */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cDropSpenserEntity_AddDropSpenserDir00 static int tolua_AllToLua_cDropSpenserEntity_AddDropSpenserDir00(lua_State* tolua_S) @@ -18897,6 +18932,23 @@ static int tolua_AllToLua_cDropSpenserEntity_SetRedstonePower00(lua_State* tolua } #endif //#ifndef TOLUA_DISABLE +/* get function: __cBlockEntityWindowOwner__ of class cDropSpenserEntity */ +#ifndef TOLUA_DISABLE_tolua_get_cDropSpenserEntity___cBlockEntityWindowOwner__ +static int tolua_get_cDropSpenserEntity___cBlockEntityWindowOwner__(lua_State* tolua_S) +{ + cDropSpenserEntity* self = (cDropSpenserEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable '__cBlockEntityWindowOwner__'",NULL); +#endif +#ifdef __cplusplus + tolua_pushusertype(tolua_S,(void*)static_cast(self), "cBlockEntityWindowOwner"); +#else + tolua_pushusertype(tolua_S,(void*)((cBlockEntityWindowOwner*)self), "cBlockEntityWindowOwner"); +#endif + return 1; +} +#endif //#ifndef TOLUA_DISABLE + /* method: GetInputSlot of class cFurnaceEntity */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_GetInputSlot00 static int tolua_AllToLua_cFurnaceEntity_GetInputSlot00(lua_State* tolua_S) @@ -19220,6 +19272,40 @@ static int tolua_AllToLua_cFurnaceEntity_HasFuelTimeLeft00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* get function: __cBlockEntityWindowOwner__ of class cFurnaceEntity */ +#ifndef TOLUA_DISABLE_tolua_get_cFurnaceEntity___cBlockEntityWindowOwner__ +static int tolua_get_cFurnaceEntity___cBlockEntityWindowOwner__(lua_State* tolua_S) +{ + cFurnaceEntity* self = (cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable '__cBlockEntityWindowOwner__'",NULL); +#endif +#ifdef __cplusplus + tolua_pushusertype(tolua_S,(void*)static_cast(self), "cBlockEntityWindowOwner"); +#else + tolua_pushusertype(tolua_S,(void*)((cBlockEntityWindowOwner*)self), "cBlockEntityWindowOwner"); +#endif + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: __cBlockEntityWindowOwner__ of class cHopperEntity */ +#ifndef TOLUA_DISABLE_tolua_get_cHopperEntity___cBlockEntityWindowOwner__ +static int tolua_get_cHopperEntity___cBlockEntityWindowOwner__(lua_State* tolua_S) +{ + cHopperEntity* self = (cHopperEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable '__cBlockEntityWindowOwner__'",NULL); +#endif +#ifdef __cplusplus + tolua_pushusertype(tolua_S,(void*)static_cast(self), "cBlockEntityWindowOwner"); +#else + tolua_pushusertype(tolua_S,(void*)((cBlockEntityWindowOwner*)self), "cBlockEntityWindowOwner"); +#endif + return 1; +} +#endif //#ifndef TOLUA_DISABLE + /* method: GetRecord of class cJukeboxEntity */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cJukeboxEntity_GetRecord00 static int tolua_AllToLua_cJukeboxEntity_GetRecord00(lua_State* tolua_S) @@ -30110,6 +30196,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,".call",tolua_AllToLua_cLuaWindow_new00_local); tolua_function(tolua_S,"delete",tolua_AllToLua_cLuaWindow_delete00); tolua_function(tolua_S,"GetContents",tolua_AllToLua_cLuaWindow_GetContents00); + tolua_variable(tolua_S,"__cItemGrid__cListener__",tolua_get_cLuaWindow___cItemGrid__cListener__,NULL); tolua_endmodule(tolua_S); tolua_constant(tolua_S,"E_BLOCK_AIR",E_BLOCK_AIR); tolua_constant(tolua_S,"E_BLOCK_STONE",E_BLOCK_STONE); @@ -31549,6 +31636,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_beginmodule(tolua_S,"cChestEntity"); tolua_constant(tolua_S,"ContentsHeight",cChestEntity::ContentsHeight); tolua_constant(tolua_S,"ContentsWidth",cChestEntity::ContentsWidth); + tolua_variable(tolua_S,"__cBlockEntityWindowOwner__",tolua_get_cChestEntity___cBlockEntityWindowOwner__,NULL); tolua_endmodule(tolua_S); tolua_cclass(tolua_S,"cDropSpenserEntity","cDropSpenserEntity","cBlockEntityWithItems",NULL); tolua_beginmodule(tolua_S,"cDropSpenserEntity"); @@ -31557,6 +31645,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"AddDropSpenserDir",tolua_AllToLua_cDropSpenserEntity_AddDropSpenserDir00); tolua_function(tolua_S,"Activate",tolua_AllToLua_cDropSpenserEntity_Activate00); tolua_function(tolua_S,"SetRedstonePower",tolua_AllToLua_cDropSpenserEntity_SetRedstonePower00); + tolua_variable(tolua_S,"__cBlockEntityWindowOwner__",tolua_get_cDropSpenserEntity___cBlockEntityWindowOwner__,NULL); tolua_endmodule(tolua_S); tolua_cclass(tolua_S,"cDispenserEntity","cDispenserEntity","cDropSpenserEntity",NULL); tolua_beginmodule(tolua_S,"cDispenserEntity"); @@ -31581,12 +31670,14 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"GetCookTimeLeft",tolua_AllToLua_cFurnaceEntity_GetCookTimeLeft00); tolua_function(tolua_S,"GetFuelBurnTimeLeft",tolua_AllToLua_cFurnaceEntity_GetFuelBurnTimeLeft00); tolua_function(tolua_S,"HasFuelTimeLeft",tolua_AllToLua_cFurnaceEntity_HasFuelTimeLeft00); + tolua_variable(tolua_S,"__cBlockEntityWindowOwner__",tolua_get_cFurnaceEntity___cBlockEntityWindowOwner__,NULL); tolua_endmodule(tolua_S); tolua_cclass(tolua_S,"cHopperEntity","cHopperEntity","cBlockEntityWithItems",NULL); tolua_beginmodule(tolua_S,"cHopperEntity"); tolua_constant(tolua_S,"ContentsHeight",cHopperEntity::ContentsHeight); tolua_constant(tolua_S,"ContentsWidth",cHopperEntity::ContentsWidth); tolua_constant(tolua_S,"TICKS_PER_TRANSFER",cHopperEntity::TICKS_PER_TRANSFER); + tolua_variable(tolua_S,"__cBlockEntityWindowOwner__",tolua_get_cHopperEntity___cBlockEntityWindowOwner__,NULL); tolua_endmodule(tolua_S); tolua_cclass(tolua_S,"cJukeboxEntity","cJukeboxEntity","cBlockEntity",NULL); tolua_beginmodule(tolua_S,"cJukeboxEntity"); diff --git a/src/Bindings/Bindings.h b/src/Bindings/Bindings.h index ef3b6b49e..012a8b13a 100644 --- a/src/Bindings/Bindings.h +++ b/src/Bindings/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/15/13 20:25:06. +** Generated automatically by tolua++-1.0.92 on 12/16/13 21:57:35. */ /* Exported function */ diff --git a/src/Bindings/LuaWindow.h b/src/Bindings/LuaWindow.h index 58d26ef96..dab99a2e2 100644 --- a/src/Bindings/LuaWindow.h +++ b/src/Bindings/LuaWindow.h @@ -33,10 +33,10 @@ Additionally, to forbid Lua from deleting this object while it is used by player cPlayer:OpenWindow check if the window is of this class, and if so, make a global Lua reference for this object. This reference needs to be unreferenced in the Destroy() function. */ -class cLuaWindow : // tolua_export - public cItemGrid::cListener, - // tolua_begin - public cWindow +// tolua_begin +class cLuaWindow : + public cWindow, + public cItemGrid::cListener { typedef cWindow super; -- cgit v1.2.3 From db5d7963e2dbb3a766850f5ffabd14980beb46b6 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 18 Dec 2013 16:11:15 +0000 Subject: Renamed back EntityAnimation to PlayerAnimation This fixes #411 and partially reverts 30ead790490f04248b861db79fddde9148b552f4 --- src/Bindings/Bindings.cpp | 40 ++++++++++++++++++++++++++++++++++++++-- src/Bindings/Bindings.h | 2 +- src/Bindings/Plugin.h | 2 +- src/Bindings/PluginLua.cpp | 8 ++++---- src/Bindings/PluginLua.h | 2 +- src/Bindings/PluginManager.cpp | 6 +++--- src/Bindings/PluginManager.h | 4 ++-- 7 files changed, 50 insertions(+), 14 deletions(-) (limited to 'src/Bindings') diff --git a/src/Bindings/Bindings.cpp b/src/Bindings/Bindings.cpp index e46e42aa4..b53b78853 100644 --- a/src/Bindings/Bindings.cpp +++ b/src/Bindings/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/16/13 21:57:34. +** Generated automatically by tolua++-1.0.92 on 12/18/13 16:09:11. */ #ifndef __cplusplus @@ -7444,6 +7444,41 @@ static int tolua_AllToLua_cEntity_AddSpeedZ00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: HandleSpeedFromAttachee of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_HandleSpeedFromAttachee00 +static int tolua_AllToLua_cEntity_HandleSpeedFromAttachee00(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_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + float a_Forward = ((float) tolua_tonumber(tolua_S,2,0)); + float a_Sideways = ((float) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HandleSpeedFromAttachee'", NULL); +#endif + { + self->HandleSpeedFromAttachee(a_Forward,a_Sideways); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HandleSpeedFromAttachee'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: SteerVehicle of class cEntity */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SteerVehicle00 static int tolua_AllToLua_cEntity_SteerVehicle00(lua_State* tolua_S) @@ -30110,7 +30145,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_constant(tolua_S,"HOOK_COLLECTING_PICKUP",cPluginManager::HOOK_COLLECTING_PICKUP); tolua_constant(tolua_S,"HOOK_CRAFTING_NO_RECIPE",cPluginManager::HOOK_CRAFTING_NO_RECIPE); tolua_constant(tolua_S,"HOOK_DISCONNECT",cPluginManager::HOOK_DISCONNECT); - tolua_constant(tolua_S,"HOOK_ENTITY_ANIMATION",cPluginManager::HOOK_ENTITY_ANIMATION); + tolua_constant(tolua_S,"HOOK_PLAYER_ANIMATION",cPluginManager::HOOK_PLAYER_ANIMATION); tolua_constant(tolua_S,"HOOK_EXECUTE_COMMAND",cPluginManager::HOOK_EXECUTE_COMMAND); tolua_constant(tolua_S,"HOOK_EXPLODED",cPluginManager::HOOK_EXPLODED); tolua_constant(tolua_S,"HOOK_EXPLODING",cPluginManager::HOOK_EXPLODING); @@ -31127,6 +31162,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"AddSpeedX",tolua_AllToLua_cEntity_AddSpeedX00); tolua_function(tolua_S,"AddSpeedY",tolua_AllToLua_cEntity_AddSpeedY00); tolua_function(tolua_S,"AddSpeedZ",tolua_AllToLua_cEntity_AddSpeedZ00); + tolua_function(tolua_S,"HandleSpeedFromAttachee",tolua_AllToLua_cEntity_HandleSpeedFromAttachee00); tolua_function(tolua_S,"SteerVehicle",tolua_AllToLua_cEntity_SteerVehicle00); tolua_function(tolua_S,"GetUniqueID",tolua_AllToLua_cEntity_GetUniqueID00); tolua_function(tolua_S,"IsDestroyed",tolua_AllToLua_cEntity_IsDestroyed00); diff --git a/src/Bindings/Bindings.h b/src/Bindings/Bindings.h index 012a8b13a..2fbd53dcc 100644 --- a/src/Bindings/Bindings.h +++ b/src/Bindings/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/16/13 21:57:35. +** Generated automatically by tolua++-1.0.92 on 12/18/13 16:09:11. */ /* Exported function */ diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h index 5cb35ac5a..9a3c2383e 100644 --- a/src/Bindings/Plugin.h +++ b/src/Bindings/Plugin.h @@ -64,7 +64,7 @@ public: virtual bool OnHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) = 0; virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer) = 0; virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) = 0; - virtual bool OnEntityAnimation (cEntity & a_Entity, int a_Animation) = 0; + virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) = 0; virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; virtual bool OnPlayerEating (cPlayer & a_Player) = 0; diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index f27cee76e..0d17c9ce2 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -550,14 +550,14 @@ bool cPluginLua::OnLogin(cClientHandle * a_Client, int a_ProtocolVersion, const -bool cPluginLua::OnEntityAnimation(cEntity & a_Entity, int a_Animation) +bool cPluginLua::OnPlayerAnimation(cPlayer & a_Player, int a_Animation) { cCSLock Lock(m_CriticalSection); bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_ENTITY_ANIMATION]; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_ANIMATION]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Entity, a_Animation, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Player, a_Animation, cLuaState::Return, res); if (res) { return true; @@ -1302,7 +1302,7 @@ const char * cPluginLua::GetHookFnName(int a_HookType) case cPluginManager::HOOK_COLLECTING_PICKUP: return "OnCollectingPickup"; case cPluginManager::HOOK_CRAFTING_NO_RECIPE: return "OnCraftingNoRecipe"; case cPluginManager::HOOK_DISCONNECT: return "OnDisconnect"; - case cPluginManager::HOOK_ENTITY_ANIMATION: return "OnEntityAnimation"; + case cPluginManager::HOOK_PLAYER_ANIMATION: return "OnPlayerAnimation"; case cPluginManager::HOOK_EXECUTE_COMMAND: return "OnExecuteCommand"; case cPluginManager::HOOK_HANDSHAKE: return "OnHandshake"; case cPluginManager::HOOK_KILLING: return "OnKilling"; diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h index 188d202e0..e1e274c72 100644 --- a/src/Bindings/PluginLua.h +++ b/src/Bindings/PluginLua.h @@ -61,7 +61,7 @@ public: virtual bool OnHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) override; virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer) override; virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) override; - virtual bool OnEntityAnimation (cEntity & a_Entity, int a_Animation) override; + virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) override; virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; virtual bool OnPlayerEating (cPlayer & a_Player) override; diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 12263605f..732da24fa 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -602,16 +602,16 @@ bool cPluginManager::CallHookLogin(cClientHandle * a_Client, int a_ProtocolVersi -bool cPluginManager::CallHookEntityAnimation(cEntity & a_Entity, int a_Animation) +bool cPluginManager::CallHookPlayerAnimation(cPlayer & a_Player, int a_Animation) { - HookMap::iterator Plugins = m_Hooks.find(HOOK_ENTITY_ANIMATION); + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_ANIMATION); if (Plugins == m_Hooks.end()) { return false; } for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnEntityAnimation(a_Entity, a_Animation)) + if ((*itr)->OnPlayerAnimation(a_Player, a_Animation)) { return true; } diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index 09f230475..b69f402c0 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -68,7 +68,7 @@ public: // tolua_export HOOK_COLLECTING_PICKUP, HOOK_CRAFTING_NO_RECIPE, HOOK_DISCONNECT, - HOOK_ENTITY_ANIMATION, + HOOK_PLAYER_ANIMATION, HOOK_EXECUTE_COMMAND, HOOK_EXPLODED, HOOK_EXPLODING, @@ -163,7 +163,7 @@ public: // tolua_export bool CallHookHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum); bool CallHookKilling (cEntity & a_Victim, cEntity * a_Killer); bool CallHookLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username); - bool CallHookEntityAnimation (cEntity & a_Entity, int a_Animation); + bool CallHookPlayerAnimation (cPlayer & a_Player, int a_Animation); bool CallHookPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); bool CallHookPlayerEating (cPlayer & a_Player); -- cgit v1.2.3