(7788ec72a) Test issuing orders automatically.

This commit is contained in:
Joonas Rikkonen
2019-05-16 05:03:49 +03:00
parent d00e2975ba
commit 60f52375e6
202 changed files with 2714 additions and 5825 deletions
@@ -21,9 +21,9 @@ namespace Barotrauma
{
if (!Enabled) { return 1000.0f; }
if (recipient.Character == null || recipient.Character.IsDead)
if (recipient.Character == null)
{
return 0.2f;
return 0.1f;
}
else
{
@@ -26,7 +26,7 @@ namespace Barotrauma
NewMessage("Client \"" + client.Name + "\" attempted to use the command \"" + names[0] + "\". Cheats must be enabled using \"enablecheats\" before the command can be used.", Color.Red);
GameMain.Server.SendConsoleMessage("You need to enable cheats using the command \"enablecheats\" before you can use the command \"" + names[0] + "\".", client);
if (Steam.SteamManager.USE_STEAM)
if (GameMain.Config.UseSteam)
{
NewMessage("Enabling cheats will disable Steam achievements during this play session.", Color.Red);
GameMain.Server.SendConsoleMessage("Enabling cheats will disable Steam achievements during this play session.", client);
@@ -193,7 +193,7 @@ namespace Barotrauma
Console.CursorLeft = 0;
Console.CursorTop -= cursorLine;
Console.Write(input);
Console.CursorLeft = input.Length % consoleWidth;
Console.CursorLeft = input.Length % Console.WindowWidth;
}
private static void AssignOnClientRequestExecute(string names, Action<Client, Vector2, string[]> onClientRequestExecute)
@@ -699,7 +699,7 @@ namespace Barotrauma
CheatsEnabled = true;
SteamAchievementManager.CheatsEnabled = true;
NewMessage("Enabled cheat commands.", Color.Red);
if (Steam.SteamManager.USE_STEAM)
if (GameMain.Config.UseSteam)
{
NewMessage("Steam achievements have been disabled during this play session.", Color.Red);
GameMain.Server?.UpdateCheatsEnabled();
@@ -714,7 +714,7 @@ namespace Barotrauma
CheatsEnabled = true;
SteamAchievementManager.CheatsEnabled = true;
NewMessage("Cheat commands have been enabled by \"" + client.Name + "\".", Color.Red);
if (Steam.SteamManager.USE_STEAM)
if (GameMain.Config.UseSteam)
{
NewMessage("Steam achievements have been disabled during this play session.", Color.Red);
GameMain.Server?.UpdateCheatsEnabled();
+4 -28
View File
@@ -53,21 +53,6 @@ namespace Barotrauma
get { return Config.SelectedContentPackages; }
}
private static ContentPackage vanillaContent;
public static ContentPackage VanillaContent
{
get
{
if (vanillaContent == null)
{
// TODO: Dynamic method for defining and finding the vanilla content package.
vanillaContent = ContentPackage.List.SingleOrDefault(cp => Path.GetFileName(cp.Path).ToLowerInvariant() == "vanilla 0.9.xml");
}
return vanillaContent;
}
}
public readonly string[] CommandLineArgs;
public GameMain(string[] args)
@@ -98,7 +83,6 @@ namespace Barotrauma
LevelGenerationParams.LoadPresets();
ScriptedEventSet.LoadPrefabs();
AfflictionPrefab.LoadAll(GetFilesOfType(ContentType.Afflictions));
StructurePrefab.LoadAll(GetFilesOfType(ContentType.Structure));
ItemPrefab.LoadAll(GetFilesOfType(ContentType.Item));
JobPrefab.LoadAll(GetFilesOfType(ContentType.Jobs));
@@ -106,6 +90,7 @@ namespace Barotrauma
NPCConversation.LoadAll(GetFilesOfType(ContentType.NPCConversations));
ItemAssemblyPrefab.LoadAll();
LevelObjectPrefab.LoadAll();
AfflictionPrefab.LoadAll(GetFilesOfType(ContentType.Afflictions));
GameModePreset.Init();
LocationType.Init();
@@ -146,20 +131,11 @@ namespace Barotrauma
}
/// <summary>
/// Returns the file paths of all files of the given type in the content packages.
/// Returns the file paths of all files of the given type in the currently selected content packages.
/// </summary>
/// <param name="type"></param>
/// <param name="searchAllContentPackages">If true, also returns files in content packages that are installed but not currently selected.</param>
public IEnumerable<string> GetFilesOfType(ContentType type, bool searchAllContentPackages = false)
public IEnumerable<string> GetFilesOfType(ContentType type)
{
if (searchAllContentPackages)
{
return ContentPackage.GetFilesOfType(ContentPackage.List, type);
}
else
{
return ContentPackage.GetFilesOfType(SelectedPackages, type);
}
return ContentPackage.GetFilesOfType(SelectedPackages, type);
}
public void StartServer()
@@ -3,7 +3,6 @@ using Lidgren.Network;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace Barotrauma
@@ -56,7 +55,7 @@ namespace Barotrauma
}
else
{
var saveFiles = SaveUtil.GetSaveFiles(SaveUtil.SaveType.Multiplayer).ToArray();
string[] saveFiles = SaveUtil.GetSaveFiles(SaveUtil.SaveType.Multiplayer);
DebugConsole.NewMessage("Saved campaigns:", Color.White);
for (int i = 0; i < saveFiles.Length; i++)
{
@@ -169,8 +168,6 @@ namespace Barotrauma
msg.Write(isRunning && endWatchman != null ? endWatchman.ID : (UInt16)0);
msg.Write(Money);
msg.Write(PurchasedHullRepairs);
msg.Write(PurchasedItemRepairs);
msg.Write((UInt16)CargoManager.PurchasedItems.Count);
foreach (PurchasedItem pi in CargoManager.PurchasedItems)
@@ -195,8 +192,6 @@ namespace Barotrauma
{
UInt16 selectedLocIndex = msg.ReadUInt16();
byte selectedMissionIndex = msg.ReadByte();
bool purchasedHullRepairs = msg.ReadBoolean();
bool purchasedItemRepairs = msg.ReadBoolean();
UInt16 purchasedItemCount = msg.ReadUInt16();
List<PurchasedItem> purchasedItems = new List<PurchasedItem>();
@@ -213,33 +208,6 @@ namespace Barotrauma
return;
}
if (purchasedHullRepairs != this.PurchasedHullRepairs)
{
if (purchasedHullRepairs && Money >= HullRepairCost)
{
this.PurchasedHullRepairs = true;
Money -= HullRepairCost;
}
else if (!purchasedHullRepairs)
{
this.PurchasedHullRepairs = false;
Money += HullRepairCost;
}
}
if (purchasedItemRepairs != this.PurchasedItemRepairs)
{
if (purchasedItemRepairs && Money >= ItemRepairCost)
{
this.PurchasedItemRepairs = true;
Money -= ItemRepairCost;
}
else if (!purchasedItemRepairs)
{
this.PurchasedItemRepairs = false;
Money += ItemRepairCost;
}
}
Map.SelectLocation(selectedLocIndex == UInt16.MaxValue ? -1 : selectedLocIndex);
if (Map.SelectedConnection != null)
{
@@ -20,8 +20,6 @@ namespace Barotrauma.Items.Components
if (!item.CanClientAccess(c)) return;
IsActive = true;
if (!autoTemp && AutoTemp) blameOnBroken = c;
if (turbineOutput < targetTurbineOutput) blameOnBroken = c;
if (fissionRate > targetFissionRate) blameOnBroken = c;
@@ -33,8 +33,7 @@ namespace Barotrauma
//update client hulls if the amount of water has changed by >10%
//or if oxygen percentage has changed by 5%
if (Math.Abs(lastSentVolume - waterVolume) > Volume * 0.1f ||
Math.Abs(lastSentOxygen - OxygenPercentage) > 5f ||
FireSources.Count > 0)
Math.Abs(lastSentOxygen - OxygenPercentage) > 5f)
{
sendUpdateTimer -= deltaTime;
if (sendUpdateTimer < 0.0f)
@@ -1126,7 +1126,7 @@ namespace Barotrauma.Networking
UInt16 modeIndex = inc.ReadUInt16();
if (GameMain.NetLobbyScreen.GameModes[modeIndex].Identifier.ToLowerInvariant() == "multiplayercampaign")
{
string[] saveFiles = SaveUtil.GetSaveFiles(SaveUtil.SaveType.Multiplayer).ToArray();
string[] saveFiles = SaveUtil.GetSaveFiles(SaveUtil.SaveType.Multiplayer);
for (int i = 0; i < saveFiles.Length; i++)
{
XDocument doc = SaveUtil.LoadGameSessionDoc(saveFiles[i]);
@@ -1960,8 +1960,6 @@ namespace Barotrauma.Networking
msg.Write(false);
}
msg.Write(serverSettings.AllowRagdollButton);
serverSettings.WriteMonsterEnabled(msg);
CompressOutgoingMessage(msg);
@@ -182,15 +182,6 @@ namespace Barotrauma.Networking
}
else
{
//tell the respawning client they're no longer a traitor
if (GameMain.Server.TraitorManager != null && clients[i].Character != null)
{
if (GameMain.Server.TraitorManager.TraitorList.Any(t => t.Character == clients[i].Character))
{
GameMain.Server.SendDirectChatMessage(TextManager.Get("traitorrespawnmessage"), clients[i], ChatMessageType.MessageBox);
}
}
clients[i].Character = character;
character.OwnerClientIP = clients[i].Connection.RemoteEndPoint.Address.ToString();
character.OwnerClientName = clients[i].Name;
@@ -56,7 +56,6 @@ namespace Barotrauma.Steam
Instance.server.SetKey("usingwhitelist", (server.ServerSettings.Whitelist != null && server.ServerSettings.Whitelist.Enabled).ToString());
Instance.server.SetKey("modeselectionmode", server.ServerSettings.ModeSelectionMode.ToString());
Instance.server.SetKey("subselectionmode", server.ServerSettings.SubSelectionMode.ToString());
Instance.server.SetKey("voicechatenabled", server.ServerSettings.VoiceChatEnabled.ToString());
Instance.server.SetKey("allowspectating", server.ServerSettings.AllowSpectating.ToString());
Instance.server.SetKey("allowrespawn", server.ServerSettings.AllowRespawn.ToString());
Instance.server.SetKey("traitors", server.ServerSettings.TraitorsEnabled.ToString());