Skip to content

Commit f288158

Browse files
Moved settings from cfg file to settings page
1 parent 9370416 commit f288158

27 files changed

Lines changed: 115 additions & 60 deletions

Changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
ChangeLog
22

3+
1.0.11
4+
Moved settings from cfg file to settings page
5+
36
1.0.10
47
Updated for KSP 1.8
58

1.5 KB
Binary file not shown.

GameData/ShipEffectsContinued/ShipEffects.cfg

Lines changed: 0 additions & 19 deletions
This file was deleted.

GameData/ShipEffectsContinued/ShipEffectsContinued.version

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
"VERSION": {
77
"MAJOR": 1,
88
"MINOR": 0,
9-
"PATCH": 9,
10-
"BUILD": 1
9+
"PATCH": 11,
10+
"BUILD": 0
1111
},
1212
"KSP_VERSION_MIN": {
1313
"MAJOR": 1,
14-
"MINOR": 2,
15-
"PATCH": 2
14+
"MINOR": 8,
15+
"PATCH": 0
1616
}
17-
}
17+
}

ShipEffectsContinued.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"VERSION": {
77
"MAJOR": 1,
88
"MINOR": 0,
9-
"PATCH": 10,
9+
"PATCH": 11,
1010
"BUILD": 0
1111
},
1212
"KSP_VERSION_MIN": {

Source/AssemblyVersion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55

66
using System.Reflection;
77

8-
[assembly: AssemblyVersion("1.0.9.1")]
8+
[assembly: AssemblyVersion("1.0.11.0")]

Source/Settings.cs

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
using System.Reflection;
2+
using UnityEngine;
3+
namespace ShipEffectsContinued
4+
{
5+
// http://forum.kerbalspaceprogram.com/index.php?/topic/147576-modders-notes-for-ksp-12/#comment-2754813
6+
// search for "Mod integration into Stock Settings
7+
// HighLogic.CurrentGame.Parameters.CustomParams<SE>().
8+
9+
public class SE : GameParameters.CustomParameterNode
10+
{
11+
public override string Title { get { return ""; } }
12+
public override GameParameters.GameMode GameMode { get { return GameParameters.GameMode.ANY; } }
13+
public override string Section { get { return "Ship Effects"; } }
14+
public override string DisplaySection { get { return "Ship Effects"; } }
15+
public override int SectionOrder { get { return 1; } }
16+
public override bool HasPresets { get { return false; } }
17+
18+
[GameParameters.CustomParameterUI("Only in IVA")]
19+
public bool OnlyInIVA = true;
20+
21+
[GameParameters.CustomParameterUI("Only if crewed")]
22+
public bool OnlyIfCrewed = true;
23+
24+
[GameParameters.CustomFloatParameterUI("Master Volume", minValue = 0, maxValue = 100f, stepCount = 101, displayFormat = "F0",
25+
toolTip = "range is from 0-100")]
26+
public float masterVolume = 100.0f;
27+
28+
[GameParameters.CustomFloatParameterUI("Rattle Volume", minValue = 0, maxValue = 100f, stepCount = 101, displayFormat = "F0",
29+
toolTip = "range is from 0-100")]
30+
public float rattleVolume = 100.0f;
31+
32+
[GameParameters.CustomFloatParameterUI("Vibration Volume", minValue = 0, maxValue = 100f, stepCount = 101, displayFormat = "F0",
33+
toolTip = "range is from 0-100")]
34+
public float vibrationVolume = 100.0f;
35+
36+
[GameParameters.CustomFloatParameterUI("Rumble Volume", minValue = 0, maxValue = 100f, stepCount = 101, displayFormat = "F0",
37+
toolTip = "range is from 0-100")]
38+
public float rumbleVolume = 100.0f;
39+
40+
[GameParameters.CustomFloatParameterUI("Thump Volume", minValue = 0, maxValue = 100f, stepCount = 101, displayFormat = "F0",
41+
toolTip = "range is from 0-100")]
42+
public float thumpVolume = 100.0f;
43+
44+
[GameParameters.CustomFloatParameterUI("Stress Volume", minValue = 0, maxValue = 100f, stepCount = 101, displayFormat = "F0",
45+
toolTip = "range is from 0-100")]
46+
public float stressVolume = 60.0f;
47+
48+
[GameParameters.CustomFloatParameterUI("Atmosphere Volume", minValue = 0, maxValue = 100f, stepCount = 101, displayFormat = "F0",
49+
toolTip = "range is from 0-100")]
50+
public float atmosphereVolume = 60.0f;
51+
52+
[GameParameters.CustomFloatParameterUI("Resist Multiplier", minValue = 0.1f, maxValue = 5f, stepCount = 101, displayFormat = "F2",
53+
toolTip = "Exaggerates or eases the value that controls the sound. a higher number means Sounds will play sooner, lower means later.")]
54+
public float resistMultiplier = 1.75f;
55+
56+
// Default is 8.0, how much g-force to simulate during re-entry
57+
[GameParameters.CustomFloatParameterUI("ReEntry Multiplier", minValue = 2, maxValue = 16f, stepCount = 101, displayFormat = "F1",
58+
toolTip = "How much g-force to simulate during re-entry. range is from 0-100")]
59+
public float reEntryMultiplier = 8.0f;
60+
61+
62+
public override void SetDifficultyPreset(GameParameters.Preset preset)
63+
{
64+
}
65+
66+
public override bool Enabled(MemberInfo member, GameParameters parameters)
67+
{
68+
return true;
69+
}
70+
public override bool Interactible(MemberInfo member, GameParameters parameters)
71+
{
72+
return true;
73+
}
74+
75+
76+
}
77+
}

Source/ShipEffectsContinued.cs

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class SEMaster : MonoBehaviour
3737
FXGroup dockedGroup = new FXGroup("DockFXGroup");
3838
FXGroup undockedGroup = new FXGroup("DockFXGroup");
3939

40+
#if false
4041
//Settings
4142
public float masterVolume = 1f;
4243
public float rVolCtrl = 1f;
@@ -48,7 +49,7 @@ public class SEMaster : MonoBehaviour
4849

4950
public float resistMultiplier = 1.0f;
5051
public float reEntryMultiplier = 8.0f;
51-
52+
#endif
5253
//sets
5354
bool rumbleSet;
5455
bool smallRattlesSet;
@@ -83,8 +84,10 @@ public class SEMaster : MonoBehaviour
8384
float counter = 0;
8485

8586
bool doEngineThrust;
87+
#if false
8688
bool onlyIVA = true;
8789
bool onlyIfCrewed = true;
90+
#endif
8891

8992
void Start()
9093
{
@@ -93,8 +96,9 @@ void Start()
9396
return;
9497

9598
LoadGroups();
96-
99+
#if false
97100
LoadSettings();
101+
#endif
98102

99103
GameEvents.onPartCouple.Add(this.onVesselDock);
100104
GameEvents.onPartUndock.Add(this.onVesselUndock);
@@ -118,7 +122,7 @@ void LoadGroups()
118122
dockedSet = createGroup(dockedGroup, vessel, dockedClip, false, true);
119123
undockedSet = createGroup(undockedGroup, vessel, undockedClip, false, true);
120124
}
121-
125+
#if false
122126
void LoadSettings()
123127
{
124128
bool settingsRead = false;
@@ -158,6 +162,7 @@ void LoadSettings()
158162
//break;
159163
}
160164
}
165+
#endif
161166

