private void TTABExecute_Click(object sender, EventArgs e)
{
var interaction = TreeTableSel.Interactions[interactionList.SelectedIndex];
var ActionID = interaction.ActionFunction;
BHAV bhav;
FSO.Content.GameIffResource CodeOwner;
if (ActionID < 4096)
{ //global
bhav = null;
//unimp as it has to access the context to get this.
}
else if (ActionID < 8192)
{ //local
bhav = SelectedEntity.Object.Resource.Get<BHAV>(ActionID);
CodeOwner = SelectedEntity.Object.Resource;
}
else
{ //semi-global
bhav = SelectedEntity.SemiGlobal.Get<BHAV>(ActionID);
CodeOwner = SelectedEntity.SemiGlobal;
}
if (bhav != null)
{
ActiveEntity.Thread.EnqueueAction(new VMQueuedAction()
{
ActionRoutine = vm.Assemble(bhav),
Callee = SelectedEntity,
StackObject = SelectedEntity,
CodeOwner = SelectedEntity.Object,
Name = (string)interactionList.SelectedItem,
InteractionNumber = (int)interaction.TTAIndex, //interactions are referenced by their tta index
Priority = (short)VMQueuePriority.UserDriven
});
}
}