1
0

Eight round of fixes

* Changed IsA() to *long if statement*
- Removed deprecated values in Entity.h - to blazes with the plugins!
* Renamed villager type enumerations to be LESS SHOUTY and more vt-y
+ Use vtMax for World.cpp testificate spawning
This commit is contained in:
Tiger Wang 2013-10-13 12:47:55 +01:00
parent d0acb37aed
commit d8d2f35e9d
6 changed files with 19 additions and 29 deletions

View File

@ -29494,11 +29494,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"etBoat",cEntity::etBoat);
tolua_constant(tolua_S,"etTNT",cEntity::etTNT);
tolua_constant(tolua_S,"etProjectile",cEntity::etProjectile);
tolua_constant(tolua_S,"etMob",cEntity::etMob);
tolua_constant(tolua_S,"eEntityType_Entity",cEntity::eEntityType_Entity);
tolua_constant(tolua_S,"eEntityType_Player",cEntity::eEntityType_Player);
tolua_constant(tolua_S,"eEntityType_Pickup",cEntity::eEntityType_Pickup);
tolua_constant(tolua_S,"eEntityType_Mob",cEntity::eEntityType_Mob);
tolua_function(tolua_S,"GetEntityType",tolua_AllToLua_cEntity_GetEntityType00);
tolua_function(tolua_S,"IsPlayer",tolua_AllToLua_cEntity_IsPlayer00);
tolua_function(tolua_S,"IsPickup",tolua_AllToLua_cEntity_IsPickup00);

View File

@ -102,13 +102,6 @@ public:
etBoat,
etTNT,
etProjectile,
// DEPRECATED older constants, left over for compatibility reasons (plugins)
etMob = etMonster, // DEPRECATED, use etMonster instead!
eEntityType_Entity = etEntity,
eEntityType_Player = etPlayer,
eEntityType_Pickup = etPickup,
eEntityType_Mob = etMob,
} ;
// tolua_end
@ -123,12 +116,14 @@ public:
eEntityType GetEntityType(void) const { return m_EntityType; }
bool IsPlayer (void) const { return (m_EntityType == etPlayer); }
bool IsPickup (void) const { return (m_EntityType == etPickup); }
bool IsMob (void) const { return (m_EntityType == etMob); }
bool IsMinecart(void) const { return (m_EntityType == etMinecart); }
bool IsBoat (void) const { return (m_EntityType == etBoat); }
bool IsTNT (void) const { return (m_EntityType == etTNT); }
bool IsPlayer (void) const { return (m_EntityType == etPlayer); }
bool IsPickup (void) const { return (m_EntityType == etPickup); }
bool IsMob (void) const { return (m_EntityType == etMonster); }
bool IsFallingBlock(void) const { return (m_EntityType == etFallingBlock); }
bool IsMinecart (void) const { return (m_EntityType == etMinecart); }
bool IsBoat (void) const { return (m_EntityType == etBoat); }
bool IsTNT (void) const { return (m_EntityType == etTNT); }
bool IsProjectile (void) const { return (m_EntityType == etProjectile); }
/// Returns true if the entity is of the specified class or a subclass (cPawn's IsA("cEntity") returns true)
virtual bool IsA(const char * a_ClassName) const;

View File

@ -24,7 +24,7 @@
cMonster::cMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height)
: super(etMob, a_Width, a_Height)
: super(etMonster, a_Width, a_Height)
, m_Target(NULL)
, m_AttackRate(3)
, idle_interval(0)

View File

@ -16,12 +16,13 @@ public:
enum eVillagerType
{
VILLAGER_TYPE_FARMER = 0,
VILLAGER_TYPE_LIBRARIAN = 1,
VILLAGER_TYPE_PRIEST = 2,
VILLAGER_TYPE_BLACKSMITH = 3,
VILLAGER_TYPE_BUTCHER = 4,
VILLAGER_TYPE_GENERIC = 5
vtFarmer = 0,
vtLibrarian = 1,
vtPriest = 2,
vtBlacksmith = 3,
vtButcher = 4,
vtGeneric = 5,
vtMax
} ;
cVillager(eVillagerType VillagerType);

View File

@ -1695,18 +1695,17 @@ void cProtocol125::WriteEntityMetadata(const cEntity & a_Entity)
WriteByte(0x73);
WriteFloat((float)(((const cMinecart &)a_Entity).LastDamage() + 10)); // Damage taken / shake effect multiplyer
if (a_Entity.IsA("cMinecartWithFurnace"))
if (((cMinecart &)a_Entity).GetPayload() == cMinecart::mpFurnace)
{
WriteByte(0x10);
WriteByte(((const cMinecartWithFurnace &)a_Entity).IsFueled() ? 1 : 0); // Fueled?
}
}
else if (a_Entity.IsA("cArrowEntity"));
else if ((a_Entity.IsProjectile() && ((cProjectileEntity &)a_Entity).GetProjectileKind() == cProjectileEntity::pkArrow));
{
WriteByte(0x10);
WriteByte(((const cArrowEntity &)a_Entity).IsCritical() ? 1 : 0); // Critical hitting arrow?
}
}

View File

@ -2576,7 +2576,7 @@ int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eTyp
int ShColor = GetTickRandomNumber(15); // 0 .. 15 - Sheep
bool SkType = GetDimension() == biNether; // Skeleton
int VilType = GetTickRandomNumber(6); // 0 .. 5 - Villager
int VilType = GetTickRandomNumber(cVillager::vtMax); // 0 .. 6 - Villager
if (VilType == 6) { VilType = 0; } // Give farmers a better chance of spawning
int HseType = GetTickRandomNumber(7); // 0 .. 7 - Horse Type (donkey, zombie, etc.)