Skip to content

Commit

Permalink
Fixed merge and some errors
Browse files Browse the repository at this point in the history
  • Loading branch information
evilfactory committed Oct 19, 2023
1 parent ea1111c commit a65d990
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public LidgrenServerPeer(Option<int> ownKey, ServerSettings settings, Callbacks
MaximumConnections = NetConfig.MaxPlayers * 2,
EnableUPnP = serverSettings.EnableUPnP,
Port = serverSettings.Port,
DualStack = GameSettings.CurrentConfig.UseDualModeSockets
DualStack = GameSettings.CurrentConfig.UseDualModeSockets,
LocalAddress = serverSettings.ListenIPAddress,
};

Expand Down
2 changes: 0 additions & 2 deletions Barotrauma/BarotraumaShared/Lua/DefaultLib/LibShared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ defaultLib["ClientPacketHeader"] = CreateEnum("Barotrauma.Networking.ClientPacke
defaultLib["ServerPacketHeader"] = CreateEnum("Barotrauma.Networking.ServerPacketHeader")
defaultLib["RandSync"] = CreateEnum("Barotrauma.Rand+RandSync")
defaultLib["DisconnectReason"] = CreateEnum("Barotrauma.Networking.DisconnectReason")
defaultLib["TraitorMessageType"] = CreateEnum("Barotrauma.Networking.TraitorMessageType")
defaultLib["CombatMode"] = CreateEnum("Barotrauma.AIObjectiveCombat+CombatMode")
defaultLib["CauseOfDeathType"] = CreateEnum("Barotrauma.CauseOfDeathType")
defaultLib["CharacterTeamType"] = CreateEnum("Barotrauma.CharacterTeamType")
Expand Down Expand Up @@ -108,7 +107,6 @@ defaultLib["NetEntityEvent"] = CreateStatic("Barotrauma.Networking.NetEntityEven
defaultLib["Screen"] = CreateStatic("Barotrauma.Screen")
defaultLib["AttackResult"] = CreateStatic("Barotrauma.AttackResult", true)
defaultLib["TempClient"] = CreateStatic("Barotrauma.Networking.TempClient", true)
defaultLib["TraitorMissionResult"] = CreateStatic("Barotrauma.TraitorMissionResult", true)
defaultLib["DecalManager"] = CreateStatic("Barotrauma.DecalManager", true)
defaultLib["AutoItemPlacer"] = CreateStatic("Barotrauma.AutoItemPlacer")
defaultLib["PropertyConditional"] = CreateStatic("Barotrauma.PropertyConditional", true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ RegisterBarotrauma("VideoPlayer")
RegisterBarotrauma("CreditsPlayer")
RegisterBarotrauma("SlideshowPlayer")
RegisterBarotrauma("SerializableEntityEditor")
RegisterBarotrauma("CircuitBoxWireRenderer")
RegisterBarotrauma("CircuitBoxLabel")
RegisterBarotrauma("CircuitBoxMouseDragSnapshotHandler")
RegisterBarotrauma("CircuitBoxUI")

RegisterBarotrauma("SettingsMenu")
RegisterBarotrauma("TabMenu")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,3 @@ RegisterBarotrauma("Networking.GameServer")

RegisterBarotrauma("Networking.ServerPeer")
RegisterBarotrauma("Networking.ServerPeer+PendingClient")

RegisterBarotrauma("Traitor")
RegisterBarotrauma("Traitor+TraitorMission")
15 changes: 10 additions & 5 deletions Barotrauma/BarotraumaShared/Lua/DefaultRegister/RegisterShared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ RegisterBarotrauma("SubmarineFile")
RegisterBarotrauma("TalentsFile")
RegisterBarotrauma("TalentTreesFile")
RegisterBarotrauma("TextFile")
RegisterBarotrauma("TraitorMissionsFile")
RegisterBarotrauma("TutorialsFile")
RegisterBarotrauma("UIStyleFile")
RegisterBarotrauma("UpgradeModulesFile")
Expand All @@ -240,8 +239,15 @@ RegisterBarotrauma("ItemInventory")
RegisterBarotrauma("Inventory+ItemSlot")
RegisterBarotrauma("FireSource")
RegisterBarotrauma("AutoItemPlacer")

local componentsToRegister = { "DockingPort", "Door", "GeneticMaterial", "Growable", "Holdable", "LevelResource", "ItemComponent", "ItemLabel", "LightComponent", "Controller", "Deconstructor", "Engine", "Fabricator", "OutpostTerminal", "Pump", "Reactor", "Steering", "PowerContainer", "Projectile", "Repairable", "Rope", "Scanner", "ButtonTerminal", "ConnectionPanel", "CustomInterface", "MemoryComponent", "Terminal", "WifiComponent", "Wire", "TriggerComponent", "ElectricalDischarger", "EntitySpawnerComponent", "ProducedItem", "VineTile", "GrowthSideExtension", "IdCard", "MeleeWeapon", "Pickable", "AbilityItemPickingTime", "Propulsion", "RangedWeapon", "AbilityRangedWeapon", "RepairTool", "Sprayer", "Throwable", "ItemContainer", "AbilityItemContainer", "Ladder", "LimbPos", "AbilityDeconstructedItem", "AbilityItemCreationMultiplier", "AbilityItemDeconstructedInventory", "MiniMap", "OxygenGenerator", "Sonar", "SonarTransducer", "Vent", "NameTag", "Planter", "Powered", "PowerTransfer", "Quality", "RemoteController", "AdderComponent", "AndComponent", "ArithmeticComponent", "ColorComponent", "ConcatComponent", "Connection", "DelayComponent", "DivideComponent", "EqualsComponent", "ExponentiationComponent", "FunctionComponent", "GreaterComponent", "ModuloComponent", "MotionSensor", "MultiplyComponent", "NotComponent", "OrComponent", "OscillatorComponent", "OxygenDetector", "RegExFindComponent", "RelayComponent", "SignalCheckComponent", "SmokeDetector", "StringComponent", "SubtractComponent", "TrigonometricFunctionComponent", "WaterDetector", "XorComponent", "StatusHUD", "Turret", "Wearable",
RegisterBarotrauma("CircuitBoxConnection")
RegisterBarotrauma("CircuitBoxComponent")
RegisterBarotrauma("CircuitBoxNode")
RegisterBarotrauma("CircuitBoxWire")
RegisterBarotrauma("CircuitBoxInputOutputNode")
RegisterBarotrauma("CircuitBoxSelectable")
RegisterBarotrauma("CircuitBoxSizes")

local componentsToRegister = { "DockingPort", "Door", "GeneticMaterial", "Growable", "Holdable", "LevelResource", "ItemComponent", "ItemLabel", "LightComponent", "Controller", "Deconstructor", "Engine", "Fabricator", "OutpostTerminal", "Pump", "Reactor", "Steering", "PowerContainer", "Projectile", "Repairable", "Rope", "Scanner", "ButtonTerminal", "ConnectionPanel", "CustomInterface", "MemoryComponent", "Terminal", "WifiComponent", "Wire", "TriggerComponent", "ElectricalDischarger", "EntitySpawnerComponent", "ProducedItem", "VineTile", "GrowthSideExtension", "IdCard", "MeleeWeapon", "Pickable", "AbilityItemPickingTime", "Propulsion", "RangedWeapon", "AbilityRangedWeapon", "RepairTool", "Sprayer", "Throwable", "ItemContainer", "AbilityItemContainer", "Ladder", "LimbPos", "AbilityDeconstructedItem", "AbilityItemCreationMultiplier", "AbilityItemDeconstructedInventory", "MiniMap", "OxygenGenerator", "Sonar", "SonarTransducer", "Vent", "NameTag", "Planter", "Powered", "PowerTransfer", "Quality", "RemoteController", "AdderComponent", "AndComponent", "ArithmeticComponent", "ColorComponent", "ConcatComponent", "Connection", "CircuitBox", "DelayComponent", "DivideComponent", "EqualsComponent", "ExponentiationComponent", "FunctionComponent", "GreaterComponent", "ModuloComponent", "MotionSensor", "MultiplyComponent", "NotComponent", "OrComponent", "OscillatorComponent", "OxygenDetector", "RegExFindComponent", "RelayComponent", "SignalCheckComponent", "SmokeDetector", "StringComponent", "SubtractComponent", "TrigonometricFunctionComponent", "WaterDetector", "XorComponent", "StatusHUD", "Turret", "Wearable",
"GridInfo", "PowerSourceGroup"
}

Expand Down Expand Up @@ -381,8 +387,7 @@ RegisterBarotrauma("Skill")
RegisterBarotrauma("SkillPrefab")
RegisterBarotrauma("SkillSettings")

RegisterBarotrauma("TraitorMissionPrefab")
RegisterBarotrauma("TraitorMissionResult")
RegisterBarotrauma("TraitorManager")

Register("FarseerPhysics.Dynamics.Body")
Register("FarseerPhysics.Dynamics.World")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void CreateAutonomousObjectives()
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))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,15 @@ public void SendSignal(Signal signal)
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)
Expand Down Expand Up @@ -428,4 +429,4 @@ public void Save(XElement parentElement)
parentElement.Add(newElement);
}
}
}
}
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaShared/SharedSource/Items/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2968,7 +2968,7 @@ public void Use(float deltaTime, Character user = null, Limb targetLimb = null,

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; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,9 @@ public static void SendMessage(string msg, ChatMessageType? messageType = null,
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 = "")
Expand Down
41 changes: 40 additions & 1 deletion Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSteam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,45 @@ public LuaCsSteam()

}

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)
Expand All @@ -45,7 +84,7 @@ private async void DownloadWorkshopItemAsync(WorkshopItemDownload download, bool
}

itemsBeingDownloaded.Remove(download);
SaveUtil.CopyFolder(download.Item.Directory, download.Destination, true, true);
CopyFolder(download.Item.Directory, download.Destination, true, true);
return;
}
}
Expand Down

0 comments on commit a65d990

Please sign in to comment.