diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-11-04 22:53:37 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-11-04 22:53:37 +0100 |
commit | 3d00e52d42edc69eb777c90c6e6f479a5a473598 (patch) | |
tree | 9ed2245653c77b7de86678c345254fe70342126e /src/Mobs | |
parent | More player speed/position overrides (diff) | |
download | cuberite-fixesandfeatures.tar cuberite-fixesandfeatures.tar.gz cuberite-fixesandfeatures.tar.bz2 cuberite-fixesandfeatures.tar.lz cuberite-fixesandfeatures.tar.xz cuberite-fixesandfeatures.tar.zst cuberite-fixesandfeatures.zip |
Diffstat (limited to '')
64 files changed, 149 insertions, 139 deletions
diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp index be2f71f7a..0043348c0 100644 --- a/src/Mobs/AggressiveMonster.cpp +++ b/src/Mobs/AggressiveMonster.cpp @@ -11,8 +11,8 @@ -cAggressiveMonster::cAggressiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) : - super(a_ConfigName, a_MobType, a_SoundHurt, a_SoundDeath, a_Width, a_Height) +cAggressiveMonster::cAggressiveMonster(CreateMonsterInfo a_Info, const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) : + super(a_Info, a_ConfigName, a_MobType, a_SoundHurt, a_SoundDeath, a_Width, a_Height) { m_EMPersonality = AGGRESSIVE; } diff --git a/src/Mobs/AggressiveMonster.h b/src/Mobs/AggressiveMonster.h index 2549ba2d3..bce8508d7 100644 --- a/src/Mobs/AggressiveMonster.h +++ b/src/Mobs/AggressiveMonster.h @@ -14,7 +14,7 @@ class cAggressiveMonster : public: - cAggressiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); + cAggressiveMonster(CreateMonsterInfo a_Info, const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); virtual void Tick (float a_Dt, cChunk & a_Chunk) override; virtual void InStateChasing(float a_Dt) override; diff --git a/src/Mobs/Bat.cpp b/src/Mobs/Bat.cpp index c072d4f48..afbd1ba08 100644 --- a/src/Mobs/Bat.cpp +++ b/src/Mobs/Bat.cpp @@ -6,8 +6,8 @@ #include "../Chunk.h" -cBat::cBat(void) : - super("Bat", mtBat, "mob.bat.hurt", "mob.bat.death", 0.5, 0.9) +cBat::cBat(CreateMonsterInfo a_Info) : + super(a_Info, "Bat", mtBat, "mob.bat.hurt", "mob.bat.death", 0.5, 0.9) { } diff --git a/src/Mobs/Bat.h b/src/Mobs/Bat.h index 6b06aeb4f..f3012508f 100644 --- a/src/Mobs/Bat.h +++ b/src/Mobs/Bat.h @@ -13,7 +13,7 @@ class cBat : typedef cPassiveMonster super; public: - cBat(void); + cBat(CreateMonsterInfo a_Info); CLASS_PROTODEF(cBat) diff --git a/src/Mobs/Blaze.cpp b/src/Mobs/Blaze.cpp index b4104d530..35d3c197d 100644 --- a/src/Mobs/Blaze.cpp +++ b/src/Mobs/Blaze.cpp @@ -8,8 +8,8 @@ -cBlaze::cBlaze(void) : - super("Blaze", mtBlaze, "mob.blaze.hit", "mob.blaze.death", 0.6, 1.8) +cBlaze::cBlaze(CreateMonsterInfo a_Info) : + super(a_Info, "Blaze", mtBlaze, "mob.blaze.hit", "mob.blaze.death", 0.6, 1.8) { } diff --git a/src/Mobs/Blaze.h b/src/Mobs/Blaze.h index f283b1070..b7734449e 100644 --- a/src/Mobs/Blaze.h +++ b/src/Mobs/Blaze.h @@ -13,7 +13,7 @@ class cBlaze : typedef cAggressiveMonster super; public: - cBlaze(void); + cBlaze(CreateMonsterInfo a_Info); CLASS_PROTODEF(cBlaze) diff --git a/src/Mobs/CaveSpider.cpp b/src/Mobs/CaveSpider.cpp index 118a6e93b..f1d91afe9 100644 --- a/src/Mobs/CaveSpider.cpp +++ b/src/Mobs/CaveSpider.cpp @@ -7,8 +7,8 @@ -cCaveSpider::cCaveSpider(void) : - super("CaveSpider", mtCaveSpider, "mob.spider.say", "mob.spider.death", 0.7, 0.5) +cCaveSpider::cCaveSpider(CreateMonsterInfo a_Info) : + super(a_Info, "CaveSpider", mtCaveSpider, "mob.spider.say", "mob.spider.death", 0.7, 0.5) { } diff --git a/src/Mobs/CaveSpider.h b/src/Mobs/CaveSpider.h index f9ed10e1b..b9145a09a 100644 --- a/src/Mobs/CaveSpider.h +++ b/src/Mobs/CaveSpider.h @@ -12,7 +12,7 @@ class cCaveSpider : typedef cAggressiveMonster super; public: - cCaveSpider(void); + cCaveSpider(CreateMonsterInfo a_Info); CLASS_PROTODEF(cCaveSpider) diff --git a/src/Mobs/Chicken.cpp b/src/Mobs/Chicken.cpp index f7e44238f..0206f8294 100644 --- a/src/Mobs/Chicken.cpp +++ b/src/Mobs/Chicken.cpp @@ -9,8 +9,8 @@ -cChicken::cChicken(void) : - super("Chicken", mtChicken, "mob.chicken.hurt", "mob.chicken.hurt", 0.3, 0.4), +cChicken::cChicken(CreateMonsterInfo a_Info) : + super(a_Info, "Chicken", mtChicken, "mob.chicken.hurt", "mob.chicken.hurt", 0.3, 0.4), m_EggDropTimer(0) { } diff --git a/src/Mobs/Chicken.h b/src/Mobs/Chicken.h index b1a50b61c..169c42fca 100644 --- a/src/Mobs/Chicken.h +++ b/src/Mobs/Chicken.h @@ -12,7 +12,7 @@ class cChicken : typedef cPassiveMonster super; public: - cChicken(void); + cChicken(CreateMonsterInfo a_Info); CLASS_PROTODEF(cChicken) diff --git a/src/Mobs/Cow.cpp b/src/Mobs/Cow.cpp index 9914df6b5..0b5b05b07 100644 --- a/src/Mobs/Cow.cpp +++ b/src/Mobs/Cow.cpp @@ -10,8 +10,8 @@ -cCow::cCow(void) : - super("Cow", mtCow, "mob.cow.hurt", "mob.cow.hurt", 0.9, 1.3) +cCow::cCow(CreateMonsterInfo a_Info) : + super(a_Info, "Cow", mtCow, "mob.cow.hurt", "mob.cow.hurt", 0.9, 1.3) { } diff --git a/src/Mobs/Cow.h b/src/Mobs/Cow.h index 8814b7e09..fad1d0cda 100644 --- a/src/Mobs/Cow.h +++ b/src/Mobs/Cow.h @@ -13,7 +13,7 @@ class cCow : typedef cPassiveMonster super; public: - cCow(); + cCow(CreateMonsterInfo a_Info); CLASS_PROTODEF(cCow) diff --git a/src/Mobs/Creeper.cpp b/src/Mobs/Creeper.cpp index 02718edf8..f49c8c858 100644 --- a/src/Mobs/Creeper.cpp +++ b/src/Mobs/Creeper.cpp @@ -10,8 +10,8 @@ -cCreeper::cCreeper(void) : - super("Creeper", mtCreeper, "mob.creeper.say", "mob.creeper.say", 0.6, 1.8), +cCreeper::cCreeper(CreateMonsterInfo a_Info) : + super(a_Info, "Creeper", mtCreeper, "mob.creeper.say", "mob.creeper.say", 0.6, 1.8), m_bIsBlowing(false), m_bIsCharged(false), m_BurnedWithFlintAndSteel(false), diff --git a/src/Mobs/Creeper.h b/src/Mobs/Creeper.h index 747daca09..a8f5345b6 100644 --- a/src/Mobs/Creeper.h +++ b/src/Mobs/Creeper.h @@ -13,7 +13,7 @@ class cCreeper : typedef cAggressiveMonster super; public: - cCreeper(void); + cCreeper(CreateMonsterInfo a_Info); CLASS_PROTODEF(cCreeper) diff --git a/src/Mobs/EnderDragon.cpp b/src/Mobs/EnderDragon.cpp index acd81cde1..5e6f949d1 100644 --- a/src/Mobs/EnderDragon.cpp +++ b/src/Mobs/EnderDragon.cpp @@ -7,9 +7,9 @@ -cEnderDragon::cEnderDragon(void) : +cEnderDragon::cEnderDragon(CreateMonsterInfo a_Info) : // TODO: Vanilla source says this, but is it right? Dragons fly, they don't stand - super("EnderDragon", mtEnderDragon, "mob.enderdragon.hit", "mob.enderdragon.end", 16.0, 8.0) + super(a_Info, "EnderDragon", mtEnderDragon, "mob.enderdragon.hit", "mob.enderdragon.end", 16.0, 8.0) { } diff --git a/src/Mobs/EnderDragon.h b/src/Mobs/EnderDragon.h index 1d4cd657c..30d1acf2e 100644 --- a/src/Mobs/EnderDragon.h +++ b/src/Mobs/EnderDragon.h @@ -13,7 +13,7 @@ class cEnderDragon : typedef cAggressiveMonster super; public: - cEnderDragon(void); + cEnderDragon(CreateMonsterInfo a_Info); CLASS_PROTODEF(cEnderDragon) diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp index 567714382..b5d552d26 100644 --- a/src/Mobs/Enderman.cpp +++ b/src/Mobs/Enderman.cpp @@ -77,8 +77,8 @@ protected: -cEnderman::cEnderman(void) : - super("Enderman", mtEnderman, "mob.endermen.hit", "mob.endermen.death", 0.5, 2.9), +cEnderman::cEnderman(CreateMonsterInfo a_Info) : + super(a_Info, "Enderman", mtEnderman, "mob.endermen.hit", "mob.endermen.death", 0.5, 2.9), m_bIsScreaming(false), CarriedBlock(E_BLOCK_AIR), CarriedMeta(0) diff --git a/src/Mobs/Enderman.h b/src/Mobs/Enderman.h index 947c32b96..84ad91114 100644 --- a/src/Mobs/Enderman.h +++ b/src/Mobs/Enderman.h @@ -13,7 +13,7 @@ class cEnderman : typedef cPassiveAggressiveMonster super; public: - cEnderman(void); + cEnderman(CreateMonsterInfo a_Info); CLASS_PROTODEF(cEnderman) diff --git a/src/Mobs/Ghast.cpp b/src/Mobs/Ghast.cpp index 6aac14779..73b9d1bc1 100644 --- a/src/Mobs/Ghast.cpp +++ b/src/Mobs/Ghast.cpp @@ -8,8 +8,8 @@ -cGhast::cGhast(void) : - super("Ghast", mtGhast, "mob.ghast.scream", "mob.ghast.death", 4, 4) +cGhast::cGhast(CreateMonsterInfo a_Info) : + super(a_Info, "Ghast", mtGhast, "mob.ghast.scream", "mob.ghast.death", 4, 4) { } diff --git a/src/Mobs/Ghast.h b/src/Mobs/Ghast.h index 1d4e6b94a..a0fbf9cf8 100644 --- a/src/Mobs/Ghast.h +++ b/src/Mobs/Ghast.h @@ -13,7 +13,7 @@ class cGhast : typedef cAggressiveMonster super; public: - cGhast(void); + cGhast(CreateMonsterInfo a_Info); CLASS_PROTODEF(cGhast) diff --git a/src/Mobs/Giant.cpp b/src/Mobs/Giant.cpp index bbcad46f0..68ff8453e 100644 --- a/src/Mobs/Giant.cpp +++ b/src/Mobs/Giant.cpp @@ -7,8 +7,8 @@ -cGiant::cGiant(void) : - super("Giant", mtGiant, "mob.zombie.hurt", "mob.zombie.death", 3.6, 10.8) +cGiant::cGiant(CreateMonsterInfo a_Info) : + super(a_Info, "Giant", mtGiant, "mob.zombie.hurt", "mob.zombie.death", 3.6, 10.8) { } diff --git a/src/Mobs/Giant.h b/src/Mobs/Giant.h index 7c04c9b4f..7b403c3a2 100644 --- a/src/Mobs/Giant.h +++ b/src/Mobs/Giant.h @@ -13,7 +13,7 @@ class cGiant : typedef cAggressiveMonster super; public: - cGiant(void); + cGiant(CreateMonsterInfo a_Info); CLASS_PROTODEF(cGiant) diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp index 67a09d4ab..e91b796c9 100644 --- a/src/Mobs/Horse.cpp +++ b/src/Mobs/Horse.cpp @@ -8,8 +8,8 @@ -cHorse::cHorse(int Type, int Color, int Style, int TameTimes) : - super("Horse", mtHorse, "mob.horse.hit", "mob.horse.death", 1.4, 1.6), +cHorse::cHorse(CreateMonsterInfo a_Info, int Type, int Color, int Style, int TameTimes) : + super(a_Info, "Horse", mtHorse, "mob.horse.hit", "mob.horse.death", 1.4, 1.6), m_bHasChest(false), m_bIsEating(false), m_bIsRearing(false), diff --git a/src/Mobs/Horse.h b/src/Mobs/Horse.h index 47189b3b0..beb1c7d9f 100644 --- a/src/Mobs/Horse.h +++ b/src/Mobs/Horse.h @@ -13,7 +13,7 @@ class cHorse : typedef cPassiveMonster super; public: - cHorse(int Type, int Color, int Style, int TameTimes); + cHorse(CreateMonsterInfo a_Info, int Type, int Color, int Style, int TameTimes); CLASS_PROTODEF(cHorse) diff --git a/src/Mobs/IronGolem.cpp b/src/Mobs/IronGolem.cpp index dae4615e4..c542585b3 100644 --- a/src/Mobs/IronGolem.cpp +++ b/src/Mobs/IronGolem.cpp @@ -7,8 +7,8 @@ -cIronGolem::cIronGolem(void) : - super("IronGolem", mtIronGolem, "mob.IronGolem.hit", "mob.IronGolem.death", 1.4, 2.9) +cIronGolem::cIronGolem(CreateMonsterInfo a_Info) : + super(a_Info, "IronGolem", mtIronGolem, "mob.IronGolem.hit", "mob.IronGolem.death", 1.4, 2.9) { } diff --git a/src/Mobs/IronGolem.h b/src/Mobs/IronGolem.h index c5341ed76..87df42c28 100644 --- a/src/Mobs/IronGolem.h +++ b/src/Mobs/IronGolem.h @@ -13,7 +13,7 @@ class cIronGolem : typedef cPassiveAggressiveMonster super; public: - cIronGolem(void); + cIronGolem(CreateMonsterInfo a_Info); CLASS_PROTODEF(cIronGolem) diff --git a/src/Mobs/MagmaCube.cpp b/src/Mobs/MagmaCube.cpp index 3e9abc108..99a3ddb7e 100644 --- a/src/Mobs/MagmaCube.cpp +++ b/src/Mobs/MagmaCube.cpp @@ -6,8 +6,8 @@ -cMagmaCube::cMagmaCube(int a_Size) : - super("MagmaCube", mtMagmaCube, "mob.MagmaCube.big", "mob.MagmaCube.big", 0.6 * a_Size, 0.6 * a_Size), +cMagmaCube::cMagmaCube(CreateMonsterInfo a_Info, int a_Size) : + super(a_Info, "MagmaCube", mtMagmaCube, "mob.MagmaCube.big", "mob.MagmaCube.big", 0.6 * a_Size, 0.6 * a_Size), m_Size(a_Size) { } diff --git a/src/Mobs/MagmaCube.h b/src/Mobs/MagmaCube.h index bfe63fa2e..af926c37c 100644 --- a/src/Mobs/MagmaCube.h +++ b/src/Mobs/MagmaCube.h @@ -13,7 +13,7 @@ class cMagmaCube : public: /// Creates a MagmaCube of the specified size; size is 1 .. 3, with 1 being the smallest - cMagmaCube(int a_Size); + cMagmaCube(CreateMonsterInfo a_Info, int a_Size); CLASS_PROTODEF(cMagmaCube) diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 12ca6bbbe..50692ebc2 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -2,13 +2,11 @@ #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "IncludeAllMonsters.h" -#include "../Root.h" #include "../Server.h" #include "../ClientHandle.h" #include "../World.h" #include "../Entities/Player.h" #include "../Entities/ExpOrb.h" -#include "../MonsterConfig.h" #include "../MersenneTwister.h" #include "../Chunk.h" @@ -65,38 +63,34 @@ static const struct //////////////////////////////////////////////////////////////////////////////// // cMonster: -cMonster::cMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) - : super(etMonster, a_Width, a_Height) - , m_EMState(IDLE) - , m_EMPersonality(AGGRESSIVE) - , m_Target(NULL) - , m_bMovingToDestination(false) - , m_LastGroundHeight(POSY_TOINT) - , m_IdleInterval(0) - , m_DestroyTimer(0) - , m_MobType(a_MobType) - , m_CustomName("") - , m_CustomNameAlwaysVisible(false) - , m_SoundHurt(a_SoundHurt) - , m_SoundDeath(a_SoundDeath) - , m_AttackRate(3) - , m_AttackDamage(1) - , m_AttackRange(2) - , m_AttackInterval(0) - , m_SightDistance(25) - , m_DropChanceWeapon(0.085f) - , m_DropChanceHelmet(0.085f) - , m_DropChanceChestplate(0.085f) - , m_DropChanceLeggings(0.085f) - , m_DropChanceBoots(0.085f) - , m_CanPickUpLoot(true) - , m_BurnsInDaylight(false) - , m_RelativeWalkSpeed(1.0) +cMonster::cMonster(CreateMonsterInfo a_Info, const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) : + super(a_Info, etMonster, a_Width, a_Height), + m_EMState(IDLE), + m_EMPersonality(AGGRESSIVE), + m_Target(NULL), + m_bMovingToDestination(false), + m_LastGroundHeight(POSY_TOINT), + m_IdleInterval(0), + m_DestroyTimer(0), + m_MobType(a_MobType), + m_CustomName(a_Info.CustomName), + m_CustomNameAlwaysVisible(a_Info.CustomNameAlwaysVisible), + m_SoundHurt(a_SoundHurt), + m_SoundDeath(a_SoundDeath), + m_AttackRate(a_Info.MonsterInfo.m_AttackRate), + m_AttackDamage(a_Info.MonsterInfo.m_AttackDamage), + m_AttackRange(a_Info.MonsterInfo.m_AttackRange), + m_AttackInterval(a_Info.MonsterInfo.m_AttackRate), + m_SightDistance(a_Info.MonsterInfo.m_SightDistance), + m_DropChanceWeapon(a_Info.DropChanceWeapon), + m_DropChanceHelmet(a_Info.DropChanceHelmet), + m_DropChanceChestplate(a_Info.DropChanceChestplate), + m_DropChanceLeggings(a_Info.DropChanceLeggings), + m_DropChanceBoots(a_Info.DropChanceBoots), + m_CanPickUpLoot(a_Info.CanPickUpLoot), + m_BurnsInDaylight(false), + m_RelativeWalkSpeed(1.0) { - if (!a_ConfigName.empty()) - { - GetMonsterConfig(a_ConfigName); - } } @@ -737,15 +731,6 @@ void cMonster::SetCustomNameAlwaysVisible(bool a_CustomNameAlwaysVisible) -void cMonster::GetMonsterConfig(const AString & a_Name) -{ - cRoot::Get()->GetMonsterConfig()->AssignAttributes(this, a_Name); -} - - - - - bool cMonster::IsUndead(void) { return false; diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h index a1f9c4a5b..f6fe88638 100644 --- a/src/Mobs/Monster.h +++ b/src/Mobs/Monster.h @@ -6,6 +6,8 @@ #include "../BlockID.h" #include "../Item.h" #include "../Enchantments.h" +#include "../Root.h" +#include "../MonsterConfig.h" #include "MonsterTypes.h" @@ -18,6 +20,31 @@ class cWorld; + +struct CreateMonsterInfo +{ + CreateMonsterInfo(const AString & a_ClassName) : + MonsterInfo(cRoot::Get()->GetMonsterConfig()->ReturnAttributes(a_ClassName)) + { + } + + CreateEntityInfo EntityInfo; + cMonsterConfig::sReturnAttributes MonsterInfo; + + float DropChanceWeapon; + float DropChanceHelmet; + float DropChanceChestplate; + float DropChanceLeggings; + float DropChanceBoots; + + AString CustomName; + bool CustomNameAlwaysVisible; + bool CanPickUpLoot; +}; + + + + // tolua_begin class cMonster : public cPawn @@ -49,7 +76,7 @@ public: a_MobType is the type of the mob (also used in the protocol ( http://wiki.vg/Entities#Mobs 2012_12_22)) a_SoundHurt and a_SoundDeath are assigned into m_SoundHurt and m_SoundDeath, respectively */ - cMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); + cMonster(CreateMonsterInfo a_Info, const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); CLASS_PROTODEF(cMonster) @@ -74,9 +101,6 @@ public: virtual void CheckEventSeePlayer(void); virtual void EventSeePlayer(cEntity * a_Player); - /// Reads the monster configuration for the specified monster name and assigns it to this object. - void GetMonsterConfig(const AString & a_Name); - /** Returns whether this mob is undead (skeleton, zombie, etc.) */ virtual bool IsUndead(void); diff --git a/src/Mobs/Mooshroom.cpp b/src/Mobs/Mooshroom.cpp index 99958720f..586c4cafc 100644 --- a/src/Mobs/Mooshroom.cpp +++ b/src/Mobs/Mooshroom.cpp @@ -13,8 +13,8 @@ -cMooshroom::cMooshroom(void) : - super("Mooshroom", mtMooshroom, "mob.cow.hurt", "mob.cow.hurt", 0.9, 1.3) +cMooshroom::cMooshroom(CreateMonsterInfo a_Info) : + super(a_Info, "Mooshroom", mtMooshroom, "mob.cow.hurt", "mob.cow.hurt", 0.9, 1.3) { } diff --git a/src/Mobs/Mooshroom.h b/src/Mobs/Mooshroom.h index fb002c2bf..2b033308d 100644 --- a/src/Mobs/Mooshroom.h +++ b/src/Mobs/Mooshroom.h @@ -13,7 +13,7 @@ class cMooshroom : typedef cPassiveMonster super; public: - cMooshroom(void); + cMooshroom(CreateMonsterInfo a_Info); CLASS_PROTODEF(cMooshroom) diff --git a/src/Mobs/Ocelot.h b/src/Mobs/Ocelot.h index f2727d354..4f0739eec 100644 --- a/src/Mobs/Ocelot.h +++ b/src/Mobs/Ocelot.h @@ -13,7 +13,7 @@ class cOcelot : typedef cPassiveMonster super; public: - cOcelot(void) : + cOcelot(CreateMonsterInfo a_Info) : super("Ocelot", mtOcelot, "mob.cat.hitt", "mob.cat.hitt", 0.6, 0.8) { } diff --git a/src/Mobs/PassiveAggressiveMonster.cpp b/src/Mobs/PassiveAggressiveMonster.cpp index e0cc2fd21..4919d4139 100644 --- a/src/Mobs/PassiveAggressiveMonster.cpp +++ b/src/Mobs/PassiveAggressiveMonster.cpp @@ -9,8 +9,8 @@ -cPassiveAggressiveMonster::cPassiveAggressiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) : - super(a_ConfigName, a_MobType, a_SoundHurt, a_SoundDeath, a_Width, a_Height) +cPassiveAggressiveMonster::cPassiveAggressiveMonster(CreateMonsterInfo a_Info, const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) : + super(a_Info, a_ConfigName, a_MobType, a_SoundHurt, a_SoundDeath, a_Width, a_Height) { m_EMPersonality = PASSIVE; } diff --git a/src/Mobs/PassiveAggressiveMonster.h b/src/Mobs/PassiveAggressiveMonster.h index 72f472281..f0c7c3bc1 100644 --- a/src/Mobs/PassiveAggressiveMonster.h +++ b/src/Mobs/PassiveAggressiveMonster.h @@ -13,7 +13,7 @@ class cPassiveAggressiveMonster : typedef cAggressiveMonster super; public: - cPassiveAggressiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); + cPassiveAggressiveMonster(CreateMonsterInfo a_Info, const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; } ; diff --git a/src/Mobs/PassiveMonster.cpp b/src/Mobs/PassiveMonster.cpp index be3043e3d..6ddb0dde0 100644 --- a/src/Mobs/PassiveMonster.cpp +++ b/src/Mobs/PassiveMonster.cpp @@ -8,8 +8,8 @@ -cPassiveMonster::cPassiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) : - super(a_ConfigName, a_MobType, a_SoundHurt, a_SoundDeath, a_Width, a_Height) +cPassiveMonster::cPassiveMonster(CreateMonsterInfo a_Info, const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) : + super(a_Info, a_ConfigName, a_MobType, a_SoundHurt, a_SoundDeath, a_Width, a_Height) { m_EMPersonality = PASSIVE; } diff --git a/src/Mobs/PassiveMonster.h b/src/Mobs/PassiveMonster.h index 9221d9a6e..6b9084ade 100644 --- a/src/Mobs/PassiveMonster.h +++ b/src/Mobs/PassiveMonster.h @@ -13,7 +13,7 @@ class cPassiveMonster : typedef cMonster super; public: - cPassiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); + cPassiveMonster(CreateMonsterInfo a_Info, const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); virtual void Tick(float a_Dt, cChunk & a_Chunk) override; diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp index 1f77cf613..90f9998db 100644 --- a/src/Mobs/Pig.cpp +++ b/src/Mobs/Pig.cpp @@ -9,8 +9,8 @@ -cPig::cPig(void) : - super("Pig", mtPig, "mob.pig.say", "mob.pig.death", 0.9, 0.9), +cPig::cPig(CreateMonsterInfo a_Info) : + super(a_Info, "Pig", mtPig, "mob.pig.say", "mob.pig.death", 0.9, 0.9), m_bIsSaddled(false) { } diff --git a/src/Mobs/Pig.h b/src/Mobs/Pig.h index 534a0ca6f..1e19c7fba 100644 --- a/src/Mobs/Pig.h +++ b/src/Mobs/Pig.h @@ -13,7 +13,7 @@ class cPig : typedef cPassiveMonster super; public: - cPig(void); + cPig(CreateMonsterInfo a_Info); CLASS_PROTODEF(cPig) diff --git a/src/Mobs/Sheep.cpp b/src/Mobs/Sheep.cpp index cbb33cb90..06bec9dc8 100644 --- a/src/Mobs/Sheep.cpp +++ b/src/Mobs/Sheep.cpp @@ -11,8 +11,8 @@ -cSheep::cSheep(int a_Color) : - super("Sheep", mtSheep, "mob.sheep.say", "mob.sheep.say", 0.6, 1.3), +cSheep::cSheep(CreateMonsterInfo a_Info, int a_Color) : + super(a_Info, "Sheep", mtSheep, "mob.sheep.say", "mob.sheep.say", 0.6, 1.3), m_IsSheared(false), m_WoolColor(a_Color), m_TimeToStopEating(-1) diff --git a/src/Mobs/Sheep.h b/src/Mobs/Sheep.h index 28e1c7254..c0ef02162 100644 --- a/src/Mobs/Sheep.h +++ b/src/Mobs/Sheep.h @@ -18,7 +18,7 @@ public: Use E_META_WOOL_* constants for the wool color. If you type -1, the server will generate a random color with the GenerateNaturalRandomColor() function. */ - cSheep(int a_Color = -1); + cSheep(CreateMonsterInfo a_Info, int a_Color = -1); CLASS_PROTODEF(cSheep) diff --git a/src/Mobs/Silverfish.h b/src/Mobs/Silverfish.h index 2df333dbc..1a82fd22d 100644 --- a/src/Mobs/Silverfish.h +++ b/src/Mobs/Silverfish.h @@ -13,7 +13,7 @@ class cSilverfish : typedef cAggressiveMonster super; public: - cSilverfish(void) : + cSilverfish(CreateMonsterInfo a_Info) : super("Silverfish", mtSilverfish, "mob.silverfish.hit", "mob.silverfish.kill", 0.3, 0.7) { } diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp index cd707f4bb..2267613b5 100644 --- a/src/Mobs/Skeleton.cpp +++ b/src/Mobs/Skeleton.cpp @@ -9,8 +9,8 @@ -cSkeleton::cSkeleton(bool IsWither) : - super("Skeleton", mtSkeleton, "mob.skeleton.hurt", "mob.skeleton.death", 0.6, 1.8), +cSkeleton::cSkeleton(CreateMonsterInfo a_Info, bool IsWither) : + super(a_Info, "Skeleton", mtSkeleton, "mob.skeleton.hurt", "mob.skeleton.death", 0.6, 1.8), m_bIsWither(IsWither) { SetBurnsInDaylight(true); diff --git a/src/Mobs/Skeleton.h b/src/Mobs/Skeleton.h index 577588b32..519ae0b52 100644 --- a/src/Mobs/Skeleton.h +++ b/src/Mobs/Skeleton.h @@ -13,7 +13,7 @@ class cSkeleton : typedef cAggressiveMonster super; public: - cSkeleton(bool IsWither); + cSkeleton(CreateMonsterInfo a_Info, bool IsWither); CLASS_PROTODEF(cSkeleton) diff --git a/src/Mobs/Slime.cpp b/src/Mobs/Slime.cpp index b709ec664..bfdee64c8 100644 --- a/src/Mobs/Slime.cpp +++ b/src/Mobs/Slime.cpp @@ -9,8 +9,9 @@ -cSlime::cSlime(int a_Size) : - super("Slime", +cSlime::cSlime(CreateMonsterInfo a_Info, int a_Size) : + super(a_Info, + "Slime", mtSlime, Printf("mob.slime.%s", GetSizeName(a_Size).c_str()), Printf("mob.slime.%s", GetSizeName(a_Size).c_str()), diff --git a/src/Mobs/Slime.h b/src/Mobs/Slime.h index f0b800f94..0671f1b4d 100644 --- a/src/Mobs/Slime.h +++ b/src/Mobs/Slime.h @@ -14,7 +14,7 @@ class cSlime : public: /** Creates a slime of the specified size; size can be 1, 2 or 4, with 1 is the smallest and 4 is the tallest. */ - cSlime(int a_Size); + cSlime(CreateMonsterInfo a_Info, int a_Size); CLASS_PROTODEF(cSlime) diff --git a/src/Mobs/SnowGolem.cpp b/src/Mobs/SnowGolem.cpp index 76334d970..a17965765 100644 --- a/src/Mobs/SnowGolem.cpp +++ b/src/Mobs/SnowGolem.cpp @@ -8,8 +8,8 @@ -cSnowGolem::cSnowGolem(void) : - super("SnowGolem", mtSnowGolem, "", "", 0.4, 1.8) +cSnowGolem::cSnowGolem(CreateMonsterInfo a_Info) : + super(a_Info, "SnowGolem", mtSnowGolem, "", "", 0.4, 1.8) { } diff --git a/src/Mobs/SnowGolem.h b/src/Mobs/SnowGolem.h index aba89e52d..8d09e8816 100644 --- a/src/Mobs/SnowGolem.h +++ b/src/Mobs/SnowGolem.h @@ -13,7 +13,7 @@ class cSnowGolem : typedef cAggressiveMonster super; public: - cSnowGolem(void); + cSnowGolem(CreateMonsterInfo a_Info); CLASS_PROTODEF(cSnowGolem) diff --git a/src/Mobs/Spider.cpp b/src/Mobs/Spider.cpp index 8b978ff6b..7840214c9 100644 --- a/src/Mobs/Spider.cpp +++ b/src/Mobs/Spider.cpp @@ -7,8 +7,8 @@ -cSpider::cSpider(void) : - super("Spider", mtSpider, "mob.spider.say", "mob.spider.death", 1.4, 0.9) +cSpider::cSpider(CreateMonsterInfo a_Info) : + super(a_Info, "Spider", mtSpider, "mob.spider.say", "mob.spider.death", 1.4, 0.9) { } diff --git a/src/Mobs/Spider.h b/src/Mobs/Spider.h index 813d2e266..f9c12a662 100644 --- a/src/Mobs/Spider.h +++ b/src/Mobs/Spider.h @@ -13,7 +13,7 @@ class cSpider : typedef cAggressiveMonster super; public: - cSpider(void); + cSpider(CreateMonsterInfo a_Info); CLASS_PROTODEF(cSpider) diff --git a/src/Mobs/Squid.cpp b/src/Mobs/Squid.cpp index bd0e141a0..3f757d617 100644 --- a/src/Mobs/Squid.cpp +++ b/src/Mobs/Squid.cpp @@ -9,8 +9,8 @@ -cSquid::cSquid(void) : - super("Squid", mtSquid, "", "", 0.95, 0.95) +cSquid::cSquid(CreateMonsterInfo a_Info) : + super(a_Info, "Squid", mtSquid, "", "", 0.95, 0.95) { } diff --git a/src/Mobs/Squid.h b/src/Mobs/Squid.h index b57340427..7ddbe2dea 100644 --- a/src/Mobs/Squid.h +++ b/src/Mobs/Squid.h @@ -13,7 +13,7 @@ class cSquid : typedef cPassiveMonster super; public: - cSquid(); + cSquid(CreateMonsterInfo a_Info); virtual void Tick(float a_Dt, cChunk & a_Chunk) override; diff --git a/src/Mobs/Villager.cpp b/src/Mobs/Villager.cpp index 781816c75..5b9c1d1b4 100644 --- a/src/Mobs/Villager.cpp +++ b/src/Mobs/Villager.cpp @@ -11,8 +11,8 @@ -cVillager::cVillager(eVillagerType VillagerType) : - super("Villager", mtVillager, "", "", 0.6, 1.8), +cVillager::cVillager(CreateMonsterInfo a_Info, eVillagerType VillagerType) : + super(a_Info, "Villager", mtVillager, "", "", 0.6, 1.8), m_ActionCountDown(-1), m_Type(VillagerType), m_VillagerAction(false) diff --git a/src/Mobs/Villager.h b/src/Mobs/Villager.h index d3a38dbf0..8f23f87f1 100644 --- a/src/Mobs/Villager.h +++ b/src/Mobs/Villager.h @@ -25,7 +25,7 @@ public: vtMax } ; - cVillager(eVillagerType VillagerType); + cVillager(CreateMonsterInfo a_Info, eVillagerType VillagerType); CLASS_PROTODEF(cVillager) diff --git a/src/Mobs/Witch.cpp b/src/Mobs/Witch.cpp index 6956f7b7a..cfce7a094 100644 --- a/src/Mobs/Witch.cpp +++ b/src/Mobs/Witch.cpp @@ -7,8 +7,8 @@ -cWitch::cWitch(void) : - super("Witch", mtWitch, "", "", 0.6, 1.8) +cWitch::cWitch(CreateMonsterInfo a_Info) : + super(a_Info, "Witch", mtWitch, "", "", 0.6, 1.8) { } diff --git a/src/Mobs/Witch.h b/src/Mobs/Witch.h index bd059f61d..884dc94c6 100644 --- a/src/Mobs/Witch.h +++ b/src/Mobs/Witch.h @@ -14,7 +14,7 @@ class cWitch : typedef cAggressiveMonster super; public: - cWitch(); + cWitch(CreateMonsterInfo a_Info); CLASS_PROTODEF(cWitch) diff --git a/src/Mobs/Wither.cpp b/src/Mobs/Wither.cpp index 578b47995..c3ac78220 100644 --- a/src/Mobs/Wither.cpp +++ b/src/Mobs/Wither.cpp @@ -10,8 +10,8 @@ -cWither::cWither(void) : - super("Wither", mtWither, "mob.wither.hurt", "mob.wither.death", 0.9, 4.0), +cWither::cWither(CreateMonsterInfo a_Info) : + super(a_Info, "Wither", mtWither, "mob.wither.hurt", "mob.wither.death", 0.9, 4.0), m_WitherInvulnerableTicks(220) { SetMaxHealth(300); diff --git a/src/Mobs/Wither.h b/src/Mobs/Wither.h index 2403823ed..2b5b21633 100644 --- a/src/Mobs/Wither.h +++ b/src/Mobs/Wither.h @@ -13,7 +13,7 @@ class cWither : typedef cAggressiveMonster super; public: - cWither(void); + cWither(CreateMonsterInfo a_Info); CLASS_PROTODEF(cWither) diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp index 4fe1ff1d6..94d516841 100644 --- a/src/Mobs/Wolf.cpp +++ b/src/Mobs/Wolf.cpp @@ -10,8 +10,8 @@ -cWolf::cWolf(void) : - super("Wolf", mtWolf, "mob.wolf.hurt", "mob.wolf.death", 0.6, 0.8), +cWolf::cWolf(CreateMonsterInfo a_Info) : + super(a_Info, "Wolf", mtWolf, "mob.wolf.hurt", "mob.wolf.death", 0.6, 0.8), m_IsSitting(false), m_IsTame(false), m_IsBegging(false), @@ -232,7 +232,7 @@ void cWolf::TickFollowPlayer() if (Distance > 30) { Callback.OwnerPos.y = FindFirstNonAirBlockPosition(Callback.OwnerPos.x, Callback.OwnerPos.z); - TeleportToCoords(Callback.OwnerPos.x, Callback.OwnerPos.y, Callback.OwnerPos.z); + SetPosition(Callback.OwnerPos); } else { diff --git a/src/Mobs/Wolf.h b/src/Mobs/Wolf.h index 7500854f8..f2aa7094b 100644 --- a/src/Mobs/Wolf.h +++ b/src/Mobs/Wolf.h @@ -14,7 +14,7 @@ class cWolf : typedef cPassiveAggressiveMonster super; public: - cWolf(void); + cWolf(CreateMonsterInfo a_Info); CLASS_PROTODEF(cWolf) diff --git a/src/Mobs/Zombie.cpp b/src/Mobs/Zombie.cpp index 30225c32d..0d7f123d3 100644 --- a/src/Mobs/Zombie.cpp +++ b/src/Mobs/Zombie.cpp @@ -9,8 +9,8 @@ -cZombie::cZombie(bool a_IsVillagerZombie) : - super("Zombie", mtZombie, "mob.zombie.hurt", "mob.zombie.death", 0.6, 1.8), +cZombie::cZombie(CreateMonsterInfo a_Info, bool a_IsVillagerZombie) : + super(a_Info, "Zombie", mtZombie, "mob.zombie.hurt", "mob.zombie.death", 0.6, 1.8), m_IsVillagerZombie(a_IsVillagerZombie), m_IsConverting(false) { diff --git a/src/Mobs/Zombie.h b/src/Mobs/Zombie.h index 118b6e6e7..b0a0361f4 100644 --- a/src/Mobs/Zombie.h +++ b/src/Mobs/Zombie.h @@ -12,7 +12,7 @@ class cZombie : typedef cAggressiveMonster super; public: - cZombie(bool a_IsVillagerZombie); + cZombie(CreateMonsterInfo a_Info, bool a_IsVillagerZombie); CLASS_PROTODEF(cZombie) diff --git a/src/Mobs/ZombiePigman.cpp b/src/Mobs/ZombiePigman.cpp index 05350f877..5a6f78918 100644 --- a/src/Mobs/ZombiePigman.cpp +++ b/src/Mobs/ZombiePigman.cpp @@ -7,8 +7,8 @@ -cZombiePigman::cZombiePigman(void) : - super("ZombiePigman", mtZombiePigman, "mob.zombiepig.zpighurt", "mob.zombiepig.zpigdeath", 0.6, 1.8) +cZombiePigman::cZombiePigman(CreateMonsterInfo a_Info) : + super(a_Info, "ZombiePigman", mtZombiePigman, "mob.zombiepig.zpighurt", "mob.zombiepig.zpigdeath", 0.6, 1.8) { } diff --git a/src/Mobs/ZombiePigman.h b/src/Mobs/ZombiePigman.h index bae0115eb..e21f2012e 100644 --- a/src/Mobs/ZombiePigman.h +++ b/src/Mobs/ZombiePigman.h @@ -12,7 +12,7 @@ class cZombiePigman : typedef cPassiveAggressiveMonster super; public: - cZombiePigman(void); + cZombiePigman(CreateMonsterInfo a_Info); CLASS_PROTODEF(cZombiePigman) |