Merge pull request #369 from r-o-b-o-t-o/add-setincombatwith

Add Unit::SetInCombatWith()
This commit is contained in:
Rochet2
2021-06-05 13:58:48 +03:00
committed by GitHub
2 changed files with 13 additions and 0 deletions

View File

@@ -335,6 +335,7 @@ ElunaRegister<Unit> UnitMethods[] =
#endif
{ "SetWaterWalk", &LuaUnit::SetWaterWalk },
{ "SetStandState", &LuaUnit::SetStandState },
{ "SetInCombatWith", &LuaUnit::SetInCombatWith },
{ "ModifyPower", &LuaUnit::ModifyPower },
// Boolean

View File

@@ -1842,6 +1842,18 @@ namespace LuaUnit
return 0;
}
/**
* Sets the [Unit] in combat with the `enemy` [Unit].
*
* @param [Unit] enemy : the [Unit] to start combat with
*/
int SetInCombatWith(lua_State* L, Unit* unit)
{
Unit* enemy = Eluna::CHECKOBJ<Unit>(L, 2);
unit->SetInCombatWith(enemy);
return 0;
}
#if (!defined(TBC) && !defined(CLASSIC))
/**
* Sets the [Unit]'s FFA flag on or off.