(d9829ac) v0.9.4.0

This commit is contained in:
Regalis
2019-10-24 18:05:42 +02:00
parent 9aa12bcac2
commit b39922a074
319 changed files with 12516 additions and 6815 deletions
@@ -21,9 +21,13 @@ namespace Barotrauma
public bool IsCompleted => pendingGoals.Count <= 0;
public bool IsPartiallyCompleted => completedGoals.Count > 0;
public bool IsStarted { get; private set; } = false;
public bool CanBeCompleted => !IsStarted || pendingGoals.All(goal => goal.CanBeCompleted);
public bool CanBeStarted(ICollection<Traitor> traitors) => !IsStarted && allGoals.Any(goal => goal.CanBeCompleted(traitors));
public bool CanBeCompleted => !IsStarted || pendingGoals.All(goal => goal.CanBeCompleted(goal.Traitors));
public bool IsEnemy(Character character) => pendingGoals.Any(goal => goal.IsEnemy(character));
public bool IsAllowedToDamage(Structure structure) => pendingGoals.Any(goal => goal.IsAllowedToDamage(structure));
public readonly HashSet<string> Roles = new HashSet<string>();
public string InfoText { get; private set; }
@@ -33,7 +37,7 @@ namespace Barotrauma
string.Join("/",
string.Join("/", activeGoals.Select((goal, index) =>
{
var statusText = goal.StatusText;
var statusText = goal.StatusText(Traitor);
var startIndex = statusText.LastIndexOf('/') + 1;
return $"{statusText.Substring(0, startIndex)}[{index}.st]={statusText.Substring(startIndex)}/[{index}.sl]={TextManager.FormatServerMessage(GoalInfoFormatId, new string[] { "[statustext]" }, new string[] { $"[{index}.st]" })}";
}).ToArray()),
@@ -43,7 +47,7 @@ namespace Barotrauma
string.Join("/",
string.Join("/", allGoals.Select((goal, index) =>
{
var statusText = goal.StatusText;
var statusText = goal.StatusText(Traitor);
var startIndex = statusText.LastIndexOf('/') + 1;
return $"{statusText.Substring(0, startIndex)}[{index}.st]={statusText.Substring(startIndex)}/[{index}.sl]={TextManager.FormatServerMessage(GoalInfoFormatId, new string[] { "[statustext]" }, new string[] { $"[{index}.st]" })}";
}).ToArray()),
@@ -127,28 +131,21 @@ namespace Barotrauma
}
IsStarted = true;
traitor.SendChatMessageBox(StartMessageText);
traitor.UpdateCurrentObjective(GoalInfos);
traitor.SendChatMessageBox(StartMessageText, traitor.Mission?.Identifier);
traitor.UpdateCurrentObjective(GoalInfos, traitor.Mission?.Identifier);
return true;
}
public void StartMessage()
{
Traitor.SendChatMessage(StartMessageText);
}
public void End(bool displayMessage)
{
if (displayMessage)
{
Traitor.SendChatMessageBox(EndMessageText);
}
Traitor.SendChatMessage(StartMessageText, Traitor.Mission?.Identifier);
}
public void EndMessage()
{
Traitor.SendChatMessage(EndMessageText);
Traitor.SendChatMessageBox(EndMessageText, Traitor.Mission?.Identifier);
Traitor.SendChatMessage(EndMessageText, Traitor.Mission?.Identifier);
}
public void Update(float deltaTime)
@@ -171,28 +168,24 @@ namespace Barotrauma
pendingGoals.RemoveAt(i);
if (GameMain.Server != null)
{
Traitor.SendChatMessage(goal.CompletedText);
Traitor.SendChatMessage(goal.CompletedText(Traitor), Traitor.Mission?.Identifier);
if (pendingGoals.Count > 0)
{
Traitor.SendChatMessageBox(goal.CompletedText);
Traitor.SendChatMessageBox(goal.CompletedText(Traitor), Traitor.Mission?.Identifier);
}
Traitor.UpdateCurrentObjective(GoalInfos);
Traitor.UpdateCurrentObjective(GoalInfos, Traitor.Mission?.Identifier);
}
}
}
}
public Objective(string infoText, int shuffleGoalsCount, params Goal[] goals)
public Objective(string infoText, int shuffleGoalsCount, ICollection<string> roles, ICollection<Goal> goals)
{
InfoText = infoText;
this.shuffleGoalsCount = shuffleGoalsCount;
Roles.UnionWith(roles);
allGoals.AddRange(goals);
}
public bool HasGoalsOfType<T>() where T : Goal
{
return allGoals?.Any(g => g is T) ?? false;
}
}
}
}