Skip to content

Commit

Permalink
Project wide spring cleanup (SubnauticaNitrox#1553)
Browse files Browse the repository at this point in the history
Project wide spring cleanup
  • Loading branch information
Jannify authored Aug 1, 2021
1 parent 2d54d07 commit 0d76a30
Show file tree
Hide file tree
Showing 302 changed files with 1,337 additions and 1,540 deletions.
1 change: 0 additions & 1 deletion Nitrox.Bootloader/Main.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;

Expand Down
52 changes: 26 additions & 26 deletions Nitrox.Bootloader/Nitrox.Bootloader.csproj
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E4226522-9189-410B-93B2-792942FBD588}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Nitrox.Bootloader</RootNamespace>
<AssemblyName>Nitrox.Bootloader</AssemblyName>
<FileAlignment>512</FileAlignment>
<NitroxLibrary>false</NitroxLibrary>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="Main.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E4226522-9189-410B-93B2-792942FBD588}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Nitrox.Bootloader</RootNamespace>
<AssemblyName>Nitrox.Bootloader</AssemblyName>
<FileAlignment>512</FileAlignment>
<NitroxLibrary>false</NitroxLibrary>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup Label=".cs files">
<Compile Include="Main.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void NegotiateReservation(IMultiplayerSessionConnectionContext sessionCon
IClient client = sessionConnectionContext.Client;
string ipAddress = sessionConnectionContext.IpAddress;
int port = sessionConnectionContext.ServerPort;
StartClient(ipAddress, client,port);
StartClient(ipAddress, client, port);
EstablishSessionPolicy(sessionConnectionContext, client);
}
}
Expand Down Expand Up @@ -55,7 +55,7 @@ private static void StartClient(string ipAddress, IClient client, int port)
{
if (!client.IsConnected)
{
client.Start(ipAddress,port);
client.Start(ipAddress, port);

if (!client.IsConnected)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using NitroxClient.Communication.Abstract;
using NitroxClient.Communication.MultiplayerSession.ConnectionState;
using NitroxClient.Debuggers;
using NitroxClient.GameLogic;
using NitroxModel;
using NitroxModel.Helper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxClient.GameLogic;
using NitroxClient.GameLogic.ChatUI;
using NitroxModel.Core;
using NitroxModel.DataStructures.Util;
using NitroxModel.Logger;
using NitroxModel.Packets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ConstructionAmountChangedProcessor : ClientPacketProcessor<Construc
public ConstructionAmountChangedProcessor(BuildThrottlingQueue buildEventQueue)
{
this.buildEventQueue = buildEventQueue;
}
}

public override void Process(ConstructionAmountChanged amountChanged)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using NitroxClient.Communication.Abstract;
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxModel_Subnautica.Packets;
using NitroxClient.GameLogic;
using NitroxModel_Subnautica.Packets;

namespace NitroxClient.Communication.Packets.Processors
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using NitroxClient.Communication.Abstract;
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxModel_Subnautica.Packets;
using NitroxClient.GameLogic;
using NitroxModel_Subnautica.Packets;

namespace NitroxClient.Communication.Packets.Processors
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using NitroxClient.Communication.Abstract;
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxModel_Subnautica.Packets;
using NitroxClient.GameLogic;
using NitroxModel_Subnautica.Packets;

namespace NitroxClient.Communication.Packets.Processors
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxModel.DataStructures.GameLogic;
using NitroxModel.Packets;
using UnityEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override void Process(DeconstructionBegin packet)
Log.Info("Received deconstruction packet for id: " + packet.Id);

GameObject deconstructing = NitroxEntity.RequireObjectFrom(packet.Id);

Constructable constructable = deconstructing.GetComponent<Constructable>();
BaseDeconstructable baseDeconstructable = deconstructing.GetComponent<BaseDeconstructable>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public override void Process(EntityMetadataUpdate update)

Optional<EntityMetadataProcessor> metadataProcessor = EntityMetadataProcessor.FromMetaData(update.NewValue);
Validate.IsTrue(metadataProcessor.HasValue, $"No processor found for EntityMetadata of type {update.NewValue.GetType()}");

metadataProcessor.Value.ProcessMetadata(gameObject, update.NewValue);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxClient.MonoBehaviours;
using NitroxClient.Unity.Smoothing;
using NitroxModel.DataStructures.Util;
using NitroxModel.Packets;
using NitroxModel_Subnautica.DataStructures;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxModel.Packets;
using NitroxClient.GameLogic;
using NitroxModel.Packets;

namespace NitroxClient.Communication.Packets.Processors
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxModel.Packets;
using NitroxClient.GameLogic;
using NitroxModel.Packets;

namespace NitroxClient.Communication.Packets.Processors
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ public override void Process(ExosuitArmActionPacket packet)
case TechType.ExosuitGrapplingArmModule:
exosuitModuleEvent.UseGrappling(gameObject.GetComponent<ExosuitGrapplingArm>(), packet.ArmAction, packet.OpVector);
break;
case TechType.ExosuitTorpedoArmModule:
exosuitModuleEvent.UseTorpedo(gameObject.GetComponent<ExosuitTorpedoArm>(), packet.ArmAction, packet.OpVector, packet.OpRotation);
case TechType.ExosuitTorpedoArmModule:
exosuitModuleEvent.UseTorpedo(gameObject.GetComponent<ExosuitTorpedoArm>(), packet.ArmAction, packet.OpVector, packet.OpRotation);
break;
default:
Log.Error("Got an arm tech that is not handled: " + packet.TechType + " with action: " + packet.ArmAction + " for id " + packet.ArmId);
break;
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class GameModeChangedProcessor : ClientPacketProcessor<GameModeChanged>
{
public override void Process(GameModeChanged packet)
{
GameModeUtils.SetGameMode((GameModeOption)(int) packet.GameMode, GameModeOption.None);
GameModeUtils.SetGameMode((GameModeOption)(int)packet.GameMode, GameModeOption.None);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxModel.Packets;
using System;
using System.Collections;
using System.Collections.Generic;
using NitroxClient.Communication.Abstract;
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxClient.GameLogic.InitialSync.Base;
using System;
using NitroxModel.Logger;
using NitroxClient.MonoBehaviours;
using System.Collections;
using NitroxClient.Communication.Abstract;
using NitroxModel.Logger;
using NitroxModel.Packets;

namespace NitroxClient.Communication.Packets.Processors
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxModel.Packets;
using NitroxModel_Subnautica.DataStructures;
using NitroxModel_Subnautica.Helper;

namespace NitroxClient.Communication.Packets.Processors
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ public override void Process(ModuleRemoved packet)
Log.Error("Could not find equipment type for " + owner.name);
return;
}

GameObject item = NitroxEntity.RequireObjectFrom(packet.ItemId);
Pickupable pickupable = item.RequireComponent<Pickupable>();
Equipment equipment = opEquipment.Value;
Dictionary<string, InventoryItem> itemsBySlot = (Dictionary<string, InventoryItem>)equipment.ReflectionGet("equipment");
InventoryItem inventoryItem = itemsBySlot[packet.Slot];
itemsBySlot[packet.Slot] = null;

equipment.ReflectionCall("UpdateCount",false,false,pickupable.GetTechType(), false);
equipment.ReflectionCall("UpdateCount", false, false, pickupable.GetTechType(), false);
Equipment.SendEquipmentEvent(pickupable, UNEQUIP_EVENT_TYPE_ID, owner, packet.Slot);
equipment.ReflectionCall("NotifyUnequip", false, false, packet.Slot, inventoryItem);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public override void Process(PDAEncyclopediaEntryAdd packet)
{
using (packetSender.Suppress<PDAEncyclopediaEntryAdd>())
{
PDAEncyclopedia.Add(packet.Key,true);
PDAEncyclopedia.Add(packet.Key, true);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ public override void Process(PDALogEntryAdd packet)
using (packetSender.Suppress<PDALogEntryAddProcessor>())
{
Dictionary<string, PDALog.Entry> entries = (Dictionary<string, PDALog.Entry>)(typeof(PDALog).GetField("entries", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null));

if (!entries.ContainsKey(packet.Key))
{
PDALog.EntryData entryData;

if (!PDALog.GetEntryData(packet.Key, out entryData))
if (!PDALog.GetEntryData(packet.Key, out PDALog.EntryData entryData))
{
entryData = new PDALog.EntryData();
entryData.key = packet.Key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxModel.Packets;
using NitroxModel_Subnautica.DataStructures;
using NitroxModel_Subnautica.Helper;
using UnityEngine;

namespace NitroxClient.Communication.Packets.Processors
Expand All @@ -27,8 +26,7 @@ public override void Process(PDAEntryAdd packet)
TechType techType = packet.TechType.ToUnity();
PDAScanner.EntryData entryData = PDAScanner.GetEntryData(techType);

PDAScanner.Entry entry;
if (!PDAScanner.GetPartialEntryByKey(techType, out entry))
if (!PDAScanner.GetPartialEntryByKey(techType, out PDAScanner.Entry entry))
{
MethodInfo methodAdd = typeof(PDAScanner).GetMethod("Add", BindingFlags.NonPublic | BindingFlags.Static, null, new Type[] { typeof(TechType), typeof(int) }, null);
entry = (PDAScanner.Entry)methodAdd.Invoke(null, new object[] { techType, packet.Unlocked });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxModel.Packets;
using NitroxModel_Subnautica.DataStructures;
using NitroxModel_Subnautica.Helper;

namespace NitroxClient.Communication.Packets.Processors
{
Expand All @@ -21,9 +20,8 @@ public override void Process(PDAEntryRemove packet)
{
using (packetSender.Suppress<PDAEntryRemove>())
{
PDAScanner.Entry entry;

if (PDAScanner.GetPartialEntryByKey(packet.TechType.ToUnity(), out entry))
if (PDAScanner.GetPartialEntryByKey(packet.TechType.ToUnity(), out PDAScanner.Entry entry))
{
List<PDAScanner.Entry> partial = (List<PDAScanner.Entry>)(typeof(PDAScanner).GetField("partial", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null));
HashSet<TechType> complete = (HashSet<TechType>)(typeof(PDAScanner).GetField("complete", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using NitroxClient.Communication.Abstract;
using NitroxClient.Communication.Abstract;
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxClient.MonoBehaviours;
using NitroxClient.Unity.Helper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxModel.Packets;
using NitroxClient.GameLogic.Bases;
using NitroxModel.Packets;

namespace NitroxClient.Communication.Packets.Processors
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using NitroxClient.GameLogic;
using NitroxModel.Packets;
using NitroxModel_Subnautica.DataStructures;
using NitroxModel_Subnautica.Helper;

namespace NitroxClient.Communication.Packets.Processors
{
Expand All @@ -19,8 +18,7 @@ public override void Process(RemotePlayerEquipmentAdded packet)
{
ushort playerId = packet.PlayerId;

RemotePlayer player;
if (!playerManager.TryFind(playerId, out player))
if (!playerManager.TryFind(playerId, out RemotePlayer player))
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using NitroxClient.GameLogic;
using NitroxModel.Packets;
using NitroxModel_Subnautica.DataStructures;
using NitroxModel_Subnautica.Helper;

namespace NitroxClient.Communication.Packets.Processors
{
Expand All @@ -19,8 +18,7 @@ public override void Process(RemotePlayerEquipmentRemoved packet)
{
ushort playerId = packet.PlayerId;

RemotePlayer player;
if (!playerManager.TryFind(playerId, out player))
if (!playerManager.TryFind(playerId, out RemotePlayer player))
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Linq;
using System.Reflection;
using NitroxClient.Communication.Abstract;
using NitroxClient.Communication.Packets.Processors.Abstract;
using NitroxModel.Logger;
using NitroxModel.Packets;
using UnityEngine;
using NitroxClient.Communication.Abstract;

namespace NitroxClient.Communication.Packets.Processors
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using NitroxModel.Helper;
using NitroxModel.Packets;
using NitroxModel_Subnautica.DataStructures;
using NitroxModel_Subnautica.Helper;
using UnityEngine;

namespace NitroxClient.Communication.Packets.Processors
Expand Down
Loading

0 comments on commit 0d76a30

Please sign in to comment.