From 68ff0edfde8d2c81e92e7b1334f8e9f19f4517d9 Mon Sep 17 00:00:00 2001 From: Gargaj Date: Tue, 15 Dec 2015 21:11:58 +0100 Subject: allow horse control (still quite buggy) --- src/Mobs/Horse.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/Mobs/Horse.cpp') diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp index a338f12bd..f133f9912 100644 --- a/src/Mobs/Horse.cpp +++ b/src/Mobs/Horse.cpp @@ -23,7 +23,8 @@ cHorse::cHorse(int Type, int Color, int Style, int TameTimes) : m_Armour(0), m_TimesToTame(TameTimes), m_TameAttemptTimes(0), - m_RearTickCount(0) + m_RearTickCount(0), + m_Speed(20.0) { } @@ -67,6 +68,7 @@ void cHorse::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) } else { + // TODO: emit hearts here m_bIsTame = true; } } @@ -158,3 +160,21 @@ void cHorse::GetDrops(cItems & a_Drops, cEntity * a_Killer) + +void cHorse::InStateIdle(std::chrono::milliseconds a_Dt) +{ + // If horse is tame and someone is sitting on it, don't walk around + if ((!m_bIsTame) || (m_Attachee == nullptr)) + { + super::InStateIdle(a_Dt); + } +} + + + + + +void cHorse::HandleSpeedFromAttachee(float a_Forward, float a_Sideways) +{ + super::HandleSpeedFromAttachee(a_Forward * m_Speed, a_Sideways * m_Speed); +} -- cgit v1.2.3