Merged branch 'master' into Projectiles.
This commit is contained in:
commit
83811b6929
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@ cloc.xsl
|
|||||||
*.user
|
*.user
|
||||||
*.suo
|
*.suo
|
||||||
/EveryNight.cmd
|
/EveryNight.cmd
|
||||||
|
*.sublime-*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
** Lua binding: AllToLua
|
** Lua binding: AllToLua
|
||||||
** Generated automatically by tolua++-1.0.92 on 08/22/13 08:53:27.
|
** Generated automatically by tolua++-1.0.92 on 08/25/13 17:06:06.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
@ -9400,6 +9400,38 @@ static int tolua_AllToLua_cPickup_IsCollected00(lua_State* tolua_S)
|
|||||||
}
|
}
|
||||||
#endif //#ifndef TOLUA_DISABLE
|
#endif //#ifndef TOLUA_DISABLE
|
||||||
|
|
||||||
|
/* method: GetProjectileKind of class cProjectileEntity */
|
||||||
|
#ifndef TOLUA_DISABLE_tolua_AllToLua_cProjectileEntity_GetProjectileKind00
|
||||||
|
static int tolua_AllToLua_cProjectileEntity_GetProjectileKind00(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
if (
|
||||||
|
!tolua_isusertype(tolua_S,1,"const cProjectileEntity",0,&tolua_err) ||
|
||||||
|
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||||
|
)
|
||||||
|
goto tolua_lerror;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
const cProjectileEntity* self = (const cProjectileEntity*) tolua_tousertype(tolua_S,1,0);
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetProjectileKind'", NULL);
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
cProjectileEntity::eKind tolua_ret = (cProjectileEntity::eKind) self->GetProjectileKind();
|
||||||
|
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'GetProjectileKind'.",&tolua_err);
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif //#ifndef TOLUA_DISABLE
|
||||||
|
|
||||||
/* method: GetCreator of class cProjectileEntity */
|
/* method: GetCreator of class cProjectileEntity */
|
||||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cProjectileEntity_GetCreator00
|
#ifndef TOLUA_DISABLE_tolua_AllToLua_cProjectileEntity_GetCreator00
|
||||||
static int tolua_AllToLua_cProjectileEntity_GetCreator00(lua_State* tolua_S)
|
static int tolua_AllToLua_cProjectileEntity_GetCreator00(lua_State* tolua_S)
|
||||||
@ -9432,6 +9464,70 @@ static int tolua_AllToLua_cProjectileEntity_GetCreator00(lua_State* tolua_S)
|
|||||||
}
|
}
|
||||||
#endif //#ifndef TOLUA_DISABLE
|
#endif //#ifndef TOLUA_DISABLE
|
||||||
|
|
||||||
|
/* method: GetMCAClassName of class cProjectileEntity */
|
||||||
|
#ifndef TOLUA_DISABLE_tolua_AllToLua_cProjectileEntity_GetMCAClassName00
|
||||||
|
static int tolua_AllToLua_cProjectileEntity_GetMCAClassName00(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
if (
|
||||||
|
!tolua_isusertype(tolua_S,1,"const cProjectileEntity",0,&tolua_err) ||
|
||||||
|
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||||
|
)
|
||||||
|
goto tolua_lerror;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
const cProjectileEntity* self = (const cProjectileEntity*) tolua_tousertype(tolua_S,1,0);
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMCAClassName'", NULL);
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
AString tolua_ret = (AString) self->GetMCAClassName();
|
||||||
|
tolua_pushcppstring(tolua_S,(const char*)tolua_ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'GetMCAClassName'.",&tolua_err);
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif //#ifndef TOLUA_DISABLE
|
||||||
|
|
||||||
|
/* method: IsInGround of class cProjectileEntity */
|
||||||
|
#ifndef TOLUA_DISABLE_tolua_AllToLua_cProjectileEntity_IsInGround00
|
||||||
|
static int tolua_AllToLua_cProjectileEntity_IsInGround00(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
if (
|
||||||
|
!tolua_isusertype(tolua_S,1,"const cProjectileEntity",0,&tolua_err) ||
|
||||||
|
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||||
|
)
|
||||||
|
goto tolua_lerror;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
const cProjectileEntity* self = (const cProjectileEntity*) tolua_tousertype(tolua_S,1,0);
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInGround'", NULL);
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
bool tolua_ret = (bool) self->IsInGround();
|
||||||
|
tolua_pushboolean(tolua_S,(bool)tolua_ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
#ifndef TOLUA_RELEASE
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'IsInGround'.",&tolua_err);
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif //#ifndef TOLUA_DISABLE
|
||||||
|
|
||||||
/* method: Get of class cPluginManager */
|
/* method: Get of class cPluginManager */
|
||||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_Get00
|
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_Get00
|
||||||
static int tolua_AllToLua_cPluginManager_Get00(lua_State* tolua_S)
|
static int tolua_AllToLua_cPluginManager_Get00(lua_State* tolua_S)
|
||||||
@ -27519,14 +27615,14 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
|||||||
tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_ZP",E_META_DROPSPENSER_FACING_ZP);
|
tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_ZP",E_META_DROPSPENSER_FACING_ZP);
|
||||||
tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_XM",E_META_DROPSPENSER_FACING_XM);
|
tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_XM",E_META_DROPSPENSER_FACING_XM);
|
||||||
tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_XP",E_META_DROPSPENSER_FACING_XP);
|
tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_XP",E_META_DROPSPENSER_FACING_XP);
|
||||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE",E_META_DOUBLE_STEP_STONE);
|
tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_STONE",E_META_DOUBLE_STONE_SLAB_STONE);
|
||||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_SANDSTONE",E_META_DOUBLE_STEP_SANDSTONE);
|
tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_SANDSTONE",E_META_DOUBLE_STONE_SLAB_SANDSTONE);
|
||||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_WOODEN",E_META_DOUBLE_STEP_WOODEN);
|
tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_WOODEN",E_META_DOUBLE_STONE_SLAB_WOODEN);
|
||||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_COBBLESTONE",E_META_DOUBLE_STEP_COBBLESTONE);
|
tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_COBBLESTONE",E_META_DOUBLE_STONE_SLAB_COBBLESTONE);
|
||||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_BRICK",E_META_DOUBLE_STEP_BRICK);
|
tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_BRICK",E_META_DOUBLE_STONE_SLAB_BRICK);
|
||||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE_BRICK",E_META_DOUBLE_STEP_STONE_BRICK);
|
tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_STONE_BRICK",E_META_DOUBLE_STONE_SLAB_STONE_BRICK);
|
||||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_NETHER_BRICK",E_META_DOUBLE_STEP_NETHER_BRICK);
|
tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_NETHER_BRICK",E_META_DOUBLE_STONE_SLAB_NETHER_BRICK);
|
||||||
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE_SECRET",E_META_DOUBLE_STEP_STONE_SECRET);
|
tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_STONE_SECRET",E_META_DOUBLE_STONE_SLAB_STONE_SECRET);
|
||||||
tolua_constant(tolua_S,"E_META_HOPPER_FACING_YM",E_META_HOPPER_FACING_YM);
|
tolua_constant(tolua_S,"E_META_HOPPER_FACING_YM",E_META_HOPPER_FACING_YM);
|
||||||
tolua_constant(tolua_S,"E_META_HOPPER_UNATTACHED",E_META_HOPPER_UNATTACHED);
|
tolua_constant(tolua_S,"E_META_HOPPER_UNATTACHED",E_META_HOPPER_UNATTACHED);
|
||||||
tolua_constant(tolua_S,"E_META_HOPPER_FACING_ZM",E_META_HOPPER_FACING_ZM);
|
tolua_constant(tolua_S,"E_META_HOPPER_FACING_ZM",E_META_HOPPER_FACING_ZM);
|
||||||
@ -27555,14 +27651,14 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
|||||||
tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_STONE",E_META_SILVERFISH_EGG_STONE);
|
tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_STONE",E_META_SILVERFISH_EGG_STONE);
|
||||||
tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_COBBLESTONE",E_META_SILVERFISH_EGG_COBBLESTONE);
|
tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_COBBLESTONE",E_META_SILVERFISH_EGG_COBBLESTONE);
|
||||||
tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_STONE_BRICK",E_META_SILVERFISH_EGG_STONE_BRICK);
|
tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_STONE_BRICK",E_META_SILVERFISH_EGG_STONE_BRICK);
|
||||||
tolua_constant(tolua_S,"E_META_STEP_STONE",E_META_STEP_STONE);
|
tolua_constant(tolua_S,"E_META_STONE_SLAB_STONE",E_META_STONE_SLAB_STONE);
|
||||||
tolua_constant(tolua_S,"E_META_STEP_SANDSTONE",E_META_STEP_SANDSTONE);
|
tolua_constant(tolua_S,"E_META_STONE_SLAB_SANDSTONE",E_META_STONE_SLAB_SANDSTONE);
|
||||||
tolua_constant(tolua_S,"E_META_STEP_PLANKS",E_META_STEP_PLANKS);
|
tolua_constant(tolua_S,"E_META_STONE_SLAB_PLANKS",E_META_STONE_SLAB_PLANKS);
|
||||||
tolua_constant(tolua_S,"E_META_STEP_COBBLESTONE",E_META_STEP_COBBLESTONE);
|
tolua_constant(tolua_S,"E_META_STONE_SLAB_COBBLESTONE",E_META_STONE_SLAB_COBBLESTONE);
|
||||||
tolua_constant(tolua_S,"E_META_STEP_BRICK",E_META_STEP_BRICK);
|
tolua_constant(tolua_S,"E_META_STONE_SLAB_BRICK",E_META_STONE_SLAB_BRICK);
|
||||||
tolua_constant(tolua_S,"E_META_STEP_STONE_BRICK",E_META_STEP_STONE_BRICK);
|
tolua_constant(tolua_S,"E_META_STONE_SLAB_STONE_BRICK",E_META_STONE_SLAB_STONE_BRICK);
|
||||||
tolua_constant(tolua_S,"E_META_STEP_NETHER_BRICK",E_META_STEP_NETHER_BRICK);
|
tolua_constant(tolua_S,"E_META_STONE_SLAB_NETHER_BRICK",E_META_STONE_SLAB_NETHER_BRICK);
|
||||||
tolua_constant(tolua_S,"E_META_STEP_STONE_SECRET",E_META_STEP_STONE_SECRET);
|
tolua_constant(tolua_S,"E_META_STONE_SLAB_STONE_SECRET",E_META_STONE_SLAB_STONE_SECRET);
|
||||||
tolua_constant(tolua_S,"E_META_STONE_BRICK_NORMAL",E_META_STONE_BRICK_NORMAL);
|
tolua_constant(tolua_S,"E_META_STONE_BRICK_NORMAL",E_META_STONE_BRICK_NORMAL);
|
||||||
tolua_constant(tolua_S,"E_META_STONE_BRICK_MOSSY",E_META_STONE_BRICK_MOSSY);
|
tolua_constant(tolua_S,"E_META_STONE_BRICK_MOSSY",E_META_STONE_BRICK_MOSSY);
|
||||||
tolua_constant(tolua_S,"E_META_STONE_BRICK_CRACKED",E_META_STONE_BRICK_CRACKED);
|
tolua_constant(tolua_S,"E_META_STONE_BRICK_CRACKED",E_META_STONE_BRICK_CRACKED);
|
||||||
@ -27579,14 +27675,14 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
|||||||
tolua_constant(tolua_S,"E_META_TORCH_XP",E_META_TORCH_XP);
|
tolua_constant(tolua_S,"E_META_TORCH_XP",E_META_TORCH_XP);
|
||||||
tolua_constant(tolua_S,"E_META_TORCH_ZM",E_META_TORCH_ZM);
|
tolua_constant(tolua_S,"E_META_TORCH_ZM",E_META_TORCH_ZM);
|
||||||
tolua_constant(tolua_S,"E_META_TORCH_ZP",E_META_TORCH_ZP);
|
tolua_constant(tolua_S,"E_META_TORCH_ZP",E_META_TORCH_ZP);
|
||||||
tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_STEP_APPLE",E_META_WOODEN_DOUBLE_STEP_APPLE);
|
tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_APPLE",E_META_WOODEN_DOUBLE_SLAB_APPLE);
|
||||||
tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_STEP_CONIFER",E_META_WOODEN_DOUBLE_STEP_CONIFER);
|
tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_CONIFER",E_META_WOODEN_DOUBLE_SLAB_CONIFER);
|
||||||
tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_STEP_BIRCH",E_META_WOODEN_DOUBLE_STEP_BIRCH);
|
tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_BIRCH",E_META_WOODEN_DOUBLE_SLAB_BIRCH);
|
||||||
tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_STEP_JUNGLE",E_META_WOODEN_DOUBLE_STEP_JUNGLE);
|
tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_JUNGLE",E_META_WOODEN_DOUBLE_SLAB_JUNGLE);
|
||||||
tolua_constant(tolua_S,"E_META_WOODEN_STEP_APPLE",E_META_WOODEN_STEP_APPLE);
|
tolua_constant(tolua_S,"E_META_WOODEN_SLAB_APPLE",E_META_WOODEN_SLAB_APPLE);
|
||||||
tolua_constant(tolua_S,"E_META_WOODEN_STEP_CONIFER",E_META_WOODEN_STEP_CONIFER);
|
tolua_constant(tolua_S,"E_META_WOODEN_SLAB_CONIFER",E_META_WOODEN_SLAB_CONIFER);
|
||||||
tolua_constant(tolua_S,"E_META_WOODEN_STEP_BIRCH",E_META_WOODEN_STEP_BIRCH);
|
tolua_constant(tolua_S,"E_META_WOODEN_SLAB_BIRCH",E_META_WOODEN_SLAB_BIRCH);
|
||||||
tolua_constant(tolua_S,"E_META_WOODEN_STEP_JUNGLE",E_META_WOODEN_STEP_JUNGLE);
|
tolua_constant(tolua_S,"E_META_WOODEN_SLAB_JUNGLE",E_META_WOODEN_SLAB_JUNGLE);
|
||||||
tolua_constant(tolua_S,"E_META_WOOL_WHITE",E_META_WOOL_WHITE);
|
tolua_constant(tolua_S,"E_META_WOOL_WHITE",E_META_WOOL_WHITE);
|
||||||
tolua_constant(tolua_S,"E_META_WOOL_ORANGE",E_META_WOOL_ORANGE);
|
tolua_constant(tolua_S,"E_META_WOOL_ORANGE",E_META_WOOL_ORANGE);
|
||||||
tolua_constant(tolua_S,"E_META_WOOL_MAGENTA",E_META_WOOL_MAGENTA);
|
tolua_constant(tolua_S,"E_META_WOOL_MAGENTA",E_META_WOOL_MAGENTA);
|
||||||
@ -27635,6 +27731,14 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
|||||||
tolua_constant(tolua_S,"E_META_STAINED_CLAY_GREEN",E_META_STAINED_CLAY_GREEN);
|
tolua_constant(tolua_S,"E_META_STAINED_CLAY_GREEN",E_META_STAINED_CLAY_GREEN);
|
||||||
tolua_constant(tolua_S,"E_META_STAINED_CLAY_RED",E_META_STAINED_CLAY_RED);
|
tolua_constant(tolua_S,"E_META_STAINED_CLAY_RED",E_META_STAINED_CLAY_RED);
|
||||||
tolua_constant(tolua_S,"E_META_STAINED_CLAY_BLACK",E_META_STAINED_CLAY_BLACK);
|
tolua_constant(tolua_S,"E_META_STAINED_CLAY_BLACK",E_META_STAINED_CLAY_BLACK);
|
||||||
|
tolua_constant(tolua_S,"E_META_SNOW_LAYER_ONE",E_META_SNOW_LAYER_ONE);
|
||||||
|
tolua_constant(tolua_S,"E_META_SNOW_LAYER_TWO",E_META_SNOW_LAYER_TWO);
|
||||||
|
tolua_constant(tolua_S,"E_META_SNOW_LAYER_THREE",E_META_SNOW_LAYER_THREE);
|
||||||
|
tolua_constant(tolua_S,"E_META_SNOW_LAYER_FOUR",E_META_SNOW_LAYER_FOUR);
|
||||||
|
tolua_constant(tolua_S,"E_META_SNOW_LAYER_FIVE",E_META_SNOW_LAYER_FIVE);
|
||||||
|
tolua_constant(tolua_S,"E_META_SNOW_LAYER_SIX",E_META_SNOW_LAYER_SIX);
|
||||||
|
tolua_constant(tolua_S,"E_META_SNOW_LAYER_SEVEN",E_META_SNOW_LAYER_SEVEN);
|
||||||
|
tolua_constant(tolua_S,"E_META_SNOW_LAYER_EIGHT",E_META_SNOW_LAYER_EIGHT);
|
||||||
tolua_constant(tolua_S,"E_META_COAL_NORMAL",E_META_COAL_NORMAL);
|
tolua_constant(tolua_S,"E_META_COAL_NORMAL",E_META_COAL_NORMAL);
|
||||||
tolua_constant(tolua_S,"E_META_COAL_CHARCOAL",E_META_COAL_CHARCOAL);
|
tolua_constant(tolua_S,"E_META_COAL_CHARCOAL",E_META_COAL_CHARCOAL);
|
||||||
tolua_constant(tolua_S,"E_META_DYE_BLACK",E_META_DYE_BLACK);
|
tolua_constant(tolua_S,"E_META_DYE_BLACK",E_META_DYE_BLACK);
|
||||||
@ -28092,10 +28196,16 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
|||||||
tolua_constant(tolua_S,"pkSplashPotion",cProjectileEntity::pkSplashPotion);
|
tolua_constant(tolua_S,"pkSplashPotion",cProjectileEntity::pkSplashPotion);
|
||||||
tolua_constant(tolua_S,"pkWitherSkull",cProjectileEntity::pkWitherSkull);
|
tolua_constant(tolua_S,"pkWitherSkull",cProjectileEntity::pkWitherSkull);
|
||||||
tolua_constant(tolua_S,"pkFishingFloat",cProjectileEntity::pkFishingFloat);
|
tolua_constant(tolua_S,"pkFishingFloat",cProjectileEntity::pkFishingFloat);
|
||||||
|
tolua_function(tolua_S,"GetProjectileKind",tolua_AllToLua_cProjectileEntity_GetProjectileKind00);
|
||||||
tolua_function(tolua_S,"GetCreator",tolua_AllToLua_cProjectileEntity_GetCreator00);
|
tolua_function(tolua_S,"GetCreator",tolua_AllToLua_cProjectileEntity_GetCreator00);
|
||||||
|
tolua_function(tolua_S,"GetMCAClassName",tolua_AllToLua_cProjectileEntity_GetMCAClassName00);
|
||||||
|
tolua_function(tolua_S,"IsInGround",tolua_AllToLua_cProjectileEntity_IsInGround00);
|
||||||
tolua_endmodule(tolua_S);
|
tolua_endmodule(tolua_S);
|
||||||
tolua_cclass(tolua_S,"cArrowEntity","cArrowEntity","cProjectileEntity",NULL);
|
tolua_cclass(tolua_S,"cArrowEntity","cArrowEntity","cProjectileEntity",NULL);
|
||||||
tolua_beginmodule(tolua_S,"cArrowEntity");
|
tolua_beginmodule(tolua_S,"cArrowEntity");
|
||||||
|
tolua_constant(tolua_S,"psNoPickup",cArrowEntity::psNoPickup);
|
||||||
|
tolua_constant(tolua_S,"psInSurvivalOrCreative",cArrowEntity::psInSurvivalOrCreative);
|
||||||
|
tolua_constant(tolua_S,"psInCreative",cArrowEntity::psInCreative);
|
||||||
tolua_endmodule(tolua_S);
|
tolua_endmodule(tolua_S);
|
||||||
tolua_cclass(tolua_S,"cPluginManager","cPluginManager","",NULL);
|
tolua_cclass(tolua_S,"cPluginManager","cPluginManager","",NULL);
|
||||||
tolua_beginmodule(tolua_S,"cPluginManager");
|
tolua_beginmodule(tolua_S,"cPluginManager");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
** Lua binding: AllToLua
|
** Lua binding: AllToLua
|
||||||
** Generated automatically by tolua++-1.0.92 on 08/22/13 08:53:27.
|
** Generated automatically by tolua++-1.0.92 on 08/25/13 17:06:07.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Exported function */
|
/* Exported function */
|
||||||
|
@ -396,15 +396,17 @@ enum
|
|||||||
E_META_DROPSPENSER_FACING_XM = 4,
|
E_META_DROPSPENSER_FACING_XM = 4,
|
||||||
E_META_DROPSPENSER_FACING_XP = 5,
|
E_META_DROPSPENSER_FACING_XP = 5,
|
||||||
|
|
||||||
// E_BLOCK_DOUBLE_STEP metas:
|
// E_BLOCK_DOUBLE_STONE_SLAB metas:
|
||||||
E_META_DOUBLE_STEP_STONE = 0,
|
E_META_DOUBLE_STONE_SLAB_STONE = 0,
|
||||||
E_META_DOUBLE_STEP_SANDSTONE = 1,
|
E_META_DOUBLE_STONE_SLAB_SANDSTONE = 1,
|
||||||
E_META_DOUBLE_STEP_WOODEN = 2,
|
E_META_DOUBLE_STONE_SLAB_WOODEN = 2,
|
||||||
E_META_DOUBLE_STEP_COBBLESTONE = 3,
|
E_META_DOUBLE_STONE_SLAB_COBBLESTONE = 3,
|
||||||
E_META_DOUBLE_STEP_BRICK = 4,
|
E_META_DOUBLE_STONE_SLAB_BRICK = 4,
|
||||||
E_META_DOUBLE_STEP_STONE_BRICK = 5,
|
E_META_DOUBLE_STONE_SLAB_STONE_BRICK = 5,
|
||||||
E_META_DOUBLE_STEP_NETHER_BRICK = 6,
|
E_META_DOUBLE_STONE_SLAB_NETHER_BRICK = 6,
|
||||||
E_META_DOUBLE_STEP_STONE_SECRET = 7,
|
E_META_DOUBLE_STONE_SLAB_STONE_SECRET = 7,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// E_BLOCK_HOPPER metas:
|
// E_BLOCK_HOPPER metas:
|
||||||
E_META_HOPPER_FACING_YM = 0,
|
E_META_HOPPER_FACING_YM = 0,
|
||||||
@ -448,15 +450,15 @@ enum
|
|||||||
E_META_SILVERFISH_EGG_COBBLESTONE = 1,
|
E_META_SILVERFISH_EGG_COBBLESTONE = 1,
|
||||||
E_META_SILVERFISH_EGG_STONE_BRICK = 2,
|
E_META_SILVERFISH_EGG_STONE_BRICK = 2,
|
||||||
|
|
||||||
// E_BLOCK_STEP metas:
|
// E_BLOCK_STONE_SLAB metas:
|
||||||
E_META_STEP_STONE = 0,
|
E_META_STONE_SLAB_STONE = 0,
|
||||||
E_META_STEP_SANDSTONE = 1,
|
E_META_STONE_SLAB_SANDSTONE = 1,
|
||||||
E_META_STEP_PLANKS = 2,
|
E_META_STONE_SLAB_PLANKS = 2,
|
||||||
E_META_STEP_COBBLESTONE = 3,
|
E_META_STONE_SLAB_COBBLESTONE = 3,
|
||||||
E_META_STEP_BRICK = 4,
|
E_META_STONE_SLAB_BRICK = 4,
|
||||||
E_META_STEP_STONE_BRICK = 5,
|
E_META_STONE_SLAB_STONE_BRICK = 5,
|
||||||
E_META_STEP_NETHER_BRICK = 6,
|
E_META_STONE_SLAB_NETHER_BRICK = 6,
|
||||||
E_META_STEP_STONE_SECRET = 7,
|
E_META_STONE_SLAB_STONE_SECRET = 7,
|
||||||
|
|
||||||
// E_BLOCK_STONE_BRICKS metas:
|
// E_BLOCK_STONE_BRICKS metas:
|
||||||
E_META_STONE_BRICK_NORMAL = 0,
|
E_META_STONE_BRICK_NORMAL = 0,
|
||||||
@ -480,17 +482,17 @@ enum
|
|||||||
E_META_TORCH_ZM = 3, // Torch attached to the ZM side of its block
|
E_META_TORCH_ZM = 3, // Torch attached to the ZM side of its block
|
||||||
E_META_TORCH_ZP = 4, // Torch attached to the ZP side of its block
|
E_META_TORCH_ZP = 4, // Torch attached to the ZP side of its block
|
||||||
|
|
||||||
// E_BLOCK_WOODEN_DOUBLE_STEP metas:
|
// E_BLOCK_WOODEN_DOUBLE_SLAB metas:
|
||||||
E_META_WOODEN_DOUBLE_STEP_APPLE = 0,
|
E_META_WOODEN_DOUBLE_SLAB_APPLE = 0,
|
||||||
E_META_WOODEN_DOUBLE_STEP_CONIFER = 1,
|
E_META_WOODEN_DOUBLE_SLAB_CONIFER = 1,
|
||||||
E_META_WOODEN_DOUBLE_STEP_BIRCH = 2,
|
E_META_WOODEN_DOUBLE_SLAB_BIRCH = 2,
|
||||||
E_META_WOODEN_DOUBLE_STEP_JUNGLE = 3,
|
E_META_WOODEN_DOUBLE_SLAB_JUNGLE = 3,
|
||||||
|
|
||||||
// E_BLOCK_WOODEN_STEP metas:
|
// E_BLOCK_WOODEN_SLAB metas:
|
||||||
E_META_WOODEN_STEP_APPLE = 0,
|
E_META_WOODEN_SLAB_APPLE = 0,
|
||||||
E_META_WOODEN_STEP_CONIFER = 1,
|
E_META_WOODEN_SLAB_CONIFER = 1,
|
||||||
E_META_WOODEN_STEP_BIRCH = 2,
|
E_META_WOODEN_SLAB_BIRCH = 2,
|
||||||
E_META_WOODEN_STEP_JUNGLE = 3,
|
E_META_WOODEN_SLAB_JUNGLE = 3,
|
||||||
|
|
||||||
// E_BLOCK_WOOL metas:
|
// E_BLOCK_WOOL metas:
|
||||||
E_META_WOOL_WHITE = 0,
|
E_META_WOOL_WHITE = 0,
|
||||||
@ -546,6 +548,16 @@ enum
|
|||||||
E_META_STAINED_CLAY_RED = 14,
|
E_META_STAINED_CLAY_RED = 14,
|
||||||
E_META_STAINED_CLAY_BLACK = 15,
|
E_META_STAINED_CLAY_BLACK = 15,
|
||||||
|
|
||||||
|
// E_BLOCK_SNOW metas:
|
||||||
|
E_META_SNOW_LAYER_ONE = 0,
|
||||||
|
E_META_SNOW_LAYER_TWO = 1,
|
||||||
|
E_META_SNOW_LAYER_THREE = 2,
|
||||||
|
E_META_SNOW_LAYER_FOUR = 3,
|
||||||
|
E_META_SNOW_LAYER_FIVE = 4,
|
||||||
|
E_META_SNOW_LAYER_SIX = 5,
|
||||||
|
E_META_SNOW_LAYER_SEVEN = 6,
|
||||||
|
E_META_SNOW_LAYER_EIGHT = 7,
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Item metas:
|
// Item metas:
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "BlockHandler.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -16,7 +18,11 @@ class cBlockCarpetHandler :
|
|||||||
public cBlockHandler
|
public cBlockHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cBlockCarpetHandler(BLOCKTYPE a_BlockType);
|
cBlockCarpetHandler(BLOCKTYPE a_BlockType) :
|
||||||
|
cBlockHandler(a_BlockType)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual const char * GetStepSound(void) override
|
virtual const char * GetStepSound(void) override
|
||||||
{
|
{
|
||||||
@ -39,13 +45,13 @@ public:
|
|||||||
|
|
||||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||||
{
|
{
|
||||||
a_Pickups.push_back(cItem(E_BLOCK_CARPET, a_BlockMeta));
|
a_Pickups.push_back(cItem(E_BLOCK_CARPET, 1, a_BlockMeta));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
virtual bool CanBeAt(int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||||
{
|
{
|
||||||
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR));
|
return (a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR);
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
@ -47,7 +47,10 @@ void cBlockDoorHandler::OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY
|
|||||||
|
|
||||||
void cBlockDoorHandler::OnUse(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
|
void cBlockDoorHandler::OnUse(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
|
||||||
{
|
{
|
||||||
cDoors::ChangeDoor(a_World, a_BlockX, a_BlockY, a_BlockZ);
|
if (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_WOODEN_DOOR)
|
||||||
|
{
|
||||||
|
cDoors::ChangeDoor(a_World, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,6 +104,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
|
|||||||
case E_BLOCK_BROWN_MUSHROOM: return new cBlockMushroomHandler (a_BlockType);
|
case E_BLOCK_BROWN_MUSHROOM: return new cBlockMushroomHandler (a_BlockType);
|
||||||
case E_BLOCK_CACTUS: return new cBlockCactusHandler (a_BlockType);
|
case E_BLOCK_CACTUS: return new cBlockCactusHandler (a_BlockType);
|
||||||
case E_BLOCK_CARROTS: return new cBlockCropsHandler (a_BlockType);
|
case E_BLOCK_CARROTS: return new cBlockCropsHandler (a_BlockType);
|
||||||
|
case E_BLOCK_CARPET: return new cBlockCarpetHandler (a_BlockType);
|
||||||
case E_BLOCK_CAULDRON: return new cBlockCauldronHandler (a_BlockType);
|
case E_BLOCK_CAULDRON: return new cBlockCauldronHandler (a_BlockType);
|
||||||
case E_BLOCK_CHEST: return new cBlockChestHandler (a_BlockType);
|
case E_BLOCK_CHEST: return new cBlockChestHandler (a_BlockType);
|
||||||
case E_BLOCK_COAL_ORE: return new cBlockOreHandler (a_BlockType);
|
case E_BLOCK_COAL_ORE: return new cBlockOreHandler (a_BlockType);
|
||||||
@ -116,8 +117,8 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
|
|||||||
case E_BLOCK_DIAMOND_ORE: return new cBlockOreHandler (a_BlockType);
|
case E_BLOCK_DIAMOND_ORE: return new cBlockOreHandler (a_BlockType);
|
||||||
case E_BLOCK_DIRT: return new cBlockDirtHandler (a_BlockType);
|
case E_BLOCK_DIRT: return new cBlockDirtHandler (a_BlockType);
|
||||||
case E_BLOCK_DISPENSER: return new cBlockDropSpenserHandler (a_BlockType);
|
case E_BLOCK_DISPENSER: return new cBlockDropSpenserHandler (a_BlockType);
|
||||||
case E_BLOCK_DOUBLE_STONE_SLAB: return new cBlockSlabHandler (a_BlockType);
|
case E_BLOCK_DOUBLE_STONE_SLAB: return new cBlockDoubleSlabHandler (a_BlockType);
|
||||||
case E_BLOCK_DOUBLE_WOODEN_SLAB: return new cBlockSlabHandler (a_BlockType);
|
case E_BLOCK_DOUBLE_WOODEN_SLAB: return new cBlockDoubleSlabHandler (a_BlockType);
|
||||||
case E_BLOCK_DROPPER: return new cBlockDropSpenserHandler (a_BlockType);
|
case E_BLOCK_DROPPER: return new cBlockDropSpenserHandler (a_BlockType);
|
||||||
case E_BLOCK_EMERALD_ORE: return new cBlockOreHandler (a_BlockType);
|
case E_BLOCK_EMERALD_ORE: return new cBlockOreHandler (a_BlockType);
|
||||||
case E_BLOCK_ENDER_CHEST: return new cBlockEnderchestHandler (a_BlockType);
|
case E_BLOCK_ENDER_CHEST: return new cBlockEnderchestHandler (a_BlockType);
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
|
|
||||||
|
// BlockSlab.h
|
||||||
|
|
||||||
|
// Declares cBlockSlabHandler and cBlockDoubleSlabHandler classes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "BlockHandler.h"
|
#include "BlockHandler.h"
|
||||||
|
#include "../Items/ItemHandler.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -19,8 +28,7 @@ public:
|
|||||||
|
|
||||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||||
{
|
{
|
||||||
char Count = ((m_BlockType == E_BLOCK_DOUBLE_STONE_SLAB) || (m_BlockType == E_BLOCK_DOUBLE_WOODEN_SLAB)) ? 2 : 1;
|
a_Pickups.push_back(cItem(m_BlockType, 1, a_BlockMeta));
|
||||||
a_Pickups.push_back(cItem(m_BlockType, Count, a_BlockMeta));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -32,11 +40,55 @@ public:
|
|||||||
) override
|
) override
|
||||||
{
|
{
|
||||||
a_BlockType = m_BlockType;
|
a_BlockType = m_BlockType;
|
||||||
|
BLOCKTYPE Type = (BLOCKTYPE) (a_Player->GetEquippedItem().m_ItemType);
|
||||||
NIBBLETYPE Meta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage & 0x07);
|
NIBBLETYPE Meta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage & 0x07);
|
||||||
|
|
||||||
|
// HandlePlaceBlock wants a cItemHandler pointer thing, so let's give it one
|
||||||
|
cItemHandler * ItemHandler = cItemHandler::GetItemHandler(GetDoubleSlabType(Type));
|
||||||
|
|
||||||
|
// Check if the block at the coordinates is a slab. Eligibility for combining has already been processed in ClientHandle
|
||||||
|
if (IsAnySlabType(a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ)))
|
||||||
|
{
|
||||||
|
// Call the function in ClientHandle that places a block when the client sends the packet,
|
||||||
|
// so that plugins may interfere with the placement.
|
||||||
|
|
||||||
|
if ((a_BlockFace == BLOCK_FACE_TOP) || (a_BlockFace == BLOCK_FACE_BOTTOM))
|
||||||
|
{
|
||||||
|
// Top and bottom faces need no parameter modification
|
||||||
|
a_Player->GetClientHandle()->HandlePlaceBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, *ItemHandler);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// The other faces need to distinguish between top and bottom cursor positions
|
||||||
|
if (a_CursorY > 7)
|
||||||
|
{
|
||||||
|
// Edit the call to use BLOCK_FACE_BOTTOM, otherwise it places incorrectly
|
||||||
|
a_Player->GetClientHandle()->HandlePlaceBlock(a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_TOP, a_CursorX, a_CursorY, a_CursorZ, *ItemHandler);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Edit the call to use BLOCK_FACE_TOP, otherwise it places incorrectly
|
||||||
|
a_Player->GetClientHandle()->HandlePlaceBlock(a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_BOTTOM, a_CursorX, a_CursorY, a_CursorZ, *ItemHandler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false; // Cancel the event, because dblslabs were already placed, nothing else needed
|
||||||
|
}
|
||||||
|
|
||||||
|
// Place the single-slab with correct metas:
|
||||||
switch (a_BlockFace)
|
switch (a_BlockFace)
|
||||||
{
|
{
|
||||||
case BLOCK_FACE_TOP: a_BlockMeta = Meta & 0x7; break; // Always bottom half of the slab when placing on top of something
|
case BLOCK_FACE_TOP:
|
||||||
case BLOCK_FACE_BOTTOM: a_BlockMeta = Meta | 0x8; break; // Always top half of the slab when placing on bottom of something
|
{
|
||||||
|
// Bottom half slab block
|
||||||
|
a_BlockMeta = Meta & 0x7;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BLOCK_FACE_BOTTOM:
|
||||||
|
{
|
||||||
|
// Top half slab block
|
||||||
|
a_BlockMeta = Meta | 0x8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case BLOCK_FACE_EAST:
|
case BLOCK_FACE_EAST:
|
||||||
case BLOCK_FACE_NORTH:
|
case BLOCK_FACE_NORTH:
|
||||||
case BLOCK_FACE_SOUTH:
|
case BLOCK_FACE_SOUTH:
|
||||||
@ -44,15 +96,14 @@ public:
|
|||||||
{
|
{
|
||||||
if (a_CursorY > 7)
|
if (a_CursorY > 7)
|
||||||
{
|
{
|
||||||
// Cursor at the top half of the face, place a top half of slab
|
// Cursor at top half of block, place top slab
|
||||||
a_BlockMeta = Meta | 0x8;
|
a_BlockMeta = Meta | 0x8; break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Cursor at the bottom half of the face, place a bottom half of slab:
|
// Cursor at bottom half of block, place bottom slab
|
||||||
a_BlockMeta = Meta & 0x7;
|
a_BlockMeta = Meta & 0x7; break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} // switch (a_BlockFace)
|
} // switch (a_BlockFace)
|
||||||
return true;
|
return true;
|
||||||
@ -61,7 +112,68 @@ public:
|
|||||||
|
|
||||||
virtual const char * GetStepSound(void) override
|
virtual const char * GetStepSound(void) override
|
||||||
{
|
{
|
||||||
return ((m_BlockType == E_BLOCK_WOODEN_SLAB) || (m_BlockType == E_BLOCK_DOUBLE_WOODEN_SLAB)) ? "step.wood" : "step.stone";
|
switch (m_BlockType)
|
||||||
|
{
|
||||||
|
case E_BLOCK_WOODEN_SLAB: return "step.wood";
|
||||||
|
case E_BLOCK_STONE_SLAB: return "step.stone";
|
||||||
|
}
|
||||||
|
ASSERT(!"Unhandled slab type!");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Returns true if the specified blocktype is one of the slabs handled by this handler
|
||||||
|
static bool IsAnySlabType(BLOCKTYPE a_BlockType)
|
||||||
|
{
|
||||||
|
return ((a_BlockType == E_BLOCK_WOODEN_SLAB) || (a_BlockType == E_BLOCK_STONE_SLAB));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Converts the single-slab blocktype to its equivalent double-slab blocktype
|
||||||
|
static BLOCKTYPE GetDoubleSlabType(BLOCKTYPE a_SingleSlabBlockType)
|
||||||
|
{
|
||||||
|
switch (a_SingleSlabBlockType)
|
||||||
|
{
|
||||||
|
case E_BLOCK_STONE_SLAB: return E_BLOCK_DOUBLE_STONE_SLAB;
|
||||||
|
case E_BLOCK_WOODEN_SLAB: return E_BLOCK_DOUBLE_WOODEN_SLAB;
|
||||||
|
}
|
||||||
|
ASSERT(!"Unhandled slab type!");
|
||||||
|
return E_BLOCK_AIR;
|
||||||
|
}
|
||||||
|
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class cBlockDoubleSlabHandler :
|
||||||
|
public cBlockHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
cBlockDoubleSlabHandler(BLOCKTYPE a_BlockType)
|
||||||
|
: cBlockHandler(a_BlockType)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||||
|
{
|
||||||
|
if (m_BlockType == E_BLOCK_DOUBLE_STONE_SLAB)
|
||||||
|
{
|
||||||
|
m_BlockType = E_BLOCK_STONE_SLAB;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_BlockType = E_BLOCK_WOODEN_SLAB;
|
||||||
|
}
|
||||||
|
a_Pickups.push_back(cItem(m_BlockType, 2, a_BlockMeta));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virtual const char * GetStepSound(void) override
|
||||||
|
{
|
||||||
|
return ((m_BlockType == E_BLOCK_DOUBLE_WOODEN_SLAB) || (m_BlockType == E_BLOCK_DOUBLE_WOODEN_SLAB)) ? "step.wood" : "step.stone";
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
@ -168,6 +168,13 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void OnUpdate(cWorld * a_World, int X, int Y, int Z)
|
||||||
|
{
|
||||||
|
if (a_World->GetBlock(X, Y - 1, Z) == E_BLOCK_AIR)
|
||||||
|
{
|
||||||
|
a_World->SetBlock(X, Y - 1, Z, E_BLOCK_VINES, a_World->GetBlockMeta(X, Y, Z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override
|
virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override
|
||||||
{
|
{
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "OSSupport/Timer.h"
|
#include "OSSupport/Timer.h"
|
||||||
#include "Items/ItemHandler.h"
|
#include "Items/ItemHandler.h"
|
||||||
#include "Blocks/BlockHandler.h"
|
#include "Blocks/BlockHandler.h"
|
||||||
|
#include "Blocks/BlockSlab.h"
|
||||||
|
|
||||||
#include "Vector3f.h"
|
#include "Vector3f.h"
|
||||||
#include "Vector3d.h"
|
#include "Vector3d.h"
|
||||||
@ -851,32 +852,78 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, c
|
|||||||
|
|
||||||
cWorld * World = m_Player->GetWorld();
|
cWorld * World = m_Player->GetWorld();
|
||||||
|
|
||||||
// Check if the block ignores build collision (water, grass etc.):
|
BLOCKTYPE ClickedBlock;
|
||||||
BLOCKTYPE ClickedBlock = World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
|
NIBBLETYPE ClickedBlockMeta;
|
||||||
cBlockHandler * Handler = cBlockHandler::GetBlockHandler(ClickedBlock);
|
BLOCKTYPE EquippedBlock = (BLOCKTYPE)(m_Player->GetEquippedItem().m_ItemType);
|
||||||
if (Handler->DoesIgnoreBuildCollision())
|
NIBBLETYPE EquippedBlockDamage = (NIBBLETYPE)(m_Player->GetEquippedItem().m_ItemDamage);
|
||||||
|
|
||||||
|
if ((a_BlockY < 0) || (a_BlockY >= cChunkDef::Height))
|
||||||
{
|
{
|
||||||
Handler->OnDestroyedByPlayer(World, m_Player, a_BlockX, a_BlockY, a_BlockZ);
|
// The block is being placed outside the world, ignore this packet altogether (#128)
|
||||||
// World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, ClickedBlock, ClickedBlockMeta);
|
||||||
|
|
||||||
|
// Special slab handling - placing a slab onto another slab produces a dblslab instead:
|
||||||
|
if (
|
||||||
|
cBlockSlabHandler::IsAnySlabType(ClickedBlock) && // Is there a slab already?
|
||||||
|
cBlockSlabHandler::IsAnySlabType(EquippedBlock) && // Is the player placing another slab?
|
||||||
|
((ClickedBlockMeta & 0x07) == (EquippedBlockDamage & 0x07)) && // Is it the same slab type?
|
||||||
|
(
|
||||||
|
(a_BlockFace == BLOCK_FACE_TOP) || // Clicking the top of a bottom slab
|
||||||
|
(a_BlockFace == BLOCK_FACE_BOTTOM) // Clicking the bottom of a top slab
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Coordinates at CLICKED block, don't move them anywhere
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
|
// Check if the block ignores build collision (water, grass etc.):
|
||||||
// Check for Blocks not allowing placement on top
|
cBlockHandler * Handler = cBlockHandler::GetBlockHandler(ClickedBlock);
|
||||||
if ((a_BlockFace == BLOCK_FACE_TOP) && !Handler->DoesAllowBlockOnTop())
|
if (Handler->DoesIgnoreBuildCollision())
|
||||||
{
|
{
|
||||||
// Resend the old block
|
Handler->OnDestroyedByPlayer(World, m_Player, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
// Some times the client still places the block O.o
|
|
||||||
World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BLOCKTYPE PlaceBlock = World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
|
BLOCKTYPE PlaceBlock = World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
if (!BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision())
|
if (!BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision())
|
||||||
{
|
{
|
||||||
// Tried to place a block *into* another?
|
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
|
||||||
return; // Happens when you place a block aiming at side of block like torch or stem
|
|
||||||
|
if ((a_BlockY < 0) || (a_BlockY >= cChunkDef::Height))
|
||||||
|
{
|
||||||
|
// The block is being placed outside the world, ignore this packet altogether (#128)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BLOCKTYPE PlaceBlock = World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
|
|
||||||
|
// Clicked on side of block, make sure that placement won't be cancelled if there is a slab able to be double slabbed.
|
||||||
|
// No need to do combinability (dblslab) checks, client will do that here.
|
||||||
|
if (cBlockSlabHandler::IsAnySlabType(PlaceBlock))
|
||||||
|
{
|
||||||
|
// It's a slab, don't do checks and proceed to double-slabbing
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check for Blocks not allowing placement on top
|
||||||
|
if ((a_BlockFace == BLOCK_FACE_TOP) && !Handler->DoesAllowBlockOnTop())
|
||||||
|
{
|
||||||
|
// Resend the old block
|
||||||
|
// Sometimes the client still places the block O.o
|
||||||
|
World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision())
|
||||||
|
{
|
||||||
|
// Tried to place a block *into* another?
|
||||||
|
// Happens when you place a block aiming at side of block like torch or stem
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -914,7 +961,7 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, c
|
|||||||
NewBlock->OnPlacedByPlayer(World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
|
NewBlock->OnPlacedByPlayer(World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
|
||||||
|
|
||||||
// Step sound with 0.8f pitch is used as block placement sound
|
// Step sound with 0.8f pitch is used as block placement sound
|
||||||
World->BroadcastSoundEffect(NewBlock->GetStepSound(),a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 1.0f, 0.8f);
|
World->BroadcastSoundEffect(NewBlock->GetStepSound(), a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 1.0f, 0.8f);
|
||||||
cRoot::Get()->GetPluginManager()->CallHookPlayerPlacedBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
|
cRoot::Get()->GetPluginManager()->CallHookPlayerPlacedBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,6 +198,9 @@ public:
|
|||||||
/// Called when the player moves into a different world; queues sreaming the new chunks
|
/// Called when the player moves into a different world; queues sreaming the new chunks
|
||||||
void MoveToWorld(cWorld & a_World, bool a_SendRespawnPacket);
|
void MoveToWorld(cWorld & a_World, bool a_SendRespawnPacket);
|
||||||
|
|
||||||
|
/// Handles the block placing packet when it is a real block placement (not block-using, item-using or eating)
|
||||||
|
void HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, cItemHandler & a_ItemHandler);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int m_ViewDistance; // Number of chunks the player can see in each direction; 4 is the minimum ( http://wiki.vg/Protocol_FAQ#.E2.80.A6all_connecting_clients_spasm_and_jerk_uncontrollably.21 )
|
int m_ViewDistance; // Number of chunks the player can see in each direction; 4 is the minimum ( http://wiki.vg/Protocol_FAQ#.E2.80.A6all_connecting_clients_spasm_and_jerk_uncontrollably.21 )
|
||||||
@ -315,9 +318,6 @@ private:
|
|||||||
/// Handles the DIG_FINISHED dig packet:
|
/// Handles the DIG_FINISHED dig packet:
|
||||||
void HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_OldBlock, NIBBLETYPE a_OldMeta);
|
void HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_OldBlock, NIBBLETYPE a_OldMeta);
|
||||||
|
|
||||||
/// Handles the block placing packet when it is a real block placement (not block-using, item-using or eating)
|
|
||||||
void HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, cItemHandler & a_ItemHandler);
|
|
||||||
|
|
||||||
// cSocketThreads::cCallback overrides:
|
// cSocketThreads::cCallback overrides:
|
||||||
virtual void DataReceived (const char * a_Data, int a_Size) override; // Data is received from the client
|
virtual void DataReceived (const char * a_Data, int a_Size) override; // Data is received from the client
|
||||||
virtual void GetOutgoingData(AString & a_Data) override; // Data can be sent to client
|
virtual void GetOutgoingData(AString & a_Data) override; // Data can be sent to client
|
||||||
|
@ -73,18 +73,19 @@ void cPickup::Tick(float a_Dt, cChunk & a_Chunk)
|
|||||||
if (!m_bCollected)
|
if (!m_bCollected)
|
||||||
{
|
{
|
||||||
int BlockY = (int) floor(GetPosY());
|
int BlockY = (int) floor(GetPosY());
|
||||||
if (BlockY < cChunkDef::Height) // Don't do anything except for falling when above the world
|
if ((BlockY >= 0) && (BlockY < cChunkDef::Height)) // Don't do anything except for falling when outside the world
|
||||||
{
|
{
|
||||||
int BlockX = (int) floor(GetPosX());
|
int BlockX = (int) floor(GetPosX());
|
||||||
int BlockZ = (int) floor(GetPosZ());
|
int BlockZ = (int) floor(GetPosZ());
|
||||||
//Position might have changed due to physics. So we have to make sure we have the correct chunk.
|
// Position might have changed due to physics. So we have to make sure we have the correct chunk.
|
||||||
cChunk * CurrentChunk = a_Chunk.GetNeighborChunk(BlockX, BlockZ);
|
cChunk * CurrentChunk = a_Chunk.GetNeighborChunk(BlockX, BlockZ);
|
||||||
if (CurrentChunk != NULL) // Make sure the chunk is loaded
|
if (CurrentChunk != NULL) // Make sure the chunk is loaded
|
||||||
{
|
{
|
||||||
int RelBlockX = BlockX - (CurrentChunk->GetPosX() * cChunkDef::Width);
|
int RelBlockX = BlockX - (CurrentChunk->GetPosX() * cChunkDef::Width);
|
||||||
int RelBlockZ = BlockZ - (CurrentChunk->GetPosZ() * cChunkDef::Width);
|
int RelBlockZ = BlockZ - (CurrentChunk->GetPosZ() * cChunkDef::Width);
|
||||||
|
|
||||||
BLOCKTYPE BlockBelow = CurrentChunk->GetBlock(RelBlockX, BlockY - 1, RelBlockZ);
|
// If the pickup is on the bottommost block position, make it think the void is made of air: (#131)
|
||||||
|
BLOCKTYPE BlockBelow = (BlockY > 0) ? CurrentChunk->GetBlock(RelBlockX, BlockY - 1, RelBlockZ) : E_BLOCK_AIR;
|
||||||
BLOCKTYPE BlockIn = CurrentChunk->GetBlock(RelBlockX, BlockY, RelBlockZ);
|
BLOCKTYPE BlockIn = CurrentChunk->GetBlock(RelBlockX, BlockY, RelBlockZ);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -40,10 +40,13 @@ public:
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
// Light a fire next to the block:
|
// Light a fire next to/on top of the block if air:
|
||||||
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
|
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
|
||||||
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FIRE, 0);
|
if (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_AIR)
|
||||||
break;
|
{
|
||||||
|
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FIRE, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,12 +116,15 @@
|
|||||||
/* _X: MSVC 2012 (MSC 1700) seems to use a different allocation scheme for STL containers,
|
/* _X: MSVC 2012 (MSC 1700) seems to use a different allocation scheme for STL containers,
|
||||||
* allocating lots of small objects and running out of memory very soon
|
* allocating lots of small objects and running out of memory very soon
|
||||||
* Thus for MSVC 2012 we cut the callstack buffer length in half
|
* Thus for MSVC 2012 we cut the callstack buffer length in half
|
||||||
|
*
|
||||||
|
* _X 2013_08_25: The callstack tracking gets worse even for MSVC 2008, a single lua_state eats 50 MiB of RAM
|
||||||
|
* Therefore I decided to further reduce the buffers from 0x2000 to 0x1000
|
||||||
*/
|
*/
|
||||||
// Controlling the callstack depth
|
// Controlling the callstack depth
|
||||||
#if (_MSC_VER < 1700)
|
#if (_MSC_VER < 1700)
|
||||||
#define MAX_CALLSTACK_LEN_BUF 0x2000
|
|
||||||
#else
|
|
||||||
#define MAX_CALLSTACK_LEN_BUF 0x1000
|
#define MAX_CALLSTACK_LEN_BUF 0x1000
|
||||||
|
#else
|
||||||
|
#define MAX_CALLSTACK_LEN_BUF 0x0800
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -942,10 +945,10 @@ static int MyAllocHook(int nAllocType, void *pvData,
|
|||||||
g_CurrentMemUsage += nSize ;
|
g_CurrentMemUsage += nSize ;
|
||||||
g_pCRTTable->Insert(lRequest, c, nSize);
|
g_pCRTTable->Insert(lRequest, c, nSize);
|
||||||
|
|
||||||
if (g_CurrentMemUsage > 1073741824) //This is 1 gb = 1024 * 1024* 1024.
|
if (g_CurrentMemUsage > 1536 * 1024* 1024)
|
||||||
{
|
{
|
||||||
printf("******************************************\n");
|
printf("******************************************\n");
|
||||||
printf("** Server reached 1 GiB memory usage, **\n");
|
printf("** Server reached 1.5 GiB memory usage, **\n");
|
||||||
printf("** something is probably wrong. **\n");
|
printf("** something is probably wrong. **\n");
|
||||||
printf("** Writing memory dump into memdump.xml **\n");
|
printf("** Writing memory dump into memdump.xml **\n");
|
||||||
printf("******************************************\n");
|
printf("******************************************\n");
|
||||||
|
@ -113,13 +113,6 @@ public:
|
|||||||
/// All bound console commands are to be removed, do any language-dependent cleanup here
|
/// All bound console commands are to be removed, do any language-dependent cleanup here
|
||||||
virtual void ClearConsoleCommands(void) {} ;
|
virtual void ClearConsoleCommands(void) {} ;
|
||||||
|
|
||||||
/** Called from cPluginManager::AddHook() to check if the hook can be added.
|
|
||||||
Plugin API providers may check if the plugin is written correctly (has the hook handler function)
|
|
||||||
Returns true if the hook can be added (handler exists)
|
|
||||||
Descendants should also log the specific error message as a warning if they return false.
|
|
||||||
*/
|
|
||||||
virtual bool CanAddHook(int a_Hook) = 0;
|
|
||||||
|
|
||||||
// tolua_begin
|
// tolua_begin
|
||||||
const AString & GetName(void) const { return m_Name; }
|
const AString & GetName(void) const { return m_Name; }
|
||||||
void SetName(const AString & a_Name) { m_Name = a_Name; }
|
void SetName(const AString & a_Name) { m_Name = a_Name; }
|
||||||
|
@ -1240,13 +1240,16 @@ void cPluginLua::ClearConsoleCommands(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cPluginLua::CanAddHook(int a_Hook)
|
bool cPluginLua::CanAddOldStyleHook(int a_HookType)
|
||||||
{
|
{
|
||||||
const char * FnName = GetHookFnName(a_Hook);
|
const char * FnName = GetHookFnName(a_HookType);
|
||||||
if (FnName == NULL)
|
if (FnName == NULL)
|
||||||
{
|
{
|
||||||
// Unknown hook ID
|
// Unknown hook ID
|
||||||
LOGWARNING("Plugin %s wants to add an unknown hook ID (%d). The plugin need not work properly.", GetName().c_str(), a_Hook);
|
LOGWARNING("Plugin %s wants to add an unknown hook ID (%d). The plugin need not work properly.",
|
||||||
|
GetName().c_str(), a_HookType
|
||||||
|
);
|
||||||
|
m_LuaState.LogStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1257,12 +1260,9 @@ bool cPluginLua::CanAddHook(int a_Hook)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOGWARNING("Plugin %s wants to add a hook (%d), but it doesn't provide the callback function \"%s\" for it. The plugin need not work properly.",
|
LOGWARNING("Plugin %s wants to add a hook (%d), but it doesn't provide the callback function \"%s\" for it. The plugin need not work properly.",
|
||||||
GetName().c_str(), a_Hook, FnName
|
GetName().c_str(), a_HookType, FnName
|
||||||
);
|
);
|
||||||
|
|
||||||
// Lua stacktrace:
|
|
||||||
m_LuaState.LogStackTrace();
|
m_LuaState.LogStackTrace();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1270,9 +1270,9 @@ bool cPluginLua::CanAddHook(int a_Hook)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const char * cPluginLua::GetHookFnName(int a_Hook)
|
const char * cPluginLua::GetHookFnName(int a_HookType)
|
||||||
{
|
{
|
||||||
switch (a_Hook)
|
switch (a_HookType)
|
||||||
{
|
{
|
||||||
case cPluginManager::HOOK_BLOCK_TO_PICKUPS: return "OnBlockToPickups";
|
case cPluginManager::HOOK_BLOCK_TO_PICKUPS: return "OnBlockToPickups";
|
||||||
case cPluginManager::HOOK_CHAT: return "OnChat";
|
case cPluginManager::HOOK_CHAT: return "OnChat";
|
||||||
@ -1331,7 +1331,17 @@ bool cPluginLua::AddHookRef(int a_HookType, int a_FnRefIdx)
|
|||||||
{
|
{
|
||||||
ASSERT(m_CriticalSection.IsLockedByCurrentThread()); // It probably has to be, how else would we have a LuaState?
|
ASSERT(m_CriticalSection.IsLockedByCurrentThread()); // It probably has to be, how else would we have a LuaState?
|
||||||
|
|
||||||
m_HookMap[a_HookType].push_back(new cLuaState::cRef(m_LuaState, a_FnRefIdx));
|
// Check if the function reference is valid:
|
||||||
|
cLuaState::cRef * Ref = new cLuaState::cRef(m_LuaState, a_FnRefIdx);
|
||||||
|
if ((Ref == NULL) || !Ref->IsValid())
|
||||||
|
{
|
||||||
|
LOGWARNING("Plugin %s tried to add a hook %d with bad handler function.", GetName().c_str(), a_HookType);
|
||||||
|
m_LuaState.LogStackTrace();
|
||||||
|
delete Ref;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_HookMap[a_HookType].push_back(Ref);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,8 @@ public:
|
|||||||
|
|
||||||
virtual void ClearConsoleCommands(void) override;
|
virtual void ClearConsoleCommands(void) override;
|
||||||
|
|
||||||
virtual bool CanAddHook(int a_Hook) override;
|
/// Returns true if the plugin contains the function for the specified hook type, using the old-style registration (#121)
|
||||||
|
bool CanAddOldStyleHook(int a_HookType);
|
||||||
|
|
||||||
// cWebPlugin override
|
// cWebPlugin override
|
||||||
virtual const AString GetWebTitle(void) const {return GetName(); }
|
virtual const AString GetWebTitle(void) const {return GetName(); }
|
||||||
|
@ -1619,10 +1619,6 @@ void cPluginManager::AddHook(cPlugin * a_Plugin, int a_Hook)
|
|||||||
LOGWARN("Called cPluginManager::AddHook() with a_Plugin == NULL");
|
LOGWARN("Called cPluginManager::AddHook() with a_Plugin == NULL");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!a_Plugin->CanAddHook(a_Hook))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
PluginList & Plugins = m_Hooks[a_Hook];
|
PluginList & Plugins = m_Hooks[a_Hook];
|
||||||
Plugins.remove(a_Plugin);
|
Plugins.remove(a_Plugin);
|
||||||
Plugins.push_back(a_Plugin);
|
Plugins.push_back(a_Plugin);
|
||||||
|
@ -53,6 +53,10 @@ void cRedstoneSimulator::WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk
|
|||||||
}
|
}
|
||||||
switch (BlockType)
|
switch (BlockType)
|
||||||
{
|
{
|
||||||
|
case E_BLOCK_PISTON:
|
||||||
|
case E_BLOCK_STICKY_PISTON:
|
||||||
|
case E_BLOCK_DISPENSER:
|
||||||
|
case E_BLOCK_DROPPER:
|
||||||
case E_BLOCK_REDSTONE_LAMP_OFF:
|
case E_BLOCK_REDSTONE_LAMP_OFF:
|
||||||
case E_BLOCK_REDSTONE_LAMP_ON:
|
case E_BLOCK_REDSTONE_LAMP_ON:
|
||||||
case E_BLOCK_REDSTONE_REPEATER_OFF:
|
case E_BLOCK_REDSTONE_REPEATER_OFF:
|
||||||
@ -514,6 +518,20 @@ bool cRedstoneSimulator::PowerBlock(const Vector3i & a_BlockPos, const Vector3i
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case E_BLOCK_REDSTONE_LAMP_OFF:
|
||||||
|
{
|
||||||
|
m_World.FastSetBlock(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, E_BLOCK_REDSTONE_LAMP_ON, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case E_BLOCK_TNT:
|
||||||
|
{
|
||||||
|
m_World.BroadcastSoundEffect("random.fuse", a_BlockPos.x * 8, a_BlockPos.y * 8, a_BlockPos.z * 8, 0.5f, 0.6f);
|
||||||
|
m_World.SpawnPrimedTNT(a_BlockPos.x + 0.5, a_BlockPos.y + 0.5, a_BlockPos.z + 0.5, 4); // 4 seconds to boom
|
||||||
|
m_World.SetBlock(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, E_BLOCK_AIR, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
@ -615,6 +633,12 @@ int cRedstoneSimulator::UnPowerBlock(const Vector3i & a_BlockPos, const Vector3i
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case E_BLOCK_REDSTONE_LAMP_ON:
|
||||||
|
{
|
||||||
|
m_World.FastSetBlock(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, E_BLOCK_REDSTONE_LAMP_OFF, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
|
@ -350,6 +350,33 @@ AString & RawBEToUTF8(short * a_RawData, int a_NumShorts, AString & a_UTF8)
|
|||||||
// UTF-8 conversion code adapted from:
|
// UTF-8 conversion code adapted from:
|
||||||
// http://stackoverflow.com/questions/2867123/convert-utf-16-to-utf-8-under-windows-and-linux-in-c
|
// http://stackoverflow.com/questions/2867123/convert-utf-16-to-utf-8-under-windows-and-linux-in-c
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Begin of Unicode, Inc.'s code / information
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/*
|
||||||
|
Notice from the original file:
|
||||||
|
* Copyright 2001-2004 Unicode, Inc.
|
||||||
|
*
|
||||||
|
* Disclaimer
|
||||||
|
*
|
||||||
|
* This source code is provided as is by Unicode, Inc. No claims are
|
||||||
|
* made as to fitness for any particular purpose. No warranties of any
|
||||||
|
* kind are expressed or implied. The recipient agrees to determine
|
||||||
|
* applicability of information provided. If this file has been
|
||||||
|
* purchased on magnetic or optical media from Unicode, Inc., the
|
||||||
|
* sole remedy for any claim will be exchange of defective media
|
||||||
|
* within 90 days of receipt.
|
||||||
|
*
|
||||||
|
* Limitations on Rights to Redistribute This Code
|
||||||
|
*
|
||||||
|
* Unicode, Inc. hereby grants the right to freely use the information
|
||||||
|
* supplied in this file in the creation of products supporting the
|
||||||
|
* Unicode Standard, and to make copies of this file in any form
|
||||||
|
* for internal or external distribution as long as this notice
|
||||||
|
* remains attached.
|
||||||
|
*/
|
||||||
|
|
||||||
#define UNI_MAX_BMP 0x0000FFFF
|
#define UNI_MAX_BMP 0x0000FFFF
|
||||||
#define UNI_MAX_UTF16 0x0010FFFF
|
#define UNI_MAX_UTF16 0x0010FFFF
|
||||||
#define UNI_MAX_UTF32 0x7FFFFFFF
|
#define UNI_MAX_UTF32 0x7FFFFFFF
|
||||||
@ -505,18 +532,24 @@ AString & UTF8ToRawBEUTF16(const char * a_UTF8, size_t a_UTF8Length, AString & a
|
|||||||
} while (tmpBytesToRead > 0);
|
} while (tmpBytesToRead > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
--------------------------------------------------------------------- */
|
---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// End of Unicode, Inc.'s code / information
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
#define HEX(x) ((x) > 9 ? (x) + 'A' - 10 : (x) + '0')
|
||||||
|
|
||||||
|
/**
|
||||||
format binary data this way:
|
format binary data this way:
|
||||||
00001234: 31 32 33 34 35 36 37 38 39 30 61 62 63 64 65 66 1234567890abcdef
|
00001234: 31 32 33 34 35 36 37 38 39 30 61 62 63 64 65 66 1234567890abcdef
|
||||||
*/
|
*/
|
||||||
#define HEX(x) ((x) > 9 ? (x) + 'A' - 10 : (x) + '0')
|
|
||||||
|
|
||||||
AString & CreateHexDump(AString & a_Out, const void * a_Data, int a_Size, int a_LineLength)
|
AString & CreateHexDump(AString & a_Out, const void * a_Data, int a_Size, int a_LineLength)
|
||||||
{
|
{
|
||||||
ASSERT(a_LineLength <= 120); // Due to using a fixed size line buffer; increase line[]'s size to lift this max
|
ASSERT(a_LineLength <= 120); // Due to using a fixed size line buffer; increase line[]'s size to lift this max
|
||||||
|
@ -133,9 +133,9 @@ void cTracer::SetValues(const Vector3f & a_Start, const Vector3f & a_Direction)
|
|||||||
|
|
||||||
int cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int a_Distance)
|
int cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int a_Distance)
|
||||||
{
|
{
|
||||||
if (a_Start.y < 0)
|
if ((a_Start.y < 0) || (a_Start.y >= cChunkDef::Height))
|
||||||
{
|
{
|
||||||
LOGD("%s: Start is below the world", __FUNCTION__);
|
LOGD("%s: Start Y is outside the world (%.2f), not tracing.", __FUNCTION__, a_Start.y);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2204,15 +2204,12 @@ cPlayer * cWorld::FindClosestPlayer(const Vector3f & a_Pos, float a_SightLimit)
|
|||||||
Vector3f Pos = (*itr)->GetPosition();
|
Vector3f Pos = (*itr)->GetPosition();
|
||||||
float Distance = (Pos - a_Pos).Length();
|
float Distance = (Pos - a_Pos).Length();
|
||||||
|
|
||||||
if (Distance <= a_SightLimit)
|
if (Distance < ClosestDistance)
|
||||||
{
|
{
|
||||||
if (!LineOfSight.Trace(a_Pos,(Pos - a_Pos),(int)(Pos - a_Pos).Length()))
|
if (!LineOfSight.Trace(a_Pos,(Pos - a_Pos),(int)(Pos - a_Pos).Length()))
|
||||||
{
|
{
|
||||||
if (Distance < ClosestDistance)
|
ClosestDistance = Distance;
|
||||||
{
|
ClosestPlayer = *itr;
|
||||||
ClosestDistance = Distance;
|
|
||||||
ClosestPlayer = *itr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user