Skip to content

Commit

Permalink
Conversions to Nautilus
Browse files Browse the repository at this point in the history
  • Loading branch information
Metious committed Apr 20, 2023
1 parent 38556d8 commit 6f73f8d
Show file tree
Hide file tree
Showing 188 changed files with 1,047 additions and 1,113 deletions.
149 changes: 149 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@

[*]
charset = utf-8
end_of_line = crlf
trim_trailing_whitespace = false
insert_final_newline = false
indent_style = space
indent_size = 4

# Microsoft .NET properties
csharp_new_line_before_members_in_object_initializers = false
csharp_preferred_modifier_order = public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
csharp_space_after_cast = true

# Always prefer 'var' if possible
csharp_style_var_elsewhere = true:suggestion
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion

# Enforce File-scoped namespace declaration
[*.cs]
csharp_style_namespace_declarations = file_scoped:error
dotnet_diagnostic.IDE0161.severity = error

# Constants style
dotnet_naming_rule.constants_rule.severity = warning
dotnet_naming_rule.constants_rule.style = pascal_case_style
dotnet_naming_rule.constants_rule.symbols = constants_symbols
dotnet_naming_rule.private_constants_rule.severity = warning
dotnet_naming_rule.private_constants_rule.style = pascal_case_style
dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols

# Private fields style
dotnet_naming_rule.private_instance_fields_rule.severity = warning
dotnet_naming_rule.private_instance_fields_rule.style = lower_camel_case_style_1
dotnet_naming_rule.private_instance_fields_rule.symbols = private_instance_fields_symbols

# Private static fields style
dotnet_naming_rule.private_static_fields_rule.severity = warning
dotnet_naming_rule.private_static_fields_rule.style = lower_camel_case_style_1
dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols

# Private static readonly fields style
dotnet_naming_rule.private_static_readonly_rule.severity = warning
dotnet_naming_rule.private_static_readonly_rule.style = lower_camel_case_style_1
dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols

# Public (static) fields style
dotnet_naming_rule.public_fields_rule.severity = warning
dotnet_naming_rule.public_fields_rule.style = lower_camel_case_style
dotnet_naming_rule.public_fields_rule.symbols = public_fields_symbols
dotnet_naming_rule.static_readonly_rule.severity = warning
dotnet_naming_rule.static_readonly_rule.style = pascal_case_style
dotnet_naming_rule.static_readonly_rule.symbols = static_readonly_symbols

# Unity's serialized fields rule
dotnet_naming_rule.unity_serialized_field_rule.severity = warning
dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style_1
dotnet_naming_rule.unity_serialized_field_rule.symbols = private_static_fields_symbols

# camelCase rule
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case

# PascalCase rule
dotnet_naming_style.pascal_case_style.capitalization = pascal_case

# Private fields rule (_camelCase)
dotnet_naming_style.lower_camel_case_style_1.capitalization = camel_case
dotnet_naming_style.lower_camel_case_style_1.required_prefix = _

# Public constants symbols
dotnet_naming_symbols.constants_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected
dotnet_naming_symbols.constants_symbols.applicable_kinds = field
dotnet_naming_symbols.constants_symbols.required_modifiers = const

# Private constants symbols
dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field
dotnet_naming_symbols.private_constants_symbols.required_modifiers = const

# Private fields symbols
dotnet_naming_symbols.private_instance_fields_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_instance_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private

# Private static fields symbols
dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static

# Private static readonly symbols
dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static,readonly

# Public fields symbols
dotnet_naming_symbols.public_fields_symbols.applicable_accessibilities = public
dotnet_naming_symbols.public_fields_symbols.applicable_kinds = field

# Non-public static readonly fields symbols
dotnet_naming_symbols.static_readonly_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected
dotnet_naming_symbols.static_readonly_symbols.applicable_kinds = field
dotnet_naming_symbols.static_readonly_symbols.required_modifiers = static,readonly

# Avoid binary operators
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none

dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# Avoid 'this.' if unnecessary
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_property = false:suggestion

# Prefer explicit access modifiers
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion

