(4082dd031) Implemented some more Steam achievements
This commit is contained in:
@@ -667,9 +667,6 @@ namespace Barotrauma
|
|||||||
//spacing
|
//spacing
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null);
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null);
|
||||||
|
|
||||||
//spacing
|
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null);
|
|
||||||
|
|
||||||
new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), buttonArea.RectTransform, Anchor.BottomLeft),
|
new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), buttonArea.RectTransform, Anchor.BottomLeft),
|
||||||
TextManager.Get("Cancel"), style: "GUIButtonLarge")
|
TextManager.Get("Cancel"), style: "GUIButtonLarge")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
private float blinkTimer;
|
private float blinkTimer;
|
||||||
|
|
||||||
|
private bool itemLoaded;
|
||||||
|
|
||||||
|
private float blinkTimer;
|
||||||
|
|
||||||
public PhysicsBody ParentBody;
|
public PhysicsBody ParentBody;
|
||||||
|
|
||||||
[Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)]
|
[Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)]
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ namespace Barotrauma
|
|||||||
public readonly HashSet<Character> ReactorMeltdown = new HashSet<Character>();
|
public readonly HashSet<Character> ReactorMeltdown = new HashSet<Character>();
|
||||||
|
|
||||||
public readonly HashSet<Character> Casualties = new HashSet<Character>();
|
public readonly HashSet<Character> Casualties = new HashSet<Character>();
|
||||||
|
|
||||||
|
public bool SubWasDamaged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RoundData roundData;
|
private static RoundData roundData;
|
||||||
@@ -110,7 +112,47 @@ namespace Barotrauma
|
|||||||
UnlockAchievement("subdeep", true, c => c != null && c.Submarine == sub && !c.IsDead && !c.IsUnconscious);
|
UnlockAchievement("subdeep", true, c => c != null && c.Submarine == sub && !c.IsDead && !c.IsUnconscious);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!roundData.SubWasDamaged)
|
||||||
|
{
|
||||||
|
roundData.SubWasDamaged = SubWallsDamaged(Submarine.MainSub);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GameMain.GameSession != null && Character.Controlled != null)
|
||||||
|
{
|
||||||
|
if (Character.Controlled.HasEquippedItem("clownmask") &&
|
||||||
|
Character.Controlled.HasEquippedItem("clowncostume"))
|
||||||
|
{
|
||||||
|
UnlockAchievement(Character.Controlled, "clowncostume");
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool SubWallsDamaged(Submarine sub)
|
||||||
|
{
|
||||||
|
foreach (Structure structure in Structure.WallList)
|
||||||
|
{
|
||||||
|
if (structure.Submarine != sub || structure.HasBody) { continue; }
|
||||||
|
for (int i = 0; i < structure.SectionCount; i++)
|
||||||
|
{
|
||||||
|
if (structure.SectionIsLeaking(i))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OnBiomeDiscovered(Biome biome)
|
public static void OnBiomeDiscovered(Biome biome)
|
||||||
@@ -274,14 +316,21 @@ namespace Barotrauma
|
|||||||
//made it to the destination
|
//made it to the destination
|
||||||
if (gameSession.Submarine.AtEndPosition)
|
if (gameSession.Submarine.AtEndPosition)
|
||||||
{
|
{
|
||||||
|
bool noDamageRun = !roundData.SubWasDamaged && !roundData.Casualties.Any(c => !(c.AIController is EnemyAIController));
|
||||||
|
|
||||||
#if SERVER
|
#if SERVER
|
||||||
if (GameMain.Server != null)
|
if (GameMain.Server != null)
|
||||||
{
|
{
|
||||||
//in MP all characters that were inside the sub during reactor meltdown and still alive at the end of the round get an achievement
|
//in MP all characters that were inside the sub during reactor meltdown and still alive at the end of the round get an achievement
|
||||||
UnlockAchievement("survivereactormeltdown", true, c => c != null && !c.IsDead && roundData.ReactorMeltdown.Contains(c));
|
UnlockAchievement("survivereactormeltdown", true, c => c != null && !c.IsDead && roundData.ReactorMeltdown.Contains(c));
|
||||||
|
if (noDamageRun)
|
||||||
|
{
|
||||||
|
UnlockAchievement("nodamagerun", true, c => c != null && !c.IsDead);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
|
if (noDamageRun) { UnlockAchievement("nodamagerun"); }
|
||||||
if (roundData.ReactorMeltdown.Any()) //in SP getting to the destination after a meltdown is enough
|
if (roundData.ReactorMeltdown.Any()) //in SP getting to the destination after a meltdown is enough
|
||||||
{
|
{
|
||||||
UnlockAchievement("survivereactormeltdown");
|
UnlockAchievement("survivereactormeltdown");
|
||||||
@@ -302,6 +351,11 @@ namespace Barotrauma
|
|||||||
UnlockAchievement(charactersInSub[0], "lonesailor");
|
UnlockAchievement(charactersInSub[0], "lonesailor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach (Character character in charactersInSub)
|
||||||
|
{
|
||||||
|
if (character.Info.Job == null) { continue; }
|
||||||
|
UnlockAchievement(character, character.Info.Job.Prefab.Identifier + "round");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user