Remove submarines markers from radar in combat missions

This should make the mission type a lot more fun.
This commit is contained in:
juanjp600
2016-09-27 19:42:15 -03:00
parent 4e9ea758cb
commit e318034a1a
3 changed files with 16 additions and 6 deletions
@@ -67,6 +67,12 @@ namespace Barotrauma
TeamASub = Submarine.MainSubs[0];
TeamBSub = Submarine.MainSubs[1];
TeamBSub.SetPosition(Level.Loaded.EndPosition - new Vector2(0.0f, 2000.0f));
foreach (Submarine submarine in Submarine.Loaded)
{
//hide all subs from radar to make sneak attacks possible
submarine.OnRadar = false;
}
}
public override void Update(float deltaTime)
@@ -91,11 +97,12 @@ namespace Barotrauma
}
}
bool ADead = TeamACrew.All(c => c.IsDead);
bool BDead = TeamBCrew.All(c => c.IsDead);
bool ADead = TeamACrew.All(c => c.IsDead || c.IsUnconscious);
bool BDead = TeamBCrew.All(c => c.IsDead || c.IsUnconscious);
if (BDead && !ADead)
{
TeamBCrew.ForEach(c => { if (!c.IsDead) c.Kill(CauseOfDeath.Damage); }); //make sure nobody in this team can be revived because that would be pretty weird
winner = Locations[0];
loser = Locations[1];
if (state==0)
@@ -106,6 +113,7 @@ namespace Barotrauma
}
if (ADead && !BDead)
{
TeamACrew.ForEach(c => { if (!c.IsDead) c.Kill(CauseOfDeath.Damage); }); //same as above
winner = Locations[1];
loser = Locations[0];
if (state == 0)
@@ -114,8 +122,8 @@ namespace Barotrauma
state = 1;
}
}
if ((TeamBSub != null && TeamBSub.AtEndPosition) || (TeamASub != null && TeamASub.AtEndPosition))
if ((TeamBSub != null && TeamBSub.AtEndPosition && TeamBCrew.Any(c => c.Submarine == TeamBSub)) || (TeamASub != null && TeamASub.AtEndPosition && TeamBCrew.Any(c => c.Submarine == TeamASub)))
{
if (ADead && !BDead)
{
@@ -124,7 +132,7 @@ namespace Barotrauma
}
}
if ((TeamASub != null && TeamASub.AtStartPosition) || (TeamBSub != null && TeamBSub.AtStartPosition))
if ((TeamASub != null && TeamASub.AtStartPosition && TeamACrew.Any(c => c.Submarine == TeamASub)) || (TeamBSub != null && TeamBSub.AtStartPosition && TeamACrew.Any(c => c.Submarine == TeamBSub)))
{
if (BDead && !ADead)
{
@@ -284,6 +284,7 @@ namespace Barotrauma.Items.Components
foreach (Submarine sub in Submarine.Loaded)
{
if (!sub.OnRadar) continue;
if (item.Submarine == sub || sub.DockedTo.Contains(item.Submarine)) continue;
if (sub.WorldPosition.Y > Level.Loaded.Size.Y) continue;
+2 -1
View File
@@ -30,7 +30,6 @@ namespace Barotrauma
class Submarine : Entity
{
public static string SavePath = "Submarines";
public static readonly Vector2 HiddenSubStartPosition = new Vector2(-50000.0f, 80000.0f);
@@ -86,6 +85,8 @@ namespace Barotrauma
set { name = value; }
}
public bool OnRadar = true;
public string Description
{
get;