diff --git a/plugin_template/localizations/commnext_localizations.csv b/plugin_template/localizations/commnext_localizations.csv index 46d005c..40c5b62 100644 --- a/plugin_template/localizations/commnext_localizations.csv +++ b/plugin_template/localizations/commnext_localizations.csv @@ -1,8 +1,8 @@ Key,Type,Desc,English,Italian,German,French,Spanish,Japanese,Korean,Polish,Russian,Chinese (Simplified),Portuguese (Brazil),Chinese (Traditional) PartModules/NextRelay/Band,Text,,Band,Banda,Band,Bande,Banda,频段,대역,Przepustka,Диапазон,频段,Banda,频段 PartModules/NextRelay/SecondaryBand,Text,,Secondary Band,Banda Secondaria,Sekundärband,Bande secondaire,Banda secundaria,次要频段,보조 대역,Druga przepustka,Вторичный диапазон,次要频段,Banda secundária,次要频段 -PartModules/NextRelay/Name,Text,,Signal Relay,Ripetitore di Segnale,,,,,,,,信号中继,, -PartModules/NextRelay/RelayDescription,Text,,This antenna behaves as a relay,,,,,,,,,这款天线能够中继信号,, +PartModules/NextRelay/Name,Text,,Signal Relay,Ripetitore di Segnale,Signalrelais,Relais de signal,Relé de señal,信号中继,신호 중계기,Przekaźnik sygnału,Ретранслятор,信号中继,Relé de sinal,信号中继 +PartModules/NextRelay/RelayDescription,Text,,This antenna behaves as a relay,Questa antenna si comporta da ripetitore,Diese Antenne verhält sich wie ein Relais,Cette antenne se comporte comme un relais,Esta antena se comporta como un relé,此天线作为中继,이 안테나는 중계기로 작동합니다,Ta antena działa jako przekaźnik,Эта антенна работает как реле,这款天线能够中继信号,Esta antena se comporta como um relé,此天线作为中继 CommNext/UI/DistanceLabel,Text,,Distance {0},Distanza {0},Entfernung {0},Distance {0},Distancia {0},距离 {0},거리 {0},Odległość {0},Расстояние {0},距离 {0},Distância {0},距离 {0} CommNext/UI/Powered,Text,,Powered,Alimentato,Betrieben,Alimenté,Alimentado,供电,전원 공급됨,Zasilany,Питание,供电,Alimentado,供电 CommNext/UI/SignalStrength,Text,,Signal Strength,Intensità del Segnale,Signalstärke,Force du Signal,Potencia de la Señal,信号强度,신호 세기,Siła Sygnału,Уровень сигнала,信号强度,Força do Sinal,信号强度 @@ -51,4 +51,5 @@ CommNext/UI/TooltipActivateBandRulers,Text,,Toggle this band rulers in Map View, CommNext/UI/TooltipNoPowerCurrentVessel,Text,,Active vessel has no power,Il veicolo attivo non ha alimentazione,Der aktive Schiff hat keine Stromversorgung,Le vaisseau actif n'a pas d'alimentation,La nave activa no tiene energía,活动船只没有电源,활성 선박에 전원이 없습니다,Aktywny statek nie ma zasilania,Активное судно не имеет питания,活动船只没有电源,A nave ativa não tem energia,活动船只没有电源 CommNext/UI/RulersDisplayModeNone,Text,Rulers display mode: None,Disabled,Disabilitato,Deaktiviert,Désactivé,Desactivado,禁用,비활성화,Dezaktywowane,Отключено,禁用,Desativado,禁用 CommNext/UI/RulersDisplayModeRelays,Text,Rulers display mode: Relays,Only relays,Solo ripetitori,Nur Relais,Seulement les relais,Solo relés,只有中继,릴레이만,Tylko przekaźniki,Только реле,只有中继,Apenas relés,只有中继 -CommNext/UI/RulersDisplayModeAll,Text,Rulers display mode: All,All,Tutti,Alle,Tous,Todos,全部,모두,Wszystkie,Все,全部,Todos,全部 \ No newline at end of file +CommNext/UI/RulersDisplayModeAll,Text,Rulers display mode: All,All,Tutti,Alle,Tous,Todos,全部,모두,Wszystkie,Все,全部,Todos,全部 +PartModules/NextRelay/ElectricCharge,Text,,Electric charge,Carica elettrica,Strom,Charge électrique,Carga eléctrica,电荷,전기 충전,Załadunek elektryczny,Электрический заряд,电荷,Carga elétrica,电荷 \ No newline at end of file diff --git a/plugin_template/patches/configs/relay_module.patch b/plugin_template/patches/configs/relay_module.patch index 612e733..ecdba54 100644 --- a/plugin_template/patches/configs/relay_module.patch +++ b/plugin_template/patches/configs/relay_module.patch @@ -6,27 +6,27 @@ @stage "setup-relays" :parts #antenna_1v_dish_hg5 { @include override-range($commnext-RANGE-HG5) - @include add-next-relay() + @include add-next-relay($commnext-EC-HG5) @include add-next-modulator("DualBand") } @stage "setup-relays" :parts #antenna_0v_dish_ra-2 { @include override-range($commnext-RANGE-RA2) - @include add-next-relay() + @include add-next-relay($commnext-EC-RA2) @include add-next-modulator("OmniBand") } @stage "setup-relays" :parts #antenna_0v_dish_ra-15 { @include override-range($commnext-RANGE-RA15) - @include add-next-relay() + @include add-next-relay($commnext-EC-RA15) @include add-next-modulator("OmniBand") } @stage "setup-relays" :parts #antenna_1v_dish_ra-100 { @include override-range($commnext-RANGE-RA100) - @include add-next-relay() + @include add-next-relay($commnext-EC-RA100) @include add-next-modulator("OmniBand") } \ No newline at end of file diff --git a/plugin_template/patches/libraries/_constants.patch b/plugin_template/patches/libraries/_constants.patch index eb72874..1a866c0 100644 --- a/plugin_template/patches/libraries/_constants.patch +++ b/plugin_template/patches/libraries/_constants.patch @@ -1,10 +1,16 @@ // -Relays // Was 36G, now 2G $commnext-RANGE-RA2: 2000000000.00; +$commnext-EC-RA2: 0.5; // Was 86G, now 15G $commnext-RANGE-RA15: 15000000000.00; +$commnext-EC-RA15: 1.0; // Was 130G, now 100G $commnext-RANGE-RA100: 100000000000.00; +$commnext-EC-RA100: 2.0; +// Stock HG-5 has 200000000.0 (200M) Make it 5M +$commnext-RANGE-HG5: 5000000.00; +$commnext-EC-HG5: 0.2; // -Antennas // Stock command pod has 200000000.0 (200M) range. Make it 5K @@ -13,8 +19,6 @@ $commnext-RANGE-POD: 5000.00; $commnext-RANGE-C16: 500000.00; // Stock 16S has 200000000.0 (200M) range. Make it 500K $commnext-RANGE-C16S: 500000.00; -// Stock HG-5 has 200000000.0 (200M) Make it 5M -$commnext-RANGE-HG5: 5000000.00; // Stock DTS-M1 has 36000000000.0 (36G) range. Make it 2G $commnext-RANGE-DTS-M1: 2000000000.00; // Stock HG-55 has 86000000000.0 (86G) range. Make it 15G diff --git a/plugin_template/patches/libraries/_relay_mixins.patch b/plugin_template/patches/libraries/_relay_mixins.patch index 2f971d2..544e120 100644 --- a/plugin_template/patches/libraries/_relay_mixins.patch +++ b/plugin_template/patches/libraries/_relay_mixins.patch @@ -6,9 +6,14 @@ } } -@mixin add-next-relay() { +@mixin add-next-relay($ec-rate) { +Module_NextRelay { - +Data_NextRelay { + +Data_NextRelay { + RequiredResource: { + Rate: $ec-rate, + ResourceName: "ElectricCharge", + AcceptanceThreshold: 0.1 + }; } } diff --git a/src/CommNext/CommNextPlugin.cs b/src/CommNext/CommNextPlugin.cs index f0f8f3b..f437c97 100644 --- a/src/CommNext/CommNextPlugin.cs +++ b/src/CommNext/CommNextPlugin.cs @@ -1,6 +1,7 @@ using System.Reflection; using BepInEx; using CommNext.Managers; +using CommNext.Modules.Relay; using CommNext.Network; using CommNext.Patches; using CommNext.Rendering; @@ -73,6 +74,11 @@ public override void OnInitialized() Harmony.CreateAndPatchAll(typeof(TelemetryComponentPatches)); Harmony.CreateAndPatchAll(typeof(SimulationObjectModelPatches)); + // EC Background Processing + if (PluginSettings.RelaysRequirePower.Value) + SpaceWarp.API.Parts.PartComponentModuleOverride + .RegisterModuleForBackgroundResourceProcessing(); + // UI MainUIManager.Instance.Initialize(); diff --git a/src/CommNext/Modules/Relay/Data_NextRelay.cs b/src/CommNext/Modules/Relay/Data_NextRelay.cs index 0d1d7fb..99b3be5 100644 --- a/src/CommNext/Modules/Relay/Data_NextRelay.cs +++ b/src/CommNext/Modules/Relay/Data_NextRelay.cs @@ -1,9 +1,12 @@ using BepInEx.Logging; using CommNext.Network.Bands; using CommNext.UI; +using CommNext.Utils; using I2.Loc; +using KSP.Game; using KSP.Sim; using KSP.Sim.Definitions; +using KSP.Sim.ResourceSystem; using KSP.UI.Binding; using UnityEngine; @@ -36,6 +39,26 @@ public override void OnPartBehaviourModuleInit() { } delegateList.Add(new OABPartData.PartInfoModuleEntry( "", s => LocalizedStrings.RelayDescription)); + + // Add resource consumption info (EC/s) + if (PluginSettings.RelaysRequirePower.Value) + delegateList.Add(new OABPartData.PartInfoModuleEntry( + LocalizationManager.GetTranslation("PartModules/Generic/Tooltip/Resources"), + _ => + { + var subEntries = new List + { + new( + LocalizedStrings.ElectricCharge, + PartModuleTooltipLocalization.FormatResourceRate( + RequiredResource.Rate, + PartModuleTooltipLocalization.GetTooltipResourceUnits(RequiredResource.ResourceName) + ) + ) + }; + return subEntries; + })); + return delegateList; } @@ -52,4 +75,46 @@ public override void Copy(ModuleData sourceModuleData) } #endregion + + #region Resources + + public override void SetupResourceRequest(ResourceFlowRequestBroker resourceFlowRequestBroker) + { + if (!PluginSettings.RelaysRequirePower.Value) return; + + var resourceIDFromName = + GameManager.Instance.Game.ResourceDefinitionDatabase.GetResourceIDFromName(RequiredResource.ResourceName); + if (resourceIDFromName == ResourceDefinitionID.InvalidID) + { + Logger.LogError($"There are no resources with name {RequiredResource.ResourceName}"); + return; + } + + RequestConfig = new ResourceFlowRequestCommandConfig + { + FlowResource = resourceIDFromName, + FlowDirection = FlowDirection.FLOW_OUTBOUND, + FlowUnits = 0.0 + }; + RequestHandle = resourceFlowRequestBroker.AllocateOrGetRequest("ModuleCommNextRelay", default); + resourceFlowRequestBroker.SetCommands( + RequestHandle, + 1.0, + [RequestConfig] + ); + } + + // [KSPDefinition] + // [Tooltip("Whether the module consumes resources")] + // public bool UseResources = true; + + public bool HasResourcesToOperate = true; + + [KSPDefinition] + [Tooltip("Resource required to operate this module if it consumes resources")] + public PartModuleResourceSetting RequiredResource; + + public ResourceFlowRequestCommandConfig RequestConfig; + + #endregion } \ No newline at end of file diff --git a/src/CommNext/Modules/Relay/PartComponentModule_NextRelay.cs b/src/CommNext/Modules/Relay/PartComponentModule_NextRelay.cs index 674b6d3..4c0c826 100644 --- a/src/CommNext/Modules/Relay/PartComponentModule_NextRelay.cs +++ b/src/CommNext/Modules/Relay/PartComponentModule_NextRelay.cs @@ -1,6 +1,9 @@ using BepInEx.Logging; +using CommNext.Utils; +using KSP.Game; using KSP.Modules; using KSP.Sim.impl; +using KSP.Sim.ResourceSystem; namespace CommNext.Modules.Relay; @@ -17,8 +20,12 @@ public class PartComponentModule_NextRelay : PartComponentModule /// public Data_Transmitter DataTransmitter { get; private set; } = null!; - private Data_NextRelay _dataRelay; + private Data_NextRelay _dataRelay = null!; + // EC management + private FlowRequestResolutionState _returnedRequestResolutionState; + private bool _hasOutstandingRequest; + private bool _lastHasResourcesToOperate; public override void OnStart(double universalTime) { @@ -30,7 +37,87 @@ public override void OnStart(double universalTime) return; } + // Setup the resource request. This will be applied only if the + // `RelayRequiresPower` setting is true. + _dataRelay.SetupResourceRequest(resourceFlowRequestBroker); + Part!.TryGetModuleData(out var dataTransmitter); DataTransmitter = dataTransmitter; } + + public override void OnUpdate(double universalTime, double deltaUniversalTime) + { + ResourceConsumptionUpdate(deltaUniversalTime); + RefreshCommNetIfNecessary(); + } + + /// + /// Handles the resource consumption for the relay. + /// + private void ResourceConsumptionUpdate(double deltaTime) + { + _lastHasResourcesToOperate = _dataRelay.HasResourcesToOperate; + + // 1. If the relay doesn't require power, we don't need to do anything. + if (!PluginSettings.RelaysRequirePower.Value || DifficultyUtils.HasInfinitePower) + { + // Just set resources to operate to true and return. + _dataRelay.HasResourcesToOperate = true; + if (resourceFlowRequestBroker.IsRequestActive(_dataRelay.RequestHandle)) + resourceFlowRequestBroker.SetRequestInactive(_dataRelay.RequestHandle); + + return; + } + + // 2. If we have an outstanding request, we need to check if it was accepted. + if (_hasOutstandingRequest) + { + _returnedRequestResolutionState = + resourceFlowRequestBroker.GetRequestState(_dataRelay.RequestHandle); + _dataRelay.HasResourcesToOperate = _returnedRequestResolutionState.WasLastTickDeliveryAccepted; + } + + _hasOutstandingRequest = false; + + // 3. We need to align Resource request to Enabled state; + // If relay is disabled, stop active request. + // If relay is enabled, trigger request. + switch (_dataRelay.EnableRelay.GetValue()) + { + case false when resourceFlowRequestBroker.IsRequestActive(_dataRelay.RequestHandle): + resourceFlowRequestBroker.SetRequestInactive(_dataRelay.RequestHandle); + // TODO Not sure about this one. + _dataRelay.HasResourcesToOperate = false; + break; + + case true when resourceFlowRequestBroker.IsRequestInactive(_dataRelay.RequestHandle): + resourceFlowRequestBroker.SetRequestActive(_dataRelay.RequestHandle); + break; + } + + if (!_dataRelay.EnableRelay.GetValue()) return; + + // 3.1 If the relay is enabled, we need to check if we have enough resources to operate. + _dataRelay.RequestConfig.FlowUnits = (double)_dataRelay.RequiredResource.Rate; + resourceFlowRequestBroker.SetCommands( + _dataRelay.RequestHandle, + 1.0, + [_dataRelay.RequestConfig] + ); + _hasOutstandingRequest = true; + } + + /// + /// Trigger a refresh of the CommNet node if the relay has resources to operate. + /// + private void RefreshCommNetIfNecessary() + { + if (_lastHasResourcesToOperate == _dataRelay.HasResourcesToOperate) return; + + Logger.LogDebug( + $"Relay '{Part.PartOwner.DisplayName}' has resources to operate: {_dataRelay.HasResourcesToOperate}"); + + Part.PartOwner.SimulationObject.Telemetry.RefreshCommNetNode(); + _lastHasResourcesToOperate = _dataRelay.HasResourcesToOperate; + } } \ No newline at end of file diff --git a/src/CommNext/Network/NetworkManager.cs b/src/CommNext/Network/NetworkManager.cs index 5ca8cc3..5e9665e 100644 --- a/src/CommNext/Network/NetworkManager.cs +++ b/src/CommNext/Network/NetworkManager.cs @@ -2,6 +2,7 @@ using CommNext.Managers; using CommNext.Network.Compute; using CommNext.Patches; +using CommNext.Utils; using KSP.Game; using KSP.Messages; using KSP.Sim; @@ -36,13 +37,13 @@ public class NetworkManager : ILateUpdate // before rebuilding the graph. private const float RebuildGraphTimerSeconds = 0.2f; - private const float UpdateNoPowerVesselsTimerSeconds = 10f; + // private const float UpdateNoPowerVesselsTimerSeconds = 10f; public Dictionary Nodes { get; private set; } = new(); public void SetupListeners() { - MessageListener.Messages.PersistentSubscribe(OnVesselControlStateChanged); + // MessageListener.Messages.PersistentSubscribe(OnVesselControlStateChanged); // Handle vessel undocked and docked messages MessageListener.Messages.PersistentSubscribe(OnVesselUndocked); @@ -80,17 +81,19 @@ public void UnregisterNode(IGGuid owner) Nodes.Remove(owner); } - /// - /// We want to update node properties (like Flags, etc) when the vessel - /// is updated. - /// - private void OnVesselControlStateChanged(MessageCenterMessage message) - { - var controlMessage = (VesselControlStateChangedMessage)message; - var networkNode = Nodes[controlMessage.Vessel.GlobalId]; - - networkNode.UpdateFromVessel(controlMessage.Vessel); - } + // /// + // /// We want to update node properties (like Flags, etc) when the vessel + // /// is updated. + // /// + // private void OnVesselControlStateChanged(MessageCenterMessage message) + // { + // var controlMessage = (VesselControlStateChangedMessage)message; + // var networkNode = Nodes[controlMessage.Vessel.GlobalId]; + // + // networkNode.HasEnoughResources = DifficultyUtils.HasInfinitePower || + // !PluginSettings.RelaysRequirePower.Value || + // controlMessage.Vessel.ControlStatus != VesselControlState.NoControl; + // } /// /// We want to update the CommNet node when a vessel is undocked, since @@ -122,25 +125,6 @@ private static void OnDecouple(MessageCenterMessage message) #endregion - private float _noPowerTimerRemaining = 0f; - - /// - /// I didn't find the point where the CommNetManager is not updating the - /// single Node state when the vessel has no power, so I'm doing it here - /// in a Routine so that we can keep the nodes in sync. - /// - private void UpdateAllVesselsStateWithNoPower() - { - foreach (var node in Nodes.Values) - { - if (node.HasEnoughResources) continue; - var vessel = GameManager.Instance.Game.UniverseModel.FindVesselComponent(node.Owner); - node.UpdateFromVessel(vessel); - if (node.HasEnoughResources) - Logger.LogInfo($"Vessel {node.Owner} has enough power now, but ControlState didn't update"); - } - } - /// /// We re-implement here the `CommNetManager`'s `Update` method since we /// want it to be executed on _LateUpdate_. This way, we can be sure all @@ -158,13 +142,6 @@ public void OnLateUpdate() if (spaceSimulation is not { IsEnabled: true }) return; - _noPowerTimerRemaining -= Time.deltaTime; - if (_noPowerTimerRemaining <= 0f) - { - UpdateAllVesselsStateWithNoPower(); - _noPowerTimerRemaining = UpdateNoPowerVesselsTimerSeconds; // 10 seconds - } - commNetManager._timerRemaining -= Time.deltaTime; if ((double)commNetManager._timerRemaining < 0.0) { diff --git a/src/CommNext/Network/NetworkNode.cs b/src/CommNext/Network/NetworkNode.cs index a138f5e..ad99e36 100644 --- a/src/CommNext/Network/NetworkNode.cs +++ b/src/CommNext/Network/NetworkNode.cs @@ -11,6 +11,8 @@ public class NetworkNode public IGGuid Owner { get; private set; } public bool IsRelay { get; set; } + + // TODO This is not correctly updated for vessels which are _not_ relays. This is not an issue since we don't care, but it's a bit misleading. public bool HasEnoughResources { get; set; } /// @@ -25,6 +27,7 @@ public class NetworkNode public NetworkNode(IGGuid owner) { Owner = owner; + HasEnoughResources = true; } /// @@ -35,16 +38,12 @@ public NetworkNode(IGGuid owner) /// public void UpdateFromVessel(VesselComponent? vessel) { - if (vessel == null) - { - HasEnoughResources = true; - return; - } + if (vessel == null) return; VesselName = vessel.Name; - HasEnoughResources = DifficultyUtils.HasInfinitePower || - !PluginSettings.RelaysRequirePower.Value || - vessel.ControlStatus != VesselControlState.NoControl; + // HasEnoughResources = DifficultyUtils.HasInfinitePower || + // !PluginSettings.RelaysRequirePower.Value || + // vessel.ControlStatus != VesselControlState.NoControl; } /// diff --git a/src/CommNext/Patches/CommNetManagerPatches.cs b/src/CommNext/Patches/CommNetManagerPatches.cs index 076a61f..cdb847c 100644 --- a/src/CommNext/Patches/CommNetManagerPatches.cs +++ b/src/CommNext/Patches/CommNetManagerPatches.cs @@ -50,6 +50,7 @@ public static void SetSourceNode(CommNetManager __instance, ref ConnectionGraphN }; var sourceNetworkNode = NetworkManager.Instance.Nodes[newSourceNode.Owner]; + sourceNetworkNode.HasEnoughResources = true; sourceNetworkNode.VesselName = LocalizedStrings.KSCCommNet; // KSC communicate always on the first band sourceNetworkNode.SetBandRanges( diff --git a/src/CommNext/Patches/TelemetryComponentPatches.cs b/src/CommNext/Patches/TelemetryComponentPatches.cs index e7b5487..6fd117d 100644 --- a/src/CommNext/Patches/TelemetryComponentPatches.cs +++ b/src/CommNext/Patches/TelemetryComponentPatches.cs @@ -23,6 +23,7 @@ public static class TelemetryComponentPatches public static void OnAdded(SimulationObjectModel simulationObject, double universalTime) { var networkNode = new NetworkNode(simulationObject.GlobalId); + networkNode.HasEnoughResources = true; networkNode.UpdateFromVessel(simulationObject.Vessel); NetworkManager.Instance.RegisterNode(networkNode); } @@ -44,12 +45,20 @@ public static void RefreshCommNetNode(TelemetryComponent __instance) if (partOwner == null) return; var isRelay = false; + // By default, we assume the part has enough resources to operate if it's not a relay + var hasEnoughResources = true; Dictionary bandRanges = new(); foreach (var part in partOwner.Parts) { if (part.TryGetModuleData(out var data)) - isRelay |= data.EnableRelay.GetValue(); + { + var isPartRelay = data.EnableRelay.GetValue(); + isRelay |= isPartRelay; + + if (isPartRelay) + hasEnoughResources &= data.HasResourcesToOperate; + } if (!part.TryGetModule(out var transmitterModule)) continue; @@ -88,6 +97,7 @@ public static void RefreshCommNetNode(TelemetryComponent __instance) } networkNode.IsRelay = isRelay; + networkNode.HasEnoughResources = hasEnoughResources; networkNode.UpdateFromVessel(__instance.SimulationObject.Vessel); networkNode.SetBandRanges(bandRanges); } diff --git a/src/CommNext/UI/Components/NetworkConnectionViewController.cs b/src/CommNext/UI/Components/NetworkConnectionViewController.cs index 0955d58..cd037de 100644 --- a/src/CommNext/UI/Components/NetworkConnectionViewController.cs +++ b/src/CommNext/UI/Components/NetworkConnectionViewController.cs @@ -77,18 +77,6 @@ private void OnControl() ConnectionsRenderer.Instance.ControlVesselOnMap(otherNode); } - private void NotifyRequiresMapView() - { - GameManager.Instance.Game.Notifications.ProcessNotification(new NotificationData() - { - Tier = NotificationTier.Passive, - Primary = new NotificationLineItemData() - { - LocKey = LocalizedStrings.ActionRequiresMapViewKey - } - }); - } - public void Bind(NetworkNode currentNode, NetworkConnection connection) { _currentNode = currentNode; diff --git a/src/CommNext/UI/LocalizedStrings.cs b/src/CommNext/UI/LocalizedStrings.cs index e42e78a..8e42465 100644 --- a/src/CommNext/UI/LocalizedStrings.cs +++ b/src/CommNext/UI/LocalizedStrings.cs @@ -5,6 +5,7 @@ namespace CommNext.UI; public static class LocalizedStrings { public static LocalizedString RelayDescription = "PartModules/NextRelay/RelayDescription"; + public static LocalizedString ElectricCharge = "PartModules/NextRelay/ElectricCharge"; public static LocalizedString Occluded = "CommNext/UI/Occluded"; public static LocalizedString Powered = "CommNext/UI/Powered"; public static LocalizedString Yes = "CommNext/UI/Yes"; diff --git a/src/CommNext/Utils/PluginSettings.cs b/src/CommNext/Utils/PluginSettings.cs index 69c5b15..0a3945e 100644 --- a/src/CommNext/Utils/PluginSettings.cs +++ b/src/CommNext/Utils/PluginSettings.cs @@ -38,7 +38,7 @@ public enum KSCRangeMode public static ConfigEntry BestPath { get; private set; } = null!; public static ConfigEntry RelaysRequirePower { get; private set; } = null!; public static ConfigEntry KSCRange { get; private set; } = null!; - public static ConfigEntry OcclusionRadiusFactor { get; private set; } = null!; + public static ConfigEntry OcclusionRadiusFactor { get; private set; } = null!; // Debug public static ConfigEntry EnableProfileLogs { get; private set; } = null!; @@ -60,7 +60,7 @@ public static void SetupConfig() "Network", "Relays require power", true, - "If true, relays will require power to function.\n" + + "If true, relays will require power to function.\n \n" + "It requires game to be reloaded to take effect." ); @@ -75,12 +75,12 @@ public static void SetupConfig() OcclusionRadiusFactor = Plugin.Config.Bind( "Network", "Occlusion radius", - 0.98, + 0.98f, new ConfigDescription( "The occlusion body radius multiplier.\n" + "A value of 0 means no occlusion, a value of 1 means full planet radius is considered for occlusion.\n" + "Default value is 0.98. Meaning 98% of planet radius is considered for occlusion.\n" + - new AcceptableValueRange(0, 1) + new AcceptableValueRange(0, 1) ) );