summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--VC2008/MCServer.vcproj4
-rw-r--r--VC2010/MCServer.vcxproj3
-rw-r--r--VC2010/MCServer.vcxproj.filters5
-rw-r--r--source/cClientHandle.cpp31
-rw-r--r--source/cVine.h24
5 files changed, 52 insertions, 15 deletions
diff --git a/VC2008/MCServer.vcproj b/VC2008/MCServer.vcproj
index f81bedf26..058f8be77 100644
--- a/VC2008/MCServer.vcproj
+++ b/VC2008/MCServer.vcproj
@@ -1388,6 +1388,10 @@
RelativePath="..\source\cTorch.h"
>
</File>
+ <File
+ RelativePath="..\source\cVine.h"
+ >
+ </File>
</Filter>
<Filter
Name="UI"
diff --git a/VC2010/MCServer.vcxproj b/VC2010/MCServer.vcxproj
index 6768105cc..324c499f4 100644
--- a/VC2010/MCServer.vcxproj
+++ b/VC2010/MCServer.vcxproj
@@ -522,6 +522,7 @@
<ClInclude Include="..\source\ChunkSender.h" />
<ClInclude Include="..\source\cIsThread.h" />
<ClInclude Include="..\Source\cLadder.h" />
+ <ClInclude Include="..\Source\cVine.h" />
<ClInclude Include="..\source\cLavaSimulator.h" />
<ClInclude Include="..\Source\cLuaCommandBinder.h" />
<ClInclude Include="..\source\cMakeDir.h" />
@@ -705,4 +706,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project> \ No newline at end of file
+</Project>
diff --git a/VC2010/MCServer.vcxproj.filters b/VC2010/MCServer.vcxproj.filters
index 0db247c6c..0a3e16992 100644
--- a/VC2010/MCServer.vcxproj.filters
+++ b/VC2010/MCServer.vcxproj.filters
@@ -996,6 +996,9 @@
<ClInclude Include="..\Source\cLadder.h">
<Filter>HandyStuff</Filter>
</ClInclude>
+ <ClInclude Include="..\Source\cVine.h">
+ <Filter>HandyStuff</Filter>
+ </ClInclude>
<ClInclude Include="..\Source\cGroupManager.h">
<Filter>cGroupManager</Filter>
</ClInclude>
@@ -1427,4 +1430,4 @@
<ItemGroup>
<ResourceCompile Include="MCServer.rc" />
</ItemGroup>
-</Project> \ No newline at end of file
+</Project>
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index 645eb673b..df97b74f6 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -18,6 +18,7 @@
#include "cStep.h"
#include "cDoors.h"
#include "cLadder.h"
+#include "cVine.h"
#include "cSign.h"
#include "cRedstone.h"
#include "cPiston.h"
@@ -307,7 +308,7 @@ void cClientHandle::Authenticate(void)
m_Player->SetIP (m_Socket.GetIPString());
- cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::E_PLUGIN_PLAYER_SPAWN, 1, m_Player);
+ cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::HOOK_PLAYER_SPAWN, 1, m_Player);
// Return a server login packet
cPacket_Login LoginResponse;
@@ -686,7 +687,7 @@ void cClientHandle::HandleLogin(cPacket_Login * a_Packet)
return;
}
- if (cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::E_PLUGIN_LOGIN, 1, a_Packet))
+ if (cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::HOOK_LOGIN, 1, a_Packet))
{
Destroy();
return;
@@ -796,7 +797,7 @@ void cClientHandle::HandleBlockDig(cPacket_BlockDig * a_Packet)
BLOCKTYPE OldBlock = World->GetBlock(a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ);
NIBBLETYPE OldMeta = World->GetBlockMeta(a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ);
- if (cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::E_PLUGIN_BLOCK_DIG, 4, a_Packet, m_Player, OldBlock, OldMeta))
+ if (cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::HOOK_BLOCK_DIG, 4, a_Packet, m_Player, OldBlock, OldMeta))
{
// The plugin doesn't agree with the digging, replace the block on the client and quit:
World->SendBlockTo(a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ, m_Player);
@@ -921,7 +922,7 @@ void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet)
return;
}
- if (cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::E_PLUGIN_BLOCK_PLACE, 2, a_Packet, m_Player))
+ if (cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::HOOK_BLOCK_PLACE, 2, a_Packet, m_Player))
{
if (a_Packet->m_Direction > -1)
{
@@ -1032,7 +1033,6 @@ void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet)
if (ClickedBlock == E_BLOCK_STEP)
{
// Only make double slab if meta values are the same and if player clicked either on top or on bottom of the block (direction either 0 or 1)
- // TODO check if it works from beneath
if (MetaData == ( m_Player->GetWorld()->GetBlockMeta(a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ) & 0x7) && a_Packet->m_Direction <= 1)
//if (MetaData == m_Player->GetWorld()->GetBlockMeta(a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ) && a_Packet->m_Direction == 1)
{
@@ -1049,7 +1049,7 @@ void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet)
}
}
- if ((ClickedBlock == E_BLOCK_SNOW) || (ClickedBlock == E_BLOCK_TALL_GRASS))
+ if ((ClickedBlock == E_BLOCK_SNOW) || (ClickedBlock == E_BLOCK_TALL_GRASS) || (ClickedBlock == E_BLOCK_VINES))
{
switch (a_Packet->m_Direction)
{
@@ -1216,11 +1216,11 @@ void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet)
break;
}
- case E_BLOCK_STEP:
- {
- MetaData += cStep::DirectionToMetaData( a_Packet->m_Direction );
- break;
- }
+ case E_BLOCK_STEP:
+ {
+ MetaData += cStep::DirectionToMetaData( a_Packet->m_Direction );
+ break;
+ }
case E_BLOCK_COBBLESTONE_STAIRS:
case E_BLOCK_BRICK_STAIRS:
@@ -1231,6 +1231,11 @@ void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet)
MetaData = cStairs::RotationToMetaData(m_Player->GetRotation(), a_Packet->m_Direction);
break;
}
+ case E_BLOCK_VINES:
+ {
+ MetaData = cVine::DirectionToMetaData(a_Packet->m_Direction);
+ break;
+ }
case E_BLOCK_LADDER:
{
MetaData = cLadder::DirectionToMetaData(a_Packet->m_Direction);
@@ -1579,7 +1584,7 @@ void cClientHandle::HandleRespawn(void)
void cClientHandle::HandleDisconnect(cPacket_Disconnect * a_Packet)
{
LOG("Received d/c packet from \"%s\"", m_Username.c_str());
- if (!cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::E_PLUGIN_DISCONNECT, 2, a_Packet->m_Reason.c_str(), m_Player))
+ if (!cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::HOOK_DISCONNECT, 2, a_Packet->m_Reason.c_str(), m_Player))
{
cPacket_Chat DisconnectMessage(m_Username + " disconnected: " + a_Packet->m_Reason);
cRoot::Get()->GetServer()->Broadcast(DisconnectMessage);
@@ -1838,7 +1843,7 @@ void cClientHandle::SendConfirmPosition(void)
m_State = csConfirmingPos;
- if (!cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::E_PLUGIN_PLAYER_JOIN, 1, m_Player))
+ if (!cRoot::Get()->GetPluginManager()->CallHook(cPluginManager::HOOK_PLAYER_JOIN, 1, m_Player))
{
// Broadcast that this player has joined the game! Yay~
cPacket_Chat Joined(m_Username + " joined the game!");
diff --git a/source/cVine.h b/source/cVine.h
new file mode 100644
index 000000000..6d2a92d15
--- /dev/null
+++ b/source/cVine.h
@@ -0,0 +1,24 @@
+#pragma once
+
+class cVine //tolua_export
+{ //tolua_export
+public:
+
+ static char DirectionToMetaData( char a_Direction )
+ {
+ switch (a_Direction)
+ {
+ case 0x2:
+ return 0x1;
+ case 0x3:
+ return 0x4;
+ case 0x4:
+ return 0x8;
+ case 0x5:
+ return 0x2;
+ default:
+ return 0xf;
+ };
+ return 0xf;
+ } //tolua_export
+}; //tolua_export \ No newline at end of file