Skip to content

Commit

Permalink
tons of merge changes
Browse files Browse the repository at this point in the history
  • Loading branch information
benvalkin committed Dec 11, 2024
2 parents 8c16e48 + 612c858 commit 3effb72
Show file tree
Hide file tree
Showing 288 changed files with 5,383 additions and 7,645 deletions.
32 changes: 11 additions & 21 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true

# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary

# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members
Expand Down Expand Up @@ -76,14 +76,14 @@ dotnet_style_prefer_simplified_interpolation = true
dotnet_style_readonly_field = true

# Parameter preferences
dotnet_code_quality_unused_parameters = all
dotnet_code_quality_unused_parameters = all:silent

# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = none

# New line preferences
dotnet_style_allow_multiple_blank_lines_experimental = true
dotnet_style_allow_statement_immediately_after_block_experimental = true
dotnet_style_allow_multiple_blank_lines_experimental = false
dotnet_style_allow_statement_immediately_after_block_experimental = false

#### C# Coding Conventions ####

Expand All @@ -97,7 +97,7 @@ csharp_style_expression_bodied_accessors = true
csharp_style_expression_bodied_constructors = false
csharp_style_expression_bodied_indexers = true
csharp_style_expression_bodied_lambdas = true
csharp_style_expression_bodied_local_functions = false
csharp_style_expression_bodied_local_functions = true
csharp_style_expression_bodied_methods = false
csharp_style_expression_bodied_operators = false
csharp_style_expression_bodied_properties = true
Expand All @@ -122,17 +122,17 @@ csharp_style_prefer_readonly_struct_member = true

# Code-block preferences
csharp_prefer_braces = true
csharp_prefer_simple_using_statement = true
csharp_prefer_simple_using_statement = true:silent
csharp_prefer_system_threading_lock = true
csharp_style_namespace_declarations = block_scoped
csharp_style_namespace_declarations = file_scoped:warning
csharp_style_prefer_method_group_conversion = true
csharp_style_prefer_primary_constructors = true
csharp_style_prefer_top_level_statements = true
csharp_style_prefer_top_level_statements = false

# Expression-level preferences
csharp_prefer_simple_default_expression = true
csharp_style_deconstructed_variable_declaration = true
csharp_style_implicit_object_creation_when_type_is_apparent = true
csharp_style_implicit_object_creation_when_type_is_apparent = false
csharp_style_inlined_variable_declaration = true
csharp_style_prefer_index_operator = true
csharp_style_prefer_local_over_anonymous_function = true
Expand All @@ -151,7 +151,7 @@ csharp_using_directive_placement = outside_namespace
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:suggestion
csharp_style_allow_embedded_statements_on_same_line_experimental = true

#### C# Formatting Rules ####
Expand Down Expand Up @@ -217,10 +217,6 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.private_fields_start_with_underscore.severity = suggestion
dotnet_naming_rule.private_fields_start_with_underscore.style = underscore_camel_case
dotnet_naming_rule.private_fields_start_with_underscore.symbols = private_fields

# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
Expand All @@ -235,9 +231,6 @@ dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, meth
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private

# Naming styles

dotnet_naming_style.pascal_case.required_prefix =
Expand All @@ -249,6 +242,3 @@ dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.underscore_camel_case.capitalization = camel_case
dotnet_naming_style.underscore_camel_case.required_prefix = _
Binary file added Libraries/Newtonsoft.Json.dll
Binary file not shown.
Binary file added Libraries/UnityEngine.UIModule.dll
Binary file not shown.
13 changes: 1 addition & 12 deletions UncreatedWarfare.Tests/TeamScoreTableTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,7 @@ private static IReadOnlyList<Team> CreateTeamList(int n)
};
}

for (int i = 0; i < n; ++i)
{
arr[i].Opponents.Capacity = n - 1;
for (int j = 0; j < n; ++j)
{
if (j == i)
continue;

arr[i].Opponents.Add(arr[j]);
}
}

Team.DeclareEnemies(arr);
return arr;
}

