summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-08 02:25:01 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-08 02:25:01 +0100
commit8285a11a26d78784f26b76e6bcdfa479f6c1a345 (patch)
tree6d567d22754b2d65258b1557e18ea8b590c2c709 /source
parentFixed bug in cChunk.cpp not calculating RedstoneCircuits at the correct positions. Also, forgot to mention you can now place colored wool. (diff)
downloadcuberite-8285a11a26d78784f26b76e6bcdfa479f6c1a345.tar
cuberite-8285a11a26d78784f26b76e6bcdfa479f6c1a345.tar.gz
cuberite-8285a11a26d78784f26b76e6bcdfa479f6c1a345.tar.bz2
cuberite-8285a11a26d78784f26b76e6bcdfa479f6c1a345.tar.lz
cuberite-8285a11a26d78784f26b76e6bcdfa479f6c1a345.tar.xz
cuberite-8285a11a26d78784f26b76e6bcdfa479f6c1a345.tar.zst
cuberite-8285a11a26d78784f26b76e6bcdfa479f6c1a345.zip
Diffstat (limited to '')
-rw-r--r--source/Bindings.cpp281
-rw-r--r--source/Bindings.h2
-rw-r--r--source/SquirrelBindings.cpp136
-rw-r--r--source/SquirrelBindings.h15
-rw-r--r--source/cClientHandle.cpp1
-rw-r--r--source/cPlugin.cpp3
-rw-r--r--source/cPlugin.h18
-rw-r--r--source/cPluginManager.cpp87
-rw-r--r--source/cPluginManager.h3
-rw-r--r--source/cWebAdmin.cpp2
-rw-r--r--source/main.cpp12
11 files changed, 529 insertions, 31 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index 330582dea..a0465e8ea 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 11/01/11 22:50:07.
+** Generated automatically by tolua++-1.0.92 on 11/08/11 02:11:35.
*/
#ifndef __cplusplus
@@ -6006,7 +6006,7 @@ static int tolua_AllToLua_cPluginManager_GetPlugin00(lua_State* tolua_S)
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) ||
- !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isstring(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
@@ -6014,7 +6014,7 @@ static int tolua_AllToLua_cPluginManager_GetPlugin00(lua_State* tolua_S)
#endif
{
cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0);
- std::string a_Plugin = ((std::string) tolua_tocppstring(tolua_S,2,0));
+ const char* a_Plugin = ((const char*) tolua_tostring(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPlugin'", NULL);
#endif
@@ -6545,7 +6545,7 @@ static int tolua_AllToLua_cPlugin_OnChat00(lua_State* tolua_S)
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cPlugin",0,&tolua_err) ||
- !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isstring(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
@@ -6554,7 +6554,7 @@ static int tolua_AllToLua_cPlugin_OnChat00(lua_State* tolua_S)
#endif
{
cPlugin* self = (cPlugin*) tolua_tousertype(tolua_S,1,0);
- std::string a_Chat = ((std::string) tolua_tocppstring(tolua_S,2,0));
+ const char* a_Chat = ((const char*) tolua_tostring(tolua_S,2,0));
cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'OnChat'", NULL);
@@ -6797,8 +6797,8 @@ static int tolua_AllToLua_cPlugin_GetName00(lua_State* tolua_S)
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetName'", NULL);
#endif
{
- std::string tolua_ret = (std::string) self->GetName();
- tolua_pushcppstring(tolua_S,(const char*)tolua_ret);
+ const char* tolua_ret = (const char*) self->GetName();
+ tolua_pushstring(tolua_S,(const char*)tolua_ret);
}
}
return 1;
@@ -6818,7 +6818,7 @@ static int tolua_AllToLua_cPlugin_SetName00(lua_State* tolua_S)
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cPlugin",0,&tolua_err) ||
- !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isstring(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
@@ -6826,7 +6826,7 @@ static int tolua_AllToLua_cPlugin_SetName00(lua_State* tolua_S)
#endif
{
cPlugin* self = (cPlugin*) tolua_tousertype(tolua_S,1,0);
- std::string a_Name = ((std::string) tolua_tocppstring(tolua_S,2,0));
+ const char* a_Name = ((const char*) tolua_tostring(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetName'", NULL);
#endif
@@ -7120,9 +7120,9 @@ public:
return ( bool ) cPlugin:: OnBlockDig(a_PacketData,a_Player,a_PickupItem);
};
};
- bool OnChat( std::string a_Chat, cPlayer* a_Player) {
+ bool OnChat( const char* a_Chat, cPlayer* a_Player) {
if (push_method("OnChat", tolua_AllToLua_cPlugin_OnChat00)) {
- tolua_pushcppstring(lua_state, (const char*)a_Chat);
+ tolua_pushstring(lua_state, (const char*)a_Chat);
tolua_pushusertype(lua_state, (void*)a_Player, "cPlayer");
ToluaBase::dbcall(lua_state, 3, 1);
bool tolua_ret = ( bool )tolua_toboolean(lua_state, -1, 0);
@@ -7210,7 +7210,7 @@ public:
bool cPlugin__OnBlockDig( cPacket_BlockDig* a_PacketData, cPlayer* a_Player, cItem* a_PickupItem) {
return ( bool )cPlugin::OnBlockDig(a_PacketData,a_Player,a_PickupItem);
};
- bool cPlugin__OnChat( std::string a_Chat, cPlayer* a_Player) {
+ bool cPlugin__OnChat( const char* a_Chat, cPlayer* a_Player) {
return ( bool )cPlugin::OnChat(a_Chat,a_Player);
};
bool cPlugin__OnLogin( cPacket_Login* a_PacketData) {
@@ -7485,7 +7485,7 @@ static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnChat00(lua_State* tolua_S)
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"Lua__cPlugin",0,&tolua_err) ||
- !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isstring(tolua_S,2,0,&tolua_err) ||
!tolua_isusertype(tolua_S,3,"cPlayer",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
@@ -7494,7 +7494,7 @@ static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnChat00(lua_State* tolua_S)
#endif
{
Lua__cPlugin* self = (Lua__cPlugin*) tolua_tousertype(tolua_S,1,0);
- std::string a_Chat = ((std::string) tolua_tocppstring(tolua_S,2,0));
+ const char* a_Chat = ((const char*) tolua_tostring(tolua_S,2,0));
cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,3,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPlugin__OnChat'", NULL);
@@ -15097,7 +15097,22 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_BLOCK_LEAVES",E_BLOCK_LEAVES);
tolua_constant(tolua_S,"E_BLOCK_SPONGE",E_BLOCK_SPONGE);
tolua_constant(tolua_S,"E_BLOCK_GLASS",E_BLOCK_GLASS);
+ tolua_constant(tolua_S,"E_BLOCK_LAPIS_ORE",E_BLOCK_LAPIS_ORE);
+ tolua_constant(tolua_S,"E_BLOCK_LAPIS_BLOCK",E_BLOCK_LAPIS_BLOCK);
+ tolua_constant(tolua_S,"E_BLOCK_DISPENSER",E_BLOCK_DISPENSER);
+ tolua_constant(tolua_S,"E_BLOCK_SANDSTONE",E_BLOCK_SANDSTONE);
+ tolua_constant(tolua_S,"E_BLOCK_NOTE_BLOCK",E_BLOCK_NOTE_BLOCK);
+ tolua_constant(tolua_S,"E_BLOCK_BED",E_BLOCK_BED);
+ tolua_constant(tolua_S,"E_BLOCK_POWERED_RAIL",E_BLOCK_POWERED_RAIL);
+ tolua_constant(tolua_S,"E_BLOCK_DETECTOR_RAIL",E_BLOCK_DETECTOR_RAIL);
+ tolua_constant(tolua_S,"E_BLOCK_STICKY_PISTON",E_BLOCK_STICKY_PISTON);
+ tolua_constant(tolua_S,"E_BLOCK_COBWEB",E_BLOCK_COBWEB);
+ tolua_constant(tolua_S,"E_BLOCK_TALL_GRASS",E_BLOCK_TALL_GRASS);
+ tolua_constant(tolua_S,"E_BLOCK_DEAD_BUSH",E_BLOCK_DEAD_BUSH);
+ tolua_constant(tolua_S,"E_BLOCK_PISTON",E_BLOCK_PISTON);
+ tolua_constant(tolua_S,"E_BLOCK_PISTON_EXTENSION",E_BLOCK_PISTON_EXTENSION);
tolua_constant(tolua_S,"E_BLOCK_WHITE_CLOTH",E_BLOCK_WHITE_CLOTH);
+ tolua_constant(tolua_S,"E_BLOCK_PISTON_MOVED_BLOCK",E_BLOCK_PISTON_MOVED_BLOCK);
tolua_constant(tolua_S,"E_BLOCK_YELLOW_FLOWER",E_BLOCK_YELLOW_FLOWER);
tolua_constant(tolua_S,"E_BLOCK_RED_ROSE",E_BLOCK_RED_ROSE);
tolua_constant(tolua_S,"E_BLOCK_BROWN_MUSHROOM",E_BLOCK_BROWN_MUSHROOM);
@@ -15136,14 +15151,18 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_BLOCK_WOODEN_PRESSURE_PLATE",E_BLOCK_WOODEN_PRESSURE_PLATE);
tolua_constant(tolua_S,"E_BLOCK_REDSTONE_ORE",E_BLOCK_REDSTONE_ORE);
tolua_constant(tolua_S,"E_BLOCK_REDSTONE_ORE_GLOWING",E_BLOCK_REDSTONE_ORE_GLOWING);
- tolua_constant(tolua_S,"E_BLOCK_REDSTONE_TORCH_ON",E_BLOCK_REDSTONE_TORCH_ON);
tolua_constant(tolua_S,"E_BLOCK_REDSTONE_TORCH_OFF",E_BLOCK_REDSTONE_TORCH_OFF);
+ tolua_constant(tolua_S,"E_BLOCK_REDSTONE_TORCH_ON",E_BLOCK_REDSTONE_TORCH_ON);
+ tolua_constant(tolua_S,"E_BLOCK_STONE_BUTTON",E_BLOCK_STONE_BUTTON);
tolua_constant(tolua_S,"E_BLOCK_SNOW",E_BLOCK_SNOW);
tolua_constant(tolua_S,"E_BLOCK_ICE",E_BLOCK_ICE);
tolua_constant(tolua_S,"E_BLOCK_SNOW_BLOCK",E_BLOCK_SNOW_BLOCK);
tolua_constant(tolua_S,"E_BLOCK_CACTUS",E_BLOCK_CACTUS);
tolua_constant(tolua_S,"E_BLOCK_CLAY",E_BLOCK_CLAY);
tolua_constant(tolua_S,"E_BLOCK_REEDS",E_BLOCK_REEDS);
+ tolua_constant(tolua_S,"E_BLOCK_JUKEBOX",E_BLOCK_JUKEBOX);
+ tolua_constant(tolua_S,"E_BLOCK_FENCE",E_BLOCK_FENCE);
+ tolua_constant(tolua_S,"E_BLOCK_PUMPKIN",E_BLOCK_PUMPKIN);
tolua_constant(tolua_S,"E_BLOCK_BLOODSTONE",E_BLOCK_BLOODSTONE);
tolua_constant(tolua_S,"E_BLOCK_SOULSAND",E_BLOCK_SOULSAND);
tolua_constant(tolua_S,"E_BLOCK_GLOWSTONE",E_BLOCK_GLOWSTONE);
@@ -15154,6 +15173,32 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_BLOCK_REDSTONE_REPEATER_ON",E_BLOCK_REDSTONE_REPEATER_ON);
tolua_constant(tolua_S,"E_BLOCK_LOCKED_CHEST",E_BLOCK_LOCKED_CHEST);
tolua_constant(tolua_S,"E_BLOCK_TRAPDOOR",E_BLOCK_TRAPDOOR);
+ tolua_constant(tolua_S,"E_BLOCK_SILVERFISH_EGG",E_BLOCK_SILVERFISH_EGG);
+ tolua_constant(tolua_S,"E_BLOCK_STONE_BRICKS",E_BLOCK_STONE_BRICKS);
+ tolua_constant(tolua_S,"E_BLOCK_HUGE_BROWN_MUSHROOM",E_BLOCK_HUGE_BROWN_MUSHROOM);
+ tolua_constant(tolua_S,"E_BLOCK_HUGE_RED_MUSHROOM",E_BLOCK_HUGE_RED_MUSHROOM);
+ tolua_constant(tolua_S,"E_BLOCK_IRON_BAR",E_BLOCK_IRON_BAR);
+ tolua_constant(tolua_S,"E_BLOCK_GLASS_PLANE",E_BLOCK_GLASS_PLANE);
+ tolua_constant(tolua_S,"E_BLOCK_MELON",E_BLOCK_MELON);
+ tolua_constant(tolua_S,"E_BLOCK_PUMPKIN_STEM",E_BLOCK_PUMPKIN_STEM);
+ tolua_constant(tolua_S,"E_BLOCK_MELON_STEM",E_BLOCK_MELON_STEM);
+ tolua_constant(tolua_S,"E_BLOCK_VINES",E_BLOCK_VINES);
+ tolua_constant(tolua_S,"E_BLOCK_FENCE_GATE",E_BLOCK_FENCE_GATE);
+ tolua_constant(tolua_S,"E_BLOCK_BRICK_STAIRS",E_BLOCK_BRICK_STAIRS);
+ tolua_constant(tolua_S,"E_BLOCK_STONE_BRICK_STAIRS",E_BLOCK_STONE_BRICK_STAIRS);
+ tolua_constant(tolua_S,"E_BLOCK_MYCELIUM",E_BLOCK_MYCELIUM);
+ tolua_constant(tolua_S,"E_BLOCK_LILY_PAD",E_BLOCK_LILY_PAD);
+ tolua_constant(tolua_S,"E_BLOCK_NETHER_BRICK",E_BLOCK_NETHER_BRICK);
+ tolua_constant(tolua_S,"E_BLOCK_NETHER_BRICK_FENCE",E_BLOCK_NETHER_BRICK_FENCE);
+ tolua_constant(tolua_S,"E_BLOCK_NETHER_BRICK_STAIRS",E_BLOCK_NETHER_BRICK_STAIRS);
+ tolua_constant(tolua_S,"E_BLOCK_NETHER_WART",E_BLOCK_NETHER_WART);
+ tolua_constant(tolua_S,"E_BLOCK_ENCHANTMENT_TABLE",E_BLOCK_ENCHANTMENT_TABLE);
+ tolua_constant(tolua_S,"E_BLOCK_BREWING_STAND",E_BLOCK_BREWING_STAND);
+ tolua_constant(tolua_S,"E_BLOCK_CAULDRON",E_BLOCK_CAULDRON);
+ tolua_constant(tolua_S,"E_BLOCK_END_PORTAL",E_BLOCK_END_PORTAL);
+ tolua_constant(tolua_S,"E_BLOCK_END_PORTAL_FRAME",E_BLOCK_END_PORTAL_FRAME);
+ tolua_constant(tolua_S,"E_BLOCK_END_STONE",E_BLOCK_END_STONE);
+ tolua_constant(tolua_S,"E_BLOCK_",E_BLOCK_);
tolua_constant(tolua_S,"E_ITEM_EMPTY",E_ITEM_EMPTY);
tolua_constant(tolua_S,"E_ITEM_STONE",E_ITEM_STONE);
tolua_constant(tolua_S,"E_ITEM_GRASS",E_ITEM_GRASS);
@@ -15173,9 +15218,104 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_ITEM_COAL_ORE",E_ITEM_COAL_ORE);
tolua_constant(tolua_S,"E_ITEM_LOG",E_ITEM_LOG);
tolua_constant(tolua_S,"E_ITEM_LEAVES",E_ITEM_LEAVES);
+ tolua_constant(tolua_S,"E_ITEM_SPONGE",E_ITEM_SPONGE);
+ tolua_constant(tolua_S,"E_ITEM_GLASS",E_ITEM_GLASS);
+ tolua_constant(tolua_S,"E_ITEM_LAPIS_ORE",E_ITEM_LAPIS_ORE);
+ tolua_constant(tolua_S,"E_ITEM_LAPIS_BLOCK",E_ITEM_LAPIS_BLOCK);
+ tolua_constant(tolua_S,"E_ITEM_DISPENSER",E_ITEM_DISPENSER);
+ tolua_constant(tolua_S,"E_ITEM_SANDSTONE",E_ITEM_SANDSTONE);
+ tolua_constant(tolua_S,"E_ITEM_NOTE_ITEM",E_ITEM_NOTE_ITEM);
+ tolua_constant(tolua_S,"E_ITEM_POWERED_RAIL",E_ITEM_POWERED_RAIL);
+ tolua_constant(tolua_S,"E_ITEM_DETECTOR_RAIL",E_ITEM_DETECTOR_RAIL);
+ tolua_constant(tolua_S,"E_ITEM_STICKY_PISTON",E_ITEM_STICKY_PISTON);
+ tolua_constant(tolua_S,"E_ITEM_COBWEB",E_ITEM_COBWEB);
+ tolua_constant(tolua_S,"E_ITEM_TALL_GRASS",E_ITEM_TALL_GRASS);
+ tolua_constant(tolua_S,"E_ITEM_DEAD_BRUSH",E_ITEM_DEAD_BRUSH);
+ tolua_constant(tolua_S,"E_ITEM_PISTON",E_ITEM_PISTON);
+ tolua_constant(tolua_S,"E_ITEM_PISTON_EXTENSION",E_ITEM_PISTON_EXTENSION);
+ tolua_constant(tolua_S,"E_ITEM_WHITE_CLOTH",E_ITEM_WHITE_CLOTH);
+ tolua_constant(tolua_S,"E_ITEM_PISTON_MOVED_BLOCK",E_ITEM_PISTON_MOVED_BLOCK);
+ tolua_constant(tolua_S,"E_ITEM_YELLOW_FLOWER",E_ITEM_YELLOW_FLOWER);
+ tolua_constant(tolua_S,"E_ITEM_RED_ROSE",E_ITEM_RED_ROSE);
+ tolua_constant(tolua_S,"E_ITEM_BROWN_MUSHROOM",E_ITEM_BROWN_MUSHROOM);
+ tolua_constant(tolua_S,"E_ITEM_RED_MUSHROOM",E_ITEM_RED_MUSHROOM);
tolua_constant(tolua_S,"E_ITEM_GOLD_BLOCK",E_ITEM_GOLD_BLOCK);
tolua_constant(tolua_S,"E_ITEM_IRON_BLOCK",E_ITEM_IRON_BLOCK);
+ tolua_constant(tolua_S,"E_ITEM_DOUBLE_STEP",E_ITEM_DOUBLE_STEP);
+ tolua_constant(tolua_S,"E_ITEM_STEP",E_ITEM_STEP);
+ tolua_constant(tolua_S,"E_ITEM_BRICK",E_ITEM_BRICK);
+ tolua_constant(tolua_S,"E_ITEM_TNT",E_ITEM_TNT);
+ tolua_constant(tolua_S,"E_ITEM_BOOKCASE",E_ITEM_BOOKCASE);
+ tolua_constant(tolua_S,"E_ITEM_MOSSY_COBBLESTONE",E_ITEM_MOSSY_COBBLESTONE);
+ tolua_constant(tolua_S,"E_ITEM_OBSIDIAN",E_ITEM_OBSIDIAN);
+ tolua_constant(tolua_S,"E_ITEM_TORCH",E_ITEM_TORCH);
+ tolua_constant(tolua_S,"E_ITEM_FIRE",E_ITEM_FIRE);
+ tolua_constant(tolua_S,"E_ITEM_MOB_SPAWNER",E_ITEM_MOB_SPAWNER);
+ tolua_constant(tolua_S,"E_ITEM_WOODEN_STAIRS",E_ITEM_WOODEN_STAIRS);
+ tolua_constant(tolua_S,"E_ITEM_CHEST",E_ITEM_CHEST);
+ tolua_constant(tolua_S,"E_ITEM_REDSTONE_WIRE",E_ITEM_REDSTONE_WIRE);
+ tolua_constant(tolua_S,"E_ITEM_DIAMOND_ORE",E_ITEM_DIAMOND_ORE);
tolua_constant(tolua_S,"E_ITEM_DIAMOND_BLOCK",E_ITEM_DIAMOND_BLOCK);
+ tolua_constant(tolua_S,"E_ITEM_WORKBENCH",E_ITEM_WORKBENCH);
+ tolua_constant(tolua_S,"E_ITEM_CROPS",E_ITEM_CROPS);
+ tolua_constant(tolua_S,"E_ITEM_SOIL",E_ITEM_SOIL);
+ tolua_constant(tolua_S,"E_ITEM_FURNACE",E_ITEM_FURNACE);
+ tolua_constant(tolua_S,"E_ITEM_BURNING_FURNACE",E_ITEM_BURNING_FURNACE);
+ tolua_constant(tolua_S,"E_ITEM_SIGN_POST",E_ITEM_SIGN_POST);
+ tolua_constant(tolua_S,"E_ITEM_LADDER",E_ITEM_LADDER);
+ tolua_constant(tolua_S,"E_ITEM_MINECART_TRACKS",E_ITEM_MINECART_TRACKS);
+ tolua_constant(tolua_S,"E_ITEM_COBBLESTONE_STAIRS",E_ITEM_COBBLESTONE_STAIRS);
+ tolua_constant(tolua_S,"E_ITEM_WALLSIGN",E_ITEM_WALLSIGN);
+ tolua_constant(tolua_S,"E_ITEM_LEVER",E_ITEM_LEVER);
+ tolua_constant(tolua_S,"E_ITEM_STONE_PRESSURE_PLATE",E_ITEM_STONE_PRESSURE_PLATE);
+ tolua_constant(tolua_S,"E_ITEM_WOODEN_PRESSURE_PLATE",E_ITEM_WOODEN_PRESSURE_PLATE);
+ tolua_constant(tolua_S,"E_ITEM_REDSTONE_ORE",E_ITEM_REDSTONE_ORE);
+ tolua_constant(tolua_S,"E_ITEM_REDSTONE_ORE_GLOWING",E_ITEM_REDSTONE_ORE_GLOWING);
+ tolua_constant(tolua_S,"E_ITEM_REDSTONE_TORCH_ON",E_ITEM_REDSTONE_TORCH_ON);
+ tolua_constant(tolua_S,"E_ITEM_REDSTONE_TORCH_OFF",E_ITEM_REDSTONE_TORCH_OFF);
+ tolua_constant(tolua_S,"E_ITEM_STONE_BUTTON",E_ITEM_STONE_BUTTON);
+ tolua_constant(tolua_S,"E_ITEM_SNOW",E_ITEM_SNOW);
+ tolua_constant(tolua_S,"E_ITEM_ICE",E_ITEM_ICE);
+ tolua_constant(tolua_S,"E_ITEM_SNOW_BLOCK",E_ITEM_SNOW_BLOCK);
+ tolua_constant(tolua_S,"E_ITEM_CACTUS",E_ITEM_CACTUS);
+ tolua_constant(tolua_S,"E_ITEM_REEDS",E_ITEM_REEDS);
+ tolua_constant(tolua_S,"E_ITEM_JUKEBOX",E_ITEM_JUKEBOX);
+ tolua_constant(tolua_S,"E_ITEM_FENCE",E_ITEM_FENCE);
+ tolua_constant(tolua_S,"E_ITEM_PUMPKIN",E_ITEM_PUMPKIN);
+ tolua_constant(tolua_S,"E_ITEM_BLOODSTONE",E_ITEM_BLOODSTONE);
+ tolua_constant(tolua_S,"E_ITEM_SOULSAND",E_ITEM_SOULSAND);
+ tolua_constant(tolua_S,"E_ITEM_GLOWSTONE",E_ITEM_GLOWSTONE);
+ tolua_constant(tolua_S,"E_ITEM_PORT",E_ITEM_PORT);
+ tolua_constant(tolua_S,"E_ITEM_JACK_O_LANTERN",E_ITEM_JACK_O_LANTERN);
+ tolua_constant(tolua_S,"E_ITEM_REDSTONE_REPEATER_OFF",E_ITEM_REDSTONE_REPEATER_OFF);
+ tolua_constant(tolua_S,"E_ITEM_REDSTONE_REPEATER_ON",E_ITEM_REDSTONE_REPEATER_ON);
+ tolua_constant(tolua_S,"E_ITEM_LOCKED_CHEST",E_ITEM_LOCKED_CHEST);
+ tolua_constant(tolua_S,"E_ITEM_TRAPDOOR",E_ITEM_TRAPDOOR);
+ tolua_constant(tolua_S,"E_ITEM_SILVERFISH_EGG",E_ITEM_SILVERFISH_EGG);
+ tolua_constant(tolua_S,"E_ITEM_STONE_BRICKS",E_ITEM_STONE_BRICKS);
+ tolua_constant(tolua_S,"E_ITEM_HUGE_BROWN_MUSHROOM",E_ITEM_HUGE_BROWN_MUSHROOM);
+ tolua_constant(tolua_S,"E_ITEM_HUGE_RED_MUSHROOM",E_ITEM_HUGE_RED_MUSHROOM);
+ tolua_constant(tolua_S,"E_ITEM_IRON_BAR",E_ITEM_IRON_BAR);
+ tolua_constant(tolua_S,"E_ITEM_GLASS_PLANE",E_ITEM_GLASS_PLANE);
+ tolua_constant(tolua_S,"E_ITEM_MELON",E_ITEM_MELON);
+ tolua_constant(tolua_S,"E_ITEM_PUMPKIN_STEM",E_ITEM_PUMPKIN_STEM);
+ tolua_constant(tolua_S,"E_ITEM_MELON_STEM",E_ITEM_MELON_STEM);
+ tolua_constant(tolua_S,"E_ITEM_VINES",E_ITEM_VINES);
+ tolua_constant(tolua_S,"E_ITEM_FENCE_GATE",E_ITEM_FENCE_GATE);
+ tolua_constant(tolua_S,"E_ITEM_BRICK_STAIRS",E_ITEM_BRICK_STAIRS);
+ tolua_constant(tolua_S,"E_ITEM_STONE_BRICK_STAIRS",E_ITEM_STONE_BRICK_STAIRS);
+ tolua_constant(tolua_S,"E_ITEM_MYCELIUM",E_ITEM_MYCELIUM);
+ tolua_constant(tolua_S,"E_ITEM_LILY_PAD",E_ITEM_LILY_PAD);
+ tolua_constant(tolua_S,"E_ITEM_NETHER_BRICK",E_ITEM_NETHER_BRICK);
+ tolua_constant(tolua_S,"E_ITEM_NETHER_BRICK_FENCE",E_ITEM_NETHER_BRICK_FENCE);
+ tolua_constant(tolua_S,"E_ITEM_NETHER_BRICK_STAIRS",E_ITEM_NETHER_BRICK_STAIRS);
+ tolua_constant(tolua_S,"E_ITEM_ENCHANTMENT_TABLE",E_ITEM_ENCHANTMENT_TABLE);
+ tolua_constant(tolua_S,"E_ITEM_END_PORTAL",E_ITEM_END_PORTAL);
+ tolua_constant(tolua_S,"E_ITEM_END_PORTAL_FRAME",E_ITEM_END_PORTAL_FRAME);
+ tolua_constant(tolua_S,"E_ITEM_END_STONE",E_ITEM_END_STONE);
+ tolua_constant(tolua_S,"E_ITEM_IRON_SHOVEL",E_ITEM_IRON_SHOVEL);
+ tolua_constant(tolua_S,"E_ITEM_IRON_PICKAXE",E_ITEM_IRON_PICKAXE);
+ tolua_constant(tolua_S,"E_ITEM_IRON_AXE",E_ITEM_IRON_AXE);
tolua_constant(tolua_S,"E_ITEM_FLINT_AND_STEEL",E_ITEM_FLINT_AND_STEEL);
tolua_constant(tolua_S,"E_ITEM_APPLE",E_ITEM_APPLE);
tolua_constant(tolua_S,"E_ITEM_BOW",E_ITEM_BOW);
@@ -15184,6 +15324,21 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_ITEM_DIAMOND",E_ITEM_DIAMOND);
tolua_constant(tolua_S,"E_ITEM_IRON",E_ITEM_IRON);
tolua_constant(tolua_S,"E_ITEM_GOLD",E_ITEM_GOLD);
+ tolua_constant(tolua_S,"E_ITEM_IRON_SWORD",E_ITEM_IRON_SWORD);
+ tolua_constant(tolua_S,"E_ITEM_WOODEN_SWORD",E_ITEM_WOODEN_SWORD);
+ tolua_constant(tolua_S,"E_ITEM_WOODEN_SHOVEL",E_ITEM_WOODEN_SHOVEL);
+ tolua_constant(tolua_S,"E_ITEM_WOODEN_PICKAXE",E_ITEM_WOODEN_PICKAXE);
+ tolua_constant(tolua_S,"E_ITEM_WOODEN_AXE",E_ITEM_WOODEN_AXE);
+ tolua_constant(tolua_S,"E_ITEM_STONE_SWORD",E_ITEM_STONE_SWORD);
+ tolua_constant(tolua_S,"E_ITEM_STONE_SHOVEL",E_ITEM_STONE_SHOVEL);
+ tolua_constant(tolua_S,"E_ITEM_STONE_PICKAXE",E_ITEM_STONE_PICKAXE);
+ tolua_constant(tolua_S,"E_ITEM_STONE_AXE",E_ITEM_STONE_AXE);
+ tolua_constant(tolua_S,"E_ITEM_DIAMOND_SWORD",E_ITEM_DIAMOND_SWORD);
+ tolua_constant(tolua_S,"E_ITEM_DIAMOND_SHOVEL",E_ITEM_DIAMOND_SHOVEL);
+ tolua_constant(tolua_S,"E_ITEM_DIAMOND_PICKAXE",E_ITEM_DIAMOND_PICKAXE);
+ tolua_constant(tolua_S,"E_ITEM_DIAMOND_AXE",E_ITEM_DIAMOND_AXE);
+ tolua_constant(tolua_S,"E_ITEM_STICK",E_ITEM_STICK);
+ tolua_constant(tolua_S,"E_ITEM_BOWL",E_ITEM_BOWL);
tolua_constant(tolua_S,"E_ITEM_MUSHROOM_SOUP",E_ITEM_MUSHROOM_SOUP);
tolua_constant(tolua_S,"E_ITEM_GOLD_SWORD",E_ITEM_GOLD_SWORD);
tolua_constant(tolua_S,"E_ITEM_GOLD_SHOVEL",E_ITEM_GOLD_SHOVEL);
@@ -15191,12 +15346,61 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_ITEM_GOLD_AXE",E_ITEM_GOLD_AXE);
tolua_constant(tolua_S,"E_ITEM_STRING",E_ITEM_STRING);
tolua_constant(tolua_S,"E_ITEM_FEATHER",E_ITEM_FEATHER);
+ tolua_constant(tolua_S,"E_ITEM_GUNPOWDER",E_ITEM_GUNPOWDER);
+ tolua_constant(tolua_S,"E_ITEM_WOODEN_HOE",E_ITEM_WOODEN_HOE);
+ tolua_constant(tolua_S,"E_ITEM_STONE_HOE",E_ITEM_STONE_HOE);
+ tolua_constant(tolua_S,"E_ITEM_IRON_HOE",E_ITEM_IRON_HOE);
+ tolua_constant(tolua_S,"E_ITEM_DIAMOND_HOE",E_ITEM_DIAMOND_HOE);
+ tolua_constant(tolua_S,"E_ITEM_GOLD_HOE",E_ITEM_GOLD_HOE);
+ tolua_constant(tolua_S,"E_ITEM_SEEDS",E_ITEM_SEEDS);
+ tolua_constant(tolua_S,"E_ITEM_WHEAT",E_ITEM_WHEAT);
tolua_constant(tolua_S,"E_ITEM_BREAD",E_ITEM_BREAD);
+ tolua_constant(tolua_S,"E_ITEM_LEATHER_CAP",E_ITEM_LEATHER_CAP);
+ tolua_constant(tolua_S,"E_ITEM_LEATHER_TUNIC",E_ITEM_LEATHER_TUNIC);
+ tolua_constant(tolua_S,"E_ITEM_LEATHER_PANTS",E_ITEM_LEATHER_PANTS);
+ tolua_constant(tolua_S,"E_ITEM_LEATHER_BOOTS",E_ITEM_LEATHER_BOOTS);
+ tolua_constant(tolua_S,"E_ITEM_CHAIN_HELMET",E_ITEM_CHAIN_HELMET);
+ tolua_constant(tolua_S,"E_ITEM_CHAIN_CHESTPLATE",E_ITEM_CHAIN_CHESTPLATE);
+ tolua_constant(tolua_S,"E_ITEM_CHAIN_LEGGINGS",E_ITEM_CHAIN_LEGGINGS);
+ tolua_constant(tolua_S,"E_ITEM_CHAIN_BOOTS",E_ITEM_CHAIN_BOOTS);
+ tolua_constant(tolua_S,"E_ITEM_IRON_HELMET",E_ITEM_IRON_HELMET);
+ tolua_constant(tolua_S,"E_ITEM_IRON_CHESTPLATE",E_ITEM_IRON_CHESTPLATE);
+ tolua_constant(tolua_S,"E_ITEM_IRON_LEGGINGS",E_ITEM_IRON_LEGGINGS);
+ tolua_constant(tolua_S,"E_ITEM_IRON_BOOTS",E_ITEM_IRON_BOOTS);
+ tolua_constant(tolua_S,"E_ITEM_DIAMOND_HELMET",E_ITEM_DIAMOND_HELMET);
+ tolua_constant(tolua_S,"E_ITEM_DIAMOND_CHESTPLATE",E_ITEM_DIAMOND_CHESTPLATE);
+ tolua_constant(tolua_S,"E_ITEM_DIAMOND_LEGGINGS",E_ITEM_DIAMOND_LEGGINGS);
+ tolua_constant(tolua_S,"E_ITEM_DIAMOND_BOOTS",E_ITEM_DIAMOND_BOOTS);
+ tolua_constant(tolua_S,"E_ITEM_GOLD_HELMET",E_ITEM_GOLD_HELMET);
+ tolua_constant(tolua_S,"E_ITEM_GOLD_CHESTPLATE",E_ITEM_GOLD_CHESTPLATE);
+ tolua_constant(tolua_S,"E_ITEM_GOLD_LEGGINGS",E_ITEM_GOLD_LEGGINGS);
+ tolua_constant(tolua_S,"E_ITEM_GOLD_BOOTS",E_ITEM_GOLD_BOOTS);
+ tolua_constant(tolua_S,"E_ITEM_FLINT",E_ITEM_FLINT);
tolua_constant(tolua_S,"E_ITEM_RAW_MEAT",E_ITEM_RAW_MEAT);
tolua_constant(tolua_S,"E_ITEM_COOKED_MEAT",E_ITEM_COOKED_MEAT);
+ tolua_constant(tolua_S,"E_ITEM_PAINTINGS",E_ITEM_PAINTINGS);
tolua_constant(tolua_S,"E_ITEM_GOLDEN_APPLE",E_ITEM_GOLDEN_APPLE);
tolua_constant(tolua_S,"E_ITEM_SIGN",E_ITEM_SIGN);
+ tolua_constant(tolua_S,"E_ITEM_WOODEN_DOOR",E_ITEM_WOODEN_DOOR);
+ tolua_constant(tolua_S,"E_ITEM_BUCKET",E_ITEM_BUCKET);
+ tolua_constant(tolua_S,"E_ITEM_WATER_BUCKET",E_ITEM_WATER_BUCKET);
+ tolua_constant(tolua_S,"E_ITEM_LAVA_BUCKET",E_ITEM_LAVA_BUCKET);
+ tolua_constant(tolua_S,"E_ITEM_MINECART",E_ITEM_MINECART);
+ tolua_constant(tolua_S,"E_ITEM_SADDLE",E_ITEM_SADDLE);
+ tolua_constant(tolua_S,"E_ITEM_IRON_DOOR",E_ITEM_IRON_DOOR);
+ tolua_constant(tolua_S,"E_ITEM_REDSTONE_DUST",E_ITEM_REDSTONE_DUST);
+ tolua_constant(tolua_S,"E_ITEM_SNOWBALL",E_ITEM_SNOWBALL);
+ tolua_constant(tolua_S,"E_ITEM_BOAT",E_ITEM_BOAT);
+ tolua_constant(tolua_S,"E_ITEM_LEATHER",E_ITEM_LEATHER);
tolua_constant(tolua_S,"E_ITEM_MILK",E_ITEM_MILK);
+ tolua_constant(tolua_S,"E_ITEM_CLAY_BRICK",E_ITEM_CLAY_BRICK);
+ tolua_constant(tolua_S,"E_ITEM_CLAY",E_ITEM_CLAY);
+ tolua_constant(tolua_S,"E_ITEM_SUGAR_CANE",E_ITEM_SUGAR_CANE);
+ tolua_constant(tolua_S,"E_ITEM_PAPER",E_ITEM_PAPER);
+ tolua_constant(tolua_S,"E_ITEM_BOOK",E_ITEM_BOOK);
+ tolua_constant(tolua_S,"E_ITEM_SLIMEBALL",E_ITEM_SLIMEBALL);
+ tolua_constant(tolua_S,"E_ITEM_CHEST_MINECART",E_ITEM_CHEST_MINECART);
+ tolua_constant(tolua_S,"E_ITEM_FURNACE_MINECART",E_ITEM_FURNACE_MINECART);
tolua_constant(tolua_S,"E_ITEM_EGG",E_ITEM_EGG);
tolua_constant(tolua_S,"E_ITEM_COMPASS",E_ITEM_COMPASS);
tolua_constant(tolua_S,"E_ITEM_FISHING_ROD",E_ITEM_FISHING_ROD);
@@ -15204,7 +15408,49 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_ITEM_GLOWSTONE_DUST",E_ITEM_GLOWSTONE_DUST);
tolua_constant(tolua_S,"E_ITEM_RAW_FISH",E_ITEM_RAW_FISH);
tolua_constant(tolua_S,"E_ITEM_COOKED_FISH",E_ITEM_COOKED_FISH);
+ tolua_constant(tolua_S,"E_ITEM_DYE",E_ITEM_DYE);
+ tolua_constant(tolua_S,"E_ITEM_BONE",E_ITEM_BONE);
+ tolua_constant(tolua_S,"E_ITEM_SUGAR",E_ITEM_SUGAR);
tolua_constant(tolua_S,"E_ITEM_CAKE",E_ITEM_CAKE);
+ tolua_constant(tolua_S,"E_ITEM_BED",E_ITEM_BED);
+ tolua_constant(tolua_S,"E_ITEM_REDSTONE_REPEATER",E_ITEM_REDSTONE_REPEATER);
+ tolua_constant(tolua_S,"E_ITEM_COOKIE",E_ITEM_COOKIE);
+ tolua_constant(tolua_S,"E_ITEM_MAP",E_ITEM_MAP);
+ tolua_constant(tolua_S,"E_ITEM_SHEARS",E_ITEM_SHEARS);
+ tolua_constant(tolua_S,"E_ITEM_MELON_SLICE",E_ITEM_MELON_SLICE);
+ tolua_constant(tolua_S,"E_ITEM_PUMPKIN_SEEDS",E_ITEM_PUMPKIN_SEEDS);
+ tolua_constant(tolua_S,"E_ITEM_MELON_SEEDS",E_ITEM_MELON_SEEDS);
+ tolua_constant(tolua_S,"E_ITEM_RAW_BEEF",E_ITEM_RAW_BEEF);
+ tolua_constant(tolua_S,"E_ITEM_STEAK",E_ITEM_STEAK);
+ tolua_constant(tolua_S,"E_ITEM_RAW_CHICKEN",E_ITEM_RAW_CHICKEN);
+ tolua_constant(tolua_S,"E_ITEM_COOKED_CHICKEN",E_ITEM_COOKED_CHICKEN);
+ tolua_constant(tolua_S,"E_ITEM_ROTTEN_FLESH",E_ITEM_ROTTEN_FLESH);
+ tolua_constant(tolua_S,"E_ITEM_ENDER_PEARL",E_ITEM_ENDER_PEARL);
+ tolua_constant(tolua_S,"E_ITEM_BLAZE_ROD",E_ITEM_BLAZE_ROD);
+ tolua_constant(tolua_S,"E_ITEM_GHAST_TEAR",E_ITEM_GHAST_TEAR);
+ tolua_constant(tolua_S,"E_ITEM_GOLD_NUGGET",E_ITEM_GOLD_NUGGET);
+ tolua_constant(tolua_S,"E_ITEM_NETHER_WART",E_ITEM_NETHER_WART);
+ tolua_constant(tolua_S,"E_ITEM_POTIONS",E_ITEM_POTIONS);
+ tolua_constant(tolua_S,"E_ITEM_GLASS_BOTTLE",E_ITEM_GLASS_BOTTLE);
+ tolua_constant(tolua_S,"E_ITEM_SPIDER_EYE",E_ITEM_SPIDER_EYE);
+ tolua_constant(tolua_S,"E_ITEM_FERMENTED_SPIDER_EYE",E_ITEM_FERMENTED_SPIDER_EYE);
+ tolua_constant(tolua_S,"E_ITEM_BLAZE_POWDER",E_ITEM_BLAZE_POWDER);
+ tolua_constant(tolua_S,"E_ITEM_MAGMA_CREAM",E_ITEM_MAGMA_CREAM);
+ tolua_constant(tolua_S,"E_ITEM_BREWING_STAND",E_ITEM_BREWING_STAND);
+ tolua_constant(tolua_S,"E_ITEM_CAULDRON",E_ITEM_CAULDRON);
+ tolua_constant(tolua_S,"E_ITEM_EYE_OF_ENDER",E_ITEM_EYE_OF_ENDER);
+ tolua_constant(tolua_S,"E_ITEM_GLISTERING_MELON",E_ITEM_GLISTERING_MELON);
+ tolua_constant(tolua_S,"E_ITEM_13_DISC",E_ITEM_13_DISC);
+ tolua_constant(tolua_S,"E_ITEM_CAT_DISC",E_ITEM_CAT_DISC);
+ tolua_constant(tolua_S,"E_ITEM_BLOCKS_DISC",E_ITEM_BLOCKS_DISC);
+ tolua_constant(tolua_S,"E_ITEM_CHIRP_DISC",E_ITEM_CHIRP_DISC);
+ tolua_constant(tolua_S,"E_ITEM_FAR_DISC",E_ITEM_FAR_DISC);
+ tolua_constant(tolua_S,"E_ITEM_MALL_DISC",E_ITEM_MALL_DISC);
+ tolua_constant(tolua_S,"E_ITEM_MELLOHI_DISC",E_ITEM_MELLOHI_DISC);
+ tolua_constant(tolua_S,"E_ITEM_STAL_DISC",E_ITEM_STAL_DISC);
+ tolua_constant(tolua_S,"E_ITEM_STRAD_DISC",E_ITEM_STRAD_DISC);
+ tolua_constant(tolua_S,"E_ITEM_WARD_DISC",E_ITEM_WARD_DISC);
+ tolua_constant(tolua_S,"E_ITEM_11_DISC",E_ITEM_11_DISC);
tolua_constant(tolua_S,"E_KEEP_ALIVE",E_KEEP_ALIVE);
tolua_constant(tolua_S,"E_LOGIN",E_LOGIN);
tolua_constant(tolua_S,"E_HANDSHAKE",E_HANDSHAKE);
@@ -15241,6 +15487,11 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_MAP_CHUNK",E_MAP_CHUNK);
tolua_constant(tolua_S,"E_MULTI_BLOCK",E_MULTI_BLOCK);
tolua_constant(tolua_S,"E_BLOCK_CHANGE",E_BLOCK_CHANGE);
+ tolua_constant(tolua_S,"E_BLOCK_ACTION",E_BLOCK_ACTION);
+ tolua_constant(tolua_S,"E_EXPLOSION",E_EXPLOSION);
+ tolua_constant(tolua_S,"E_SOUND_EFFECT",E_SOUND_EFFECT);
+ tolua_constant(tolua_S,"E_NEW_INVALID_STATE",E_NEW_INVALID_STATE);
+ tolua_constant(tolua_S,"E_THUNDERBOLT",E_THUNDERBOLT);
tolua_constant(tolua_S,"E_WINDOW_OPEN",E_WINDOW_OPEN);
tolua_constant(tolua_S,"E_WINDOW_CLOSE",E_WINDOW_CLOSE);
tolua_constant(tolua_S,"E_WINDOW_CLICK",E_WINDOW_CLICK);
diff --git a/source/Bindings.h b/source/Bindings.h
index 8c6c7302d..844bc3ff0 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 11/01/11 22:50:07.
+** Generated automatically by tolua++-1.0.92 on 11/08/11 02:11:36.
*/
/* Exported function */
diff --git a/source/SquirrelBindings.cpp b/source/SquirrelBindings.cpp
new file mode 100644
index 000000000..20f226e3a
--- /dev/null
+++ b/source/SquirrelBindings.cpp
@@ -0,0 +1,136 @@
+#include "SquirrelBindings.h"
+#if USE_SQUIRREL
+#pragma warning(disable:4100) // Getting A LOT of these warnings from SqPlus
+#pragma warning(disable:4127)
+
+#include "cMCLogger.h"
+
+#include <sqplus/sqplus.h>
+#include <sqplus/SquirrelObject.h>
+#include <../squirrel/sqstate.h>
+#include <../squirrel/sqvm.h>
+#include <stdarg.h>
+
+#include "cPlugin.h"
+#include "cPluginManager.h"
+#include "cRoot.h"
+#include "cPlayer.h"
+
+bool SquirrelBindings::IsBound = false;
+
+bool IsTopClosure( HSQUIRRELVM v )
+{
+ return ( v->_stack[0]._type == OT_CLOSURE );
+}
+
+class __Squirrel_Base_Class // All inheritable classes should extend this class, as it allows virtual functions to call Squirrel
+{
+public:
+ template<typename T>
+ static int ConstructAndDestruct(HSQUIRRELVM v, T* a_Instance, SQRELEASEHOOK a_ReleaseHook )
+ {
+ LOG("ConstructAndDestruct()");
+
+ StackHandler sa(v);
+ HSQOBJECT ho = sa.GetObjectHandle(1); // OT_INSTANCE
+ SquirrelObject instance(ho);
+ SqPlus::PopulateAncestry(v, instance, a_Instance);
+ a_Instance->vm = v;
+ a_Instance->obj = instance;
+
+ sq_setinstanceup(v, 1, a_Instance);
+ sq_setreleasehook(v, 1, a_ReleaseHook);
+ return TRUE;
+ }
+
+ HSQUIRRELVM vm;
+ SquirrelObject obj;
+};
+
+class cPlugin__Squirrel : public cPlugin, public __Squirrel_Base_Class
+{
+public:
+ cPlugin__Squirrel() { SetLanguage( cPlugin::E_SQUIRREL ); }
+
+ bool Initialize() // This is a pure virtual function, so it NEEDS an implementation on the script side or it would be an illegal instance
+ {
+ SqPlus::SquirrelFunction<bool> InitFunc(obj, "Initialize");
+ if( !InitFunc.func.IsNull() )
+ return InitFunc();
+ LOGWARN("cPlugin__Squirrel::Initialize() Pure virtual function called!"); // Spam some errorz to make it clear this function needs to be implemented
+ return false;
+ }
+
+ static int constructor(HSQUIRRELVM v) { return ConstructAndDestruct( v, new cPlugin__Squirrel, SqPlus::ReleaseClassPtr<cPlugin__Squirrel>::release ); }
+
+ virtual bool OnChat( const char* a_Chat, cPlayer* a_Player )
+ {
+ if( !IsTopClosure(vm) ) // Avoid recursion (TODO: FIXME: THIS NEEDS MORE RESEARCH!)
+ { //Called from C++
+ return SqPlus::SquirrelFunction<bool>(obj, "OnChat")(a_Chat, a_Player);
+ }
+ else // Called from Squirrel
+ {
+ return cPlugin::OnChat(a_Chat, a_Player);
+ }
+ }
+};
+
+static void printFunc(HSQUIRRELVM v,const SQChar * s,...)
+{
+ (void)v;
+ va_list vl;
+ va_start(vl,s);
+ cMCLogger::GetInstance()->Log( s, vl );
+ va_end(vl);
+}
+
+DECLARE_INSTANCE_TYPE( cRoot );
+DECLARE_INSTANCE_TYPE( cPluginManager );
+DECLARE_ENUM_TYPE( cPluginManager::PluginHook );
+DECLARE_INSTANCE_TYPE( cPlugin );
+DECLARE_INSTANCE_TYPE( cPlugin__Squirrel );
+
+DECLARE_INSTANCE_TYPE( cEntity );
+DECLARE_INSTANCE_TYPE( cPawn );
+DECLARE_INSTANCE_TYPE( cPlayer );
+
+void SquirrelBindings::Bind( HSQUIRRELVM a_SquirrelVM )
+{
+ IsBound = true;
+
+ sq_setprintfunc(a_SquirrelVM, printFunc, printFunc);
+
+
+ SqPlus::SQClassDefNoConstructor<cEntity>("cEntity");
+ SqPlus::SQClassDefNoConstructor<cPawn, cEntity>("cPawn", "cEntity");
+ SqPlus::SQClassDefNoConstructor<cPlayer, cPawn>("cPlayer", "cPawn"). // All NoConstructor because they need a custom one
+ func(&cPlayer::GetName, "GetName");
+
+ SqPlus::SQClassDefNoConstructor<cPlugin>("cPlugin").
+ func(&cPlugin::SetName, "SetName").
+ func(&cPlugin::GetName, "GetName").
+ func(&cPlugin::GetVersion, "GetVersion").
+ func(&cPlugin::OnChat, "OnChat");
+
+
+ SqPlus::SQClassDef<cPlugin__Squirrel, cPlugin>("cPlugin__Squirrel", "cPlugin").
+ staticFunc(&cPlugin__Squirrel::constructor, "constructor");
+
+
+ SqPlus::SQClassDefNoConstructor<cRoot>("cRoot").
+ staticFunc(&cRoot::Get, "Get").
+ func(static_cast<cPluginManager* (__thiscall cRoot::*)(void)>(&cRoot::GetPluginManager), "GetPluginManager");
+
+
+ SqPlus::SQClassDefNoConstructor<cPluginManager>("cPluginManager").
+ overloadFunc<bool (cPluginManager::*)(cPlugin*)>(&cPluginManager::AddPlugin, "AddPlugin").
+ func(&cPluginManager::GetPlugin, "GetPlugin").
+ func(&cPluginManager::AddHook, "AddHook").
+ enumInt( cPluginManager::E_PLUGIN_CHAT, "E_PLUGIN_CHAT");
+
+
+
+}
+
+#endif \ No newline at end of file
diff --git a/source/SquirrelBindings.h b/source/SquirrelBindings.h
new file mode 100644
index 000000000..492014560
--- /dev/null
+++ b/source/SquirrelBindings.h
@@ -0,0 +1,15 @@
+#pragma once
+
+#define USE_SQUIRREL 0
+
+#if USE_SQUIRREL
+
+struct SQVM;
+class SquirrelBindings
+{
+public:
+ static void Bind( SQVM* a_SquirrelVM );
+ static bool IsBound;
+};
+
+#endif \ No newline at end of file
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index 79488f0c4..2632d5ac6 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -69,6 +69,7 @@
#ifndef _WIN32
#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
+#include <stdlib.h> // rand()
#endif
#define AddPistonDir( x, y, z, dir, amount ) switch(dir) { case 0: (y)-=(amount); break; case 1: (y)+=(amount); break;\
diff --git a/source/cPlugin.cpp b/source/cPlugin.cpp
index 10f5d74d3..5fc056a2d 100644
--- a/source/cPlugin.cpp
+++ b/source/cPlugin.cpp
@@ -5,6 +5,7 @@
cPlugin::cPlugin()
: m_Version( 0 )
+ , m_Language( E_CPP )
{
}
@@ -44,7 +45,7 @@ bool cPlugin::OnDisconnect( std::string a_Reason, cPlayer* a_Player )
return false;
}
-bool cPlugin::OnChat( std::string a_Chat, cPlayer* a_Player )
+bool cPlugin::OnChat( const char* a_Chat, cPlayer* a_Player )
{
(void)a_Chat;
(void)a_Player;
diff --git a/source/cPlugin.h b/source/cPlugin.h
index 6c38871f3..a1e2a358f 100644
--- a/source/cPlugin.h
+++ b/source/cPlugin.h
@@ -41,7 +41,7 @@ public:
virtual bool OnDisconnect( std::string a_Reason, cPlayer* a_Player );
virtual bool OnBlockPlace( cPacket_BlockPlace* a_PacketData, cPlayer* a_Player );
virtual bool OnBlockDig( cPacket_BlockDig* a_PacketData, cPlayer* a_Player, cItem* a_PickupItem ) { (void)a_PacketData; (void)a_Player; (void)a_PickupItem; return false; }
- virtual bool OnChat( std::string a_Chat, cPlayer* a_Player );
+ virtual bool OnChat( const char* a_Chat, cPlayer* a_Player );
virtual bool OnLogin( cPacket_Login* a_PacketData );
virtual void OnPlayerSpawn( cPlayer* a_Player );
virtual bool OnPlayerJoin( cPlayer* a_Player );
@@ -50,8 +50,8 @@ public:
virtual bool OnKilled( cPawn* a_Killed, cEntity* a_Killer ) { (void)a_Killed; (void)a_Killer; return false; }
// Accessors
- std::string GetName() const { return m_Name; }
- void SetName( std::string a_Name ) { m_Name = a_Name; }
+ const char* GetName() const { return m_Name.c_str(); }
+ void SetName( const char* a_Name ) { m_Name = a_Name; }
int GetVersion() const { return m_Version; }
void SetVersion( int a_Version ) { m_Version = a_Version; }
@@ -69,7 +69,19 @@ public:
void BindCommand( FuncCommandHandler* a_Function, std::string & a_Command ); // >> EXPORTED IN MANUALBINDINGS <<
const std::vector< CommandStruct > & GetCommands() const { return m_Commands; } // >> EXPORTED IN MANUALBINDINGS <<
+
+ /* This should not be exposed to scripting languages */
+ enum PluginLanguage
+ {
+ E_CPP,
+ E_LUA,
+ E_SQUIRREL,
+ };
+ PluginLanguage GetLanguage() { return m_Language; }
+ void SetLanguage( PluginLanguage a_Language ) { m_Language = a_Language; }
+
private:
+ PluginLanguage m_Language;
std::vector< CommandStruct > m_Commands;
std::string m_Name;
int m_Version;
diff --git a/source/cPluginManager.cpp b/source/cPluginManager.cpp
index db776f0a7..f1369bf46 100644
--- a/source/cPluginManager.cpp
+++ b/source/cPluginManager.cpp
@@ -6,10 +6,16 @@
#include "cItem.h"
#include "cRoot.h"
#include "cLuaCommandBinder.h"
-
+#include "../iniFile/iniFile.h"
+#include <string> //strcmp
#include <stdarg.h>
-#include "../iniFile/iniFile.h"
+#include "SquirrelBindings.h"
+#if USE_SQUIRREL
+#pragma warning(disable:4100;disable:4127;disable:4510;disable:4610;disable:4244;disable:4512) // Getting A LOT of these warnings from SqPlus
+#include <sqplus/sqplus.h>
+#pragma warning(default:4100;default:4127;default:4510;default:4610;default:4244;default:4512)
+#endif
extern std::vector<std::string> StringSplit(std::string str, std::string delim);
@@ -39,6 +45,7 @@ cPluginManager::cPluginManager()
cPluginManager::~cPluginManager()
{
UnloadPluginsNow();
+
delete m_LuaCommandBinder;
delete m_pState;
}
@@ -54,6 +61,16 @@ void cPluginManager::ReloadPluginsNow()
m_bReloadPlugins = false;
UnloadPluginsNow();
+
+
+#if USE_SQUIRREL
+ if( !SquirrelBindings::IsBound ) // Can only do this once apparently, or we're making ambiguous calls in the script
+ {
+ SquirrelVM::Init();
+ SquirrelBindings::Bind( SquirrelVM::GetVMPtr() );
+ }
+#endif
+
cIniFile IniFile("settings.ini");
if( IniFile.ReadFile() )
{
@@ -64,10 +81,10 @@ void cPluginManager::ReloadPluginsNow()
for(unsigned int i = 0; i < NumPlugins; i++)
{
std::string ValueName = IniFile.GetValueName(KeyNum, i );
- if( ValueName.compare("Plugin") == 0 )
- { // It's a plugin
+ if( ValueName.compare("Plugin") == 0 ) // It's a Lua plugin
+ {
std::string PluginFile = IniFile.GetValue(KeyNum, i );
- if( PluginFile.compare("") != 0 )
+ if( !PluginFile.empty() )
{
// allow for comma separated plugin list
// degrades and works fine for the plugin
@@ -82,6 +99,32 @@ void cPluginManager::ReloadPluginsNow()
}
}
}
+#if USE_SQUIRREL
+ else if( ValueName.compare("Squirrel") == 0 ) // Squirrel plugin
+ {
+ std::string PluginFile = IniFile.GetValue(KeyNum, i );
+ if( !PluginFile.empty() )
+ {
+ LOGINFO("Loading Squirrel plugin: %s", PluginFile.c_str() );
+ try
+ {
+ SquirrelObject SquirrelScript = SquirrelVM::CompileScript( (std::string("Plugins/") + PluginFile + ".nut").c_str() );
+ try
+ {
+ SquirrelVM::RunScript( SquirrelScript );
+ }
+ catch (SquirrelError & e)
+ {
+ LOGERROR("Error: %s, %s\n", e.desc, "SquirrelVM::RunScript");
+ }
+ }
+ catch (SquirrelError & e)
+ {
+ LOGERROR("Error: %s, %s\n", e.desc, "SquirrelVM::CompileScript");
+ }
+ }
+ }
+#endif
}
}
@@ -98,6 +141,8 @@ void cPluginManager::ReloadPluginsNow()
{
LOG("WARNING: Can't find settings.ini, so can't load any plugins.");
}
+
+
LOG("--Done loading plugins--");
}
@@ -291,11 +336,11 @@ bool cPluginManager::CallHook( PluginHook a_Hook, unsigned int a_NumArgs, ... )
return false;
}
-cPlugin* cPluginManager::GetPlugin( std::string a_Plugin )
+cPlugin* cPluginManager::GetPlugin( const char* a_Plugin )
{
for( PluginList::iterator itr = m_pState->Plugins.begin(); itr != m_pState->Plugins.end(); ++itr )
{
- if( (*itr)->GetName().compare( a_Plugin ) == 0 )
+ if( std::string( (*itr)->GetName() ).compare( a_Plugin ) == 0 )
{
return *itr;
}
@@ -328,6 +373,25 @@ void cPluginManager::UnloadPluginsNow()
{
RemovePlugin( *m_pState->Plugins.begin(), true );
}
+
+ //SquirrelVM::Shutdown(); // This breaks shit
+}
+
+void cPluginManager::RemoveHooks( cPlugin* a_Plugin )
+{
+ m_pState->Hooks[ E_PLUGIN_TICK ].remove( a_Plugin );
+ m_pState->Hooks[ E_PLUGIN_CHAT ].remove( a_Plugin );
+ m_pState->Hooks[ E_PLUGIN_COLLECT_ITEM ].remove( a_Plugin );
+ m_pState->Hooks[ E_PLUGIN_BLOCK_DIG ].remove( a_Plugin );
+ m_pState->Hooks[ E_PLUGIN_BLOCK_PLACE ].remove( a_Plugin );
+ m_pState->Hooks[ E_PLUGIN_DISCONNECT ].remove( a_Plugin );
+ m_pState->Hooks[ E_PLUGIN_HANDSHAKE ].remove( a_Plugin );
+ m_pState->Hooks[ E_PLUGIN_LOGIN ].remove( a_Plugin );
+ m_pState->Hooks[ E_PLUGIN_PLAYER_SPAWN ].remove( a_Plugin );
+ m_pState->Hooks[ E_PLUGIN_PLAYER_JOIN ].remove( a_Plugin );
+ m_pState->Hooks[ E_PLUGIN_PLAYER_MOVE ].remove( a_Plugin );
+ m_pState->Hooks[ E_PLUGIN_TAKE_DAMAGE ].remove( a_Plugin );
+ m_pState->Hooks[ E_PLUGIN_KILLED ].remove( a_Plugin );
}
void cPluginManager::RemovePlugin( cPlugin* a_Plugin, bool a_bDelete /* = false */ )
@@ -336,8 +400,10 @@ void cPluginManager::RemovePlugin( cPlugin* a_Plugin, bool a_bDelete /* = false
{
m_LuaCommandBinder->RemoveBindingsForPlugin( a_Plugin );
m_pState->Plugins.remove( a_Plugin );
+ RemoveHooks( a_Plugin );
a_Plugin->OnDisable();
- delete a_Plugin;
+ if( a_Plugin->GetLanguage() != cPlugin::E_SQUIRREL ) // Squirrel needs to clean it up himself!
+ delete a_Plugin;
}
else
{
@@ -356,11 +422,14 @@ bool cPluginManager::AddPlugin( cPlugin* a_Plugin )
m_pState->Plugins.push_back( a_Plugin );
return true;
}
+
+ RemoveHooks( a_Plugin ); // Undo any damage the Initialize() might have done
return false;
}
bool cPluginManager::AddPlugin( lua_State* a_LuaState, cPlugin* a_Plugin )
{
+ a_Plugin->SetLanguage( cPlugin::E_LUA );
cPlugin_Lua* LuaPlugin = GetLuaPlugin( a_LuaState );
if( LuaPlugin && a_Plugin->Initialize() )
{
@@ -391,8 +460,8 @@ void cPluginManager::RemoveLuaPlugin( std::string a_FileName )
if( (*itr)->GetFileName() == a_FileName )
{
cPlugin_Lua* Plugin = *itr;
- delete Plugin;
m_pState->LuaPlugins.remove( Plugin );
+ delete Plugin;
return;
}
}
diff --git a/source/cPluginManager.h b/source/cPluginManager.h
index 6a94060e0..ebe974b11 100644
--- a/source/cPluginManager.h
+++ b/source/cPluginManager.h
@@ -34,7 +34,7 @@ public: //tolua_export
static cPluginManager * GetPluginManager(); //tolua_export
typedef std::list< cPlugin* > PluginList;
- cPlugin* GetPlugin( std::string a_Plugin ); //tolua_export
+ cPlugin* GetPlugin( const char* a_Plugin ); //tolua_export
const PluginList & GetAllPlugins(); // >> EXPORTED IN MANUALBINDINGS <<
void ReloadPlugins(); //tolua_export
@@ -47,6 +47,7 @@ public: //tolua_export
bool CallHook( PluginHook a_Hook, unsigned int a_NumArgs, ... );
+ void RemoveHooks( cPlugin* a_Plugin );
void RemovePlugin( cPlugin* a_Plugin, bool a_bDelete = false ); //tolua_export
void RemoveLuaPlugin( std::string a_FileName ); //tolua_export
cPlugin_Lua* GetLuaPlugin( lua_State* a_State ); //tolua_export
diff --git a/source/cWebAdmin.cpp b/source/cWebAdmin.cpp
index 03775ee3f..bc22a4681 100644
--- a/source/cWebAdmin.cpp
+++ b/source/cWebAdmin.cpp
@@ -109,7 +109,7 @@ void cWebAdmin::Request_Handler(webserver::http_request* r)
const cPluginManager::PluginList & List = PM->GetAllPlugins();
for( cPluginManager::PluginList::const_iterator itr = List.begin(); itr != List.end(); ++itr )
{
- Content += (*itr)->GetName() + "<br>";
+ Content += std::string( (*itr)->GetName() ) + "<br>";
}
Content += "</p>";
Content += "<h4>Players:</h4><p>";
diff --git a/source/main.cpp b/source/main.cpp
index 1868e30ca..cbe499281 100644
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -9,6 +9,13 @@
#include <csignal> //std::signal
#include <stdlib.h> //exit()
+#include "SquirrelBindings.h"
+#if USE_SQUIRREL
+#pragma warning(disable:4100;disable:4127;disable:4510;disable:4610;disable:4244;disable:4512) // Getting A LOT of these warnings from SqPlus
+#include <sqplus/sqplus.h>
+#pragma warning(default:4100;default:4127;default:4510;default:4610;default:4244;default:4512)
+#endif
+
void ShowCrashReport(int)
{
std::signal(SIGSEGV, SIG_DFL);
@@ -43,6 +50,11 @@ int main( int argc, char **argv )
{
LOGERROR("Unknown exception!");
}
+
+#if USE_SQUIRREL
+ SquirrelVM::Shutdown();
+#endif
+
#ifdef _DEBUG
_CrtDumpMemoryLeaks();
#endif