From a53342e23f74f918943841fc484ca6167c32b86b Mon Sep 17 00:00:00 2001 From: Kelsi Date: Mon, 23 Mar 2026 04:07:34 -0700 Subject: [PATCH] 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. --- src/addons/lua_engine.cpp | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/addons/lua_engine.cpp b/src/addons/lua_engine.cpp index a22d615d..6d60c119 100644 --- a/src/addons/lua_engine.cpp +++ b/src/addons/lua_engine.cpp @@ -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(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(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(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);