summaryrefslogtreecommitdiffstats
path: root/source/Mobs/Villager.cpp
diff options
context:
space:
mode:
authorSamuel Barney <samjbarney@gmail.com>2013-10-14 17:42:43 +0200
committerSamuel Barney <samjbarney@gmail.com>2013-10-14 17:42:43 +0200
commit5df5176f8d1793b44c7e2353cb46ca0966be1bdd (patch)
tree95343394cd9902ceaf885f379342c593392e9c16 /source/Mobs/Villager.cpp
parentMobs no longer spawn up in the air. (diff)
parentAPIDump: Documented HOOK_HANDSHAKE. (diff)
downloadcuberite-5df5176f8d1793b44c7e2353cb46ca0966be1bdd.tar
cuberite-5df5176f8d1793b44c7e2353cb46ca0966be1bdd.tar.gz
cuberite-5df5176f8d1793b44c7e2353cb46ca0966be1bdd.tar.bz2
cuberite-5df5176f8d1793b44c7e2353cb46ca0966be1bdd.tar.lz
cuberite-5df5176f8d1793b44c7e2353cb46ca0966be1bdd.tar.xz
cuberite-5df5176f8d1793b44c7e2353cb46ca0966be1bdd.tar.zst
cuberite-5df5176f8d1793b44c7e2353cb46ca0966be1bdd.zip
Diffstat (limited to 'source/Mobs/Villager.cpp')
-rw-r--r--source/Mobs/Villager.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/source/Mobs/Villager.cpp b/source/Mobs/Villager.cpp
index 98e5276e1..97d6dc3ca 100644
--- a/source/Mobs/Villager.cpp
+++ b/source/Mobs/Villager.cpp
@@ -2,16 +2,34 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Villager.h"
+#include "../World.h"
-cVillager::cVillager(void) :
- super("Villager", 120, "", "", 0.6, 1.8)
+cVillager::cVillager(eVillagerType VillagerType) :
+ super("Villager", 120, "", "", 0.6, 1.8),
+ m_Type(VillagerType)
{
}
+
+void cVillager::DoTakeDamage(TakeDamageInfo & a_TDI)
+{
+ super::DoTakeDamage(a_TDI);
+ if (a_TDI.Attacker->IsPlayer())
+ {
+ if (m_World->GetTickRandomNumber(5) == 3)
+ {
+ m_World->BroadcastEntityStatus(*this, ENTITY_STATUS_VILLAGER_ANGRY);
+ }
+ }
+}
+
+
+
+