summaryrefslogtreecommitdiffstats
path: root/src/Entities/Minecart.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities/Minecart.cpp')
-rw-r--r--src/Entities/Minecart.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index ad63f848e..c8f43a3e6 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -118,6 +118,7 @@ void cMinecart::SpawnOn(cClientHandle & a_ClientHandle)
}
}
a_ClientHandle.SendSpawnVehicle(*this, 10, SubType); // 10 = Minecarts, SubType = What type of Minecart
+ a_ClientHandle.SendEntityMetadata(*this);
}
@@ -212,7 +213,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
{
case E_META_RAIL_ZM_ZP: // NORTHSOUTH
{
- SetRotation(270);
+ SetYaw(270);
SetPosY(floor(GetPosY()) + 0.55);
SetSpeedY(0); // Don't move vertically as on ground
SetSpeedX(0); // Correct diagonal movement from curved rails
@@ -238,7 +239,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_XM_XP: // EASTWEST
{
- SetRotation(180);
+ SetYaw(180);
SetPosY(floor(GetPosY()) + 0.55);
SetSpeedY(0);
SetSpeedZ(0);
@@ -261,7 +262,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_ASCEND_ZM: // ASCEND NORTH
{
- SetRotation(270);
+ SetYaw(270);
SetSpeedX(0);
if (GetSpeedZ() >= 0)
@@ -283,7 +284,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_ASCEND_ZP: // ASCEND SOUTH
{
- SetRotation(270);
+ SetYaw(270);
SetSpeedX(0);
if (GetSpeedZ() > 0)
@@ -305,7 +306,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_ASCEND_XM: // ASCEND EAST
{
- SetRotation(180);
+ SetYaw(180);
SetSpeedZ(0);
if (GetSpeedX() >= 0)
@@ -325,7 +326,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_ASCEND_XP: // ASCEND WEST
{
- SetRotation(180);
+ SetYaw(180);
SetSpeedZ(0);
if (GetSpeedX() > 0)
@@ -345,7 +346,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_CURVED_ZM_XM: // Ends pointing NORTH and WEST
{
- SetRotation(315); // Set correct rotation server side
+ SetYaw(315); // Set correct rotation server side
SetPosY(floor(GetPosY()) + 0.55); // Levitate dat cart
TestBlockCollision(a_RailMeta);
@@ -357,7 +358,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_CURVED_ZM_XP: // Curved NORTH EAST
{
- SetRotation(225);
+ SetYaw(225);
SetPosY(floor(GetPosY()) + 0.55);
TestBlockCollision(a_RailMeta);
@@ -367,7 +368,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_CURVED_ZP_XM: // Curved SOUTH WEST
{
- SetRotation(135);
+ SetYaw(135);
SetPosY(floor(GetPosY()) + 0.55);
TestBlockCollision(a_RailMeta);
@@ -377,7 +378,7 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
}
case E_META_RAIL_CURVED_ZP_XP: // Curved SOUTH EAST
{
- SetRotation(45);
+ SetYaw(45);
SetPosY(floor(GetPosY()) + 0.55);
TestBlockCollision(a_RailMeta);
@@ -413,7 +414,7 @@ void cMinecart::HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta)
{
case E_META_RAIL_ZM_ZP: // NORTHSOUTH
{
- SetRotation(270);
+ SetYaw(270);
SetPosY(floor(GetPosY()) + 0.55);
SetSpeedY(0);
SetSpeedX(0);
@@ -435,7 +436,7 @@ void cMinecart::HandlePoweredRailPhysics(NIBBLETYPE a_RailMeta)
}
case E_META_RAIL_XM_XP: // EASTWEST
{
- SetRotation(180);
+ SetYaw(180);
SetPosY(floor(GetPosY()) + 0.55);
SetSpeedY(0);
SetSpeedZ(0);
@@ -841,10 +842,12 @@ void cMinecart::Destroyed()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// cEmptyMinecart:
+// cRideableMinecart:
-cEmptyMinecart::cEmptyMinecart(double a_X, double a_Y, double a_Z) :
- super(mpNone, a_X, a_Y, a_Z)
+cRideableMinecart::cRideableMinecart(double a_X, double a_Y, double a_Z, const cItem & a_Content, int a_Height) :
+ super(mpNone, a_X, a_Y, a_Z),
+ m_Content(a_Content),
+ m_Height(a_Height)
{
}
@@ -852,7 +855,7 @@ cEmptyMinecart::cEmptyMinecart(double a_X, double a_Y, double a_Z) :
-void cEmptyMinecart::OnRightClicked(cPlayer & a_Player)
+void cRideableMinecart::OnRightClicked(cPlayer & a_Player)
{
if (m_Attachee != NULL)
{