(32460d493) Fixed: Wait timers running in tutorials when pause menu is open

This commit is contained in:
Joonas Rikkonen
2019-05-18 17:53:18 +03:00
parent 419754ccf1
commit b1326787f7
7 changed files with 88 additions and 74 deletions
@@ -132,7 +132,7 @@ namespace Barotrauma.Tutorials
{ {
shakeTimer -= 0.1f; shakeTimer -= 0.1f;
GameMain.GameScreen.Cam.Shake = shakeAmount; GameMain.GameScreen.Cam.Shake = shakeAmount;
yield return new WaitForSeconds(0.1f); yield return new WaitForSeconds(0.1f, false);
} }
// Room 2 // Room 2
@@ -142,7 +142,7 @@ namespace Barotrauma.Tutorials
// Room 3 // Room 3
do { yield return null; } while (!captain_medicObjectiveSensor.MotionDetected); do { yield return null; } while (!captain_medicObjectiveSensor.MotionDetected);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(captain_medic.Info.DisplayName, TextManager.Get("Captain.Radio.Medic"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(captain_medic.Info.DisplayName, TextManager.Get("Captain.Radio.Medic"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(2f); yield return new WaitForSeconds(2f, false);
GameMain.GameSession.CrewManager.ToggleCrewAreaOpen = true; GameMain.GameSession.CrewManager.ToggleCrewAreaOpen = true;
GameMain.GameSession.CrewManager.AddCharacter(captain_medic); GameMain.GameSession.CrewManager.AddCharacter(captain_medic);
TriggerTutorialSegment(0); TriggerTutorialSegment(0);
@@ -157,7 +157,7 @@ namespace Barotrauma.Tutorials
// Submarine // Submarine
do { yield return null; } while (!captain_enteredSubmarineSensor.MotionDetected); do { yield return null; } while (!captain_enteredSubmarineSensor.MotionDetected);
yield return new WaitForSeconds(3f); yield return new WaitForSeconds(3f, false);
captain_mechanic.AIController.Enabled = captain_security.AIController.Enabled = captain_engineer.AIController.Enabled = true; captain_mechanic.AIController.Enabled = captain_security.AIController.Enabled = captain_engineer.AIController.Enabled = true;
TriggerTutorialSegment(1); TriggerTutorialSegment(1);
GameMain.GameSession.CrewManager.AddCharacter(captain_mechanic); GameMain.GameSession.CrewManager.AddCharacter(captain_mechanic);
@@ -169,7 +169,7 @@ namespace Barotrauma.Tutorials
} }
while (!HasOrder(captain_mechanic, "repairsystems", "jobspecific")); while (!HasOrder(captain_mechanic, "repairsystems", "jobspecific"));
RemoveCompletedObjective(segments[1]); RemoveCompletedObjective(segments[1]);
yield return new WaitForSeconds(2f); yield return new WaitForSeconds(2f, false);
TriggerTutorialSegment(2); TriggerTutorialSegment(2);
GameMain.GameSession.CrewManager.AddCharacter(captain_security); GameMain.GameSession.CrewManager.AddCharacter(captain_security);
do do
@@ -180,7 +180,7 @@ namespace Barotrauma.Tutorials
} }
while (!HasOrder(captain_security, "operateweapons", "fireatwill")); while (!HasOrder(captain_security, "operateweapons", "fireatwill"));
RemoveCompletedObjective(segments[2]); RemoveCompletedObjective(segments[2]);
yield return new WaitForSeconds(4f); yield return new WaitForSeconds(4f, false);
TriggerTutorialSegment(3); TriggerTutorialSegment(3);
GameMain.GameSession.CrewManager.AddCharacter(captain_engineer); GameMain.GameSession.CrewManager.AddCharacter(captain_engineer);
do do
@@ -202,10 +202,10 @@ namespace Barotrauma.Tutorials
do do
{ {
//captain_navConsoleCustomInterface.HighlightElement(0, uiHighlightColor, duration: 1.0f, pulsateAmount: 0.0f); //captain_navConsoleCustomInterface.HighlightElement(0, uiHighlightColor, duration: 1.0f, pulsateAmount: 0.0f);
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f, false);
} while (Submarine.MainSub.DockedTo.Count > 0); } while (Submarine.MainSub.DockedTo.Count > 0);
RemoveCompletedObjective(segments[4]); RemoveCompletedObjective(segments[4]);
yield return new WaitForSeconds(2f); yield return new WaitForSeconds(2f, false);
TriggerTutorialSegment(5); // Navigate to destination TriggerTutorialSegment(5); // Navigate to destination
do do
{ {
@@ -221,15 +221,15 @@ namespace Barotrauma.Tutorials
} while (!captain_sonar.IsActive); } while (!captain_sonar.IsActive);
do { yield return null; } while (Vector2.Distance(Submarine.MainSub.WorldPosition, Level.Loaded.EndPosition) > 4000f); do { yield return null; } while (Vector2.Distance(Submarine.MainSub.WorldPosition, Level.Loaded.EndPosition) > 4000f);
RemoveCompletedObjective(segments[5]); RemoveCompletedObjective(segments[5]);
yield return new WaitForSeconds(4f); yield return new WaitForSeconds(4f, false);
TriggerTutorialSegment(6); // Docking TriggerTutorialSegment(6); // Docking
do do
{ {
//captain_navConsoleCustomInterface.HighlightElement(0, uiHighlightColor, duration: 1.0f, pulsateAmount: 0.0f); //captain_navConsoleCustomInterface.HighlightElement(0, uiHighlightColor, duration: 1.0f, pulsateAmount: 0.0f);
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f, false);
} while (!Submarine.MainSub.AtEndPosition || Submarine.MainSub.DockedTo.Count == 0); } while (!Submarine.MainSub.AtEndPosition || Submarine.MainSub.DockedTo.Count == 0);
RemoveCompletedObjective(segments[6]); RemoveCompletedObjective(segments[6]);
yield return new WaitForSeconds(3f); yield return new WaitForSeconds(3f, false);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Captain.Radio.Complete").Replace("[OUTPOSTNAME]", GameMain.GameSession.EndLocation.Name), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Captain.Radio.Complete").Replace("[OUTPOSTNAME]", GameMain.GameSession.EndLocation.Name), ChatMessageType.Radio, null);
SetHighlight(captain_navConsole.Item, false); SetHighlight(captain_navConsole.Item, false);
SetHighlight(captain_sonar.Item, false); SetHighlight(captain_sonar.Item, false);
@@ -119,7 +119,7 @@ namespace Barotrauma.Tutorials
// explosions and radio messages ------------------------------------------------------ // explosions and radio messages ------------------------------------------------------
yield return new WaitForSeconds(3.0f); yield return new WaitForSeconds(3.0f, false);
//SoundPlayer.PlayDamageSound("StructureBlunt", 10, Character.Controlled.WorldPosition); //SoundPlayer.PlayDamageSound("StructureBlunt", 10, Character.Controlled.WorldPosition);
//// Room 1 //// Room 1
@@ -141,7 +141,7 @@ namespace Barotrauma.Tutorials
explosion.Explode(Character.Controlled.WorldPosition - Vector2.UnitX * 25, null); explosion.Explode(Character.Controlled.WorldPosition - Vector2.UnitX * 25, null);
SoundPlayer.PlayDamageSound("StructureBlunt", 10, Character.Controlled.WorldPosition - Vector2.UnitX * 25); SoundPlayer.PlayDamageSound("StructureBlunt", 10, Character.Controlled.WorldPosition - Vector2.UnitX * 25);
yield return new WaitForSeconds(0.5f); yield return new WaitForSeconds(0.5f, false);
doctor.DamageLimb( doctor.DamageLimb(
Character.Controlled.WorldPosition, Character.Controlled.WorldPosition,
@@ -154,15 +154,15 @@ namespace Barotrauma.Tutorials
{ {
shakeTimer -= 0.1f; shakeTimer -= 0.1f;
GameMain.GameScreen.Cam.Shake = shakeAmount; GameMain.GameScreen.Cam.Shake = shakeAmount;
yield return new WaitForSeconds(0.1f); yield return new WaitForSeconds(0.1f, false);
} }
yield return new WaitForSeconds(3.0f); yield return new WaitForSeconds(3.0f, false);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.KnockedDown"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.KnockedDown"), ChatMessageType.Radio, null);
// first tutorial segment, get medical supplies ------------------------------------------------------ // first tutorial segment, get medical supplies ------------------------------------------------------
yield return new WaitForSeconds(1.5f); yield return new WaitForSeconds(1.5f, false);
SetHighlight(doctor_suppliesCabinet.Item, true); SetHighlight(doctor_suppliesCabinet.Item, true);
/*while (doctor.CurrentHull != doctor_suppliesCabinet.Item.CurrentHull) /*while (doctor.CurrentHull != doctor_suppliesCabinet.Item.CurrentHull)
@@ -190,19 +190,19 @@ namespace Barotrauma.Tutorials
} }
yield return null; yield return null;
} while (doctor.Inventory.FindItemByIdentifier("antidama1") == null); // Wait until looted } while (doctor.Inventory.FindItemByIdentifier("antidama1") == null); // Wait until looted
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f, false);
SetHighlight(doctor_suppliesCabinet.Item, false); SetHighlight(doctor_suppliesCabinet.Item, false);
RemoveCompletedObjective(segments[0]); RemoveCompletedObjective(segments[0]);
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f, false);
// 2nd tutorial segment, treat self ------------------------------------------------------------------------- // 2nd tutorial segment, treat self -------------------------------------------------------------------------
TriggerTutorialSegment(1, GameMain.Config.KeyBind(InputType.Health)); // Open health interface TriggerTutorialSegment(1, GameMain.Config.KeyBind(InputType.Health)); // Open health interface
while (CharacterHealth.OpenHealthWindow == null) while (CharacterHealth.OpenHealthWindow == null)
{ {
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f, false);
} }
RemoveCompletedObjective(segments[1]); RemoveCompletedObjective(segments[1]);
@@ -226,7 +226,7 @@ namespace Barotrauma.Tutorials
while (CharacterHealth.OpenHealthWindow != null) while (CharacterHealth.OpenHealthWindow != null)
{ {
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f, false);
} }
// treat patient -------------------------------------------------------------------------------------------- // treat patient --------------------------------------------------------------------------------------------
@@ -240,9 +240,9 @@ namespace Barotrauma.Tutorials
while (doctor.CurrentHull != patient1.CurrentHull) while (doctor.CurrentHull != patient1.CurrentHull)
{ {
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f, false);
} }
yield return new WaitForSeconds(0.0f); yield return new WaitForSeconds(0.0f, false);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.AssistantBurns"), ChatMessageType.Radio, null); GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.AssistantBurns"), ChatMessageType.Radio, null);
GameMain.GameSession.CrewManager.AllowCharacterSwitch = false; GameMain.GameSession.CrewManager.AllowCharacterSwitch = false;
@@ -250,7 +250,7 @@ namespace Barotrauma.Tutorials
GameMain.GameSession.CrewManager.AddCharacter(patient1); GameMain.GameSession.CrewManager.AddCharacter(patient1);
GameMain.GameSession.CrewManager.ToggleCrewAreaOpen = true; GameMain.GameSession.CrewManager.ToggleCrewAreaOpen = true;
yield return new WaitForSeconds(3.0f); yield return new WaitForSeconds(3.0f, false);
TriggerTutorialSegment(3); // Get the patient to medbay TriggerTutorialSegment(3); // Get the patient to medbay
while (patient1.CurrentOrder == null || patient1.CurrentOrder.AITag != "follow") while (patient1.CurrentOrder == null || patient1.CurrentOrder.AITag != "follow")
@@ -263,13 +263,13 @@ namespace Barotrauma.Tutorials
while (patient1.CurrentHull != medBay) while (patient1.CurrentHull != medBay)
{ {
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f, false);
} }
RemoveCompletedObjective(segments[3]); RemoveCompletedObjective(segments[3]);
SetHighlight(doctor_medBayCabinet.Item, true); SetHighlight(doctor_medBayCabinet.Item, true);
SetDoorAccess(doctor_thirdDoor, doctor_thirdDoorLight, true); SetDoorAccess(doctor_thirdDoor, doctor_thirdDoorLight, true);
yield return new WaitForSeconds(2.0f); yield return new WaitForSeconds(2.0f, false);
TriggerTutorialSegment(4, GameMain.Config.KeyBind(InputType.Health)); // treat burns TriggerTutorialSegment(4, GameMain.Config.KeyBind(InputType.Health)); // treat burns
@@ -309,7 +309,7 @@ namespace Barotrauma.Tutorials
} }
RemoveCompletedObjective(segments[4]); RemoveCompletedObjective(segments[4]);
SetHighlight(patient1, false); SetHighlight(patient1, false);
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f, false);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.AssistantBurnsHealed"), ChatMessageType.Radio, null); GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.AssistantBurnsHealed"), ChatMessageType.Radio, null);
@@ -329,7 +329,7 @@ namespace Barotrauma.Tutorials
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f);
}*/ }*/
do { yield return null; } while (!tutorial_upperFinalDoor.IsOpen); do { yield return null; } while (!tutorial_upperFinalDoor.IsOpen);
yield return new WaitForSeconds(2.0f); yield return new WaitForSeconds(2.0f, false);
TriggerTutorialSegment(5, GameMain.Config.KeyBind(InputType.Health)); // perform CPR TriggerTutorialSegment(5, GameMain.Config.KeyBind(InputType.Health)); // perform CPR
SetHighlight(patient2, true); SetHighlight(patient2, true);
@@ -350,12 +350,12 @@ namespace Barotrauma.Tutorials
while (doctor.Submarine != Submarine.MainSub) while (doctor.Submarine != Submarine.MainSub)
{ {
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f, false);
} }
yield return new WaitForSeconds(5.0f); yield return new WaitForSeconds(5.0f, false);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.EnteredSub"), ChatMessageType.Radio, null); GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.EnteredSub"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(3.0f); yield return new WaitForSeconds(3.0f, false);
TriggerTutorialSegment(6, GameMain.Config.KeyBind(InputType.Health)); // give treatment to anyone in need TriggerTutorialSegment(6, GameMain.Config.KeyBind(InputType.Health)); // give treatment to anyone in need
foreach (var patient in subPatients) foreach (var patient in subPatients)
@@ -398,7 +398,7 @@ namespace Barotrauma.Tutorials
SetHighlight(subPatients[i], false); SetHighlight(subPatients[i], false);
} }
} }
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f, false);
} }
RemoveCompletedObjective(segments[6]); RemoveCompletedObjective(segments[6]);
foreach (var patient in subPatients) foreach (var patient in subPatients)
@@ -213,7 +213,7 @@ namespace Barotrauma.Tutorials
{ {
shakeTimer -= 0.1f; shakeTimer -= 0.1f;
GameMain.GameScreen.Cam.Shake = shakeAmount; GameMain.GameScreen.Cam.Shake = shakeAmount;
yield return new WaitForSeconds(0.1f); yield return new WaitForSeconds(0.1f, false);
} }
//// Remove //// Remove
@@ -231,7 +231,7 @@ namespace Barotrauma.Tutorials
// Room 2 // Room 2
do { yield return null; } while (!engineer_equipmentObjectiveSensor.MotionDetected); do { yield return null; } while (!engineer_equipmentObjectiveSensor.MotionDetected);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.Equipment"), ChatMessageType.Radio, null); GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.Equipment"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(0.5f); yield return new WaitForSeconds(0.5f, false);
TriggerTutorialSegment(0, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Deselect)); // Retrieve equipment TriggerTutorialSegment(0, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Deselect)); // Retrieve equipment
bool firstSlotRemoved = false; bool firstSlotRemoved = false;
bool secondSlotRemoved = false; bool secondSlotRemoved = false;
@@ -280,7 +280,7 @@ namespace Barotrauma.Tutorials
// Room 3 // Room 3
do { yield return null; } while (!IsSelectedItem(engineer_reactor.Item)); do { yield return null; } while (!IsSelectedItem(engineer_reactor.Item));
yield return new WaitForSeconds(0.5f); yield return new WaitForSeconds(0.5f, false);
TriggerTutorialSegment(1); TriggerTutorialSegment(1);
do do
{ {
@@ -326,7 +326,7 @@ namespace Barotrauma.Tutorials
} }
yield return null; yield return null;
} while (!reactorOperatedProperly); } while (!reactorOperatedProperly);
yield return new WaitForSeconds(2f); yield return new WaitForSeconds(2f, false);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.ReactorStable"), ChatMessageType.Radio, null); GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.ReactorStable"), ChatMessageType.Radio, null);
do do
{ {
@@ -343,7 +343,7 @@ namespace Barotrauma.Tutorials
float wait = 1.5f; float wait = 1.5f;
do do
{ {
yield return new WaitForSeconds(0.1f); yield return new WaitForSeconds(0.1f, false);
wait -= 0.1f; wait -= 0.1f;
engineer_reactor.AutoTempSlider.BarScrollValue = 0.0f; engineer_reactor.AutoTempSlider.BarScrollValue = 0.0f;
} while (wait > 0.0f); } while (wait > 0.0f);
@@ -356,17 +356,8 @@ namespace Barotrauma.Tutorials
// Room 4 // Room 4
do { yield return null; } while (!engineer_secondDoor.IsOpen); do { yield return null; } while (!engineer_secondDoor.IsOpen);
yield return new WaitForSeconds(1f); yield return new WaitForSeconds(1f, false);
TriggerTutorialSegment(2, GameMain.Config.KeyBind(InputType.Select)); // Repair the junction box TriggerTutorialSegment(2, GameMain.Config.KeyBind(InputType.Select)); // Repair the junction box
do
{
if (!engineer.HasEquippedItem("screwdriver"))
{
HighlightInventorySlot(engineer.Inventory, "screwdriver", highlightColor, .5f, .5f, 0f);
}
yield return null;
} while (!engineer.HasEquippedItem("screwdriver")); // Wait until equipped
do { yield return null; } while (!engineer_brokenJunctionBox.IsFullCondition); // Wait until repaired do { yield return null; } while (!engineer_brokenJunctionBox.IsFullCondition); // Wait until repaired
SetHighlight(engineer_brokenJunctionBox, false); SetHighlight(engineer_brokenJunctionBox, false);
RemoveCompletedObjective(segments[2]); RemoveCompletedObjective(segments[2]);
@@ -379,7 +370,7 @@ namespace Barotrauma.Tutorials
// Room 5 // Room 5
do { yield return null; } while (!engineer_thirdDoor.IsOpen); do { yield return null; } while (!engineer_thirdDoor.IsOpen);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.FaultyWiring"), ChatMessageType.Radio, null); GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.FaultyWiring"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(2f); yield return new WaitForSeconds(2f, false);
TriggerTutorialSegment(3, GameMain.Config.KeyBind(InputType.Use), GameMain.Config.KeyBind(InputType.Deselect)); // Connect the junction boxes TriggerTutorialSegment(3, GameMain.Config.KeyBind(InputType.Use), GameMain.Config.KeyBind(InputType.Deselect)); // Connect the junction boxes
do { CheckGhostWires(); HandleJunctionBoxWiringHighlights(); yield return null; } while (engineer_workingPump.Voltage < engineer_workingPump.MinVoltage); // Wait until connected all the way to the pump do { CheckGhostWires(); HandleJunctionBoxWiringHighlights(); yield return null; } while (engineer_workingPump.Voltage < engineer_workingPump.MinVoltage); // Wait until connected all the way to the pump
CheckGhostWires(); CheckGhostWires();
@@ -396,7 +387,7 @@ namespace Barotrauma.Tutorials
// Submarine // Submarine
do { yield return null; } while (!tutorial_enteredSubmarineSensor.MotionDetected); do { yield return null; } while (!tutorial_enteredSubmarineSensor.MotionDetected);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.Submarine"), ChatMessageType.Radio, null); GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.Submarine"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(2f); yield return new WaitForSeconds(2f, false);
TriggerTutorialSegment(4); // Repair junction box TriggerTutorialSegment(4); // Repair junction box
while (ContentRunning) yield return null; while (ContentRunning) yield return null;
SetHighlight(engineer_submarineJunctionBox_1, true); SetHighlight(engineer_submarineJunctionBox_1, true);
@@ -452,7 +443,7 @@ namespace Barotrauma.Tutorials
tutorial_oxygenGenerator.PowerConsumption = reactorLoads[i]; tutorial_oxygenGenerator.PowerConsumption = reactorLoads[i];
while (timer > 0) while (timer > 0)
{ {
yield return new WaitForSeconds(0.1f); yield return new WaitForSeconds(0.1f, false);
if (IsReactorPoweredUp(engineer_reactor)) if (IsReactorPoweredUp(engineer_reactor))
{ {
timer -= 0.1f; timer -= 0.1f;
@@ -230,25 +230,25 @@ namespace Barotrauma.Tutorials
{ {
shakeTimer -= 0.1f; shakeTimer -= 0.1f;
GameMain.GameScreen.Cam.Shake = shakeAmount; GameMain.GameScreen.Cam.Shake = shakeAmount;
yield return new WaitForSeconds(0.1f); yield return new WaitForSeconds(0.1f, false);
} }
yield return new WaitForSeconds(2.5f); yield return new WaitForSeconds(2.5f, false);
mechanic_fabricator.RemoveFabricationRecipes(new List<string>() { "extinguisher", "wrench", "weldingtool", "weldingfuel", "divingmask", "railgunshell", "nuclearshell", "uex", "harpoongun" }); mechanic_fabricator.RemoveFabricationRecipes(new List<string>() { "extinguisher", "wrench", "weldingtool", "weldingfuel", "divingmask", "railgunshell", "nuclearshell", "uex", "harpoongun" });
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.WakeUp"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.WakeUp"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(2.5f); yield return new WaitForSeconds(2.5f, false);
TriggerTutorialSegment(0, GameMain.Config.KeyBind(InputType.Up), GameMain.Config.KeyBind(InputType.Left), GameMain.Config.KeyBind(InputType.Down), GameMain.Config.KeyBind(InputType.Right), GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Select)); // Open door objective TriggerTutorialSegment(0, GameMain.Config.KeyBind(InputType.Up), GameMain.Config.KeyBind(InputType.Left), GameMain.Config.KeyBind(InputType.Down), GameMain.Config.KeyBind(InputType.Right), GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Select)); // Open door objective
yield return new WaitForSeconds(0.0f); yield return new WaitForSeconds(0.0f, false);
SetDoorAccess(mechanic_firstDoor, mechanic_firstDoorLight, true); SetDoorAccess(mechanic_firstDoor, mechanic_firstDoorLight, true);
SetHighlight(mechanic_firstDoor.Item, true); SetHighlight(mechanic_firstDoor.Item, true);
do { yield return null; } while (!mechanic_firstDoor.IsOpen); do { yield return null; } while (!mechanic_firstDoor.IsOpen);
SetHighlight(mechanic_firstDoor.Item, false); SetHighlight(mechanic_firstDoor.Item, false);
yield return new WaitForSeconds(1.5f); yield return new WaitForSeconds(1.5f, false);
RemoveCompletedObjective(segments[0]); RemoveCompletedObjective(segments[0]);
// Room 2 // Room 2
yield return new WaitForSeconds(0.0f); yield return new WaitForSeconds(0.0f, false);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.Equipment"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.Equipment"), ChatMessageType.Radio, null);
do { yield return null; } while (!mechanic_equipmentObjectiveSensor.MotionDetected); do { yield return null; } while (!mechanic_equipmentObjectiveSensor.MotionDetected);
TriggerTutorialSegment(1, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Deselect)); // Equipment & inventory objective TriggerTutorialSegment(1, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Deselect)); // Equipment & inventory objective
@@ -287,7 +287,7 @@ namespace Barotrauma.Tutorials
yield return null; yield return null;
} while (mechanic.Inventory.FindItemByIdentifier("divingmask") == null || mechanic.Inventory.FindItemByIdentifier("weldingtool") == null || mechanic.Inventory.FindItemByIdentifier("wrench") == null); // Wait until looted } while (mechanic.Inventory.FindItemByIdentifier("divingmask") == null || mechanic.Inventory.FindItemByIdentifier("weldingtool") == null || mechanic.Inventory.FindItemByIdentifier("wrench") == null); // Wait until looted
SetHighlight(mechanic_equipmentCabinet.Item, false); SetHighlight(mechanic_equipmentCabinet.Item, false);
yield return new WaitForSeconds(1.5f); yield return new WaitForSeconds(1.5f, false);
RemoveCompletedObjective(segments[1]); RemoveCompletedObjective(segments[1]);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.Breach"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.Breach"), ChatMessageType.Radio, null);
@@ -312,7 +312,7 @@ namespace Barotrauma.Tutorials
do { yield return null; } while (WallHasDamagedSections(mechanic_brokenWall_1)); // Highlight until repaired do { yield return null; } while (WallHasDamagedSections(mechanic_brokenWall_1)); // Highlight until repaired
mechanic.RemoveActiveObjectiveEntity(mechanic_brokenWall_1); mechanic.RemoveActiveObjectiveEntity(mechanic_brokenWall_1);
RemoveCompletedObjective(segments[2]); RemoveCompletedObjective(segments[2]);
yield return new WaitForSeconds(1f); yield return new WaitForSeconds(1f, false);
TriggerTutorialSegment(3, GameMain.Config.KeyBind(InputType.Select)); // Pump objective TriggerTutorialSegment(3, GameMain.Config.KeyBind(InputType.Select)); // Pump objective
SetHighlight(mechanic_workingPump.Item, true); SetHighlight(mechanic_workingPump.Item, true);
do do
@@ -330,17 +330,17 @@ namespace Barotrauma.Tutorials
do { yield return null; } while (mechanic_brokenhull_1.WaterPercentage > waterVolumeBeforeOpening); // Unlock door once drained do { yield return null; } while (mechanic_brokenhull_1.WaterPercentage > waterVolumeBeforeOpening); // Unlock door once drained
RemoveCompletedObjective(segments[3]); RemoveCompletedObjective(segments[3]);
SetDoorAccess(mechanic_thirdDoor, mechanic_thirdDoorLight, true); SetDoorAccess(mechanic_thirdDoor, mechanic_thirdDoorLight, true);
yield return new WaitForSeconds(1.5f); yield return new WaitForSeconds(1.5f, false);
//TriggerTutorialSegment(11, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Up), GameMain.Config.KeyBind(InputType.Down), GameMain.Config.KeyBind(InputType.Select)); // Ladder objective //TriggerTutorialSegment(11, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Up), GameMain.Config.KeyBind(InputType.Down), GameMain.Config.KeyBind(InputType.Select)); // Ladder objective
//do { yield return null; } while (!mechanic_ladderSensor.MotionDetected); //do { yield return null; } while (!mechanic_ladderSensor.MotionDetected);
//RemoveCompletedObjective(segments[11]); //RemoveCompletedObjective(segments[11]);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.News"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.News"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(1f); yield return new WaitForSeconds(1f, false);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.Fire"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.Fire"), ChatMessageType.Radio, null);
// Room 4 // Room 4
do { yield return null; } while (!mechanic_thirdDoor.IsOpen); do { yield return null; } while (!mechanic_thirdDoor.IsOpen);
yield return new WaitForSeconds(1f); yield return new WaitForSeconds(1f, false);
mechanic_fire = new DummyFireSource(new Vector2(20f, 2f), Item.ItemList.Find(i => i.HasTag("mechanic_fire")).WorldPosition); mechanic_fire = new DummyFireSource(new Vector2(20f, 2f), Item.ItemList.Find(i => i.HasTag("mechanic_fire")).WorldPosition);
//do { yield return null; } while (!mechanic_craftingObjectiveSensor.MotionDetected); //do { yield return null; } while (!mechanic_craftingObjectiveSensor.MotionDetected);
TriggerTutorialSegment(4); // Deconstruct TriggerTutorialSegment(4); // Deconstruct
@@ -364,7 +364,7 @@ namespace Barotrauma.Tutorials
} }
yield return null; yield return null;
} while (mechanic.Inventory.FindItemByIdentifier("oxygentank") == null || mechanic.Inventory.FindItemByIdentifier("sodium") == null); // Wait until looted } while (mechanic.Inventory.FindItemByIdentifier("oxygentank") == null || mechanic.Inventory.FindItemByIdentifier("sodium") == null); // Wait until looted
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f, false);
SetHighlight(mechanic_craftingCabinet.Item, false); SetHighlight(mechanic_craftingCabinet.Item, false);
SetHighlight(mechanic_deconstructor.Item, true); SetHighlight(mechanic_deconstructor.Item, true);
@@ -409,7 +409,7 @@ namespace Barotrauma.Tutorials
SetHighlight(mechanic_deconstructor.Item, false); SetHighlight(mechanic_deconstructor.Item, false);
RemoveCompletedObjective(segments[4]); RemoveCompletedObjective(segments[4]);
yield return new WaitForSeconds(1f); yield return new WaitForSeconds(1f, false);
TriggerTutorialSegment(5); // Fabricate TriggerTutorialSegment(5); // Fabricate
SetHighlight(mechanic_fabricator.Item, true); SetHighlight(mechanic_fabricator.Item, true);
do do
@@ -465,7 +465,7 @@ namespace Barotrauma.Tutorials
do { yield return null; } while (!mechanic_fireSensor.MotionDetected); do { yield return null; } while (!mechanic_fireSensor.MotionDetected);
TriggerTutorialSegment(6, GameMain.Config.KeyBind(InputType.Aim), GameMain.Config.KeyBind(InputType.Shoot)); // Using the extinguisher TriggerTutorialSegment(6, GameMain.Config.KeyBind(InputType.Aim), GameMain.Config.KeyBind(InputType.Shoot)); // Using the extinguisher
do { yield return null; } while (!mechanic_fire.Removed); // Wait until extinguished do { yield return null; } while (!mechanic_fire.Removed); // Wait until extinguished
yield return new WaitForSeconds(3f); yield return new WaitForSeconds(3f, false);
RemoveCompletedObjective(segments[6]); RemoveCompletedObjective(segments[6]);
if (mechanic.HasEquippedItem("extinguisher")) // do not trigger if dropped already if (mechanic.HasEquippedItem("extinguisher")) // do not trigger if dropped already
@@ -197,7 +197,7 @@ namespace Barotrauma.Tutorials
{ {
shakeTimer -= 0.1f; shakeTimer -= 0.1f;
GameMain.GameScreen.Cam.Shake = shakeAmount; GameMain.GameScreen.Cam.Shake = shakeAmount;
yield return new WaitForSeconds(0.1f); yield return new WaitForSeconds(0.1f, false);
} }
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.WakeUp"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.WakeUp"), ChatMessageType.Radio, null);
@@ -205,7 +205,7 @@ namespace Barotrauma.Tutorials
// Room 2 // Room 2
do { yield return null; } while (!officer_equipmentObjectiveSensor.MotionDetected); do { yield return null; } while (!officer_equipmentObjectiveSensor.MotionDetected);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.Equipment"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.Equipment"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(3f); yield return new WaitForSeconds(3f, false);
//TriggerTutorialSegment(0, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Deselect)); // Retrieve equipment //TriggerTutorialSegment(0, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Deselect)); // Retrieve equipment
SetHighlight(officer_equipmentCabinet.Item, true); SetHighlight(officer_equipmentCabinet.Item, true);
bool firstSlotRemoved = false; bool firstSlotRemoved = false;
@@ -259,7 +259,7 @@ namespace Barotrauma.Tutorials
{ {
HighlightInventorySlot(officer.Inventory, "ballistichelmet", highlightColor, .5f, .5f, 0f); HighlightInventorySlot(officer.Inventory, "ballistichelmet", highlightColor, .5f, .5f, 0f);
} }
yield return new WaitForSeconds(1f); yield return new WaitForSeconds(1f, false);
} while (!officer.HasEquippedItem("stunbaton") || !officer.HasEquippedItem("bodyarmor") || !officer.HasEquippedItem("ballistichelmet")); } while (!officer.HasEquippedItem("stunbaton") || !officer.HasEquippedItem("bodyarmor") || !officer.HasEquippedItem("ballistichelmet"));
RemoveCompletedObjective(segments[1]); RemoveCompletedObjective(segments[1]);
SetDoorAccess(officer_firstDoor, officer_firstDoorLight, true); SetDoorAccess(officer_firstDoor, officer_firstDoorLight, true);
@@ -271,7 +271,7 @@ namespace Barotrauma.Tutorials
do { yield return null; } while (!officer_crawler.IsDead); do { yield return null; } while (!officer_crawler.IsDead);
RemoveCompletedObjective(segments[2]); RemoveCompletedObjective(segments[2]);
Heal(officer); Heal(officer);
yield return new WaitForSeconds(1f); yield return new WaitForSeconds(1f, false);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.CrawlerDead"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.CrawlerDead"), ChatMessageType.Radio, null);
SetDoorAccess(officer_secondDoor, officer_secondDoorLight, true); SetDoorAccess(officer_secondDoor, officer_secondDoorLight, true);
@@ -296,7 +296,7 @@ namespace Barotrauma.Tutorials
SetHighlight(officer_ammoShelf_1.Item, false); SetHighlight(officer_ammoShelf_1.Item, false);
SetHighlight(officer_ammoShelf_2.Item, false); SetHighlight(officer_ammoShelf_2.Item, false);
RemoveCompletedObjective(segments[3]); RemoveCompletedObjective(segments[3]);
yield return new WaitForSeconds(2f); yield return new WaitForSeconds(2f, false);
TriggerTutorialSegment(4, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Shoot), GameMain.Config.KeyBind(InputType.Deselect)); // Kill hammerhead TriggerTutorialSegment(4, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Shoot), GameMain.Config.KeyBind(InputType.Deselect)); // Kill hammerhead
officer_hammerhead = SpawnMonster(hammerheadCharacterFile, officer_hammerheadSpawnPos); officer_hammerhead = SpawnMonster(hammerheadCharacterFile, officer_hammerheadSpawnPos);
officer_hammerhead.AIController.SelectTarget(officer.AiTarget); officer_hammerhead.AIController.SelectTarget(officer.AiTarget);
@@ -316,14 +316,14 @@ namespace Barotrauma.Tutorials
Heal(officer); Heal(officer);
SetHighlight(officer_coilgunPeriscope, false); SetHighlight(officer_coilgunPeriscope, false);
RemoveCompletedObjective(segments[4]); RemoveCompletedObjective(segments[4]);
yield return new WaitForSeconds(1f); yield return new WaitForSeconds(1f, false);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.HammerheadDead"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.HammerheadDead"), ChatMessageType.Radio, null);
SetDoorAccess(officer_thirdDoor, officer_thirdDoorLight, true); SetDoorAccess(officer_thirdDoor, officer_thirdDoorLight, true);
// Room 5 // Room 5
//do { yield return null; } while (!officer_rangedWeaponSensor.MotionDetected); //do { yield return null; } while (!officer_rangedWeaponSensor.MotionDetected);
do { yield return null; } while (!officer_thirdDoor.IsOpen); do { yield return null; } while (!officer_thirdDoor.IsOpen);
yield return new WaitForSeconds(3f); yield return new WaitForSeconds(3f, false);
TriggerTutorialSegment(5, GameMain.Config.KeyBind(InputType.Aim), GameMain.Config.KeyBind(InputType.Shoot)); // Ranged weapons TriggerTutorialSegment(5, GameMain.Config.KeyBind(InputType.Aim), GameMain.Config.KeyBind(InputType.Shoot)); // Ranged weapons
SetHighlight(officer_rangedWeaponHolder.Item, true); SetHighlight(officer_rangedWeaponHolder.Item, true);
do { yield return null; } while (!officer_rangedWeaponHolder.Inventory.IsEmpty()); // Wait until looted do { yield return null; } while (!officer_rangedWeaponHolder.Inventory.IsEmpty()); // Wait until looted
@@ -430,7 +430,7 @@ namespace Barotrauma.Tutorials
RemoveCompletedObjective(segments[7]); RemoveCompletedObjective(segments[7]);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.Complete"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.Complete"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(4f); yield return new WaitForSeconds(4f, false);
CoroutineManager.StartCoroutine(TutorialCompleted()); CoroutineManager.StartCoroutine(TutorialCompleted());
} }
@@ -218,6 +218,22 @@ namespace Barotrauma
return true; return true;
} }
private bool RefreshJoinButtonState(GUIComponent component, object obj)
{
if (obj == null || waitingForRefresh) { return false; }
if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text))
{
joinButton.Enabled = true;
}
else
{
joinButton.Enabled = false;
}
return true;
}
private bool SelectServer(GUIComponent component, object obj) private bool SelectServer(GUIComponent component, object obj)
{ {
if (obj == null || waitingForRefresh) { return false; } if (obj == null || waitingForRefresh) { return false; }
@@ -198,19 +198,26 @@ namespace Barotrauma
public readonly float TotalTime; public readonly float TotalTime;
float timer; float timer;
bool ignorePause;
public WaitForSeconds(float time) public WaitForSeconds(float time, bool ignorePause = true)
{ {
timer = time; timer = time;
TotalTime = time; TotalTime = time;
this.ignorePause = ignorePause;
} }
public bool CheckFinished(float deltaTime) public bool CheckFinished(float deltaTime)
{ {
#if !SERVER
if (ignorePause || !GUI.PauseMenuOpen)
{
timer -= deltaTime;
}
#else
timer -= deltaTime; timer -= deltaTime;
return timer<=0.0f; #endif
return timer <= 0.0f;
} }
} }
} }