From 83120a804655be3ca9354456c2cdf3e47079f51f Mon Sep 17 00:00:00 2001 From: Jon Pepler Date: Mon, 11 May 2026 13:08:04 +0100 Subject: [PATCH] fix: propagate AlwaysEvaluable through ActionAPIEntry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Attribute-based registration constructed ActionAPIEntry without threading attr.AlwaysEvaluable into its base APIEntry, so any [TelemetryAPI(IsAction = true, AlwaysEvaluable = true)] handler was silently hard-gated to flight mode regardless of the flag. Behaviour-preserving on the current codebase — no shipped handler combines IsAction + AlwaysEvaluable today — but the flag becomes load-bearing the moment a handler legitimately needs to fire outside flight (e.g. a tech-tree unlock from the Space Center, an alarm add from the editor scene). ActionAPIEntry's ctor takes the new bool with a default of false, so existing call sites remain compatible. --- Telemachus/src/DataLinkHandlerBase.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Telemachus/src/DataLinkHandlerBase.cs b/Telemachus/src/DataLinkHandlerBase.cs index 4ddc3a0..b2fec6f 100644 --- a/Telemachus/src/DataLinkHandlerBase.cs +++ b/Telemachus/src/DataLinkHandlerBase.cs @@ -76,8 +76,9 @@ private void RegisterAnnotatedMethods() APIEntry entry; if (attr.IsAction) - // Action handlers must run on the main Unity thread - entry = new ActionAPIEntry(queueDelayed(fn), attr.Key, attr.Description, formatter); + // Action handlers run on the main Unity thread; propagate AlwaysEvaluable. + entry = new ActionAPIEntry(queueDelayed(fn), attr.Key, attr.Description, formatter, + attr.AlwaysEvaluable); else if (attr.Plotable) entry = new PlotableAPIEntry(fn, attr.Key, attr.Description, formatter, attr.Units, attr.AlwaysEvaluable); @@ -214,8 +215,10 @@ public APIEntry(DataLinkHandler.APIDelegate function, string APIString, public class ActionAPIEntry : APIEntry { public ActionAPIEntry(DataLinkHandler.APIDelegate function, - string APIString, string name, DataSourceResultFormatter formatter) - : base(function, APIString, name, formatter, APIEntry.UnitType.UNITLESS) + string APIString, string name, DataSourceResultFormatter formatter, + bool alwaysEvaluable = false) + : base(function, APIString, name, formatter, + APIEntry.UnitType.UNITLESS, alwaysEvaluable) { plotable = false; }