summaryrefslogtreecommitdiffstats
path: root/source/Entities
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/Entities/Entity.h63
-rw-r--r--source/Entities/Minecart.cpp58
-rw-r--r--source/Entities/Minecart.h13
3 files changed, 128 insertions, 6 deletions
diff --git a/source/Entities/Entity.h b/source/Entities/Entity.h
index a2c99d2a0..764c5a64b 100644
--- a/source/Entities/Entity.h
+++ b/source/Entities/Entity.h
@@ -71,6 +71,13 @@ public:
ENTITY_STATUS_WOLF_SHAKING = 8,
ENTITY_STATUS_EATING_ACCEPTED = 9,
ENTITY_STATUS_SHEEP_EATING = 10,
+ ENTITY_STATUS_GOLEM_ROSING = 11,
+ ENTITY_STATUS_VILLAGER_HEARTS = 12,
+ ENTITY_STATUS_VILLAGER_ANGRY = 13,
+ ENTITY_STATUS_VILLAGER_HAPPY = 14,
+ ENTITY_STATUS_WITCH_MAGICKING = 15,
+ // It seems 16 (zombie conversion) is now done with metadata
+ ENTITY_STATUS_FIREWORK_EXPLODE= 17,
} ;
enum
@@ -333,6 +340,62 @@ public:
virtual bool IsRiding (void) const {return false; }
virtual bool IsSprinting(void) const {return false; }
virtual bool IsRclking (void) const {return false; }
+ virtual bool IsInvisible(void) const {return false; }
+
+ // Ageables + Tameables
+ virtual bool IsBabby (void) const {return false; }
+ virtual bool IsSitting (void) const {return false; }
+ virtual bool IsTame (void) const {return false; }
+
+ // Creepers
+ virtual bool IsCharged (void) const {return false; }
+ virtual bool IsBlowing (void) const {return false; }
+
+ // Furnace Minecarts & Minecarts
+ virtual int LastDamage (void) const {return 0; }
+ virtual bool IsFueled (void) const {return false; }
+
+ // Bat
+ virtual bool IsHanging (void) const {return false; }
+
+ // Pig
+ virtual bool IsSaddled (void) const {return false; }
+
+ // TESTIFICATE
+ virtual int GetVilType(void) const {return 0; }
+
+ // Zombie
+ virtual bool IsVillager(void) const {return false; }
+ virtual bool IsConvert (void) const {return false; }
+
+ // Ghast
+ virtual bool IsCharging(void) const {return false; }
+
+ // Arrow
+ virtual bool IsCritical(void) const {return false; }
+
+ // Wolf
+ virtual bool IsAngry (void) const {return false; }
+ virtual bool IsBegging (void) const {return false; }
+ virtual int GetCollar (void) const {return 0; }
+
+ // Sheep
+ virtual int GetFurColor(void) const {return 0; }
+ virtual bool IsSheared (void) const {return false; }
+
+ // Enderman
+ virtual BLOCKTYPE CarriedBlock (void) const {return E_BLOCK_AIR; }
+ virtual NIBBLETYPE CarriedMeta (void) const {return 0; }
+ virtual bool IsScream (void) const {return false; }
+
+ // Skeleton || Wither Skeleton
+ virtual bool IsWither (void) const {return false; }
+
+ // Witch
+ virtual bool IsNosey (void) const {return false; }
+
+ // Slimes and Magma cubes
+ virtual int GetSize (void) const {return 1; }
// tolua_end
diff --git a/source/Entities/Minecart.cpp b/source/Entities/Minecart.cpp
index a2f1e5593..1711e296f 100644
--- a/source/Entities/Minecart.cpp
+++ b/source/Entities/Minecart.cpp
@@ -16,7 +16,8 @@
cMinecart::cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z) :
super(etMinecart, a_X, a_Y, a_Z, 0.98, 0.7),
- m_Payload(a_Payload)
+ m_Payload(a_Payload),
+ m_LastDamage(0)
{
SetMass(20.f);
SetMaxHealth(6);
@@ -344,11 +345,51 @@ void cMinecart::HandleRailPhysics(float a_Dt, cChunk & a_Chunk)
void cMinecart::DoTakeDamage(TakeDamageInfo & TDI)
{
+ m_LastDamage = TDI.FinalDamage;
super::DoTakeDamage(TDI);
+ m_World->BroadcastEntityMetadata(*this);
+
if (GetHealth() <= 0)
{
Destroy(true);
+
+ cItems Drops;
+ switch (m_Payload)
+ {
+ case mpNone:
+ {
+ Drops.push_back(cItem(E_ITEM_MINECART, 1, 0));
+ break;
+ }
+ case mpChest:
+ {
+ Drops.push_back(cItem(E_ITEM_CHEST_MINECART, 1, 0));
+ break;
+ }
+ case mpFurnace:
+ {
+ Drops.push_back(cItem(E_ITEM_FURNACE_MINECART, 1, 0));
+ break;
+ }
+ case mpTNT:
+ {
+ Drops.push_back(cItem(0, 1, 0));
+ break;
+ }
+ case mpHopper:
+ {
+ Drops.push_back(cItem(0, 1, 0));
+ break;
+ }
+ default:
+ {
+ ASSERT(!"Unhandled minecart type when spawning pickup!");
+ return;
+ }
+ }
+
+ m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ());
}
}
@@ -434,7 +475,8 @@ void cMinecartWithChest::OnRightClicked(cPlayer & a_Player)
// cMinecartWithFurnace:
cMinecartWithFurnace::cMinecartWithFurnace(double a_X, double a_Y, double a_Z) :
- super(mpFurnace, a_X, a_Y, a_Z)
+ super(mpFurnace, a_X, a_Y, a_Z),
+ m_IsFueled(false)
{
}
@@ -444,8 +486,16 @@ cMinecartWithFurnace::cMinecartWithFurnace(double a_X, double a_Y, double a_Z) :
void cMinecartWithFurnace::OnRightClicked(cPlayer & a_Player)
{
- // Try to power the furnace with whatever the player is holding
- // TODO
+ if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_COAL)
+ {
+ if (!a_Player.IsGameModeCreative())
+ {
+ a_Player.GetInventory().RemoveOneEquippedItem();
+ }
+
+ m_IsFueled = true;
+ m_World->BroadcastEntityMetadata(*this);
+ }
}
diff --git a/source/Entities/Minecart.h b/source/Entities/Minecart.h
index 0152f5dfc..f974ea76a 100644
--- a/source/Entities/Minecart.h
+++ b/source/Entities/Minecart.h
@@ -50,16 +50,19 @@ public:
// cEntity overrides:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
virtual void HandlePhysics(float a_Dt, cChunk & a_Chunk) override;
- void HandleRailPhysics(float a_Dt, cChunk & a_Chunk);
virtual void DoTakeDamage(TakeDamageInfo & TDI) override;
-
+ int LastDamage(void) const { return m_LastDamage; }
+ void HandleRailPhysics(float a_Dt, cChunk & a_Chunk);
ePayload GetPayload(void) const { return m_Payload; }
protected:
ePayload m_Payload;
cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z);
+
+ int m_LastDamage;
+
} ;
@@ -127,6 +130,12 @@ public:
// cEntity overrides:
virtual void OnRightClicked(cPlayer & a_Player) override;
+ bool IsFueled (void) const { return m_IsFueled; }
+
+private:
+
+ bool m_IsFueled;
+
} ;