Wire production aircraft callbacks and diagnose native prison action selection
This commit is contained in:
@@ -136,6 +136,43 @@ class ERR_OrdinaryGateObserver
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static string ChoiceIdentity(BaseUserAction action)
|
||||
{
|
||||
if (!action) return "none:-1";
|
||||
// Native class metadata and local action ID only: never action names,
|
||||
// denial text, player identity or CanBeShown/CanBePerformed callbacks.
|
||||
return string.Format("%1:%2", action.Type().ToString(), action.GetActionID());
|
||||
}
|
||||
|
||||
protected void ObserveChoices(int index, int now)
|
||||
{
|
||||
string choices;
|
||||
if (!System.GetCLIParam("errOrdinaryGateChoices", choices) || choices != m_Nonce) return;
|
||||
if (m_Stopped || !Context()) return;
|
||||
BaseUserAction selected = m_Handler.GetSelectedAction();
|
||||
bool contextMatch = m_Handler.GetCurrentContext() == m_Context;
|
||||
array<BaseUserAction> actions = {};
|
||||
array<bool> permitted = {};
|
||||
m_Handler.GetFilteredActions(actions, permitted);
|
||||
string ordered = "";
|
||||
int shown = actions.Count();
|
||||
if (shown > 8) shown = 8;
|
||||
for (int i = 0; i < shown; i++)
|
||||
{
|
||||
int cached = -1;
|
||||
if (i < permitted.Count())
|
||||
{
|
||||
cached = 0;
|
||||
if (permitted[i]) cached = 1;
|
||||
}
|
||||
if (i > 0) ordered += ",";
|
||||
ordered += string.Format("%1=%2:%3", i, ChoiceIdentity(actions[i]), cached);
|
||||
}
|
||||
if (!Context()) return;
|
||||
string detail = string.Format("selected=%1 context=%2 actions=%3 permissions=%4 shown=%5 truncated=%6 ordered=[%7]", ChoiceIdentity(selected), contextMatch, actions.Count(), permitted.Count(), shown, actions.Count() > shown, ordered);
|
||||
PrintFormat("ERR GATE CHOICE: run=%1 sample=%2 real=%3 %4", m_Nonce, index, now, detail);
|
||||
}
|
||||
|
||||
protected void Observe(ERR_GameMode mode, BaseWorld world, PlayerController controller, IEntity actor, string nonce, int started, int index, int now)
|
||||
{
|
||||
if (m_Stopped) return;
|
||||
@@ -174,6 +211,7 @@ class ERR_OrdinaryGateObserver
|
||||
PrintFormat("ERR GATE OBSERVE: run=%1 sample=%2 real=%3 %4", m_Nonce, index, now, actionDetail);
|
||||
string geometry = string.Format("GEOMETRY body=%1 context=%2 radius=%3 doorState=%4 doorControl=%5 prison=%6 gate=%7 gateForward=%8", origin, contextOrigin, radius, state, control, prison, gate, gateForward);
|
||||
PrintFormat("ERR GATE OBSERVE: run=%1 sample=%2 real=%3 %4", m_Nonce, index, now, geometry);
|
||||
ObserveChoices(index, now);
|
||||
m_Index = index; m_Previous = now;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user