/// <summary> /// Similar to TriggerOnNextOpcode(), except this won't trigger until the /// next KOSFixedUpdate in which the callstack is free of other similar /// future-update triggers like this one. This is to be 'nice' to /// other kerboscript code and prevent these types of triggers from /// using 100% of the CPU time. This should be used in /// cases where you intend to make a repeating callback by scheduling /// a new call as soon as you detect the previous one is done. (like /// VectorRenderer's UPDATEVEC does for example). It can also be used for /// one-shots as well, if you think it's okay for the one-shot to wait until /// at least the next update boundary to execute. /// </summary> public TriggerInfo TriggerOnFutureUpdate(InterruptPriority priority, params Structure[] args) { if (CheckForDead(false)) { return(null); } return(Cpu.AddTrigger(this, priority, Cpu.NextTriggerInstanceId, false, args)); }
// Token: 0x06000A75 RID: 2677 RVA: 0x0002DBB7 File Offset: 0x0002BDB7 public bool SetInterruptState(EntityState newNextState, InterruptPriority interruptPriority) { if (this.CanInterruptState(interruptPriority)) { this.nextState = newNextState; return(true); } return(false); }
// Token: 0x06000EDB RID: 3803 RVA: 0x00049186 File Offset: 0x00047386 public bool SetInterruptState(EntityState newNextState, InterruptPriority interruptPriority) { if (((this.nextState != null) ? this.nextState : this.state).GetMinimumInterruptPriority() <= interruptPriority) { this.nextState = newNextState; return(true); } return(false); }
/// <summary> /// Make a new trigger for insertion into the trigger list, which is a callback from C# code. /// </summary> /// <param name="context">The ProgramContext under which this Trigger is meant to run.</param> /// <param name="entryPoint">Address within the program context where the routine starts that /// needs to be called when the trigger needs to be invoked.</param> /// <param name="instanceCount">If you want it to be allowed to make more than one instance of /// a trigger at this EntryPoint, then pass in a call to TriggerInfo.NextInstance here, else /// pass in zero to mean that multiple instances from the same entry point aren't allowed.</param> /// <param name="closure">If not-null, this is the closure the trigger should be called with. /// If null, the trigger will only reliably be able to see global variables.</param> /// <param name="args">list of the arguments to pass in to the function. Note, the existence of /// arguments mandates that this is a callback trigger.</param> public TriggerInfo(IProgramContext context, int entryPoint, InterruptPriority priority, int instanceCount, List <VariableScope> closure, List <Structure> args) { EntryPoint = entryPoint; Priority = priority; InstanceCount = instanceCount; IsCSharpCallback = true; ReturnValue = new ScalarIntValue(0); CallbackFinished = false; Args = args ?? new List <Structure>(); ContextId = context.ContextId; Closure = closure; }
public TriggerInfo AddTrigger(UserDelegate del, InterruptPriority priority, int instanceId, bool immediate, params kOS.Safe.Encapsulation.Structure[] args) { throw new NotImplementedException(); }
public TriggerInfo AddTrigger(int triggerFunctionPointer, InterruptPriority priority, int instanceId, bool immediate, List <VariableScope> closure) { throw new NotImplementedException(); }
public bool HasActiveTriggersAtLeastPriority(InterruptPriority pri) { return(Triggers.Exists(t => t.Priority >= pri && !t.IsImmediateTrigger)); }
// Token: 0x06000A74 RID: 2676 RVA: 0x0002DB9A File Offset: 0x0002BD9A public bool CanInterruptState(InterruptPriority interruptPriority) { return((this.nextState ?? this.state).GetMinimumInterruptPriority() <= interruptPriority); }
/// <summary> /// Take only those pending triggers that AddPendingTrigger added who's /// Priority is higher than the given value, and make them become active. /// ("active" here means "called on the callstack like a subroutine.") /// </summary> /// <param name="aboveThis"></param> public void ActivatePendingTriggersAbovePriority(InterruptPriority aboveThis) { Triggers.AddRange(TriggersToInsert.FindAll(t => t.Priority > aboveThis)); TriggersToInsert.RemoveAll(t => t.Priority > aboveThis); }