Added commands to change sub, shuttle, gamemode & mission
Also fixed the exe icons
This commit is contained in:
@@ -57,8 +57,7 @@
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
@@ -122,8 +122,7 @@ namespace Barotrauma
|
||||
get { return (int)missionTypeBlock.UserData; }
|
||||
set { missionTypeBlock.UserData = value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<JobPrefab> JobPreferences
|
||||
{
|
||||
get
|
||||
|
||||
@@ -48,6 +48,9 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="MonoGame.Framework, Version=3.5.1.1679, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
@@ -46,15 +46,70 @@ namespace Barotrauma
|
||||
break;
|
||||
case "say":
|
||||
case "msg":
|
||||
string text = "";
|
||||
for (int i=1;i<commands.Count();i++)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(text)) text += " ";
|
||||
text += commands[i];
|
||||
}
|
||||
string text = string.Join(" ", commands.Skip(1));
|
||||
if (commands[0].ToLower() == "say") text = "HOST: " + text;
|
||||
GameMain.Server.SendChatMessage(text, ChatMessageType.Server);
|
||||
break;
|
||||
case "servername":
|
||||
GameMain.Server.Name = string.Join(" ", commands.Skip(1));
|
||||
GameMain.NetLobbyScreen.ChangeServerName(string.Join(" ", commands.Skip(1)));
|
||||
break;
|
||||
case "servermsg":
|
||||
GameMain.NetLobbyScreen.ChangeServerMessage(string.Join(" ", commands.Skip(1)));
|
||||
break;
|
||||
case "gamemode":
|
||||
{
|
||||
int index = -1;
|
||||
if (int.TryParse(string.Join(" ", commands.Skip(1)), out index))
|
||||
{
|
||||
GameMain.NetLobbyScreen.SelectedModeIndex = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMain.NetLobbyScreen.SelectedModeName = string.Join(" ", commands.Skip(1));
|
||||
}
|
||||
DebugConsole.NewMessage("Set gamemode to " + GameMain.NetLobbyScreen.SelectedModeName, Color.Cyan);
|
||||
}
|
||||
break;
|
||||
case "mission":
|
||||
{
|
||||
int index = -1;
|
||||
if (int.TryParse(string.Join(" ", commands.Skip(1)), out index))
|
||||
{
|
||||
GameMain.NetLobbyScreen.MissionTypeIndex = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMain.NetLobbyScreen.MissionTypeName = string.Join(" ", commands.Skip(1));
|
||||
}
|
||||
DebugConsole.NewMessage("Set mission to " + GameMain.NetLobbyScreen.MissionTypeName, Color.Cyan);
|
||||
}
|
||||
break;
|
||||
case "sub":
|
||||
case "submarine":
|
||||
{
|
||||
Submarine sub = GameMain.NetLobbyScreen.GetSubList().Find(s => s.Name.ToLower() == string.Join(" ", commands.Skip(1)).ToLower());
|
||||
|
||||
if (sub != null)
|
||||
{
|
||||
GameMain.NetLobbyScreen.SelectedSub = sub;
|
||||
}
|
||||
sub = GameMain.NetLobbyScreen.SelectedSub;
|
||||
DebugConsole.NewMessage("Selected sub: " + sub.Name + (sub.HasTag(SubmarineTag.Shuttle) ? " (shuttle)" : ""), Color.Cyan);
|
||||
}
|
||||
break;
|
||||
case "shuttle":
|
||||
{
|
||||
Submarine shuttle = GameMain.NetLobbyScreen.GetSubList().Find(s => s.Name.ToLower() == string.Join(" ", commands.Skip(1)).ToLower());
|
||||
|
||||
if (shuttle != null)
|
||||
{
|
||||
GameMain.NetLobbyScreen.SelectedShuttle = shuttle;
|
||||
}
|
||||
shuttle = GameMain.NetLobbyScreen.SelectedShuttle;
|
||||
DebugConsole.NewMessage("Selected shuttle: " + shuttle.Name + (shuttle.HasTag(SubmarineTag.Shuttle) ? "" : " (not shuttle)"), Color.Cyan);
|
||||
}
|
||||
break;
|
||||
case "startgame":
|
||||
case "startround":
|
||||
case "start":
|
||||
|
||||
@@ -20,8 +20,6 @@ namespace Barotrauma
|
||||
/// </summary>
|
||||
public static class Program
|
||||
{
|
||||
private static int restartAttempts;
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
@@ -66,10 +64,6 @@ namespace Barotrauma
|
||||
{
|
||||
sb.AppendLine("Server (" + (GameMain.Server.GameStarted ? "Round had started)" : "Round hadn't been started)"));
|
||||
}
|
||||
else if (GameMain.Client != null)
|
||||
{
|
||||
sb.AppendLine("Client (" + (GameMain.Client.GameStarted ? "Round had started)" : "Round hadn't been started)"));
|
||||
}
|
||||
|
||||
sb.AppendLine("\n");
|
||||
sb.AppendLine("System info:");
|
||||
|
||||
@@ -11,11 +11,48 @@ namespace Barotrauma
|
||||
{
|
||||
partial class NetLobbyScreen : Screen
|
||||
{
|
||||
public Submarine SelectedSub;
|
||||
public Submarine SelectedShuttle;
|
||||
private Submarine selectedSub;
|
||||
private Submarine selectedShuttle;
|
||||
|
||||
public Submarine SelectedSub
|
||||
{
|
||||
get { return selectedSub; }
|
||||
set { selectedSub = value; lastUpdateID++; }
|
||||
}
|
||||
public Submarine SelectedShuttle
|
||||
{
|
||||
get { return selectedShuttle; }
|
||||
set { selectedShuttle = value; lastUpdateID++; }
|
||||
}
|
||||
|
||||
private GameModePreset[] GameModes;
|
||||
public int SelectedModeIndex;
|
||||
|
||||
private int selectedModeIndex;
|
||||
public int SelectedModeIndex
|
||||
{
|
||||
get { return selectedModeIndex; }
|
||||
set {
|
||||
lastUpdateID++;
|
||||
selectedModeIndex = Math.Max(0, Math.Min(GameModes.Count()-1, value));
|
||||
}
|
||||
}
|
||||
|
||||
public string SelectedModeName
|
||||
{
|
||||
get { return GameModes[SelectedModeIndex].Name; }
|
||||
set
|
||||
{
|
||||
for (int i = 0; i < GameModes.Count(); i++)
|
||||
{
|
||||
if (GameModes[i].Name.ToLower() == value.ToLower())
|
||||
{
|
||||
SelectedModeIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GameModePreset SelectedMode
|
||||
{
|
||||
get { return GameModes[SelectedModeIndex]; }
|
||||
@@ -23,7 +60,41 @@ namespace Barotrauma
|
||||
|
||||
public string ServerMessageText;
|
||||
|
||||
public int MissionTypeIndex;
|
||||
private int missionTypeIndex;
|
||||
public int MissionTypeIndex
|
||||
{
|
||||
get { return missionTypeIndex; }
|
||||
set {
|
||||
lastUpdateID++;
|
||||
missionTypeIndex = Math.Max(0, Math.Min(Mission.MissionTypes.Count()-1, value));
|
||||
}
|
||||
}
|
||||
|
||||
public string MissionTypeName
|
||||
{
|
||||
get { return Mission.MissionTypes[MissionTypeIndex]; }
|
||||
set
|
||||
{
|
||||
for (int i = 0; i < Mission.MissionTypes.Count(); i++)
|
||||
{
|
||||
if (Mission.MissionTypes[i].ToLower() == value.ToLower())
|
||||
{
|
||||
MissionTypeIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeServerName(string n)
|
||||
{
|
||||
ServerName = n; lastUpdateID++;
|
||||
}
|
||||
|
||||
public void ChangeServerMessage(string m)
|
||||
{
|
||||
ServerMessageText = m; lastUpdateID++;
|
||||
}
|
||||
|
||||
public List<JobPrefab> JobPreferences
|
||||
{
|
||||
@@ -39,8 +110,13 @@ namespace Barotrauma
|
||||
|
||||
subs = Submarine.SavedSubmarines.Where(s => !s.HasTag(SubmarineTag.HideInMenus)).ToList();
|
||||
|
||||
SelectedSub = subs[0];
|
||||
SelectedShuttle = subs[0]; //TODO: don't use the same sub as a shuttle by default
|
||||
if (subs == null || subs.Count()==0)
|
||||
{
|
||||
throw new Exception("No submarines are available.");
|
||||
}
|
||||
|
||||
selectedSub = subs.First(s => !s.HasTag(SubmarineTag.Shuttle));
|
||||
selectedShuttle = subs.First(s => s.HasTag(SubmarineTag.Shuttle));
|
||||
|
||||
DebugConsole.NewMessage("Selected sub: " + SelectedSub.Name, Color.White);
|
||||
DebugConsole.NewMessage("Selected shuttle: " + SelectedShuttle.Name, Color.White);
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Barotrauma
|
||||
|
||||
return commands.ToArray();
|
||||
}
|
||||
|
||||
|
||||
public static void ExecuteCommand(string command, GameMain game)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(command)) return;
|
||||
|
||||
@@ -293,11 +293,11 @@ namespace Barotrauma
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
/*#if CLIENT
|
||||
#if CLIENT
|
||||
return (GameMain.DebugDraw) ? Name + "(ID: " + ID + ")" : Name;
|
||||
#elif SERVER*/
|
||||
#elif SERVER
|
||||
return Name + "(ID: " + ID + ")";
|
||||
//#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
public List<IPropertyObject> AllPropertyObjects
|
||||
@@ -1304,7 +1304,6 @@ namespace Barotrauma
|
||||
|
||||
public void ServerWrite(NetBuffer msg, Client c, object[] extraData = null)
|
||||
{
|
||||
DebugConsole.NewMessage(ToString(), Color.Magenta);
|
||||
if (extraData == null || extraData.Length == 0 || !(extraData[0] is NetEntityEvent.Type))
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user