Respawn shuttle transport duration can be adjusted or set to unlimited (= shuttle won't leave after spawning), subs with the HideInMenus tag aren't shown in menus, respawn info msgs are shown to all players
This commit is contained in:
@@ -10,7 +10,7 @@ namespace Barotrauma
|
|||||||
public class GUIDropDown : GUIComponent
|
public class GUIDropDown : GUIComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
public delegate bool OnSelectedHandler(GUIComponent selected);
|
public delegate bool OnSelectedHandler(GUIComponent selected, object obj = null);
|
||||||
public OnSelectedHandler OnSelected;
|
public OnSelectedHandler OnSelected;
|
||||||
|
|
||||||
private GUIButton button;
|
private GUIButton button;
|
||||||
@@ -126,7 +126,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
Dropped = false;
|
Dropped = false;
|
||||||
|
|
||||||
if (OnSelected != null) OnSelected(component);
|
if (OnSelected != null) OnSelected(component, component.UserData);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
displayModeDD.SelectItem(GameMain.Config.WindowMode);
|
displayModeDD.SelectItem(GameMain.Config.WindowMode);
|
||||||
|
|
||||||
displayModeDD.OnSelected = (guiComponent) => { GameMain.Config.WindowMode = (WindowMode)guiComponent.UserData; return true; };
|
displayModeDD.OnSelected = (guiComponent, obj) => { GameMain.Config.WindowMode = (WindowMode)guiComponent.UserData; return true; };
|
||||||
|
|
||||||
y += 70;
|
y += 70;
|
||||||
|
|
||||||
@@ -408,7 +408,7 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SelectResolution(GUIComponent selected)
|
private bool SelectResolution(GUIComponent selected, object userData)
|
||||||
{
|
{
|
||||||
DisplayMode mode = selected.UserData as DisplayMode;
|
DisplayMode mode = selected.UserData as DisplayMode;
|
||||||
if (mode == null) return false;
|
if (mode == null) return false;
|
||||||
|
|||||||
@@ -57,14 +57,14 @@ namespace Barotrauma.Networking
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HasDefaultValue(120.0f, true)]
|
[HasDefaultValue(300.0f, true)]
|
||||||
public float RespawnInterval
|
public float RespawnInterval
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HasDefaultValue(60.0f, true)]
|
[HasDefaultValue(180.0f, true)]
|
||||||
public float MaxTransportTime
|
public float MaxTransportTime
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
@@ -236,7 +236,7 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
settingsFrame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.5f);
|
settingsFrame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.5f);
|
||||||
|
|
||||||
GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, 400, 420), null, Alignment.Center, GUI.Style, settingsFrame);
|
GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, 400, 430), null, Alignment.Center, GUI.Style, settingsFrame);
|
||||||
innerFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
|
innerFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, -5, 0, 20), "Settings", GUI.Style, innerFrame, GUI.LargeFont);
|
new GUITextBlock(new Rectangle(0, -5, 0, 20), "Settings", GUI.Style, innerFrame, GUI.LargeFont);
|
||||||
@@ -361,14 +361,44 @@ namespace Barotrauma.Networking
|
|||||||
minRespawnSlider.BarScroll = MinRespawnRatio;
|
minRespawnSlider.BarScroll = MinRespawnRatio;
|
||||||
minRespawnSlider.OnMoved = (GUIScrollBar scrollBar, float barScroll) =>
|
minRespawnSlider.OnMoved = (GUIScrollBar scrollBar, float barScroll) =>
|
||||||
{
|
{
|
||||||
GUITextBlock voteText = scrollBar.UserData as GUITextBlock;
|
GUITextBlock txt = scrollBar.UserData as GUITextBlock;
|
||||||
|
|
||||||
MinRespawnRatio = barScroll;
|
MinRespawnRatio = barScroll;
|
||||||
voteText.Text = "Minimum players to respawn: " + (int)MathUtils.Round(MinRespawnRatio * 100.0f, 10.0f) + " %";
|
txt.Text = "Minimum players to respawn: " + (int)MathUtils.Round(MinRespawnRatio * 100.0f, 10.0f) + " %";
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
minRespawnSlider.OnMoved(minRespawnSlider, MinRespawnRatio);
|
minRespawnSlider.OnMoved(minRespawnSlider, MinRespawnRatio);
|
||||||
|
|
||||||
|
y += 35;
|
||||||
|
|
||||||
|
var respawnDurationText = new GUITextBlock(new Rectangle(0, y, 200, 20), "Duration of respawn transport", GUI.Style, settingsTabs[0]);
|
||||||
|
respawnDurationText.ToolTip = "The amount of time respawned players have to navigate the respawn shuttle to the main submarine. " +
|
||||||
|
"After the duration expires, the shuttle will automatically head back out of the level.";
|
||||||
|
|
||||||
|
var respawnDurationSlider = new GUIScrollBar(new Rectangle(150, y + 22, 100, 10), GUI.Style, 0.1f, settingsTabs[0]);
|
||||||
|
respawnDurationSlider.ToolTip = minRespawnText.ToolTip;
|
||||||
|
respawnDurationSlider.UserData = respawnDurationText;
|
||||||
|
respawnDurationSlider.Step = 0.1f;
|
||||||
|
respawnDurationSlider.BarScroll = MinRespawnRatio;
|
||||||
|
respawnDurationSlider.OnMoved = (GUIScrollBar scrollBar, float barScroll) =>
|
||||||
|
{
|
||||||
|
GUITextBlock txt = scrollBar.UserData as GUITextBlock;
|
||||||
|
|
||||||
|
if (barScroll == 1.0f)
|
||||||
|
{
|
||||||
|
MaxTransportTime = 0;
|
||||||
|
txt.Text = "Duration of respawn transport: unlimited";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MaxTransportTime = barScroll * 600.0f + 60.0f;
|
||||||
|
txt.Text = "Duration of respawn transport: " + ToolBox.SecondsToReadableTime(MaxTransportTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
respawnDurationSlider.OnMoved(respawnDurationSlider, (MaxTransportTime - 60.0f)/600.0f);
|
||||||
|
|
||||||
y += 40;
|
y += 40;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -391,10 +391,9 @@ namespace Barotrauma.Networking
|
|||||||
string respawnInfo = "";
|
string respawnInfo = "";
|
||||||
|
|
||||||
if (respawnManager.CurrentState == RespawnManager.State.Waiting &&
|
if (respawnManager.CurrentState == RespawnManager.State.Waiting &&
|
||||||
respawnManager.CountdownStarted &&
|
respawnManager.CountdownStarted)
|
||||||
myCharacter != null && myCharacter.IsDead)
|
|
||||||
{
|
{
|
||||||
respawnInfo = respawnManager.RespawnTimer <= 0.0f ? "" : "Respawning in " + ToolBox.SecondsToReadableTime(respawnManager.RespawnTimer);
|
respawnInfo = respawnManager.RespawnTimer <= 0.0f ? "" : "Respawn Shuttle dispatching in " + ToolBox.SecondsToReadableTime(respawnManager.RespawnTimer);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (respawnManager.CurrentState == RespawnManager.State.Transporting)
|
else if (respawnManager.CurrentState == RespawnManager.State.Transporting)
|
||||||
@@ -405,7 +404,7 @@ namespace Barotrauma.Networking
|
|||||||
if (!string.IsNullOrEmpty(respawnInfo))
|
if (!string.IsNullOrEmpty(respawnInfo))
|
||||||
{
|
{
|
||||||
GUI.DrawString(spriteBatch,
|
GUI.DrawString(spriteBatch,
|
||||||
new Vector2(GameMain.GraphicsWidth - 300.0f, 20),
|
new Vector2(GameMain.GraphicsWidth - 400.0f, 20),
|
||||||
respawnInfo, Color.White, null, 0, GUI.SmallFont);
|
respawnInfo, Color.White, null, 0, GUI.SmallFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -178,6 +178,9 @@ namespace Barotrauma.Networking
|
|||||||
networkMember.AddChatMessage("The shuttle will automatically return back to the outpost. Please leave the shuttle immediately.", ChatMessageType.Server);
|
networkMember.AddChatMessage("The shuttle will automatically return back to the outpost. Please leave the shuttle immediately.", ChatMessageType.Server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//infinite transport time -> shuttle wont return
|
||||||
|
if (maxTransportTime < 0.1f) return;
|
||||||
|
|
||||||
var server = networkMember as GameServer;
|
var server = networkMember as GameServer;
|
||||||
if (server == null) return;
|
if (server == null) return;
|
||||||
|
|
||||||
@@ -196,15 +199,6 @@ namespace Barotrauma.Networking
|
|||||||
shuttleReturnTimer = maxTransportTime;
|
shuttleReturnTimer = maxTransportTime;
|
||||||
shuttleTransportTimer = maxTransportTime;
|
shuttleTransportTimer = maxTransportTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
//shuttleReturnTimer += deltaTime;
|
|
||||||
//if (shuttleReturnTimer > 10.0f)
|
|
||||||
//{
|
|
||||||
// state = State.Returning;
|
|
||||||
|
|
||||||
// server.SendRespawnManagerMsg();
|
|
||||||
// shuttleReturnTimer = 0.0f;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateReturning(float deltaTime)
|
private void UpdateReturning(float deltaTime)
|
||||||
@@ -477,7 +471,7 @@ namespace Barotrauma.Networking
|
|||||||
CoroutineManager.StartCoroutine(ForceShuttleToPos(Level.Loaded.StartPosition - Vector2.UnitY * Level.ShaftHeight, 100.0f), "forcepos");
|
CoroutineManager.StartCoroutine(ForceShuttleToPos(Level.Loaded.StartPosition - Vector2.UnitY * Level.ShaftHeight, 100.0f), "forcepos");
|
||||||
break;
|
break;
|
||||||
case State.Waiting:
|
case State.Waiting:
|
||||||
CountdownStarted = true;
|
CountdownStarted = inc.ReadBoolean();
|
||||||
|
|
||||||
ResetShuttle();
|
ResetShuttle();
|
||||||
|
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ namespace Barotrauma
|
|||||||
new GUITextBlock(new Rectangle(0,y,150,20), "Name:", GUI.Style, saveFrame);
|
new GUITextBlock(new Rectangle(0,y,150,20), "Name:", GUI.Style, saveFrame);
|
||||||
y += 20;
|
y += 20;
|
||||||
|
|
||||||
nameBox = new GUITextBox(new Rectangle(5, y, 150, 20), GUI.Style, saveFrame);
|
nameBox = new GUITextBox(new Rectangle(5, y, 250, 20), GUI.Style, saveFrame);
|
||||||
nameBox.OnEnterPressed = ChangeSubName;
|
nameBox.OnEnterPressed = ChangeSubName;
|
||||||
nameBox.Text = GetSubName();
|
nameBox.Text = GetSubName();
|
||||||
|
|
||||||
@@ -376,8 +376,7 @@ namespace Barotrauma
|
|||||||
Alignment.TopLeft, GUI.Style, saveFrame);
|
Alignment.TopLeft, GUI.Style, saveFrame);
|
||||||
descriptionBox.Wrap = true;
|
descriptionBox.Wrap = true;
|
||||||
descriptionBox.Text = Submarine.MainSub == null ? "" : Submarine.MainSub.Description;
|
descriptionBox.Text = Submarine.MainSub == null ? "" : Submarine.MainSub.Description;
|
||||||
descriptionBox.OnSelected += ExpandDescriptionBox;
|
descriptionBox.OnEnterPressed = ChangeSubDescription;
|
||||||
descriptionBox.OnTextChanged = ChangeSubDescription;
|
|
||||||
|
|
||||||
y += descriptionBox.Rect.Height + 15;
|
y += descriptionBox.Rect.Height + 15;
|
||||||
new GUITextBlock(new Rectangle(0, y, 150, 20), "Settings:", GUI.Style, saveFrame);
|
new GUITextBlock(new Rectangle(0, y, 150, 20), "Settings:", GUI.Style, saveFrame);
|
||||||
@@ -675,7 +674,7 @@ namespace Barotrauma
|
|||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SelectLinkedSub(GUIComponent selected)
|
private bool SelectLinkedSub(GUIComponent selected, object userData)
|
||||||
{
|
{
|
||||||
var submarine = selected.UserData as Submarine;
|
var submarine = selected.UserData as Submarine;
|
||||||
if (submarine == null) return false;
|
if (submarine == null) return false;
|
||||||
@@ -747,7 +746,7 @@ namespace Barotrauma
|
|||||||
textBox.UserData = text;
|
textBox.UserData = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
textBox.Rect = new Rectangle(textBox.Rect.Location, new Point(textBox.Rect.Width, 20));
|
// textBox.Rect = new Rectangle(textBox.Rect.Location, new Point(textBox.Rect.Width, 20));
|
||||||
|
|
||||||
textBox.Text = ToolBox.LimitString(text, 15);
|
textBox.Text = ToolBox.LimitString(text, 15);
|
||||||
|
|
||||||
@@ -757,20 +756,6 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExpandDescriptionBox(GUITextBox textBox, Keys key)
|
|
||||||
{
|
|
||||||
if (Submarine.MainSub != null)
|
|
||||||
{
|
|
||||||
textBox.Text = Submarine.MainSub.Description;
|
|
||||||
}
|
|
||||||
else if (textBox.UserData is string)
|
|
||||||
{
|
|
||||||
textBox.Text = (string)textBox.UserData;
|
|
||||||
}
|
|
||||||
|
|
||||||
textBox.Rect = new Rectangle(textBox.Rect.Location, new Point(textBox.Rect.Width, 150));
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool SelectPrefab(GUIComponent component, object obj)
|
private bool SelectPrefab(GUIComponent component, object obj)
|
||||||
{
|
{
|
||||||
AddPreviouslyUsed(obj as MapEntityPrefab);
|
AddPreviouslyUsed(obj as MapEntityPrefab);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Barotrauma.Networking;
|
using Barotrauma.Networking;
|
||||||
|
using System.Linq;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
@@ -91,6 +92,8 @@ namespace Barotrauma
|
|||||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), "Selected submarine:", null, null, Alignment.Left, GUI.Style, menuTabs[(int)Tab.NewGame]);
|
new GUITextBlock(new Rectangle(0, 0, 0, 30), "Selected submarine:", null, null, Alignment.Left, GUI.Style, menuTabs[(int)Tab.NewGame]);
|
||||||
mapList = new GUIListBox(new Rectangle(0, 30, 200, panelRect.Height-100), GUI.Style, menuTabs[(int)Tab.NewGame]);
|
mapList = new GUIListBox(new Rectangle(0, 30, 200, panelRect.Height-100), GUI.Style, menuTabs[(int)Tab.NewGame]);
|
||||||
|
|
||||||
|
var subsToShow = Submarine.SavedSubmarines.Where(s => !s.HasTag(SubmarineTag.HideInMenus));
|
||||||
|
|
||||||
foreach (Submarine sub in Submarine.SavedSubmarines)
|
foreach (Submarine sub in Submarine.SavedSubmarines)
|
||||||
{
|
{
|
||||||
new GUITextBlock(
|
new GUITextBlock(
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ namespace Barotrauma
|
|||||||
//GameMain.GameScreen.Cam.TargetPos = Vector2.Zero;
|
//GameMain.GameScreen.Cam.TargetPos = Vector2.Zero;
|
||||||
|
|
||||||
subList.Enabled = GameMain.Server != null || GameMain.NetworkMember.Voting.AllowSubVoting;
|
subList.Enabled = GameMain.Server != null || GameMain.NetworkMember.Voting.AllowSubVoting;
|
||||||
shuttleList.Enabled = subList.Enabled;
|
shuttleList.Enabled = subList.Enabled;
|
||||||
playerList.Enabled = GameMain.Server != null;
|
playerList.Enabled = GameMain.Server != null;
|
||||||
modeList.Enabled = GameMain.Server != null || GameMain.NetworkMember.Voting.AllowModeVoting;
|
modeList.Enabled = GameMain.Server != null || GameMain.NetworkMember.Voting.AllowModeVoting;
|
||||||
seedBox.Enabled = GameMain.Server != null;
|
seedBox.Enabled = GameMain.Server != null;
|
||||||
@@ -368,17 +368,21 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (IsServer && GameMain.Server != null)
|
if (IsServer && GameMain.Server != null)
|
||||||
{
|
{
|
||||||
|
List<Submarine> subsToShow = Submarine.SavedSubmarines.Where(s => !s.HasTag(SubmarineTag.HideInMenus)).ToList();
|
||||||
|
|
||||||
int prevSelectedSub = subList.SelectedIndex;
|
int prevSelectedSub = subList.SelectedIndex;
|
||||||
UpdateSubList(subList, Submarine.SavedSubmarines);
|
UpdateSubList(subList, subsToShow);
|
||||||
|
|
||||||
int prevSelectedShuttle = shuttleList.SelectedIndex;
|
int prevSelectedShuttle = shuttleList.SelectedIndex;
|
||||||
UpdateSubList(shuttleList, Submarine.SavedSubmarines);
|
UpdateSubList(shuttleList, subsToShow);
|
||||||
|
|
||||||
modeList.OnSelected = VotableClicked;
|
modeList.OnSelected = VotableClicked;
|
||||||
modeList.OnSelected = SelectMode;
|
modeList.OnSelected = SelectMode;
|
||||||
subList.OnSelected = VotableClicked;
|
subList.OnSelected = VotableClicked;
|
||||||
subList.OnSelected = SelectSub;
|
subList.OnSelected = SelectSub;
|
||||||
|
|
||||||
|
shuttleList.OnSelected = SelectSub;
|
||||||
|
|
||||||
traitorProbabilityButtons[0].OnClicked = ToggleTraitorsEnabled;
|
traitorProbabilityButtons[0].OnClicked = ToggleTraitorsEnabled;
|
||||||
traitorProbabilityButtons[1].OnClicked = ToggleTraitorsEnabled;
|
traitorProbabilityButtons[1].OnClicked = ToggleTraitorsEnabled;
|
||||||
|
|
||||||
@@ -613,10 +617,10 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
valueChanged = true;
|
valueChanged = true;
|
||||||
|
|
||||||
var hash = (obj as Submarine).MD5Hash;
|
var hash = obj is Submarine ? ((Submarine)obj).MD5Hash.Hash : "";
|
||||||
|
|
||||||
//hash will be null if opening the sub file failed -> don't select the sub
|
//hash will be null if opening the sub file failed -> don't select the sub
|
||||||
if (string.IsNullOrWhiteSpace(hash.Hash))
|
if (string.IsNullOrWhiteSpace(hash))
|
||||||
{
|
{
|
||||||
(component as GUITextBlock).TextColor = Color.DarkRed * 0.8f;
|
(component as GUITextBlock).TextColor = Color.DarkRed * 0.8f;
|
||||||
component.CanBeFocused = false;
|
component.CanBeFocused = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user