diff options
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/Plugin.h | 2 | ||||
-rw-r--r-- | src/Bindings/PluginLua.cpp | 4 | ||||
-rw-r--r-- | src/Bindings/PluginLua.h | 2 | ||||
-rw-r--r-- | src/Bindings/PluginManager.cpp | 4 | ||||
-rw-r--r-- | src/Bindings/PluginManager.h | 2 | ||||
-rw-r--r-- | src/Entities/EntityEffect.cpp | 62 | ||||
-rw-r--r-- | src/Entities/EntityEffect.h | 104 | ||||
-rw-r--r-- | src/Entities/Pawn.cpp | 7 | ||||
-rw-r--r-- | src/Entities/Pawn.h | 3 | ||||
-rw-r--r-- | src/Entities/SplashPotionEntity.cpp | 2 | ||||
-rw-r--r-- | src/Items/ItemPotion.h | 4 | ||||
-rw-r--r-- | src/Mobs/CaveSpider.cpp | 2 |
12 files changed, 94 insertions, 104 deletions
diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h index dabe8debb..5196a03dc 100644 --- a/src/Bindings/Plugin.h +++ b/src/Bindings/Plugin.h @@ -57,7 +57,7 @@ public: virtual bool OnCollectingPickup (cPlayer * a_Player, cPickup * a_Pickup) = 0; virtual bool OnCraftingNoRecipe (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) = 0; virtual bool OnDisconnect (cClientHandle & a_Client, const AString & a_Reason) = 0; - virtual bool OnEntityAddEffect (cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, cEntity * a_Originator, double a_DistanceModifier) = 0; + virtual bool OnEntityAddEffect (cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, double a_DistanceModifier) = 0; virtual bool OnExecuteCommand (cPlayer * a_Player, const AStringVector & a_Split) = 0; virtual bool OnExploded (cWorld & a_World, double a_ExplosionSize, bool a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) = 0; virtual bool OnExploding (cWorld & a_World, double & a_ExplosionSize, bool & a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) = 0; diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index e10cca708..a08803189 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -420,14 +420,14 @@ bool cPluginLua::OnDisconnect(cClientHandle & a_Client, const AString & a_Reason -bool cPluginLua::OnEntityAddEffect(cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, cEntity * a_Originator, double a_DistanceModifier) +bool cPluginLua::OnEntityAddEffect(cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, double a_DistanceModifier) { cCSLock Lock(m_CriticalSection); bool res = false; cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_ENTITY_ADD_EFFECT]; for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) { - m_LuaState.Call((int)(**itr), &a_Entity, a_EffectType, a_EffectDurationTicks, a_EffectIntensity, a_Originator, a_DistanceModifier, cLuaState::Return, res); + m_LuaState.Call((int)(**itr), &a_Entity, a_EffectType, a_EffectDurationTicks, a_EffectIntensity, a_DistanceModifier, cLuaState::Return, res); if (res) { return true; diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h index 94371c830..0ea76ba24 100644 --- a/src/Bindings/PluginLua.h +++ b/src/Bindings/PluginLua.h @@ -80,7 +80,7 @@ public: virtual bool OnCollectingPickup (cPlayer * a_Player, cPickup * a_Pickup) override; virtual bool OnCraftingNoRecipe (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override; virtual bool OnDisconnect (cClientHandle & a_Client, const AString & a_Reason) override; - virtual bool OnEntityAddEffect (cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, cEntity * a_Originator, double a_DistanceModifier) override; + virtual bool OnEntityAddEffect (cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, double a_DistanceModifier) override; virtual bool OnExecuteCommand (cPlayer * a_Player, const AStringVector & a_Split) override; virtual bool OnExploded (cWorld & a_World, double a_ExplosionSize, bool a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) override; virtual bool OnExploding (cWorld & a_World, double & a_ExplosionSize, bool & a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) override; diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index c80344c30..2264faf8b 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -474,7 +474,7 @@ bool cPluginManager::CallHookDisconnect(cClientHandle & a_Client, const AString -bool cPluginManager::CallHookEntityAddEffect(cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, cEntity * a_Originator, double a_DistanceModifier) +bool cPluginManager::CallHookEntityAddEffect(cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, double a_DistanceModifier) { HookMap::iterator Plugins = m_Hooks.find(HOOK_ENTITY_ADD_EFFECT); if (Plugins == m_Hooks.end()) @@ -483,7 +483,7 @@ bool cPluginManager::CallHookEntityAddEffect(cEntity & a_Entity, int a_EffectTyp } for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnEntityAddEffect(a_Entity, a_EffectType, a_EffectDurationTicks, a_EffectIntensity, a_Originator, a_DistanceModifier)) + if ((*itr)->OnEntityAddEffect(a_Entity, a_EffectType, a_EffectDurationTicks, a_EffectIntensity, a_DistanceModifier)) { return true; } diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index 4d5a350d4..2f0ec0e27 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -184,7 +184,7 @@ public: // tolua_export bool CallHookCollectingPickup (cPlayer * a_Player, cPickup & a_Pickup); bool CallHookCraftingNoRecipe (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe); bool CallHookDisconnect (cClientHandle & a_Client, const AString & a_Reason); - bool CallHookEntityAddEffect (cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, cEntity * a_Originator, double a_DistanceModifier); + bool CallHookEntityAddEffect (cEntity & a_Entity, int a_EffectType, int a_EffectDurationTicks, int a_EffectIntensity, double a_DistanceModifier); bool CallHookExecuteCommand (cPlayer * a_Player, const AStringVector & a_Split); // If a_Player == NULL, it is a console cmd bool CallHookExploded (cWorld & a_World, double a_ExplosionSize, bool a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData); bool CallHookExploding (cWorld & a_World, double & a_ExplosionSize, bool & a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData); diff --git a/src/Entities/EntityEffect.cpp b/src/Entities/EntityEffect.cpp index 9881785cb..e68ded8b0 100644 --- a/src/Entities/EntityEffect.cpp +++ b/src/Entities/EntityEffect.cpp @@ -11,7 +11,6 @@ cEntityEffect::cEntityEffect(): m_Ticks(0), m_Duration(0), m_Intensity(0), - m_Creator(NULL), m_DistanceModifier(1) { @@ -21,11 +20,10 @@ cEntityEffect::cEntityEffect(): -cEntityEffect::cEntityEffect(int a_Duration, short a_Intensity, cPawn *a_Creator, double a_DistanceModifier): +cEntityEffect::cEntityEffect(int a_Duration, short a_Intensity, double a_DistanceModifier): m_Ticks(0), m_Duration(a_Duration), m_Intensity(a_Intensity), - m_Creator(a_Creator), m_DistanceModifier(a_DistanceModifier) { @@ -44,35 +42,35 @@ cEntityEffect::~cEntityEffect() -cEntityEffect * cEntityEffect::CreateEntityEffect(cEntityEffect::eType a_EffectType, int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier) +cEntityEffect * cEntityEffect::CreateEntityEffect(cEntityEffect::eType a_EffectType, int a_Duration, short a_Intensity, double a_DistanceModifier) { switch (a_EffectType) { - case cEntityEffect::effNoEffect: return new cEntityEffect (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); + case cEntityEffect::effNoEffect: return new cEntityEffect (a_Duration, a_Intensity, a_DistanceModifier); - case cEntityEffect::effAbsorption: return new cEntityEffectAbsorption (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effBlindness: return new cEntityEffectBlindness (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effFireResistance: return new cEntityEffectFireResistance(a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effHaste: return new cEntityEffectHaste (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effHealthBoost: return new cEntityEffectHealthBoost (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effHunger: return new cEntityEffectHunger (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effInstantDamage: return new cEntityEffectInstantDamage (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effInstantHealth: return new cEntityEffectInstantHealth (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effInvisibility: return new cEntityEffectInvisibility (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effJumpBoost: return new cEntityEffectJumpBoost (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effMiningFatigue: return new cEntityEffectMiningFatigue (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effNausea: return new cEntityEffectNausea (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effNightVision: return new cEntityEffectNightVision (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effPoison: return new cEntityEffectPoison (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effRegeneration: return new cEntityEffectRegeneration (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effResistance: return new cEntityEffectResistance (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effSaturation: return new cEntityEffectSaturation (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effSlowness: return new cEntityEffectSlowness (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effSpeed: return new cEntityEffectSpeed (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effStrength: return new cEntityEffectStrength (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effWaterBreathing: return new cEntityEffectWaterBreathing(a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effWeakness: return new cEntityEffectWeakness (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); - case cEntityEffect::effWither: return new cEntityEffectWither (a_Duration, a_Intensity, a_Creator, a_DistanceModifier); + case cEntityEffect::effAbsorption: return new cEntityEffectAbsorption (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effBlindness: return new cEntityEffectBlindness (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effFireResistance: return new cEntityEffectFireResistance(a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effHaste: return new cEntityEffectHaste (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effHealthBoost: return new cEntityEffectHealthBoost (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effHunger: return new cEntityEffectHunger (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effInstantDamage: return new cEntityEffectInstantDamage (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effInstantHealth: return new cEntityEffectInstantHealth (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effInvisibility: return new cEntityEffectInvisibility (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effJumpBoost: return new cEntityEffectJumpBoost (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effMiningFatigue: return new cEntityEffectMiningFatigue (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effNausea: return new cEntityEffectNausea (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effNightVision: return new cEntityEffectNightVision (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effPoison: return new cEntityEffectPoison (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effRegeneration: return new cEntityEffectRegeneration (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effResistance: return new cEntityEffectResistance (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effSaturation: return new cEntityEffectSaturation (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effSlowness: return new cEntityEffectSlowness (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effSpeed: return new cEntityEffectSpeed (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effStrength: return new cEntityEffectStrength (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effWaterBreathing: return new cEntityEffectWaterBreathing(a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effWeakness: return new cEntityEffectWeakness (a_Duration, a_Intensity, a_DistanceModifier); + case cEntityEffect::effWither: return new cEntityEffectWither (a_Duration, a_Intensity, a_DistanceModifier); } ASSERT(!"Unhandled entity effect type!"); @@ -120,7 +118,7 @@ void cEntityEffectInstantHealth::OnActivate(cPawn & a_Target) { if (((cMonster &) a_Target).IsUndead()) { - a_Target.TakeDamage(dtPotionOfHarming, m_Creator, amount, 0); + a_Target.TakeDamage(dtPotionOfHarming, NULL, amount, 0); // TODO: Store attacker in a pointer-safe way, pass to TakeDamage return; } } @@ -147,7 +145,7 @@ void cEntityEffectInstantDamage::OnActivate(cPawn & a_Target) return; } } - a_Target.TakeDamage(dtPotionOfHarming, m_Creator, amount, 0); + a_Target.TakeDamage(dtPotionOfHarming, NULL, amount, 0); // TODO: Store attacker in a pointer-safe way, pass to TakeDamage } @@ -248,7 +246,7 @@ void cEntityEffectPoison::OnTick(cPawn & a_Target) // Cannot take poison damage when health is at 1 if (a_Target.GetHealth() > 1) { - a_Target.TakeDamage(dtPoisoning, m_Creator, 1, 0); + a_Target.TakeDamage(dtPoisoning, NULL, 1, 0); } } } @@ -269,7 +267,7 @@ void cEntityEffectWither::OnTick(cPawn & a_Target) if (m_Ticks % frequency == 0) { - a_Target.TakeDamage(dtWither, m_Creator, 1, 0); + a_Target.TakeDamage(dtWither, NULL, 1, 0); } //TODO: "<Player> withered away> } diff --git a/src/Entities/EntityEffect.h b/src/Entities/EntityEffect.h index ae7958e11..c593fba81 100644 --- a/src/Entities/EntityEffect.h +++ b/src/Entities/EntityEffect.h @@ -42,9 +42,8 @@ public: /** Creates an entity effect of the specified type @param a_Duration How long this effect will last, in ticks @param a_Intensity How strong the effect will be applied - @param a_Creator The pawn that produced this entity effect @param a_DistanceModifier The distance modifier for affecting potency, defaults to 1 */ - cEntityEffect(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1); + cEntityEffect(int a_Duration, short a_Intensity, double a_DistanceModifier = 1); virtual ~cEntityEffect(void); @@ -53,9 +52,8 @@ public: @param a_EffectType The effect type to create the effect from @param a_Duration How long this effect will last, in ticks @param a_Intensity How strong the effect will be applied - @param a_Creator The pawn that produced this entity effect @param a_DistanceModifier The distance modifier for affecting potency, defaults to 1 */ - static cEntityEffect * CreateEntityEffect(cEntityEffect::eType a_EffectType, int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier); + static cEntityEffect * CreateEntityEffect(cEntityEffect::eType a_EffectType, int a_Duration, short a_Intensity, double a_DistanceModifier); /** Returns how many ticks this effect has been active for */ int GetTicks() { return m_Ticks; } @@ -63,15 +61,12 @@ public: int GetDuration() { return m_Duration; } /** Returns how strong the effect will be applied */ short GetIntensity() { return m_Intensity; } - /** Returns the pawn that produced this entity effect */ - cPawn *GetCreator() { return m_Creator; } /** Returns the distance modifier for affecting potency */ double GetDistanceModifier() { return m_DistanceModifier; } void SetTicks(int a_Ticks) { m_Ticks = a_Ticks; } void SetDuration(int a_Duration) { m_Duration = a_Duration; } void SetIntensity(short a_Intensity) { m_Intensity = a_Intensity; } - void SetCreator(cPawn * a_Creator) { m_Creator = a_Creator; } void SetDistanceModifier(double a_DistanceModifier) { m_DistanceModifier = a_DistanceModifier; } virtual void OnTick(cPawn & a_Target); @@ -88,9 +83,6 @@ protected: /** How strong the effect will be applied */ short m_Intensity; - /** The pawn that produced this entity effect (threw the potion, etc) */ - cPawn *m_Creator; - /** The distance modifier for affecting potency */ double m_DistanceModifier; }; @@ -103,8 +95,8 @@ class cEntityEffectSpeed: { typedef cEntityEffect super; public: - cEntityEffectSpeed(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectSpeed(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -117,8 +109,8 @@ class cEntityEffectSlowness: { typedef cEntityEffect super; public: - cEntityEffectSlowness(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectSlowness(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -131,8 +123,8 @@ class cEntityEffectHaste: { typedef cEntityEffect super; public: - cEntityEffectHaste(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectHaste(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -145,8 +137,8 @@ class cEntityEffectMiningFatigue: { typedef cEntityEffect super; public: - cEntityEffectMiningFatigue(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectMiningFatigue(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -159,8 +151,8 @@ class cEntityEffectStrength: { typedef cEntityEffect super; public: - cEntityEffectStrength(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectStrength(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -173,8 +165,8 @@ class cEntityEffectInstantHealth: { typedef cEntityEffect super; public: - cEntityEffectInstantHealth(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectInstantHealth(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } @@ -189,8 +181,8 @@ class cEntityEffectInstantDamage: { typedef cEntityEffect super; public: - cEntityEffectInstantDamage(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectInstantDamage(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } @@ -205,8 +197,8 @@ class cEntityEffectJumpBoost: { typedef cEntityEffect super; public: - cEntityEffectJumpBoost(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectJumpBoost(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -219,8 +211,8 @@ class cEntityEffectNausea: { typedef cEntityEffect super; public: - cEntityEffectNausea(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectNausea(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -233,8 +225,8 @@ class cEntityEffectRegeneration: { typedef cEntityEffect super; public: - cEntityEffectRegeneration(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectRegeneration(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } @@ -249,8 +241,8 @@ class cEntityEffectResistance: { typedef cEntityEffect super; public: - cEntityEffectResistance(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectResistance(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -263,8 +255,8 @@ class cEntityEffectFireResistance: { typedef cEntityEffect super; public: - cEntityEffectFireResistance(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectFireResistance(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -277,8 +269,8 @@ class cEntityEffectWaterBreathing: { typedef cEntityEffect super; public: - cEntityEffectWaterBreathing(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectWaterBreathing(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -291,8 +283,8 @@ class cEntityEffectInvisibility: { typedef cEntityEffect super; public: - cEntityEffectInvisibility(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectInvisibility(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -305,8 +297,8 @@ class cEntityEffectBlindness: { typedef cEntityEffect super; public: - cEntityEffectBlindness(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectBlindness(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -319,8 +311,8 @@ class cEntityEffectNightVision: { typedef cEntityEffect super; public: - cEntityEffectNightVision(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectNightVision(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -333,8 +325,8 @@ class cEntityEffectHunger: { typedef cEntityEffect super; public: - cEntityEffectHunger(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectHunger(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } @@ -349,8 +341,8 @@ class cEntityEffectWeakness: { typedef cEntityEffect super; public: - cEntityEffectWeakness(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectWeakness(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } @@ -365,8 +357,8 @@ class cEntityEffectPoison: { typedef cEntityEffect super; public: - cEntityEffectPoison(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectPoison(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } @@ -381,8 +373,8 @@ class cEntityEffectWither: { typedef cEntityEffect super; public: - cEntityEffectWither(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectWither(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } @@ -397,8 +389,8 @@ class cEntityEffectHealthBoost: { typedef cEntityEffect super; public: - cEntityEffectHealthBoost(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectHealthBoost(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -411,8 +403,8 @@ class cEntityEffectAbsorption: { typedef cEntityEffect super; public: - cEntityEffectAbsorption(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectAbsorption(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } }; @@ -425,8 +417,8 @@ class cEntityEffectSaturation: { typedef cEntityEffect super; public: - cEntityEffectSaturation(int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier = 1): - super(a_Duration, a_Intensity, a_Creator, a_DistanceModifier) + cEntityEffectSaturation(int a_Duration, short a_Intensity, double a_DistanceModifier = 1): + super(a_Duration, a_Intensity, a_DistanceModifier) { } diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp index 62f71e20f..840736f6a 100644 --- a/src/Entities/Pawn.cpp +++ b/src/Entities/Pawn.cpp @@ -52,16 +52,17 @@ void cPawn::Tick(float a_Dt, cChunk & a_Chunk) void cPawn::KilledBy(cEntity * a_Killer) { ClearEntityEffects(); + super::KilledBy(a_Killer); } -void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, int a_Duration, short a_Intensity, cPawn * a_Creator, double a_DistanceModifier) +void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, int a_Duration, short a_Intensity, double a_DistanceModifier) { // Check if the plugins allow the addition: - if (cPluginManager::Get()->CallHookEntityAddEffect(*this, a_EffectType, a_Duration, a_Intensity, a_Creator, a_DistanceModifier)) + if (cPluginManager::Get()->CallHookEntityAddEffect(*this, a_EffectType, a_Duration, a_Intensity, a_DistanceModifier)) { // A plugin disallows the addition, bail out. return; @@ -74,7 +75,7 @@ void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, int a_Duration, s } a_Duration = (int)(a_Duration * a_DistanceModifier); - m_EntityEffects[a_EffectType] = cEntityEffect::CreateEntityEffect(a_EffectType, a_Duration, a_Intensity, a_Creator, a_DistanceModifier); + m_EntityEffects[a_EffectType] = cEntityEffect::CreateEntityEffect(a_EffectType, a_Duration, a_Intensity, a_DistanceModifier); m_World->BroadcastEntityEffect(*this, a_EffectType, a_Intensity, a_Duration); m_EntityEffects[a_EffectType]->OnActivate(*this); } diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index 307e5db3d..252ec5edb 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -30,10 +30,9 @@ public: @param a_EffectType The entity effect to apply @param a_EffectDurationTicks The duration of the effect @param a_EffectIntensity The level of the effect (0 = Potion I, 1 = Potion II, etc) - @param a_Creator The pawn that produced the effect (e.g. threw the potion) @param a_DistanceModifier The scalar multiplied to the potion duration, only applies to splash potions) */ - void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, cPawn * a_Creator, double a_DistanceModifier = 1); + void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, double a_DistanceModifier = 1); /** Removes a currently applied entity effect @param a_EffectType The entity effect to remove diff --git a/src/Entities/SplashPotionEntity.cpp b/src/Entities/SplashPotionEntity.cpp index 3d2ef279f..e84f1c430 100644 --- a/src/Entities/SplashPotionEntity.cpp +++ b/src/Entities/SplashPotionEntity.cpp @@ -79,7 +79,7 @@ bool cSplashPotionEntity::cSplashPotionCallback::Item(cEntity * a_Entity) } m_EntityEffect.SetDistanceModifier(Reduction); - ((cPawn *) a_Entity)->AddEntityEffect(m_EntityEffectType, m_EntityEffect.GetDuration(), m_EntityEffect.GetIntensity(), m_EntityEffect.GetCreator(), Reduction); + ((cPawn *) a_Entity)->AddEntityEffect(m_EntityEffectType, m_EntityEffect.GetDuration(), m_EntityEffect.GetIntensity(), Reduction); } return false; } diff --git a/src/Items/ItemPotion.h b/src/Items/ItemPotion.h index 43b9f280d..5badeda94 100644 --- a/src/Items/ItemPotion.h +++ b/src/Items/ItemPotion.h @@ -123,7 +123,7 @@ public: Vector3d Speed = a_Player->GetLookVector() * 7; short potion_damage = a_Item.m_ItemDamage; - cSplashPotionEntity *Projectile = new cSplashPotionEntity(a_Player, Pos.x, Pos.y, Pos.z, &Speed, GetEntityEffectType(potion_damage), cEntityEffect(GetEntityEffectDuration(potion_damage), GetEntityEffectIntensity(potion_damage), a_Player), GetPotionName(potion_damage)); + cSplashPotionEntity *Projectile = new cSplashPotionEntity(a_Player, Pos.x, Pos.y, Pos.z, &Speed, GetEntityEffectType(potion_damage), cEntityEffect(GetEntityEffectDuration(potion_damage), GetEntityEffectIntensity(potion_damage)), GetPotionName(potion_damage)); if (Projectile == NULL) { return false; @@ -146,7 +146,7 @@ public: virtual bool EatItem(cPlayer * a_Player, cItem * a_Item) override { // Called when potion is a drinkable potion - a_Player->AddEntityEffect(GetEntityEffectType(a_Item->m_ItemDamage), GetEntityEffectDuration(a_Item->m_ItemDamage), GetEntityEffectIntensity(a_Item->m_ItemDamage), a_Player); + a_Player->AddEntityEffect(GetEntityEffectType(a_Item->m_ItemDamage), GetEntityEffectDuration(a_Item->m_ItemDamage), GetEntityEffectIntensity(a_Item->m_ItemDamage)); a_Player->GetInventory().RemoveOneEquippedItem(); a_Player->GetInventory().AddItem(E_ITEM_GLASS_BOTTLE); return true; diff --git a/src/Mobs/CaveSpider.cpp b/src/Mobs/CaveSpider.cpp index 34135714d..118a6e93b 100644 --- a/src/Mobs/CaveSpider.cpp +++ b/src/Mobs/CaveSpider.cpp @@ -34,7 +34,7 @@ void cCaveSpider::Attack(float a_Dt) if (m_Target->IsPawn()) { // TODO: Easy = no poison, Medium = 7 seconds, Hard = 15 seconds - ((cPawn *) m_Target)->AddEntityEffect(cEntityEffect::effPoison, 7 * 20, 0, this); + ((cPawn *) m_Target)->AddEntityEffect(cEntityEffect::effPoison, 7 * 20, 0); } } |