feat: add taxi/flight path API (NumTaxiNodes, TaxiNodeName, TakeTaxiNode)

NumTaxiNodes() returns the count of taxi nodes available at the
current flight master. TaxiNodeName(index) returns the node name.
TaxiNodeGetType(index) returns whether the node is known/reachable.
TakeTaxiNode(index) activates the flight to the selected node.

Uses existing taxiNodes_ data and activateTaxi() method.
Enables flight path addons and taxi map overlay addons.
This commit is contained in:
Kelsi 2026-03-23 04:07:34 -07:00
parent 285c4caf24
commit a53342e23f

View file

@ -5182,6 +5182,54 @@ void LuaEngine::registerCoreAPI() {
if (gh) gh->requestPvpLog();
return 0;
}},
// --- Taxi/Flight Paths ---
{"NumTaxiNodes", [](lua_State* L) -> int {
auto* gh = getGameHandler(L);
lua_pushnumber(L, gh ? gh->getTaxiNodes().size() : 0);
return 1;
}},
{"TaxiNodeName", [](lua_State* L) -> int {
auto* gh = getGameHandler(L);
int index = static_cast<int>(luaL_checknumber(L, 1));
if (!gh) { lua_pushstring(L, ""); return 1; }
int i = 0;
for (const auto& [id, node] : gh->getTaxiNodes()) {
if (++i == index) {
lua_pushstring(L, node.name.c_str());
return 1;
}
}
lua_pushstring(L, "");
return 1;
}},
{"TaxiNodeGetType", [](lua_State* L) -> int {
auto* gh = getGameHandler(L);
int index = static_cast<int>(luaL_checknumber(L, 1));
if (!gh) { lua_pushnumber(L, 0); return 1; }
int i = 0;
for (const auto& [id, node] : gh->getTaxiNodes()) {
if (++i == index) {
bool known = gh->isKnownTaxiNode(id);
lua_pushnumber(L, known ? 1 : 0); // 0=none, 1=reachable, 2=current
return 1;
}
}
lua_pushnumber(L, 0);
return 1;
}},
{"TakeTaxiNode", [](lua_State* L) -> int {
auto* gh = getGameHandler(L);
int index = static_cast<int>(luaL_checknumber(L, 1));
if (!gh) return 0;
int i = 0;
for (const auto& [id, node] : gh->getTaxiNodes()) {
if (++i == index) {
gh->activateTaxi(id);
break;
}
}
return 0;
}},
// --- Quest Interaction ---
{"AcceptQuest", [](lua_State* L) -> int {
auto* gh = getGameHandler(L);