162167
public bool createGroup(FXGroup group, Vessel vessel, string clip, bool loop, bool fxBypass)
163168
{
@@ -185,7 +190,7 @@ void SoundFX(FXGroup fx, float volume, float volCtrl, float spread, bool play)
185190
if (!gamePaused && !fx.audio.isPlaying && play == true)
186191
{
187192
fx.audio.Play();
188-
fx.audio.volume = (Mathf.Clamp(volume, 0, 1f) * volCtrl) * masterVolume;
193+
fx.audio.volume = (Mathf.Clamp(volume, 0, 1f) * volCtrl) * HighLogic.CurrentGame.Parameters.CustomParams<SE>().masterVolume;
189194
}
190195
else
191196
{
@@ -271,7 +276,7 @@ void Update()
271276

272277
if (burnDownTime > 0)
273278
{
274-
vResist += (aeroFx.FxScalar * burnDownTime * reEntryMultiplier);
279+
vResist += (aeroFx.FxScalar * burnDownTime * HighLogic.CurrentGame.Parameters.CustomParams<SE>().reEntryMultiplier);
275280

276281
burnDownTime -= Time.deltaTime;
277282
}
@@ -331,12 +336,12 @@ void Update()
331336

332337
vResist += engineAccel;
333338

334-
vResist *= resistMultiplier;
339+
vResist *= HighLogic.CurrentGame.Parameters.CustomParams<SE>().resistMultiplier;
335340

336341
bool isCrewed = false;
337342

338343
//don't search if not necessary
339-
if (onlyIfCrewed)
344+
if (HighLogic.CurrentGame.Parameters.CustomParams<SE>().OnlyIfCrewed)
340345
{
341346
foreach (Part part in vessel.parts)
342347
{
@@ -350,12 +355,12 @@ void Update()
350355
if (!gamePaused)
351356
{
352357

353-
if ((!onlyIfCrewed || isCrewed) && !MapView.MapIsEnabled && (onlyIVA == false || InternalCamera.Instance.isActive))
358+
if ((!HighLogic.CurrentGame.Parameters.CustomParams<SE>().OnlyIfCrewed || isCrewed) && !MapView.MapIsEnabled && (HighLogic.CurrentGame.Parameters.CustomParams<SE>().OnlyInIVA == false || InternalCamera.Instance.isActive))
354359
{
355360
//wind and pressure?
356361
if (surfSpeed > 10 || vesselRot > 1.5f)
357362
{
358-
SoundFX(atmosphereGroup, ((atmDensity * surfSpeed - 10f) / 80f) + ((vesselRot - 1.5f) / 7.0f * atmDensity), aVolCtrl, 90f, true);
363+
SoundFX(atmosphereGroup, ((atmDensity * surfSpeed - 10f) / 80f) + ((vesselRot - 1.5f) / 7.0f * atmDensity), HighLogic.CurrentGame.Parameters.CustomParams<SE>().atmosphereVolume / 100f, 90f, true);
359364
}
360365
else
361366
{
@@ -365,7 +370,7 @@ void Update()
365370
//dynamics
366371
if (vResist > 0.5)
367372
{
368-
SoundFX(smallRattlesGroup, (vResist - 0.5f) / 4f, rVolCtrl, 90f, true);
373+
SoundFX(smallRattlesGroup, (vResist - 0.5f) / 4f, HighLogic.CurrentGame.Parameters.CustomParams<SE>().rattleVolume / 100f, 90f, true);
369374
}
370375
else
371376
{
@@ -374,7 +379,7 @@ void Update()
374379

375380
if (vResist > 0.8 || vesselRot > 1.5f)
376381
{
377-
SoundFX(vibrationsGroup, ((vResist - 0.8f) / 2f) + ((vesselRot - 1.5f) / 6f), vVolCtrl, 35f, true);
382+
SoundFX(vibrationsGroup, ((vResist - 0.8f) / 2f) + ((vesselRot - 1.5f) / 6f), HighLogic.CurrentGame.Parameters.CustomParams<SE>().vibrationVolume / 100f, 35f, true);
378383
}
379384
else
380385
{
@@ -383,7 +388,7 @@ void Update()
383388

384389
if (vResist > 1 || vesselRot > 2.0f)
385390
{
386-
SoundFX(rumbleGroup, ((vResist - 1f) / 2f) + ((vesselRot - 2.0f) / 6f), rmVolCtrl, 180f, true);
391+
SoundFX(rumbleGroup, ((vResist - 1f) / 2f) + ((vesselRot - 2.0f) / 6f), HighLogic.CurrentGame.Parameters.CustomParams<SE>().rumbleVolume / 100f, 180f, true);
387392
}
388393
else
389394
{
@@ -392,7 +397,7 @@ void Update()
392397

393398
if (vResist > 4.0)
394399
{
395-
SoundFX(bigRattlesGroup, (vResist - 5f) / 4f, rVolCtrl, 90f, true);
400+
SoundFX(bigRattlesGroup, (vResist - 5f) / 4f, HighLogic.CurrentGame.Parameters.CustomParams<SE>().rattleVolume / 100f, 90f, true);
396401
}
397402
else
398403
{
@@ -401,7 +406,7 @@ void Update()
401406

402407
if (vResist > 8.0)
403408
{
404-
SoundFX(stressBigGroup, (vResist - 6f) / 6f, sVolCtrl, 90f, true);
409+
SoundFX(stressBigGroup, (vResist - 6f) / 6f, HighLogic.CurrentGame.Parameters.CustomParams<SE>().stressVolume / 100f, 90f, true);
405410
}
406411
else
407412
{
@@ -427,11 +432,11 @@ void Update()
427432
{
428433
if (vResist > 2.0f && vResist < 5.0)
429434
{
430-
SoundFX(thumpLowGroup, (vResist - 2.0f) / 3f, tVolCtrl, 180f, true);
435+
SoundFX(thumpLowGroup, (vResist - 2.0f) / 3f, HighLogic.CurrentGame.Parameters.CustomParams<SE>().thumpVolume / 100f, 180f, true);
431436
}
432437
if (vResist > 4.0f && vResist < 8.0)
433438
{
434-
SoundFX(thumpHeavyGroup, (vResist - 4.0f) / 4f, tVolCtrl, 180f, true);
439+
SoundFX(thumpHeavyGroup, (vResist - 4.0f) / 4f, HighLogic.CurrentGame.Parameters.CustomParams<SE>().thumpVolume / 100f, 180f, true);
435440
}
436441
}
437442
}

Source/ShipEffectsContinued.csproj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
<Prefer32Bit>false</Prefer32Bit>
3434
</PropertyGroup>
3535
<ItemGroup>
36-
<Reference Include="$(KSPDIR)\KSP_x64_Data\Managed\Assembly*.dll">
37-
<Private>False</Private>
36+
<Reference Include="$(KSPDIR)\KSP_x64_Data\Managed\Assembly*.dll">
37+
<Private>False</Private>
3838
</Reference>
3939
<Reference Include="$(KSPDIR)\KSP_x64_Data\Managed\UnityEngine*.dll">
40-
<Private>False</Private>
40+
<Private>False</Private>
4141
</Reference>
42-
<Reference Include="System" />
42+
<Reference Include="System" />
4343
</ItemGroup>
4444
<ItemGroup>
4545
<Compile Include="AssemblyVersion.cs">
@@ -48,6 +48,7 @@
4848
<DependentUpon>AssemblyVersion.tt</DependentUpon>
4949
</Compile>
5050
<Compile Include="InstallChecker.cs" />
51+
<Compile Include="Settings.cs" />
5152
<Compile Include="ShipEffectsContinued.cs" />
5253
<Compile Include="Properties\AssemblyInfo.cs" />
5354
</ItemGroup>
@@ -91,4 +92,4 @@ if $(ConfigurationName) == Release (
9192
<Target Name="AfterBuild">
9293
</Target>
9394
-->
94-
</Project>
95+
</Project>
-536 KB
Binary file not shown.

0 commit comments

Comments
 (0)