From a3d81f4163d3001162e2a3b76f256f68a9582761 Mon Sep 17 00:00:00 2001 From: MaxtorCoder Date: Sun, 4 May 2025 19:00:34 +0200 Subject: [PATCH] feat: Add .editorconfig and add XML documentation for some fields - Ignore XML documentation for NPC Appearance fields --- .editorconfig | 98 +++++++++++++++++++ S1API/Dialogues/DialogueInjector.cs | 7 +- .../Appearances/AccessoryFields/Bottom.cs | 2 + .../Appearances/AccessoryFields/Chest.cs | 2 + .../Appearances/AccessoryFields/Feet.cs | 2 + .../Appearances/AccessoryFields/Hands.cs | 2 + .../Appearances/AccessoryFields/Head.cs | 2 + .../Appearances/AccessoryFields/Neck.cs | 2 + .../Appearances/AccessoryFields/Waist.cs | 2 + .../Appearances/BodyLayerFields/Pants.cs | 2 + .../Appearances/BodyLayerFields/Shirt.cs | 2 + .../CustomizationFields/HairStyle.cs | 2 + .../Appearances/FaceLayerFields/Eyes.cs | 2 + .../Appearances/FaceLayerFields/Face.cs | 2 + .../Appearances/FaceLayerFields/FacialHair.cs | 2 + S1API/GameTime/GameDateTime.cs | 33 ++++++- S1API/PhoneCalls/Constants/EvaluationType.cs | 10 ++ .../PhoneCalls/Constants/SystemTriggerType.cs | 10 ++ S1API/PhoneCalls/PhoneCallDefinition.cs | 4 + 19 files changed, 184 insertions(+), 4 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..82d03112 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,98 @@ +# Top-most EditorConfig file +root = true + +# Global settings +[*] +charset = utf-8-bom +end_of_line = crlf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 +tab_width = 4 + +# C# code style settings +[*.cs] +csharp_new_line_before_members_in_object_initializers = false +csharp_style_prefer_utf8_string_literals = true:suggestion +csharp_style_var_elsewhere = false:suggestion +csharp_style_var_for_built_in_types = false:suggestion +csharp_style_var_when_type_is_apparent = false:suggestion + +# Enforce enforce these warnings during build +dotnet_diagnostic.IDE0008.severity = warning +dotnet_diagnostic.IDE0040.severity = warning + +# .NET code style settings +dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity: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 +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 +dotnet_style_require_accessibility_modifiers = always:warning +dotnet_sort_system_directives_first = false + +# ReSharper formatting settings +resharper_autodetect_indent_settings = true +resharper_blank_lines_after_block_statements = 0 +resharper_blank_lines_after_start_comment = 0 +resharper_blank_lines_after_using_list = 0 +resharper_blank_lines_around_auto_property = 0 +resharper_braces_for_ifelse = not_required +resharper_braces_redundant = false +resharper_constructor_or_destructor_body = expression_body +resharper_csharp_blank_lines_around_invocable = 0 +resharper_csharp_empty_block_style = together_same_line +resharper_csharp_insert_final_newline = true +resharper_csharp_max_line_length = 194 +resharper_csharp_remove_blank_lines_near_braces_in_code = false +resharper_csharp_remove_blank_lines_near_braces_in_declarations = false +resharper_default_private_modifier = implicit +resharper_formatter_off_tag = @formatter:off +resharper_formatter_on_tag = @formatter:on +resharper_formatter_tags_enabled = true +resharper_indent_preprocessor_directives = normal +resharper_instance_members_qualify_declared_in = +resharper_method_or_operator_body = expression_body +resharper_object_creation_when_type_not_evident = target_typed +resharper_parentheses_redundancy_style = remove +resharper_place_expr_accessor_on_single_line = true +resharper_place_expr_method_on_single_line = false +resharper_place_expr_property_on_single_line = false +resharper_place_field_attribute_on_same_line = false +resharper_place_simple_embedded_statement_on_same_line = false +resharper_show_autodetect_configure_formatting_tip = false +resharper_use_indent_from_vs = false + +# ReSharper inspection severities +resharper_arrange_redundant_parentheses_highlighting = hint +resharper_arrange_this_qualifier_highlighting = hint +resharper_built_in_type_reference_style_for_member_access_highlighting = hint +resharper_built_in_type_reference_style_highlighting = hint +resharper_check_namespace_highlighting = none +resharper_condition_is_always_true_or_false_according_to_nullable_api_contract_highlighting = none +resharper_localizable_element_highlighting = none +resharper_mvc_action_not_resolved_highlighting = warning +resharper_mvc_area_not_resolved_highlighting = warning +resharper_mvc_controller_not_resolved_highlighting = warning +resharper_mvc_masterpage_not_resolved_highlighting = warning +resharper_mvc_partial_view_not_resolved_highlighting = warning +resharper_mvc_template_not_resolved_highlighting = warning +resharper_mvc_view_component_not_resolved_highlighting = warning +resharper_mvc_view_component_view_not_resolved_highlighting = warning +resharper_mvc_view_not_resolved_highlighting = warning +resharper_razor_assembly_not_resolved_highlighting = warning +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_unity_performance_critical_code_camera_main_highlighting = none +resharper_unity_performance_critical_code_invocation_highlighting = none +resharper_unreachable_switch_case_due_to_integer_analysis_highlighting = none +resharper_web_config_module_not_resolved_highlighting = warning +resharper_web_config_type_not_resolved_highlighting = warning +resharper_web_config_wrong_module_highlighting = warning diff --git a/S1API/Dialogues/DialogueInjector.cs b/S1API/Dialogues/DialogueInjector.cs index 9c5da647..4e879029 100644 --- a/S1API/Dialogues/DialogueInjector.cs +++ b/S1API/Dialogues/DialogueInjector.cs @@ -87,7 +87,7 @@ private static System.Collections.IEnumerator WaitForNPCsAndInject() for (int i = _pendingInjections.Count - 1; i >= 0; i--) { DialogueInjection? injection = _pendingInjections[i]; - var npcs = Object.FindObjectsOfType(); + NPC[]? npcs = Object.FindObjectsOfType(); NPC? target = null; foreach (NPC npc in npcs) @@ -115,8 +115,11 @@ private static System.Collections.IEnumerator WaitForNPCsAndInject() /// /// The dialogue injection object containing the data for the choice to inject. /// The NPC that will have the dialogue choice injected. - private static void TryInject(DialogueInjection injection, NPC npc) + private static void TryInject(DialogueInjection injection, NPC? npc) { + if (npc == null) + return; + DialogueHandler handler = npc.GetComponent(); NPCEvent_LocationDialogue dialogueEvent = npc.GetComponentInChildren(true); if (!dialogueEvent || !dialogueEvent.DialogueOverride) diff --git a/S1API/Entities/Appearances/AccessoryFields/Bottom.cs b/S1API/Entities/Appearances/AccessoryFields/Bottom.cs index 68e1cdc0..2fdf378e 100644 --- a/S1API/Entities/Appearances/AccessoryFields/Bottom.cs +++ b/S1API/Entities/Appearances/AccessoryFields/Bottom.cs @@ -1,6 +1,7 @@ using S1API.Entities.Appearances.Base; using System.Reflection; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace S1API.Entities.Appearances.AccessoryFields { /// @@ -12,3 +13,4 @@ public class Bottom : BaseAccessoryAppearance public const string MediumSkirt = "Avatar/Accessories/Bottom/MediumSkirt/MediumSkirt"; } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/S1API/Entities/Appearances/AccessoryFields/Chest.cs b/S1API/Entities/Appearances/AccessoryFields/Chest.cs index d2126774..5e88f07b 100644 --- a/S1API/Entities/Appearances/AccessoryFields/Chest.cs +++ b/S1API/Entities/Appearances/AccessoryFields/Chest.cs @@ -1,5 +1,6 @@ using S1API.Entities.Appearances.Base; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace S1API.Entities.Appearances.AccessoryFields { /// @@ -14,3 +15,4 @@ public class Chest : BaseAccessoryAppearance public const string OpenVest = "Avatar/Accessories/Chest/OpenVest/OpenVest"; } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/S1API/Entities/Appearances/AccessoryFields/Feet.cs b/S1API/Entities/Appearances/AccessoryFields/Feet.cs index 3ddb72ae..78775893 100644 --- a/S1API/Entities/Appearances/AccessoryFields/Feet.cs +++ b/S1API/Entities/Appearances/AccessoryFields/Feet.cs @@ -1,5 +1,6 @@ using S1API.Entities.Appearances.Base; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace S1API.Entities.Appearances.AccessoryFields { /// @@ -14,3 +15,4 @@ public class Feet : BaseAccessoryAppearance public const string Sneakers = "Avatar/Accessories/Feet/Sneakers/Sneakers"; } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/S1API/Entities/Appearances/AccessoryFields/Hands.cs b/S1API/Entities/Appearances/AccessoryFields/Hands.cs index ae157971..61c2f48c 100644 --- a/S1API/Entities/Appearances/AccessoryFields/Hands.cs +++ b/S1API/Entities/Appearances/AccessoryFields/Hands.cs @@ -1,5 +1,6 @@ using S1API.Entities.Appearances.Base; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace S1API.Entities.Appearances.AccessoryFields { /// @@ -10,3 +11,4 @@ public class Hands : BaseAccessoryAppearance public const string Polex = "Avatar/Accessories/Hands/Polex/Polex"; } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/S1API/Entities/Appearances/AccessoryFields/Head.cs b/S1API/Entities/Appearances/AccessoryFields/Head.cs index 8be729cb..a9c1cea4 100644 --- a/S1API/Entities/Appearances/AccessoryFields/Head.cs +++ b/S1API/Entities/Appearances/AccessoryFields/Head.cs @@ -1,5 +1,6 @@ using S1API.Entities.Appearances.Base; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace S1API.Entities.Appearances.AccessoryFields { /// @@ -23,3 +24,4 @@ public class Head : BaseAccessoryAppearance public const string SmallRoundGlasses = "Avatar/Accessories/Head/SmallRoundGlasses/SmallRoundGlasses"; } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/S1API/Entities/Appearances/AccessoryFields/Neck.cs b/S1API/Entities/Appearances/AccessoryFields/Neck.cs index 274303f3..b954d664 100644 --- a/S1API/Entities/Appearances/AccessoryFields/Neck.cs +++ b/S1API/Entities/Appearances/AccessoryFields/Neck.cs @@ -1,5 +1,6 @@ using S1API.Entities.Appearances.Base; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace S1API.Entities.Appearances.AccessoryFields { /// @@ -10,3 +11,4 @@ public class Neck : BaseAccessoryAppearance public const string GoldChain = "Avatar/Accessories/Neck/GoldChain/GoldChain"; } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/S1API/Entities/Appearances/AccessoryFields/Waist.cs b/S1API/Entities/Appearances/AccessoryFields/Waist.cs index 56df0604..4ff3a341 100644 --- a/S1API/Entities/Appearances/AccessoryFields/Waist.cs +++ b/S1API/Entities/Appearances/AccessoryFields/Waist.cs @@ -1,5 +1,6 @@ using S1API.Entities.Appearances.Base; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace S1API.Entities.Appearances.AccessoryFields { /// @@ -14,3 +15,4 @@ public class Waist : BaseAccessoryAppearance public const string PriestGown = "Avatar/Accessories/Neck/PriestGown/PriestGown"; } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/S1API/Entities/Appearances/BodyLayerFields/Pants.cs b/S1API/Entities/Appearances/BodyLayerFields/Pants.cs index 45e40fea..0fed0759 100644 --- a/S1API/Entities/Appearances/BodyLayerFields/Pants.cs +++ b/S1API/Entities/Appearances/BodyLayerFields/Pants.cs @@ -1,5 +1,6 @@ using S1API.Entities.Appearances.Base; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace S1API.Entities.Appearances.BodyLayerFields { /// @@ -14,3 +15,4 @@ public class Pants : BaseBodyAppearance public const string MaleUnderwear = "Avatar/Layers/Bottom/MaleUnderwear"; } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/S1API/Entities/Appearances/BodyLayerFields/Shirt.cs b/S1API/Entities/Appearances/BodyLayerFields/Shirt.cs index 177aab36..56ee157a 100644 --- a/S1API/Entities/Appearances/BodyLayerFields/Shirt.cs +++ b/S1API/Entities/Appearances/BodyLayerFields/Shirt.cs @@ -1,5 +1,6 @@ using S1API.Entities.Appearances.Base; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace S1API.Entities.Appearances.BodyLayerFields { /// @@ -22,3 +23,4 @@ public class Shirts : BaseBodyAppearance public const string VNeck = "Avatar/Layers/Top/V-Neck"; } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/S1API/Entities/Appearances/CustomizationFields/HairStyle.cs b/S1API/Entities/Appearances/CustomizationFields/HairStyle.cs index 2ac69fbe..9d24f517 100644 --- a/S1API/Entities/Appearances/CustomizationFields/HairStyle.cs +++ b/S1API/Entities/Appearances/CustomizationFields/HairStyle.cs @@ -1,5 +1,6 @@ using S1API.Entities.Appearances.Base; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace S1API.Entities.Appearances.CustomizationFields { /// @@ -35,3 +36,4 @@ public class HairStyle : BaseAppearance public const string Spiky = "Avatar/Hair/spiky/Spiky"; } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/S1API/Entities/Appearances/FaceLayerFields/Eyes.cs b/S1API/Entities/Appearances/FaceLayerFields/Eyes.cs index 6c7a82ad..3fca57e5 100644 --- a/S1API/Entities/Appearances/FaceLayerFields/Eyes.cs +++ b/S1API/Entities/Appearances/FaceLayerFields/Eyes.cs @@ -1,5 +1,6 @@ using S1API.Entities.Appearances.Base; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace S1API.Entities.Appearances.FaceLayerFields { /// @@ -13,3 +14,4 @@ public class Eyes : BaseFaceAppearance public const string TiredEyes = "Avatar/Layers/Face/TiredEyes"; } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/S1API/Entities/Appearances/FaceLayerFields/Face.cs b/S1API/Entities/Appearances/FaceLayerFields/Face.cs index e64b826b..c8db0c6a 100644 --- a/S1API/Entities/Appearances/FaceLayerFields/Face.cs +++ b/S1API/Entities/Appearances/FaceLayerFields/Face.cs @@ -1,5 +1,6 @@ using S1API.Entities.Appearances.Base; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace S1API.Entities.Appearances.FaceLayerFields { /// @@ -21,3 +22,4 @@ public class Face : BaseFaceAppearance public const string Surprised = "Avatar/Layers/Face/Face_Surprised"; } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/S1API/Entities/Appearances/FaceLayerFields/FacialHair.cs b/S1API/Entities/Appearances/FaceLayerFields/FacialHair.cs index add2de76..7574f994 100644 --- a/S1API/Entities/Appearances/FaceLayerFields/FacialHair.cs +++ b/S1API/Entities/Appearances/FaceLayerFields/FacialHair.cs @@ -1,5 +1,6 @@ using S1API.Entities.Appearances.Base; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace S1API.Entities.Appearances.FaceLayerFields { /// @@ -12,3 +13,4 @@ public class FacialHair : BaseFaceAppearance public const string Swirl = "Avatar/Layers/Face/FacialHair_Swirl"; } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/S1API/GameTime/GameDateTime.cs b/S1API/GameTime/GameDateTime.cs index 8dcbfa43..10780291 100644 --- a/S1API/GameTime/GameDateTime.cs +++ b/S1API/GameTime/GameDateTime.cs @@ -8,8 +8,6 @@ using S1GameDateTimeData = ScheduleOne.Persistence.Datas.GameDateTimeData; #endif -using System; - namespace S1API.GameTime { /// @@ -17,7 +15,14 @@ namespace S1API.GameTime /// public struct GameDateTime { + /// + /// The number of days that have elapsed since a reference point. + /// public int ElapsedDays; + + /// + /// The time of day in 24-hour format (e.g., 1330 for 1:30 PM). + /// public int Time; /// @@ -127,21 +132,45 @@ public override string ToString() return $"Day {ElapsedDays}, {GetFormattedTime()}"; } + /// + /// Adds two GameDateTime instances by summing their total minutes. + /// + /// The first GameDateTime. + /// The second GameDateTime. + /// A new GameDateTime representing the total. public static GameDateTime operator +(GameDateTime a, GameDateTime b) { return new GameDateTime(a.GetMinSum() + b.GetMinSum()); } + /// + /// Subtracts one GameDateTime from another by their total minutes. + /// + /// The GameDateTime to subtract from. + /// The GameDateTime to subtract. + /// The difference as a new GameDateTime. public static GameDateTime operator -(GameDateTime a, GameDateTime b) { return new GameDateTime(a.GetMinSum() - b.GetMinSum()); } + /// + /// Determines whether one GameDateTime is later than another. + /// + /// The first GameDateTime. + /// The second GameDateTime. + /// true if a is later than b; otherwise, false. public static bool operator >(GameDateTime a, GameDateTime b) { return a.GetMinSum() > b.GetMinSum(); } + /// + /// Determines whether one GameDateTime is earlier than another. + /// + /// The first GameDateTime. + /// The second GameDateTime. + /// true if a is earlier than b; otherwise, false. public static bool operator <(GameDateTime a, GameDateTime b) { return a.GetMinSum() < b.GetMinSum(); diff --git a/S1API/PhoneCalls/Constants/EvaluationType.cs b/S1API/PhoneCalls/Constants/EvaluationType.cs index 8bebbf78..bc2510b8 100644 --- a/S1API/PhoneCalls/Constants/EvaluationType.cs +++ b/S1API/PhoneCalls/Constants/EvaluationType.cs @@ -1,8 +1,18 @@ namespace S1API.PhoneCalls.Constants { + /// + /// Represents the result condition that determines whether an evaluation passes. + /// public enum EvaluationType { + /// + /// The evaluation passes when the condition evaluates to true. + /// PassOnTrue, + + /// + /// The evaluation passes when the condition evaluates to false. + /// PassOnFalse } } diff --git a/S1API/PhoneCalls/Constants/SystemTriggerType.cs b/S1API/PhoneCalls/Constants/SystemTriggerType.cs index 3e51f05e..e34dfdd5 100644 --- a/S1API/PhoneCalls/Constants/SystemTriggerType.cs +++ b/S1API/PhoneCalls/Constants/SystemTriggerType.cs @@ -1,8 +1,18 @@ namespace S1API.PhoneCalls.Constants { + /// + /// Specifies system-level triggers used during a phone call sequence. + /// public enum SystemTriggerType { + /// + /// Trigger that activates at the start of a sequence. + /// StartTrigger, + + /// + /// Trigger that activates upon completion of a sequence. + /// DoneTrigger } } diff --git a/S1API/PhoneCalls/PhoneCallDefinition.cs b/S1API/PhoneCalls/PhoneCallDefinition.cs index a0e5d578..3e2f5ed1 100644 --- a/S1API/PhoneCalls/PhoneCallDefinition.cs +++ b/S1API/PhoneCalls/PhoneCallDefinition.cs @@ -17,6 +17,10 @@ namespace S1API.PhoneCalls { + /// + /// Base class for defining a scripted phone call, including caller information and stage entries. + /// This is a wrapper around the game's internal . + /// public abstract class PhoneCallDefinition { // ReSharper disable once MemberCanBePrivate.Global