summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2017-07-02 07:40:59 +0200
committerLukas Pioch <lukas@zgow.de>2017-07-02 07:40:59 +0200
commitb1628846d9a47df35b107fbd9979a5f3c1a91656 (patch)
treed1919db25997bc418573c638aab468557683ee1a /src
parentPlayers in creative and spectator aren't affected by cacti (#3824) (diff)
downloadcuberite-b1628846d9a47df35b107fbd9979a5f3c1a91656.tar
cuberite-b1628846d9a47df35b107fbd9979a5f3c1a91656.tar.gz
cuberite-b1628846d9a47df35b107fbd9979a5f3c1a91656.tar.bz2
cuberite-b1628846d9a47df35b107fbd9979a5f3c1a91656.tar.lz
cuberite-b1628846d9a47df35b107fbd9979a5f3c1a91656.tar.xz
cuberite-b1628846d9a47df35b107fbd9979a5f3c1a91656.tar.zst
cuberite-b1628846d9a47df35b107fbd9979a5f3c1a91656.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Horse.cpp40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp
index acf79d3b1..b51e7843e 100644
--- a/src/Mobs/Horse.cpp
+++ b/src/Mobs/Horse.cpp
@@ -4,6 +4,7 @@
#include "../World.h"
#include "../EffectID.h"
#include "../Entities/Player.h"
+#include "Broadcaster.h"
@@ -24,7 +25,7 @@ cHorse::cHorse(int Type, int Color, int Style, int TameTimes) :
m_TimesToTame(TameTimes),
m_TameAttemptTimes(0),
m_RearTickCount(0),
- m_MaxSpeed(20.0)
+ m_MaxSpeed(14.0)
{
}
@@ -75,7 +76,7 @@ void cHorse::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
}
else
{
- // TODO: emit hearts here
+ m_World->GetBroadcaster().BroadcastParticleEffect("heart", static_cast<Vector3f>(GetPosition()), Vector3f{}, 0, 5);
m_bIsTame = true;
}
}
@@ -104,26 +105,31 @@ void cHorse::OnRightClicked(cPlayer & a_Player)
{
super::OnRightClicked(a_Player);
- if (!m_bIsSaddled && m_bIsTame)
+ if (m_bIsTame)
{
- if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_SADDLE)
+ if (!m_bIsSaddled)
{
- // Saddle the horse:
- if (!a_Player.IsGameModeCreative())
+ if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_SADDLE)
{
- a_Player.GetInventory().RemoveOneEquippedItem();
+ // Saddle the horse:
+ if (!a_Player.IsGameModeCreative())
+ {
+ a_Player.GetInventory().RemoveOneEquippedItem();
+ }
+ m_bIsSaddled = true;
+ m_World->BroadcastEntityMetadata(*this);
+ }
+ else
+ {
+ a_Player.AttachTo(this);
}
- m_bIsSaddled = true;
- m_World->BroadcastEntityMetadata(*this);
}
- else if (!a_Player.GetEquippedItem().IsEmpty())
+ else
{
- // The horse doesn't like being hit, make it rear:
- m_bIsRearing = true;
- m_RearTickCount = 0;
+ a_Player.AttachTo(this);
}
}
- else
+ else if (a_Player.GetEquippedItem().IsEmpty())
{
if (m_Attachee != nullptr)
{
@@ -144,6 +150,12 @@ void cHorse::OnRightClicked(cPlayer & a_Player)
m_TameAttemptTimes++;
a_Player.AttachTo(this);
}
+ else
+ {
+ m_bIsRearing = true;
+ m_RearTickCount = 0;
+ m_World->BroadcastSoundEffect("entity.horse.angry", GetPosX(), GetPosY(), GetPosZ(), 1.0f, 0.8f);
+ }
}