Vertical docking port, docking sounds, water flows properly between horizontally docked hulls, falseoutput of signal check components can be changed, lighting and FOW works between hulls (todo: some logic for determining when to update light.HullsInRange when two subs are moving relative to each other)

This commit is contained in:
Regalis
2016-06-27 17:48:20 +03:00
parent b04e204dc3
commit 38c5251005
19 changed files with 291 additions and 116 deletions
+25 -1
View File
@@ -53,6 +53,7 @@ namespace Barotrauma
private bool update;
private Sound currentFlowSound;
private int soundIndex;
private float soundVolume;
@@ -392,12 +393,24 @@ namespace Barotrauma
foreach (Gap gap in ConnectedGaps)
{
float gapFlow = gap.LerpedFlowForce.Length();
#if DEBUG
var asd = MapEntity.FindEntityByID(gap.ID);
if (asd != gap)
{
int adslkmfdlasfk = 9;
}
#endif
if (gapFlow > strongestFlow)
{
strongestFlow = gapFlow;
}
}
if (strongestFlow>0.1f)
{
soundVolume = soundVolume + ((strongestFlow < 100.0f) ? -deltaTime * 0.5f : deltaTime * 0.5f);
@@ -406,13 +419,24 @@ namespace Barotrauma
int index = (int)Math.Floor(strongestFlow / 100.0f);
index = Math.Min(index, 2);
soundIndex = SoundPlayer.flowSounds[index].Loop(soundIndex, soundVolume, WorldPosition, 2000.0f);
var flowSound = SoundPlayer.flowSounds[index];
if (flowSound != currentFlowSound && soundIndex > -1)
{
Sounds.SoundManager.Stop(soundIndex);
currentFlowSound = null;
soundIndex = -1;
}
currentFlowSound = flowSound;
soundIndex = currentFlowSound.Loop(soundIndex, soundVolume, WorldPosition, 2000.0f);
}
else
{
if (soundIndex > -1)
{
Sounds.SoundManager.Stop(soundIndex);
currentFlowSound = null;
soundIndex = -1;
}
}