Getter added & Extra Code Cleanup

This commit is contained in:
xIvan0ff
2021-05-23 00:17:50 +03:00
parent 564b6b8b17
commit fa6fc881e6
2 changed files with 160 additions and 140 deletions

View File

@@ -14,6 +14,24 @@
*/ */
namespace LuaCreature namespace LuaCreature
{ {
/**
* Returns `true` if the [Creature] can regenerate health,
* and returns `false` otherwise.
*
* @return bool isRegenerating
*/
int IsRegeneratingHealth(lua_State* L, Creature* creature)
{
#if defined(AZEROTHCORE)
Eluna::Push(L, creature->isRegeneratingHealth());
#elif defined(TRINITY)
Eluna::Push(L, creature->CanRegenerateHealth());
#else
Eluna::Push(L, creature->IsRegeneratingHealth());
#endif
return 1;
}
/** /**
* Sets whether the [Creature] can regenerate health or not. * Sets whether the [Creature] can regenerate health or not.
* *
@@ -963,6 +981,7 @@ namespace LuaCreature
return 0; return 0;
} }
/** /**
* Makes the [Creature] able to fly if enabled. * Makes the [Creature] able to fly if enabled.
* *

View File

@@ -811,6 +811,7 @@ ElunaRegister<Creature> CreatureMethods[] =
{ "SetEquipmentSlots", &LuaCreature::SetEquipmentSlots }, { "SetEquipmentSlots", &LuaCreature::SetEquipmentSlots },
// Boolean // Boolean
{ "IsRegeneratingHealth", &LuaCreature::IsRegeneratingHealth },
#if defined(TRINITY) || defined(AZEROTHCORE) #if defined(TRINITY) || defined(AZEROTHCORE)
{ "IsDungeonBoss", &LuaCreature::IsDungeonBoss }, { "IsDungeonBoss", &LuaCreature::IsDungeonBoss },
#endif #endif