Added the OnEntityAddEffect hook.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "Pawn.h"
|
||||
#include "../World.h"
|
||||
#include "../Bindings/PluginManager.h"
|
||||
|
||||
|
||||
|
||||
@@ -72,6 +73,14 @@ void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurat
|
||||
|
||||
void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect)
|
||||
{
|
||||
// Check if the plugins allow the addition:
|
||||
if (cPluginManager::Get()->CallHookEntityAddEffect(*this, a_EffectType, a_Effect.GetDuration(), a_Effect.GetIntensity(), a_Effect.GetUser(), a_Effect.GetDistanceModifier()))
|
||||
{
|
||||
// A plugin disallows the addition, bail out.
|
||||
return;
|
||||
}
|
||||
|
||||
// No need to add empty effects:
|
||||
if (a_EffectType == cEntityEffect::effNoEffect)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
// tolua_begin
|
||||
|
||||
/** Applies an entity effect
|
||||
Checks with plugins if they allow the addition.
|
||||
@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)
|
||||
@@ -35,6 +36,7 @@ public:
|
||||
void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, cPawn * a_User, double a_DistanceModifier = 1);
|
||||
|
||||
/** Applies an entity effect
|
||||
Checks with plugins if they allow the addition.
|
||||
@param a_EffectType The entity effect to apply
|
||||
@param a_Effect The parameters of the effect
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user