1
0

Pawn: renamed HandleEntityEffects to HandleEntityEffect

Exported entity effect functions for ToLua and documented them in APIDesc.lua
This commit is contained in:
archshift 2014-06-12 19:50:02 -07:00
parent 71b4c49490
commit 5b2b6e0615
8 changed files with 15 additions and 10 deletions

View File

@ -1688,6 +1688,9 @@ a_Player:OpenWindow(Window);
TakeDamage = { Return = "" }, TakeDamage = { Return = "" },
KilledBy = { Return = "" }, KilledBy = { Return = "" },
GetHealth = { Return = "number" }, GetHealth = { Return = "number" },
AddEntityEffect = { Params = "EffectType, {{cEntityEffect}}", Return = "", Notes = "Applies an entity effect" },
RemoveEntityEffect = { Params = "EffectType", Return = "", Notes = "Removes a currently applied entity effect" },
ClearEntityEffects = { Return = "", Notes = "Removes all currently applied entity effects" },
}, },
Inherits = "cEntity", Inherits = "cEntity",
}, -- cPawn }, -- cPawn

View File

@ -28,7 +28,7 @@ void cPawn::Tick(float a_Dt, cChunk & a_Chunk)
cEntityEffect &effect_values = iter->second; cEntityEffect &effect_values = iter->second;
// Apply entity effect // Apply entity effect
HandleEntityEffects(effect_type, effect_values); HandleEntityEffect(effect_type, effect_values);
// Reduce the effect's duration // Reduce the effect's duration
effect_values.m_Ticks--; effect_values.m_Ticks--;
@ -106,7 +106,7 @@ void cPawn::ClearEntityEffects()
void cPawn::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect) void cPawn::HandleEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect)
{ {
switch (a_EffectType) switch (a_EffectType)
{ {

View File

@ -23,6 +23,7 @@ public:
virtual void Tick(float a_Dt, cChunk & a_Chunk) override; virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
virtual void KilledBy(cEntity * a_Killer) override; virtual void KilledBy(cEntity * a_Killer) override;
// tolua_begin
/** Applies an entity effect /** Applies an entity effect
* @param a_EffectType The entity effect to apply * @param a_EffectType The entity effect to apply
* @param a_Effect The parameters of the effect * @param a_Effect The parameters of the effect
@ -36,6 +37,7 @@ public:
/** Removes all currently applied entity effects (used when drinking milk) */ /** Removes all currently applied entity effects (used when drinking milk) */
void ClearEntityEffects(); void ClearEntityEffects();
// tolua_end
protected: protected:
typedef std::map<cEntityEffect::eType, cEntityEffect> tEffectMap; typedef std::map<cEntityEffect::eType, cEntityEffect> tEffectMap;
@ -45,7 +47,7 @@ protected:
* @param a_EffectType The selected entity effect * @param a_EffectType The selected entity effect
* @param a_Effect The parameters of the selected entity effect * @param a_Effect The parameters of the selected entity effect
*/ */
virtual void HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect); virtual void HandleEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect);
} ; // tolua_export } ; // tolua_export

View File

@ -1867,7 +1867,7 @@ void cPlayer::TickBurning(cChunk & a_Chunk)
void cPlayer::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect) void cPlayer::HandleEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect)
{ {
switch (a_EffectType) switch (a_EffectType)
{ {
@ -1897,7 +1897,7 @@ void cPlayer::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffe
} }
} }
super::HandleEntityEffects(a_EffectType, a_Effect); super::HandleEntityEffect(a_EffectType, a_Effect);
} }

View File

@ -522,7 +522,7 @@ protected:
virtual void TickBurning(cChunk & a_Chunk) override; virtual void TickBurning(cChunk & a_Chunk) override;
/** Called each tick to handle entity effects*/ /** Called each tick to handle entity effects*/
virtual void HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect) override; virtual void HandleEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect) override;
/** Called in each tick to handle food-related processing */ /** Called in each tick to handle food-related processing */
void HandleFood(void); void HandleFood(void);

View File

@ -128,7 +128,7 @@ public:
{ {
return false; return false;
} }
if (!Projectile->Initialize(*a_World)) if (!Projectile->Initialize(a_World))
{ {
delete Projectile; delete Projectile;
return false; return false;

View File

@ -436,7 +436,7 @@ void cMonster::HandleFalling()
void cMonster::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect) void cMonster::HandleEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect)
{ {
switch (a_EffectType) switch (a_EffectType)
{ {
@ -475,7 +475,7 @@ void cMonster::HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEff
} }
} }
super::HandleEntityEffects(a_EffectType, a_Effect); super::HandleEntityEffect(a_EffectType, a_Effect);
} }

View File

@ -225,7 +225,7 @@ protected:
/* =========================== */ /* =========================== */
virtual void HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect) override; virtual void HandleEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect) override;
float m_IdleInterval; float m_IdleInterval;
float m_DestroyTimer; float m_DestroyTimer;