/// <summary> /// Whether this vessel meets the parameter condition. /// </summary> /// <param name="vessel">Vessel to check</param> /// <returns>Whether the vessel meets the parameter condition(s).</returns> protected override bool VesselMeetsCondition(Vessel vessel) { LoggingUtil.LogVerbose(this, "Checking VesselMeetsCondition: " + vessel.id + " (" + vessel.vesselName + ")"); // Get all the antennae VesselSatellite sat = RTCore.Instance.Satellites[vessel.id]; IEnumerable <IAntenna> antennas = sat != null ? sat.Antennas : new List <IAntenna>(); // If we're a VesselParameterGroup child, only do actual state change if we're the tracked vessel bool checkOnly = false; VesselParameterGroup vpg = GetParameterGroupHost(); if (vpg != null) { checkOnly = vpg.TrackedVessel != vessel; } return(ParameterDelegate <IAntenna> .CheckChildConditions(this, antennas, checkOnly)); }
protected override void OnParameterStateChange(ContractParameter param) { if (param.State == ParameterState.Complete && parameter.Contains(param.ID)) { VesselParameterGroup vpg = param as VesselParameterGroup; SetCrew(vpg.TrackedVessel); // If the parameter is the last one to complete, then the events fire in the wrong // order. So check for that condition. if (contract.ContractState == Contract.State.Completed) { DoAwarding(); } // Sometimes we can also get multiple events for the same parameter (even without // disableOnStateChange set to false). So prevent duplicate experience rewards. parameter.Remove(param.ID); } }