Many api fixes, add vanilla names to mob type -> string functions and mob spawner fixes.

This commit is contained in:
Howaner
2014-11-29 15:20:44 +01:00
parent 648fee1a08
commit 2478e290f9
13 changed files with 137 additions and 122 deletions
+6 -6
View File
@@ -33,22 +33,22 @@ public:
// tolua_begin
/** Set the Type */
/** Set the type of the mob head */
void SetType(const eMobHeadType & a_SkullType);
/** Set the Rotation */
/** Set the rotation of the mob head */
void SetRotation(eMobHeadRotation a_Rotation);
/** Set the Player Name for Mobheads with Player type */
/** Set the player name for mob heads with player type */
void SetOwner(const AString & a_Owner);
/** Get the Type */
/** Returns the type of the mob head */
eMobHeadType GetType(void) const { return m_Type; }
/** Get the Rotation */
/** Returns the rotation of the mob head */
eMobHeadRotation GetRotation(void) const { return m_Rotation; }
/** Get the setted Player Name */
/** Returns the player name of the mob head */
AString GetOwner(void) const { return m_Owner; }
// tolua_end
+1 -46
View File
@@ -49,7 +49,7 @@ void cMobSpawnerEntity::UsedBy(cPlayer * a_Player)
{
a_Player->GetInventory().RemoveOneEquippedItem();
}
LOGD("Changed monster spawner at {%d, %d, %d} to type %s.", GetPosX(), GetPosY(), GetPosZ(), GetEntityName().c_str());
LOGD("Changed monster spawner at {%d, %d, %d} to type %s.", GetPosX(), GetPosY(), GetPosZ(), cMonster::MobTypeToString(MonsterType).c_str());
}
}
@@ -195,51 +195,6 @@ void cMobSpawnerEntity::SpawnEntity(void)
AString cMobSpawnerEntity::GetEntityName() const
{
switch (m_Entity)
{
case mtBat: return "Bat";
case mtBlaze: return "Blaze";
case mtCaveSpider: return "CaveSpider";
case mtChicken: return "Chicken";
case mtCow: return "Cow";
case mtCreeper: return "Creeper";
case mtEnderDragon: return "EnderDragon";
case mtEnderman: return "Enderman";
case mtGhast: return "Ghast";
case mtGiant: return "Giant";
case mtHorse: return "EntityHorse";
case mtIronGolem: return "VillagerGolem";
case mtMagmaCube: return "LavaSlime";
case mtMooshroom: return "MushroomCow";
case mtOcelot: return "Ozelot";
case mtPig: return "Pig";
case mtSheep: return "Sheep";
case mtSilverfish: return "Silverfish";
case mtSkeleton: return "Skeleton";
case mtSlime: return "Slime";
case mtSnowGolem: return "SnowMan";
case mtSpider: return "Spider";
case mtSquid: return "Squid";
case mtVillager: return "Villager";
case mtWitch: return "Witch";
case mtWither: return "WitherBoss";
case mtWolf: return "Wolf";
case mtZombie: return "Zombie";
case mtZombiePigman: return "PigZombie";
default:
{
ASSERT(!"Unknown monster type!");
return "Pig";
}
}
}
int cMobSpawnerEntity::GetNearbyPlayersNum(void)
{
Vector3d SpawnerPos(m_PosX + 0.5, m_PosY + 0.5, m_PosZ + 0.5);
+5 -5
View File
@@ -35,22 +35,22 @@ public:
/** Spawns the entity. This function automaticly change the spawn delay! */
void SpawnEntity(void);
/** Returns the entity type who will be spawn by this mob spawner. */
/** Returns the entity type that will be spawn by this mob spawner. */
eMonsterType GetEntity(void) const { return m_Entity; }
/** Sets the entity type who will be spawn by this mob spawner. */
void SetEntity(eMonsterType a_EntityType) { m_Entity = a_EntityType; }
/** Returns the entity name. (Required by the protocol) */
AString GetEntityName(void) const;
/** Returns the spawn delay. */
/** Returns the spawn delay. This is the tick delay that is needed to spawn new monsters. */
short GetSpawnDelay(void) const { return m_SpawnDelay; }
/** Sets the spawn delay. */
void SetSpawnDelay(short a_Delay) { m_SpawnDelay = a_Delay; }
/** Returns the amount of the nearby players in a 16-block radius. */
int GetNearbyPlayersNum(void);
/** Returns the amount of this monster type in a 8-block radius (Y: 4-block radius). */
int GetNearbyMonsterNum(eMonsterType a_EntityType);
// tolua_end