mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: add UnitOnTaxi function for flight path detection
Returns true when the player is on a taxi/flight path. Used by action bar addons to disable abilities during flight and by map addons to track taxi state.
This commit is contained in:
parent
b1171327cb
commit
8dca33e5cc
1 changed files with 16 additions and 0 deletions
|
|
@ -540,6 +540,21 @@ static int lua_UnitDetailedThreatSituation(lua_State* L) {
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnitOnTaxi(unit) → boolean (true if on a flight path)
|
||||||
|
static int lua_UnitOnTaxi(lua_State* L) {
|
||||||
|
const char* uid = luaL_optstring(L, 1, "player");
|
||||||
|
auto* gh = getGameHandler(L);
|
||||||
|
if (!gh) { lua_pushboolean(L, 0); return 1; }
|
||||||
|
std::string uidStr(uid);
|
||||||
|
for (char& c : uidStr) c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
|
||||||
|
if (uidStr == "player") {
|
||||||
|
lua_pushboolean(L, gh->isOnTaxiFlight());
|
||||||
|
} else {
|
||||||
|
lua_pushboolean(L, 0); // Can't determine for other units
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// UnitSex(unit) → 1=unknown, 2=male, 3=female
|
// UnitSex(unit) → 1=unknown, 2=male, 3=female
|
||||||
static int lua_UnitSex(lua_State* L) {
|
static int lua_UnitSex(lua_State* L) {
|
||||||
const char* uid = luaL_optstring(L, 1, "player");
|
const char* uid = luaL_optstring(L, 1, "player");
|
||||||
|
|
@ -3219,6 +3234,7 @@ void LuaEngine::registerCoreAPI() {
|
||||||
{"UnitIsTapped", lua_UnitIsTapped},
|
{"UnitIsTapped", lua_UnitIsTapped},
|
||||||
{"UnitIsTappedByPlayer", lua_UnitIsTappedByPlayer},
|
{"UnitIsTappedByPlayer", lua_UnitIsTappedByPlayer},
|
||||||
{"UnitIsTappedByAllThreatList", lua_UnitIsTappedByAllThreatList},
|
{"UnitIsTappedByAllThreatList", lua_UnitIsTappedByAllThreatList},
|
||||||
|
{"UnitOnTaxi", lua_UnitOnTaxi},
|
||||||
{"UnitThreatSituation", lua_UnitThreatSituation},
|
{"UnitThreatSituation", lua_UnitThreatSituation},
|
||||||
{"UnitDetailedThreatSituation", lua_UnitDetailedThreatSituation},
|
{"UnitDetailedThreatSituation", lua_UnitDetailedThreatSituation},
|
||||||
{"UnitSex", lua_UnitSex},
|
{"UnitSex", lua_UnitSex},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue