(76909c3c7) Fixed "clowncostume" and "crewaway" achievements not unlocking in multiplayer, fixed being able to get the "killclown" achievement by committing suicide while wearing a clown costume. Closes #1478

+ merge fix
This commit is contained in:
Joonas Rikkonen
2019-05-18 18:22:24 +03:00
parent e17c8e5acb
commit eed0666879
6 changed files with 33 additions and 36 deletions
@@ -903,7 +903,7 @@ namespace Barotrauma.Networking
connected = false; connected = false;
ConnectToServer(serverIP); ConnectToServer(serverIP);
} }
if (clientID == myID) else
{ {
string msg = ""; string msg = "";
if (disconnectReason == DisconnectReason.Unknown) if (disconnectReason == DisconnectReason.Unknown)
@@ -198,8 +198,6 @@ namespace Barotrauma
UserData = "noresults" UserData = "noresults"
}; };
} }
return true;
} }
private bool RefreshJoinButtonState(GUIComponent component, object obj) private bool RefreshJoinButtonState(GUIComponent component, object obj)
@@ -82,23 +82,6 @@ namespace Barotrauma
public override void Update(float deltaTime) public override void Update(float deltaTime)
{ {
if (DisableCrewAI || Character.IsUnconscious) return; if (DisableCrewAI || Character.IsUnconscious) return;
if (Character.Submarine != null || SelectedAiTarget?.Entity?.Submarine != null)
{
if (steeringManager != insideSteering)
{
insideSteering.Reset();
}
steeringManager = insideSteering;
}
else
{
if (steeringManager != outsideSteering)
{
outsideSteering.Reset();
}
steeringManager = outsideSteering;
}
float maxDistanceToSub = 3000; float maxDistanceToSub = 3000;
if (Character.Submarine != null || SelectedAiTarget?.Entity?.Submarine != null && if (Character.Submarine != null || SelectedAiTarget?.Entity?.Submarine != null &&
@@ -2,7 +2,6 @@
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using System; using System;
using System.Linq; using System.Linq;
using Barotrauma.Extensions;
namespace Barotrauma namespace Barotrauma
{ {
@@ -1003,7 +1003,6 @@ namespace Barotrauma
new XAttribute("autocheckupdates", AutoCheckUpdates), new XAttribute("autocheckupdates", AutoCheckUpdates),
new XAttribute("musicvolume", musicVolume), new XAttribute("musicvolume", musicVolume),
new XAttribute("soundvolume", soundVolume), new XAttribute("soundvolume", soundVolume),
new XAttribute("voicechatvolume", voiceChatVolume),
new XAttribute("verboselogging", VerboseLogging), new XAttribute("verboselogging", VerboseLogging),
new XAttribute("savedebugconsolelogs", SaveDebugConsoleLogs), new XAttribute("savedebugconsolelogs", SaveDebugConsoleLogs),
new XAttribute("enablesplashscreen", EnableSplashScreen), new XAttribute("enablesplashscreen", EnableSplashScreen),
@@ -119,23 +119,40 @@ namespace Barotrauma
} }
} }
if (GameMain.GameSession != null && Character.Controlled != null) if (GameMain.GameSession != null)
{ {
if (Character.Controlled.HasEquippedItem("clownmask") && #if CLIENT
Character.Controlled.HasEquippedItem("clowncostume")) if (Character.Controlled != null) { CheckMidRoundAchievements(Character.Controlled); }
#else
foreach (Client client in GameMain.Server.ConnectedClients)
{ {
UnlockAchievement(Character.Controlled, "clowncostume"); if (client.Character != null)
}
if (Submarine.MainSub != null && Character.Controlled.Submarine == null)
{
float dist = 500 / Physics.DisplayToRealWorldRatio;
if (Vector2.DistanceSquared(Character.Controlled.WorldPosition, Submarine.MainSub.WorldPosition) >
dist * dist)
{ {
UnlockAchievement(Character.Controlled, "crewaway"); CheckMidRoundAchievements(client.Character);
} }
} }
#endif
}
}
private static void CheckMidRoundAchievements(Character c)
{
if (c == null || c.Removed) { return; }
if (c.HasEquippedItem("clownmask") &&
c.HasEquippedItem("clowncostume"))
{
UnlockAchievement(c, "clowncostume");
}
if (Submarine.MainSub != null && c.Submarine == null)
{
float dist = 500 / Physics.DisplayToRealWorldRatio;
if (Vector2.DistanceSquared(c.WorldPosition, Submarine.MainSub.WorldPosition) >
dist * dist)
{
UnlockAchievement(c, "crewaway");
}
} }
} }
@@ -214,7 +231,8 @@ namespace Barotrauma
} }
if (character.HasEquippedItem("clownmask") && if (character.HasEquippedItem("clownmask") &&
character.HasEquippedItem("clowncostume")) character.HasEquippedItem("clowncostume") &&
causeOfDeath.Killer != character)
{ {
UnlockAchievement(causeOfDeath.Killer, "killclown"); UnlockAchievement(causeOfDeath.Killer, "killclown");
} }