Exemple #1
0
 public ObserveBody(string type, KerbalismContractRequirement requirement, ConfigNode node) : base(type, requirement)
 {
     maxDistance        = Lib.ConfigValue(node, "maxDistance", 0.0);
     maxDistanceAU      = Lib.ConfigValue(node, "maxDistanceAU", 0.0);
     minSurface         = Lib.ConfigValue(node, "minSurface", 0.0);
     minAngularVelocity = Lib.ConfigValue(node, "minAngularVelocity", 0.0);
     maxAngularVelocity = Lib.ConfigValue(node, "maxAngularVelocity", 0.0);
 }
 protected override void OnParameterLoad(ConfigNode node)
 {
     arguments   = new Arguments(node);
     title       = arguments.title;
     requirement = Configuration.Requirement(arguments.requirementId);
     lastUpdate  = ConfigNodeUtil.ParseValue(node, "lastUpdate", 0.0);
     targetBody  = ConfigNodeUtil.ParseValue <CelestialBody>(node, "targetBody", (CelestialBody)null);
 }
Exemple #3
0
 public AboveWaypoint(string type, KerbalismContractRequirement requirement, ConfigNode node) : base(type, requirement)
 {
     minElevation            = Lib.ConfigValue(node, "minElevation", 0.0);
     minAngularVelocity      = Lib.ConfigValue(node, "minAngularVelocity", 0.0);
     maxAngularVelocity      = Lib.ConfigValue(node, "maxAngularVelocity", 0.0);
     minDistance             = Lib.ConfigValue(node, "minDistance", 0.0);
     maxDistance             = Lib.ConfigValue(node, "maxDistance", 0.0);
     minRadialVelocity       = Lib.ConfigValue(node, "minRadialVelocity", 0.0);
     minRadialVelocityChange = Lib.ConfigValue(node, "minRadialVelocityChange", 0.0);
 }
        public KerbalismContractParameter(Arguments arguments, CelestialBody targetBody)
        {
            this.arguments  = arguments;
            this.targetBody = targetBody;
            this.title      = arguments.title;

            requirement = Configuration.Requirement(arguments.requirementId);

            CreateSubParameters();
        }
        public static void Load()
        {
            var cfg = GameDatabase.Instance.GetConfigNode("KerbalismContracts") ?? new ConfigNode();

            foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("KerbalismContractRequirement"))
            {
                var requirement = new KerbalismContractRequirement(node);
                if (!string.IsNullOrEmpty(requirement.name))
                {
                    Requirements.Add(requirement.name, requirement);
                }
            }
        }
        public Altitude(string type, KerbalismContractRequirement requirement, ConfigNode node) : base(type, requirement)
        {
            min  = Lib.ConfigValue(node, "min", 0);
            max  = Lib.ConfigValue(node, "max", 0);
            minR = Lib.ConfigValue(node, "minR", 0.0);
            maxR = Lib.ConfigValue(node, "maxR", 0.0);

            description = Lib.ConfigValue <string>(node, "description", null);

            if (min == 0 && max == 0 && minR == 0 && maxR == 0)
            {
                Utils.Log($"Invalid altitude restriction in {requirement.name}: must set a min/minR or max/maxR");
            }
        }
Exemple #7
0
 protected override void OnParameterLoad(ConfigNode node)
 {
     requirementId   = ConfigNodeUtil.ParseValue(node, "requirementId", "");
     duration        = ConfigNodeUtil.ParseValue(node, "duration", 0.0);
     allowedDowntime = ConfigNodeUtil.ParseValue(node, "allowedDowntime", 0.0);
     waitDuration    = ConfigNodeUtil.ParseValue(node, "waitDuration", 0.0);
     allowReset      = ConfigNodeUtil.ParseValue(node, "allowReset", true);
     minVessels      = ConfigNodeUtil.ParseValue(node, "minVessels", 1);
     waypointIndex   = ConfigNodeUtil.ParseValue(node, "waypointIndex", 0);
     lastUpdate      = ConfigNodeUtil.ParseValue(node, "lastUpdate", 0.0);
     requirement     = Configuration.Requirement(requirementId);
     durationType    = Lib.ConfigEnum(node, "durationType", DurationParameter.DurationType.countdown);
     allowUnpowered  = ConfigNodeUtil.ParseValue(node, "allowUnpowered", false);
     targetBody      = ConfigNodeUtil.ParseValue <CelestialBody>(node, "targetBody", (CelestialBody)null);
 }
Exemple #8
0
        public static void Load()
        {
            var cfg = GameDatabase.Instance.GetConfigNode("KerbalismContracts") ?? new ConfigNode();

            HideRadiationBelts      = Lib.ConfigValue(cfg, "hideRadiationBelts", true);
            SunObservationEquipment = Lib.ConfigValue(cfg, "sunObservationEquipment", "uvcs");
            MinSunObservationAngle  = Lib.ConfigValue(cfg, "minSunObservationAngle", 2.0);

            foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("KerbalismContractRequirement"))
            {
                var requirement = new KerbalismContractRequirement(node);
                if (!string.IsNullOrEmpty(requirement.name))
                {
                    Requirements.Add(requirement.name, requirement);
                }
            }
        }
        public static SubRequirement Load(KerbalismContractRequirement requirement, ConfigNode node)
        {
            if (subRequirementActivators.Count == 0)
            {
                InitSubRequirementActivators();
            }

            string type = Lib.ConfigValue(node, "name", "");

            if (!subRequirementActivators.ContainsKey(type))
            {
                Utils.Log($"Will ignore unknown sub requirement type {type} in {requirement.name}", LogLevel.Error);
                return(null);
            }

            Utils.LogDebug($"Loading sub requirement {type}");

            return((SubRequirement)subRequirementActivators[type].Invoke(new object[] { type, requirement, node }));
        }
Exemple #10
0
        public KerbalismContractParameter(Arguments arguments, CelestialBody targetBody)
        {
            this.requirementId   = arguments.requirementId;
            this.duration        = arguments.duration.Value;
            this.allowedDowntime = arguments.allowedDowntime.Value;
            this.waitDuration    = arguments.waitDuration.Value;
            this.allowReset      = arguments.allowReset;
            this.minVessels      = arguments.minVessels;
            this.waypointIndex   = arguments.waypointIndex;
            this.title           = arguments.title;
            this.hideChildren    = arguments.hideChildren;
            this.durationType    = arguments.durationType;
            this.allowUnpowered  = arguments.allowUnpowered;
            this.targetBody      = targetBody;

            this.requirement = Configuration.Requirement(requirementId);

            CreateSubParameters();
        }
 public EquipmentRunning(string type, KerbalismContractRequirement requirement, ConfigNode node) : base(type, requirement)
 {
     equipmentId      = Lib.ConfigValue(node, "equipmentId", "");
     description      = Lib.ConfigValue <string>(node, "description", null);
     shortDescription = Lib.ConfigValue <string>(node, "shortDescription", null);
 }
 protected SubRequirement(string type, KerbalismContractRequirement parent)
 {
     this.type   = type;
     this.parent = parent;
 }
Exemple #13
0
 public SolarElevation(string type, KerbalismContractRequirement requirement, ConfigNode node) : base(type, requirement)
 {
     min         = Lib.ConfigValue(node, "min", double.MinValue);
     max         = Lib.ConfigValue(node, "max", double.MaxValue);
     description = Lib.ConfigValue <string>(node, "description", null);
 }