Expand Down
14 changes: 8 additions & 6 deletions UncreatedWarfare/Buildables/BuildableContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ public class BuildableContainer : MonoBehaviour, IComponentContainer<IBuildableC
{
private readonly List<IBuildableComponent> _components = new List<IBuildableComponent>();

#nullable disable
public IBuildable Buildable { get; private set; }
public DateTime CreateTime { get; private set; }
#nullable restore

internal void Init(IBuildable buildable)
{
Buildable = buildable;
CreateTime = DateTime.UtcNow;
}

public void AddComponent(IBuildableComponent newComponent)
{
Expand Down Expand Up @@ -70,12 +78,6 @@ public object Component(Type t)
return component;
}

public void Init(IBuildable buildable)
{
Buildable = buildable;
CreateTime = DateTime.Now;
}

void IManualOnDestroy.ManualOnDestroy()
{
lock (_components)
Expand Down
5 changes: 2 additions & 3 deletions UncreatedWarfare/Commands/AbandonCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
//using Uncreated.Warfare.Interaction.Commands;
//using Uncreated.Warfare.Translations;
//using Uncreated.Warfare.Vehicles;
//using Uncreated.Warfare.Vehicles.Info;
//using Uncreated.Warfare.Zones;

//namespace Uncreated.Warfare.Commands;

//[Command("abandon", "av"), MetadataFile]
//public class AbandonCommand : IExecutableCommand
//internal sealed class AbandonCommand : IExecutableCommand
//{
// private readonly ZoneStore _zoneStore;
// private readonly VehicleInfoStore _vehicleInfo;
// private readonly AbandonService _abandonService;
// private readonly AbandonTranslations _translations;

// /// <inheritdoc />
// public CommandContext Context { get; set; }
// public required CommandContext Context { get; init; }

// public AbandonCommand(TranslationInjection<AbandonTranslations> translations, ZoneStore zoneStore, VehicleInfoStore vehicleInfo, AbandonService abandonService)
// {
Expand Down
18 changes: 6 additions & 12 deletions UncreatedWarfare/Commands/AmmoCommand.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
using System;
using Uncreated.Warfare.Components;
using Uncreated.Warfare.Interaction.Commands;
using Uncreated.Warfare.Kits;
using Uncreated.Warfare.Logging;
using Uncreated.Warfare.Models.Kits;
using Uncreated.Warfare.Interaction.Commands;
using Uncreated.Warfare.Players.Management;
using Uncreated.Warfare.Translations;
using Uncreated.Warfare.Util;
using Uncreated.Warfare.Vehicles;

namespace Uncreated.Warfare.Commands;

Expand All @@ -19,7 +12,7 @@ public class AmmoCommand : IExecutableCommand
private readonly AmmoCommandTranslations _translations;

/// <inheritdoc />
public CommandContext Context { get; set; }
public required CommandContext Context { get; init; }

public AmmoCommand(DroppedItemTracker itemTracker, TranslationInjection<AmmoCommandTranslations> translations, IPlayerService playerService)
{
Expand All @@ -29,9 +22,9 @@ public AmmoCommand(DroppedItemTracker itemTracker, TranslationInjection<AmmoComm
}

/// <inheritdoc />
public async UniTask ExecuteAsync(CancellationToken token)
public UniTask ExecuteAsync(CancellationToken token)
{
Context.AssertRanByPlayer();
throw Context.SendNotImplemented();
#if false
VehicleBay? bay = Data.Singletons.GetSingleton<VehicleBay>();
if (bay == null || !bay.IsLoaded)
Expand Down Expand Up @@ -78,7 +71,8 @@ public async UniTask ExecuteAsync(CancellationToken token)
}
}

FOB? fob = Data.Singletons.GetSingleton<FOBManager>()?.FindNearestFOB<FOB>(vehicle.transform.position, vehicle.lockedGroup.m_SteamID.GetTeam());
FOB? fob =
Data.Singletons.GetSingleton<FOBManager>()?.FindNearestFOB<FOB>(vehicle.transform.position, vehicle.lockedGroup.m_SteamID.GetTeam());

if (fob == null && !isInMain)
throw Context.Reply(_translations.AmmoNotNearFOB);
Expand Down
4 changes: 2 additions & 2 deletions UncreatedWarfare/Commands/AttachCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
namespace Uncreated.Warfare.Commands;

[Command("attach"), MetadataFile]
public class AttachCommand : IExecutableCommand
internal sealed class AttachCommand : IExecutableCommand
{
private readonly AttachTranslations _translations;

private static readonly Guid FiremodeEffectGuid = new Guid("bc41e0feaebe4e788a3612811b8722d3");
private static EffectAsset? _firemodeEffect;

/// <inheritdoc />
public CommandContext Context { get; set; }
public required CommandContext Context { get; init; }

public AttachCommand(TranslationInjection<AttachTranslations> translations)
{
Expand Down
4 changes: 2 additions & 2 deletions UncreatedWarfare/Commands/BuildCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
namespace Uncreated.Warfare.Commands;

[HideFromHelp, Command("build")]
public class BuildCommand : IExecutableCommand
internal sealed class BuildCommand : IExecutableCommand
{
private readonly FobTranslations _translations;

/// <inheritdoc />
public CommandContext Context { get; set; }
public required CommandContext Context { get; init; }

public BuildCommand(TranslationInjection<FobTranslations> translations)
{
Expand Down
4 changes: 2 additions & 2 deletions UncreatedWarfare/Commands/BuyCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
namespace Uncreated.Warfare.Commands;

[Command("buy"), MetadataFile]
public class BuyCommand : IExecutableCommand
internal sealed class BuyCommand : IExecutableCommand
{
private readonly KitManager _kitManager;
private readonly SignInstancer _signs;
private readonly RequestTranslations _translations;
private readonly KitCommandTranslations _kitTranslations;

/// <inheritdoc />
public CommandContext Context { get; set; }
public required CommandContext Context { get; init; }

public BuyCommand(TranslationInjection<RequestTranslations> translations, TranslationInjection<KitCommandTranslations> kitTranslations, KitManager kitManager, SignInstancer signs)
{
Expand Down
4 changes: 2 additions & 2 deletions UncreatedWarfare/Commands/Clear/ClearBuildablesCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
namespace Uncreated.Warfare.Commands;

[Command("buildables", "structures", "barricades", "buildable", "structure", "barricade", "struct", "b", "s"), SubCommandOf(typeof(ClearCommand))]
public class ClearBuildablesCommand : IExecutableCommand
internal sealed class ClearBuildablesCommand : IExecutableCommand
{
private readonly BuildableSaver _buildableSaver;
private readonly ClearTranslations _translations;

public CommandContext Context { get; set; }
public required CommandContext Context { get; init; }
public ClearBuildablesCommand(TranslationInjection<ClearTranslations> translations, BuildableSaver buildableSaver)
{
_buildableSaver = buildableSaver;
Expand Down
4 changes: 2 additions & 2 deletions UncreatedWarfare/Commands/Clear/ClearCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace Uncreated.Warfare.Commands;

[Command("clear", "clr"), MetadataFile]
public class ClearCommand : ICommand;
public class ClearTranslations : PropertiesTranslationCollection
internal sealed class ClearCommand : ICommand;
public sealed class ClearTranslations : PropertiesTranslationCollection
{
protected override string FileName => "Commands/Clear";

Expand Down
5 changes: 3 additions & 2 deletions UncreatedWarfare/Commands/Clear/ClearInventoryCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
namespace Uncreated.Warfare.Commands;

[Command("inventory", "inv"), SubCommandOf(typeof(ClearCommand))]
public class ClearInventoryCommand : IExecutableCommand
internal sealed class ClearInventoryCommand : IExecutableCommand
{
private readonly ClearTranslations _translations;

public CommandContext Context { get; set; }
public required CommandContext Context { get; init; }

public ClearInventoryCommand(TranslationInjection<ClearTranslations> translations)
{
_translations = translations.Value;
Expand Down
5 changes: 3 additions & 2 deletions UncreatedWarfare/Commands/Clear/ClearItemsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
namespace Uncreated.Warfare.Commands;

[Command("items", "item", "i"), SubCommandOf(typeof(ClearCommand))]
public class ClearItemsCommand : IExecutableCommand
internal sealed class ClearItemsCommand : IExecutableCommand
{
private readonly ClearTranslations _translations;

public CommandContext Context { get; set; }
public required CommandContext Context { get; init; }

public ClearItemsCommand(TranslationInjection<ClearTranslations> translations)
{
_translations = translations.Value;
Expand Down
5 changes: 3 additions & 2 deletions UncreatedWarfare/Commands/Clear/ClearVehiclesCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
namespace Uncreated.Warfare.Commands;

[Command("vehicles", "veh", "v"), SubCommandOf(typeof(ClearCommand))]
public class ClearVehiclesCommand : IExecutableCommand
internal sealed class ClearVehiclesCommand : IExecutableCommand
{
private readonly VehicleRequestService _vehicleService;
private readonly ClearTranslations _translations;

public CommandContext Context { get; set; }
public required CommandContext Context { get; init; }

public ClearVehiclesCommand(VehicleRequestService vehicleService, TranslationInjection<ClearTranslations> translations)
{
_vehicleService = vehicleService;
Expand Down
8 changes: 4 additions & 4 deletions UncreatedWarfare/Commands/ConfrimCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ namespace Uncreated.Warfare.Commands;

[Command("confirm", "c"), HideFromHelp]
[Priority(-1)]
public class ConfirmCommand : IExecutableCommand
public sealed class ConfirmCommand : IExecutableCommand
{
/// <inheritdoc />
public CommandContext Context { get; set; }
public required CommandContext Context { get; init; }

/// <inheritdoc />
public UniTask ExecuteAsync(CancellationToken token)
Expand All @@ -20,10 +20,10 @@ public UniTask ExecuteAsync(CancellationToken token)

[Command("deny"), HideFromHelp]
[Priority(-1)]
public class DenyCommand : IExecutableCommand
public sealed class DenyCommand : IExecutableCommand
{
/// <inheritdoc />
public CommandContext Context { get; set; }
public required CommandContext Context { get; init; }

/// <inheritdoc />
public UniTask ExecuteAsync(CancellationToken token)
Expand Down
Loading

0 comments on commit 3effb72

Please sign in to comment.