v0.3.4.2: fixed section bodies not being restored after repairing a wall/window, fixed servers letting all clients in despite a wrong password, game version or content package

This commit is contained in:
Regalis
2016-03-05 12:50:22 +02:00
10 changed files with 45 additions and 26 deletions

View File

@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.4.1")]
[assembly: AssemblyFileVersion("0.3.4.1")]
[assembly: AssemblyVersion("0.3.4.2")]
[assembly: AssemblyFileVersion("0.3.4.2")]

View File

@@ -284,7 +284,7 @@ namespace Barotrauma
float sectionDamage = wall.SectionDamage(sectionIndex);
for (int i = sectionIndex - 2; i <= sectionIndex + 2; i++)
{
if (wall.SectionHasHole(i))
if (wall.SectionBodyDisabled(i))
{
sectionIndex = i;
break;

View File

@@ -472,8 +472,10 @@ namespace Barotrauma
foreach (var gap in ConnectedGaps.Where(gap => gap.Open > 0))
{
var pos = gap.Position - body.Position;
var distance = MathHelper.Max(Vector2.DistanceSquared(body.Position, gap.Position)/1000,1f);
pos.Normalize();
body.body.ApplyForce((pos * gap.LerpedFlowForce) * deltaTime);
body.body.ApplyForce((pos * (gap.LerpedFlowForce/distance)) * deltaTime);
}
}

View File

@@ -259,13 +259,13 @@ namespace Barotrauma
if (prefab.CastShadow)
{
GeneateConvexHull();
GenerateConvexHull();
}
InsertToList();
}
private void GeneateConvexHull()
private void GenerateConvexHull()
{
// If not null and not empty , remove the hulls from the system
if(_convexHulls != null && _convexHulls.Any())
@@ -452,13 +452,16 @@ namespace Barotrauma
sections[sectionIndex].isHighLighted = true;
}
public bool SectionHasHole(int sectionIndex)
public bool SectionBodyDisabled(int sectionIndex)
{
if (sectionIndex < 0 || sectionIndex >= sections.Length) return false;
return (sections[sectionIndex].damage>=prefab.MaxHealth);
}
/// <summary>
/// Sections that are leaking have a gap placed on them
/// </summary>
public bool SectionIsLeaking(int sectionIndex)
{
if (sectionIndex < 0 || sectionIndex >= sections.Length) return false;
@@ -528,7 +531,7 @@ namespace Barotrauma
float damageAmount = attack.GetStructureDamage(deltaTime);
if (playSound && !SectionHasHole(i))
if (playSound && !SectionBodyDisabled(i))
{
DamageSoundType damageSoundType = (attack.DamageType == DamageType.Blunt) ? DamageSoundType.StructureBlunt : DamageSoundType.StructureSlash;
SoundPlayer.PlayDamageSound(damageSoundType, damageAmount, position);
@@ -561,7 +564,7 @@ namespace Barotrauma
sections[sectionIndex].gap.Remove();
sections[sectionIndex].gap = null;
if(CastShadow)
GeneateConvexHull();
GenerateConvexHull();
}
}
else
@@ -575,20 +578,20 @@ namespace Barotrauma
gapRect.Height += 20;
sections[sectionIndex].gap = new Gap(gapRect, !isHorizontal, Submarine);
if(CastShadow)
GeneateConvexHull();
GenerateConvexHull();
}
}
if (sections[sectionIndex].gap != null)
sections[sectionIndex].gap.Open = (float)Math.Pow(((damage / prefab.MaxHealth)-0.5)*2.0, 2.0);
bool hadHole = SectionHasHole(sectionIndex);
bool hadHole = SectionBodyDisabled(sectionIndex);
sections[sectionIndex].damage = MathHelper.Clamp(damage, 0.0f, prefab.MaxHealth);
bool hasHole = SectionHasHole(sectionIndex);
bool hasHole = SectionBodyDisabled(sectionIndex);
if (hadHole == hasHole) return;
if (hasHole) Explosion.ApplyExplosionForces(sections[sectionIndex].gap.WorldPosition, 500.0f, 5.0f, 0.0f, 0.0f);
//if (hasHole) Explosion.ApplyExplosionForces(sections[sectionIndex].gap.WorldPosition, 500.0f, 5.0f, 0.0f, 0.0f);
UpdateSections();
}
@@ -600,11 +603,18 @@ namespace Barotrauma
}
bodies.Clear();
var mergedSections = new List<WallSection>();
foreach (var section in sections)
for (int i = 0; i < sections.Count(); i++ )
{
if(section.gap == null)
var section = sections[i];
if (!SectionBodyDisabled(i))
{
mergedSections.Add(section);
if (section.gap == null || mergedSections.Count <= 0) continue;
continue;
}
if (mergedSections.Count <= 0) continue;
Rectangle mergedRect;
if (isHorizontal)
mergedRect = new Rectangle(mergedSections.Min(x => x.rect.Left), mergedSections.Max(x => x.rect.Top),

View File

@@ -374,7 +374,7 @@ namespace Barotrauma
{
if (structure.IsPlatform || structure.StairDirection != Direction.None) return -1;
int sectionIndex = structure.FindSectionIndex(ConvertUnits.ToDisplayUnits(point));
if (sectionIndex > -1 && structure.SectionHasHole(sectionIndex)) return -1;
if (sectionIndex > -1 && structure.SectionBodyDisabled(sectionIndex)) return -1;
}
if (fraction < closestFraction)

View File

@@ -291,7 +291,7 @@ namespace Barotrauma.Networking
if (denyMessage == "Password required!" || denyMessage == "Wrong password!")
{
GameMain.ServerListScreen.JoinServer(serverIP, true);
GameMain.ServerListScreen.JoinServer(serverIP, true, denyMessage);
}
else
{

View File

@@ -631,7 +631,7 @@ namespace Barotrauma.Networking
return;
}
#if DEBUG
#if !DEBUG
if (!string.IsNullOrWhiteSpace(password) && string.IsNullOrWhiteSpace(userPassword))
{
inc.SenderConnection.Deny("Password required!");

View File

@@ -299,18 +299,18 @@ namespace Barotrauma
return true;
}
public void JoinServer(string ip, bool hasPassword)
public void JoinServer(string ip, bool hasPassword, string msg = "Password required")
{
CoroutineManager.StartCoroutine(ConnectToServer(ip, hasPassword));
CoroutineManager.StartCoroutine(ConnectToServer(ip, hasPassword, msg));
}
private IEnumerable<object> ConnectToServer(string ip, bool hasPassword)
private IEnumerable<object> ConnectToServer(string ip, bool hasPassword, string msg = "Password required")
{
string selectedPassword = "";
if (hasPassword)
{
var msgBox = new GUIMessageBox("Password required:", "", new string[] { "OK", "Cancel" });
var msgBox = new GUIMessageBox(msg, "", new string[] { "OK", "Cancel" });
var passwordBox = new GUITextBox(new Rectangle(0,40,150,25), Alignment.TopLeft, GUI.Style, msgBox.children[0]);
passwordBox.UserData = "password";

View File

@@ -1,3 +1,11 @@
---------------------------------------------------------------------------------------------------------
v0.3.4.2
---------------------------------------------------------------------------------------------------------
- fixed characters passing through walls/windows that have already been repaired
- fixed the spawn command in Linux version
- fixed clients being able to join servers with the wrong password
---------------------------------------------------------------------------------------------------------
v0.3.4.1
---------------------------------------------------------------------------------------------------------
@@ -12,7 +20,6 @@ of messages received from different clients and discard valid messages
- mantises don't bleed
- fixed crashing when swapping some specific equipped items with another item in the inventory
- fixed deconstructor, fabricator and railgun connection panels closing immediately after opening
- fixed newly created subs being saved to the root folder instead of the Submarines folder
---------------------------------------------------------------------------------------------------------
v0.3.4.0

View File

@@ -44,8 +44,8 @@ Credits:
------------------------------------------------------------------------
Programming, graphics, sounds, game design - Joonas Rikkonen ("Regalis")
Graphics - James Bear ("Moonsaber99")
Programming - Sebastian Broberg
Graphics - James Bear ("Moonsaber99")
Programming - Sebastian Broberg
------------------------------------------------------------------------