Merge remote-tracking branch 'refs/remotes/barotrauma/master'

Conflicts:
	Subsurface/Properties/AssemblyInfo.cs
	Subsurface/Source/Characters/Character.cs
	Subsurface/Source/GUI/GUI.cs
	Subsurface/Source/GameMain.cs
	Subsurface/Source/GameSettings.cs
	Subsurface/Source/Items/CharacterInventory.cs
	Subsurface/Source/Items/Components/ItemComponent.cs
	Subsurface/Source/Items/Components/Machines/Pump.cs
	Subsurface/Source/Items/Components/Machines/Radar.cs
	Subsurface/Source/Items/Components/Machines/Steering.cs
	Subsurface/Source/Items/Components/Power/PowerContainer.cs
	Subsurface/Source/Items/Inventory.cs
	Subsurface/Source/Items/Item.cs
	Subsurface/Source/Items/ItemSpawner.cs
	Subsurface/Source/Map/Levels/WaterRenderer.cs
	Subsurface/Source/Map/LinkedSubmarine.cs
	Subsurface/Source/Map/Map/Map.cs
	Subsurface/Source/Map/Structure.cs
	Subsurface/Source/Map/Submarine.cs
	Subsurface/Source/Map/WayPoint.cs
	Subsurface/Source/Networking/GameClient.cs
	Subsurface/Source/Networking/GameServer.cs
	Subsurface/Source/Physics/PhysicsBody.cs
	Subsurface/Source/Screens/GameScreen.cs
This commit is contained in:
juanjp600
2016-10-11 20:19:25 -03:00
130 changed files with 4428 additions and 67178 deletions

View File

