Fixed merge and some errors

This commit is contained in:
EvilFactory
2023-10-19 12:53:49 -03:00
parent ea1111cd6e
commit a65d99021c
10 changed files with 63 additions and 19 deletions
@@ -164,7 +164,7 @@ namespace Barotrauma
var order = new Order(orderPrefab, autonomousObjective.Option, item ?? character.CurrentHull as Entity, orderPrefab.GetTargetItemComponent(item), orderGiver: character);
if (order == null) { continue; }
if ((order.IgnoreAtOutpost || autonomousObjective.IgnoreAtOutpost) &&
Level.IsLoadedFriendlyOutpost && character.TeamID != CharacterTeamType.FriendlyNPC && !character.IsFriendlyNPCTurnedHostile)
Level.IsLoadedFriendlyOutpost && character.TeamID != CharacterTeamType.FriendlyNPC)
{
if (Submarine.MainSub != null && Submarine.MainSub.DockedTo.None(s => s.TeamID != CharacterTeamType.FriendlyNPC && s.TeamID != character.TeamID))
{
@@ -323,14 +323,15 @@ namespace Barotrauma.Items.Components
wire.RegisterSignal(signal, source: this);
#endif
SendSignalIntoConnection(signal, recipient);
GameMain.LuaCs.Hook.Call("signalReceived", signal, recipient);
GameMain.LuaCs.Hook.Call("signalReceived." + recipient.item.Prefab.Identifier, signal, recipient);
}
GameMain.LuaCs.Hook.Call("signalReceived", signal, connection);
GameMain.LuaCs.Hook.Call("signalReceived." + recipient.item.Prefab.Identifier, signal, connection);
foreach (CircuitBoxConnection connection in CircuitBoxConnections)
{
connection.ReceiveSignal(signal);
GameMain.LuaCs.Hook.Call("signalReceived", signal, connection.Connection);
GameMain.LuaCs.Hook.Call("signalReceived." + connection.Connection.Item.Prefab.Identifier, signal, connection);
}
enumeratingWires = false;
foreach (var removedWire in removedWires)
@@ -428,4 +429,4 @@ namespace Barotrauma.Items.Components
parentElement.Add(newElement);
}
}
}
}
@@ -2968,7 +2968,7 @@ namespace Barotrauma
if (condition <= 0.0f) { return; }
var should = GameMain.LuaCs.Hook.Call<bool?>("item.use", new object[] { this, character, targetLimb });
var should = GameMain.LuaCs.Hook.Call<bool?>("item.use", new object[] { this, user, targetLimb, useTarget });
if (should != null && should.Value) { return; }
@@ -489,9 +489,9 @@ namespace Barotrauma
GameMain.Server.SendChatMessage(msg, messageType, sender, character);
}
public static void SendTraitorMessage(Client client, string msg, Identifier missionid, TraitorMessageType type)
public static void SendTraitorMessage(WriteOnlyMessage message, Client client)
{
GameMain.Server.SendTraitorMessage(client, msg, missionid, type);
GameMain.Server.SendTraitorMessage(message, client);
}
public static void SendDirectChatMessage(string sendername, string text, Character sender, ChatMessageType messageType = ChatMessageType.Private, Client client = null, string iconStyle = "")
@@ -28,6 +28,45 @@ namespace Barotrauma
}
private static void CopyFolder(string sourceDirName, string destDirName, bool copySubDirs, bool overwriteExisting = false)
{
// Get the subdirectories for the specified directory.
DirectoryInfo dir = new DirectoryInfo(sourceDirName);
if (!dir.Exists)
{
throw new System.IO.DirectoryNotFoundException(
"Source directory does not exist or could not be found: "
+ sourceDirName);
}
IEnumerable<DirectoryInfo> dirs = dir.GetDirectories();
// If the destination directory doesn't exist, create it.
if (!Directory.Exists(destDirName))
{
Directory.CreateDirectory(destDirName);
}
// Get the files in the directory and copy them to the new location.
IEnumerable<FileInfo> files = dir.GetFiles();
foreach (FileInfo file in files)
{
string tempPath = Path.Combine(destDirName, file.Name);
if (!overwriteExisting && File.Exists(tempPath)) { continue; }
file.CopyTo(tempPath, true);
}
// If copying subdirectories, copy them and their contents to new location.
if (copySubDirs)
{
foreach (DirectoryInfo subdir in dirs)
{
string tempPath = Path.Combine(destDirName, subdir.Name);
CopyFolder(subdir.FullName, tempPath, copySubDirs, overwriteExisting);
}
}
}
private async void DownloadWorkshopItemAsync(WorkshopItemDownload download, bool startDownload = false)
{
if (startDownload)
@@ -45,7 +84,7 @@ namespace Barotrauma
}
itemsBeingDownloaded.Remove(download);
SaveUtil.CopyFolder(download.Item.Directory, download.Destination, true, true);
CopyFolder(download.Item.Directory, download.Destination, true, true);
return;
}
}