Refactored event/task logic:
- Instead of configuring a commonness value and difficulty for an event and creating new random events until the maximum difficulty of the selected level is reached, the number of events per level can be configured directly (and overridden for specific level types). - Removed task logic. The initial idea was to display the unfinished tasks to the player somehow and to use them as objectives for the AI crew, but those were scrapped and the tasks only ended up controlling which type of music to play. TODO: implement some kind of logic to determine when to play repair/monster music clips.
This commit is contained in:
@@ -41,7 +41,7 @@ namespace Barotrauma.Tutorials
|
||||
|
||||
GameMain.GameSession.StartShift("tuto");
|
||||
|
||||
GameMain.GameSession.TaskManager.Tasks.Clear();
|
||||
GameMain.GameSession.TaskManager.Events.Clear();
|
||||
|
||||
GameMain.GameScreen.Select();
|
||||
}
|
||||
|
||||
@@ -344,6 +344,13 @@ namespace Barotrauma
|
||||
|
||||
private static List<BackgroundMusic> GetSuitableMusicClips()
|
||||
{
|
||||
|
||||
Submarine targetSubmarine = null;
|
||||
if (Character.Controlled != null)
|
||||
{
|
||||
targetSubmarine = Character.Controlled.Submarine;
|
||||
}
|
||||
|
||||
string musicType = "default";
|
||||
if (OverrideMusicType != null)
|
||||
{
|
||||
@@ -355,37 +362,14 @@ namespace Barotrauma
|
||||
{
|
||||
musicType = "ruins";
|
||||
}
|
||||
else if ((Character.Controlled != null && Character.Controlled.Submarine != null && Character.Controlled.Submarine.AtDamageDepth) ||
|
||||
else if ((targetSubmarine != null && targetSubmarine.AtDamageDepth) ||
|
||||
(Screen.Selected == GameMain.GameScreen && GameMain.GameScreen.Cam.Position.Y < SubmarineBody.DamageDepth))
|
||||
{
|
||||
musicType = "deep";
|
||||
}
|
||||
else
|
||||
else if (targetSubmarine != null)
|
||||
{
|
||||
Task criticalTask = null;
|
||||
if (GameMain.GameSession != null && GameMain.GameSession.TaskManager != null)
|
||||
{
|
||||
foreach (Task task in GameMain.GameSession.TaskManager.Tasks)
|
||||
{
|
||||
if (!task.IsStarted) continue;
|
||||
if (criticalTask == null || task.Priority > criticalTask.Priority)
|
||||
{
|
||||
criticalTask = task;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (criticalTask != null)
|
||||
{
|
||||
var suitableClips =
|
||||
musicClips.Where(music =>
|
||||
music != null &&
|
||||
music.type == criticalTask.MusicType &&
|
||||
music.priorityRange.X < criticalTask.Priority &&
|
||||
music.priorityRange.Y > criticalTask.Priority).ToList();
|
||||
|
||||
if (suitableClips.Count > 0) return suitableClips;
|
||||
}
|
||||
//TODO: determine whether to switch to monster or repair musictype
|
||||
}
|
||||
|
||||
return musicClips.Where(music => music != null && music.type == musicType).ToList();
|
||||
|
||||
Reference in New Issue
Block a user