# ReSharper properties
resharper_autodetect_indent_settings = true
resharper_indent_preprocessor_directives = normal
resharper_space_within_single_line_array_initializer_braces = false
resharper_use_indent_from_vs = false

# ReSharper inspection severities
resharper_arrange_redundant_parentheses_highlighting = hint
resharper_arrange_this_qualifier_highlighting = hint
resharper_arrange_type_member_modifiers_highlighting = hint
resharper_arrange_type_modifiers_highlighting = hint
resharper_built_in_type_reference_style_for_member_access_highlighting = hint
resharper_built_in_type_reference_style_highlighting = hint
resharper_redundant_base_qualifier_highlighting = warning
resharper_suggest_var_or_type_built_in_types_highlighting = hint
resharper_suggest_var_or_type_elsewhere_highlighting = hint
resharper_suggest_var_or_type_simple_types_highlighting = hint
resharper_web_config_module_not_resolved_highlighting = warning
resharper_web_config_type_not_resolved_highlighting = warning
resharper_web_config_wrong_module_highlighting = warning

[{*.har,*.inputactions,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,jest.config}]
indent_style = space
indent_size = 2

[*.{appxmanifest,asax,ascx,aspx,axaml,build,cg,cginc,compute,cs,cshtml,dtd,fs,fsi,fsscript,fsx,hlsl,hlsli,hlslinc,master,ml,mli,nuspec,paml,razor,resw,resx,shader,skin,usf,ush,vb,xaml,xamlx,xoml,xsd}]
indent_style = space
indent_size = 4
tab_width = 4
22 changes: 0 additions & 22 deletions .github/README.md

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/version-checker.yml

This file was deleted.

28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Contributing

