Ejemplo n.º 1
0
        public static bool SensorLockSequence_CompleteOrders_Prefix(SensorLockSequence __instance, AbstractActor ___owningActor)
        {
            Mod.Log.Trace?.Write("SLS:CO entered, aborting invocation");
            //Mod.Log.Trace?.Write($"  oa:{___owningActor.DisplayName}_{___owningActor.GetPilot().Name} hasFired:{___owningActor.HasFiredThisRound} hasMoved:{___owningActor.HasMovedThisRound} hasActivated:{___owningActor.HasActivatedThisRound}");

            // Force the ability to be on cooldown
            if (PilotHasFreeSensorLockAbility(___owningActor))
            {
                Pilot   pilot   = ___owningActor.GetPilot();
                Ability ability = pilot.GetActiveAbility(ActiveAbilityID.SensorLock);
                Mod.Log.Debug?.Write($"  On sensor lock complete, cooldown is:{ability.CurrentCooldown}");
                if (ability.CurrentCooldown < 1)
                {
                    ability.ActivateCooldown();
                }

                Mod.Log.Debug?.Write($"  Clearing all sequences");

                if (ModState.SelectionStateSensorLock != null)
                {
                    Mod.Log.Debug?.Write($"  Calling clearTargetedActor");
                    Traverse traverse = Traverse.Create(ModState.SelectionStateSensorLock).Method("ClearTargetedActor");
                    traverse.GetValue();

                    //State.SelectionStateSensorLock.BackOut();

                    ModState.SelectionStateSensorLock = null;
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        public static void SelectionStateSensorLock_CanActorUseThisState_Postfix(SelectionStateSensorLock __instance, AbstractActor actor, ref bool __result)
        {
            Mod.Log.Trace?.Write("SSSL:CAUTS entered");

            if (PilotHasFreeSensorLockAbility(actor))
            {
                Pilot   pilot         = actor?.GetPilot();
                Ability activeAbility = pilot.GetActiveAbility(ActiveAbilityID.SensorLock);
                bool    flag          = (activeAbility != null && activeAbility.IsAvailable);
                Mod.Log.Debug?.Write($"  Pilot has sensorLock:{activeAbility} and abilityIsAvailable:{activeAbility.IsAvailable}");
                __result = flag;
            }
        }