@@ -45,6 +45,9 @@ namespace Barotrauma.Networking
get;
private set;
}
public Dictionary<string, bool> monsterEnabled;
public Dictionary<string, int> extraCargo;
public bool ShowNetStats;
@@ -250,6 +253,18 @@ namespace Barotrauma.Networking
Voting.AllowModeVoting = modeSelectionMode == SelectionMode.Vote;
showLogButton.Visible = SaveServerLogs;
List<string> monsterNames = Directory.GetDirectories("Content/Characters").ToList();
for (int i=0;i<monsterNames.Count;i++)
{
monsterNames[i] = monsterNames[i].Replace("Content/Characters", "").Replace("/", "").Replace("\\", "");
}
monsterEnabled = new Dictionary<string, bool>();
foreach (string s in monsterNames)
{
monsterEnabled.Add(s, true);
}
extraCargo = new Dictionary<string, int>();
}
private void CreateSettingsFrame()
@@ -286,6 +301,8 @@ namespace Barotrauma.Networking
int y = 0;
settingsTabs[0].Padding = new Vector4(40.0f, 5.0f, 40.0f, 40.0f);
new GUITextBlock(new Rectangle(0, y, 100, 20), "Submarine selection:", GUI.Style, settingsTabs[0]);
var selectionFrame = new GUIFrame(new Rectangle(0, y + 20, 300, 20), null, settingsTabs[0]);
for (int i = 0; i < 3; i++)
@@ -314,7 +331,7 @@ namespace Barotrauma.Networking
endBox.Selected = EndRoundAtLevelEnd;
endBox.OnSelected = (GUITickBox) => { EndRoundAtLevelEnd = GUITickBox.Selected; return true; };
y += 30;
y += 25;
var endVoteBox = new GUITickBox(new Rectangle(0, y, 20, 20), "End round by voting", Alignment.Left, settingsTabs[0]);
endVoteBox.Selected = Voting.AllowEndVoting;
@@ -342,7 +359,7 @@ namespace Barotrauma.Networking
};
votesRequiredSlider.OnMoved(votesRequiredSlider, votesRequiredSlider.BarScroll);
y += 40;
y += 35;
var respawnBox = new GUITickBox(new Rectangle(0, y, 20, 20), "Allow respawning", Alignment.Left, settingsTabs[0]);
respawnBox.Selected = AllowRespawn;
@@ -353,9 +370,9 @@ namespace Barotrauma.Networking
};
var respawnIntervalText = new GUITextBlock(new Rectangle(20, y + 20, 20, 20), "Respawn interval", GUI.Style, settingsTabs[0], GUI.SmallFont);
var respawnIntervalText = new GUITextBlock(new Rectangle(20, y + 18, 20, 20), "Respawn interval", GUI.Style, settingsTabs[0], GUI.SmallFont);
var respawnIntervalSlider = new GUIScrollBar(new Rectangle(150, y + 22, 100, 10), GUI.Style, 0.1f, settingsTabs[0]);
var respawnIntervalSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 10), GUI.Style, 0.1f, settingsTabs[0]);
respawnIntervalSlider.UserData = respawnIntervalText;
respawnIntervalSlider.Step = 0.05f;
respawnIntervalSlider.BarScroll = RespawnInterval / 600.0f;
@@ -369,12 +386,12 @@ namespace Barotrauma.Networking
};
respawnIntervalSlider.OnMoved(respawnIntervalSlider, respawnIntervalSlider.BarScroll);
y += 40;
y += 35;
var minRespawnText = new GUITextBlock(new Rectangle(0, y, 200, 20), "Minimum players to respawn", GUI.Style, settingsTabs[0]);
minRespawnText.ToolTip = "What percentage of players has to be dead/spectating until a respawn shuttle is dispatched";
var minRespawnSlider = new GUIScrollBar(new Rectangle(150, y + 22, 100, 10), GUI.Style, 0.1f, settingsTabs[0]);
var minRespawnSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 10), GUI.Style, 0.1f, settingsTabs[0]);
minRespawnSlider.ToolTip = minRespawnText.ToolTip;
minRespawnSlider.UserData = minRespawnText;
minRespawnSlider.Step = 0.1f;
@@ -389,13 +406,13 @@ namespace Barotrauma.Networking
};
minRespawnSlider.OnMoved(minRespawnSlider, MinRespawnRatio);
y += 35;
y += 30;
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]);
var respawnDurationSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 10), GUI.Style, 0.1f, settingsTabs[0]);
respawnDurationSlider.ToolTip = minRespawnText.ToolTip;
respawnDurationSlider.UserData = respawnDurationText;
respawnDurationSlider.Step = 0.1f;
@@ -419,8 +436,139 @@ namespace Barotrauma.Networking
};
respawnDurationSlider.OnMoved(respawnDurationSlider, respawnDurationSlider.BarScroll);
y += 40;
y += 35;
var monsterButton = new GUIButton(new Rectangle(0, y, 130, 20), "Monster Spawns", GUI.Style, settingsTabs[0]);
monsterButton.Enabled = !GameStarted;
var monsterFrame = new GUIListBox(new Rectangle(-290, 60, 280, 250), GUI.Style, settingsTabs[0]);
monsterFrame.Visible = false;
monsterButton.UserData = monsterFrame;
monsterButton.OnClicked = (button, obj) =>
{
if (gameStarted)
{
((GUIComponent)obj).Visible = false;
button.Enabled = false;
return true;
}
((GUIComponent)obj).Visible = !((GUIComponent)obj).Visible;
return true;
};
List<string> monsterNames = monsterEnabled.Keys.ToList();
foreach (string s in monsterNames)
{
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 260, 25),
s,
GUI.Style,
Alignment.Left, Alignment.Left, monsterFrame);
textBlock.Padding = new Vector4(35.0f, 3.0f, 0.0f, 0.0f);
textBlock.UserData = monsterFrame;
textBlock.CanBeFocused = false;
var monsterEnabledBox = new GUITickBox(new Rectangle(-25, 0, 20, 20), "", Alignment.Left, textBlock);
monsterEnabledBox.Selected = monsterEnabled[s];
monsterEnabledBox.OnSelected = (GUITickBox) =>
{
if (gameStarted)
{
monsterFrame.Visible = false;
monsterButton.Enabled = false;
return true;
}
monsterEnabled[s] = !monsterEnabled[s];
return true;
};
}
var cargoButton = new GUIButton(new Rectangle(160, y, 130, 20), "Additional Cargo", GUI.Style, settingsTabs[0]);
cargoButton.Enabled = !GameStarted;
var cargoFrame = new GUIListBox(new Rectangle(300, 60, 280, 250), GUI.Style, settingsTabs[0]);
cargoFrame.Visible = false;
cargoButton.UserData = cargoFrame;
cargoButton.OnClicked = (button, obj) =>
{
if (gameStarted)
{
((GUIComponent)obj).Visible = false;
button.Enabled = false;
return true;
}
((GUIComponent)obj).Visible = !((GUIComponent)obj).Visible;
return true;
};
foreach (MapEntityPrefab pf in MapEntityPrefab.list)
{
if (!(pf is ItemPrefab) || (pf.Price <= 0.0f && !pf.tags.Contains("smallitem"))) continue;
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 260, 25),
pf.Name,
GUI.Style,
Alignment.Left, Alignment.Left, cargoFrame);
textBlock.Padding = new Vector4(30.0f, 3.0f, 0.0f, 0.0f);
textBlock.UserData = cargoFrame;
textBlock.CanBeFocused = false;
if (pf.sprite != null)
{
float scale = Math.Min(Math.Min(30.0f / pf.sprite.SourceRect.Width, 30.0f / pf.sprite.SourceRect.Height), 1.0f);
GUIImage img = new GUIImage(new Rectangle(-15-(int)(pf.sprite.SourceRect.Width*scale*0.5f), 12-(int)(pf.sprite.SourceRect.Height*scale*0.5f), 40, 40), pf.sprite, Alignment.Left, textBlock);
img.Color = pf.SpriteColor;
img.Scale = scale;
}
int cargoVal = 0;
extraCargo.TryGetValue(pf.Name, out cargoVal);
var countText = new GUITextBlock(
new Rectangle(180, 0, 50, 25),
cargoVal.ToString(),
GUI.Style,
Alignment.Left, Alignment.Center, textBlock);
var incButton = new GUIButton(new Rectangle(220, 5, 10, 15), ">", GUI.Style, textBlock);
incButton.UserData = countText;
incButton.OnClicked = (button, obj) =>
{
int val;
if (extraCargo.TryGetValue(pf.Name, out val))
{
extraCargo[pf.Name]++; val = extraCargo[pf.Name];
}
else
{
extraCargo.Add(pf.Name,1); val = 1;
}
((GUITextBlock)obj).Text = val.ToString();
((GUITextBlock)obj).SetTextPos();
return true;
};
var decButton = new GUIButton(new Rectangle(180, 5, 10, 15), "<", GUI.Style, textBlock);
decButton.UserData = countText;
decButton.OnClicked = (button, obj) =>
{
int val;
if (extraCargo.TryGetValue(pf.Name, out val))
{
extraCargo[pf.Name]--;
val = extraCargo[pf.Name];
if (val <= 0)
{
extraCargo.Remove(pf.Name);
val = 0;
}
((GUITextBlock)obj).Text = val.ToString();
((GUITextBlock)obj).SetTextPos();
}
return true;
};
}
//--------------------------------------------------------------------------------
// server settings