## Preferred conventions and code style
* For commiting, we encourage [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary).
* We encourage [access modifiers](https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/access-modifiers) to be specified explicitly with no exceptions.
* Keep access modifiers as strict as possible (E.G: Do not default everything to `public` when they're not meant for public access).
* Unity messages (Awake, Start, Update etc..) should always be `private`.
* Remove unused `using` statements. Many IDEs offer shortcuts to perform this action.
* For namespaces, use [File Scoped Namespaces](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces).

## Setup
1. Download and install [.NET 7](https://dotnet.microsoft.com/en-us/download/dotnet/7.0)
2. Fork & clone the repository
3. Open the solution (.sln) file with your favorite IDE
4. Restore the dependencies by performing a NuGet restore via your IDE or by simply executing `dotnet restore` in a terminal
5. Make your changes, then submit a pull request.

## Submitting a Pull Request
We expect submitted PRs to be functional and thoroughly tested in the game. Please make sure of the following:
* Your changes do not break existing mods. Be it in a new world/save, or existing ones
* Follow our [Pull Request Template](.github/PULL_REQUEST_TEMPLATE.md)
* Run code refactoring automations to match our [preferred styles](#preferred-conventions-and-code-style).

If you are new to pull requests, read through [GitHub's Guide](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests).

## Docs Contribution
If you're looking to contribute to the [docs](https://subnauticamodding.github.io/Nautilus), refer to our [Docs Guidelines](Documentation/README.md).

6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project>
<PropertyGroup>
<Authors>SMLHelperDevs</Authors>
<Authors>Subnautica Modding</Authors>
<DebugType>embedded</DebugType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageProjectUrl>https://github.com/SubnauticaModding/SMLHelper</PackageProjectUrl>
<RepositoryUrl>https://github.com/SubnauticaModding/SMLHelper</RepositoryUrl>
<PackageProjectUrl>https://github.com/SubnauticaModding/Nautilus</PackageProjectUrl>
<RepositoryUrl>https://github.com/SubnauticaModding/Nautilus</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
Expand Down
24 changes: 13 additions & 11 deletions Example mod/ConfigExamples.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
namespace SMLHelper.Examples;
using Nautilus.Commands;
using Nautilus.Handlers;
using Nautilus.Json;
using Nautilus.Json.Attributes;
using Nautilus.Options;
using Nautilus.Options.Attributes;
using Nautilus.Utility;

namespace Nautilus.Examples;

using HarmonyLib;
using Commands;
using Handlers;
using Json;
using Json.Attributes;
using Options;
using Options.Attributes;
using UnityEngine;
using BepInEx;
using BepInEx.Logging;
using Utility;

[BepInPlugin("com.snmodding.smlhelper.configexample", "SMLHelper Config Example Mod", PluginInfo.PLUGIN_VERSION)]
[BepInDependency("com.snmodding.smlhelper")]
[BepInPlugin("com.snmodding.nautilus.configexample", "Nautilus Config Example Mod", PluginInfo.PLUGIN_VERSION)]
[BepInDependency("com.snmodding.nautilus")]
public class ConfigExamples : BaseUnityPlugin
{
internal static ManualLogSource LogSource { get; private set; }
Expand Down Expand Up @@ -130,13 +132,13 @@ public enum CustomChoice { One, Two, Three }
/// launch and is the recommended setting.</para>
///
/// <para>Both of these values allow for bitwise combinations of their options, so
/// <c>[Menu("SMLHelper Example Mod", LoadOn = MenuAttribute.LoadEvents.MenuRegistered | MenuAttribute.LoadEvents.MenuOpened)]</c>
/// <c>[Menu("Nautilus Example Mod", LoadOn = MenuAttribute.LoadEvents.MenuRegistered | MenuAttribute.LoadEvents.MenuOpened)]</c>
/// is valid and will result in the values being loaded both on game start and also whenever the menu is opened.</para>
///
/// <para>We could also specify a <see cref="ConfigFileAttribute"/> here to customise the name of the config file
/// (defaults to "config") and an optional subfolder for the config file to reside in.</para>
/// </summary>
[Menu("SMLHelper Example Mod")]
[Menu("Nautilus Example Mod")]
public class Config: ConfigFile
{
/// <summary>
Expand Down
14 changes: 7 additions & 7 deletions Example mod/CustomFabricatorExample.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using BepInEx;
using SMLHelper.Assets;
using SMLHelper.Assets.Gadgets;
using SMLHelper.Assets.PrefabTemplates;
using SMLHelper.Crafting;
using Nautilus.Assets;
using Nautilus.Assets.Gadgets;
using Nautilus.Assets.PrefabTemplates;
using Nautilus.Crafting;
#if SUBNAUTICA
using Ingredient = CraftData.Ingredient;
#endif

namespace SMLHelper.Examples;
namespace Nautilus.Examples;

[BepInPlugin("com.snmodding.smlhelper.customfabricator", "SMLHelper Custom Fabricator Example Mod", PluginInfo.PLUGIN_VERSION)]
[BepInDependency("com.snmodding.smlhelper")]
[BepInPlugin("com.snmodding.nautilus.customfabricator", "Nautilus Custom Fabricator Example Mod", PluginInfo.PLUGIN_VERSION)]
[BepInDependency("com.snmodding.nautilus")]
public class CustomFabricatorExample : BaseUnityPlugin
{
private void Awake()
Expand Down
12 changes: 6 additions & 6 deletions Example mod/CustomPrefabExamples.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using BepInEx;
using SMLHelper.Assets;
using SMLHelper.Assets.Gadgets;
using SMLHelper.Assets.PrefabTemplates;
using Nautilus.Assets;
using Nautilus.Assets.Gadgets;
using Nautilus.Assets.PrefabTemplates;
using UnityEngine;
using BiomeData = LootDistributionData.BiomeData;

namespace SMLHelper.Examples;
namespace Nautilus.Examples;

[BepInPlugin("com.snmodding.smlhelper.customprefab", "SMLHelper Custom Prefab Example Mod", PluginInfo.PLUGIN_VERSION)]
[BepInDependency("com.snmodding.smlhelper")]
[BepInPlugin("com.snmodding.nautilus.customprefab", "Nautilus Custom Prefab Example Mod", Nautilus.PluginInfo.PLUGIN_VERSION)]
[BepInDependency("com.snmodding.nautilus")]
public class CustomPrefabExamples : BaseUnityPlugin
{
private void Awake()
Expand Down
Loading

0 comments on commit 6f73f8d

Please sign in to comment.