diff --git a/.editorconfig b/.editorconfig index e643cce7..195d725d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -134,11 +134,16 @@ resharper_web_config_module_not_resolved_highlighting = warning resharper_web_config_type_not_resolved_highlighting = warning resharper_web_config_wrong_module_highlighting = warning -dotnet_diagnostic.RCS1123.severity = none # parentheses in expressions (covered by default dotnet analyzers) -dotnet_diagnostic.RCS1213.severity = none # unused methods (^) -dotnet_diagnostic.RCS1163.severity = none # unused parameter (^) -dotnet_diagnostic.RCS1139.severity = none # missing on xmldoc ( is used in places as a way to easily link to random methods) -dotnet_diagnostic.IDE0005.severity = warning # unused using directive +# parentheses in expressions (covered by default dotnet analyzers) +dotnet_diagnostic.RCS1123.severity = none +# unused methods (^) +dotnet_diagnostic.RCS1213.severity = none +# unused parameter (^) +dotnet_diagnostic.RCS1163.severity = none +# missing on xmldoc ( is used in places as a way to easily link to random methods) +dotnet_diagnostic.RCS1139.severity = none +# unused using directive +dotnet_diagnostic.IDE0005.severity = warning [*.{appxmanifest,asax,ascx,aspx,axaml,build,cg,cginc,compute,cs,cshtml,dtd,fx,fxh,hlsl,hlsli,hlslinc,master,nuspec,paml,razor,resw,resx,shader,skin,usf,ush,vb,xaml,xamlx,xoml,xsd}] indent_style = space @@ -146,7 +151,11 @@ indent_size = 4 tab_width = 4 [/Unity/**/*.cs] -dotnet_diagnostic.RCS1251.severity = none # braces on empty classes +# braces on empty classes +dotnet_diagnostic.RCS1251.severity = none -[/Unity/Packages/**/*.cs] +[/Unity/{Packages,Assets/Plugins/FMOD}/**/*.cs] +# JustMyCode:tm: generated_code = true +dotnet_diagnostic.IDE0005.severity = none +dotnet_diagnostic.IDE1006.severity = none diff --git a/Immersion/Globals.cs b/Immersion/Globals.cs index 6351b3a3..3435b38b 100644 --- a/Immersion/Globals.cs +++ b/Immersion/Globals.cs @@ -32,9 +32,8 @@ public static PronounSet PlayerPronouns return _playerPronouns.Value; if (!PronounSet.TryParse(PlayerPrefs.GetString(PronounsKey, ""), out PronounSet pronouns)) - _playerPronouns = DefaultPronouns; - PlayerPronouns = pronouns; - return _playerPronouns.Value; + pronouns = DefaultPronouns; + return PlayerPronouns = pronouns; } set { diff --git a/SCHIZO/Creatures/Components/SwimInSchoolFieldSetter.cs b/SCHIZO/Creatures/Components/SwimInSchoolFieldSetter.cs new file mode 100644 index 00000000..dbd73dc4 --- /dev/null +++ b/SCHIZO/Creatures/Components/SwimInSchoolFieldSetter.cs @@ -0,0 +1,13 @@ +namespace SCHIZO.Creatures.Components; + +partial class SwimInSchoolFieldSetter +{ + private void Start() + { + SwimInSchool swim = behaviour as SwimInSchool; + if (!swim) return; + swim.kBreakDistance = breakDistance; + swim.percentFindLeaderRespond = percentFindLeaderRespond; + swim.chanceLoseLeader = chanceLoseLeader; + } +} \ No newline at end of file diff --git a/SCHIZO/Helpers/GameObjectEnumerableHelpers.cs b/SCHIZO/Helpers/GameObjectEnumerableHelpers.cs index 13334f1b..ebcb6c42 100644 --- a/SCHIZO/Helpers/GameObjectEnumerableHelpers.cs +++ b/SCHIZO/Helpers/GameObjectEnumerableHelpers.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; +using Nautilus.Extensions; using UnityEngine; namespace SCHIZO.Helpers; @@ -13,7 +14,8 @@ public static IEnumerable AllOfTechType(TechType techType) .Select(tag => tag.gameObject) .Concat(UnityEngine.Resources.FindObjectsOfTypeAll() .Where(id => CraftData.GetTechType(id.gameObject, out _) == techType) - .Select(id => id.gameObject)); + .Select(id => id.gameObject)) + .Where(go => !go.IsPrefab()); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IEnumerable SelectComponent(this IEnumerable gameObjects) where TComponent : Component diff --git a/SCHIZO/Resources/AssetBundles/Assets.cs b/SCHIZO/Resources/AssetBundles/Assets.cs index 1da60707..e9c97cbb 100644 --- a/SCHIZO/Resources/AssetBundles/Assets.cs +++ b/SCHIZO/Resources/AssetBundles/Assets.cs @@ -12,7 +12,7 @@ namespace SCHIZO.Resources; public static class Assets { - private const int _rnd = -1269642852; + private const int _rnd = -1520284776; private static readonly UnityEngine.AssetBundle _a = ResourceManager.GetAssetBundle("assets"); diff --git a/SCHIZO/Resources/AssetBundles/assets b/SCHIZO/Resources/AssetBundles/assets index d880795a..a8818f7d 100644 Binary files a/SCHIZO/Resources/AssetBundles/assets and b/SCHIZO/Resources/AssetBundles/assets differ diff --git a/SCHIZO/Tweaks/Content/ContentAlertManager.cs b/SCHIZO/Tweaks/Content/ContentAlertManager.cs index 3c42d286..47b27910 100644 --- a/SCHIZO/Tweaks/Content/ContentAlertManager.cs +++ b/SCHIZO/Tweaks/Content/ContentAlertManager.cs @@ -1,11 +1,9 @@ using System; -using System.Collections; using System.Collections.Generic; using System.Linq; using HarmonyLib; using SCHIZO.Helpers; using UnityEngine; -using UWE; namespace SCHIZO.Tweaks.Content; @@ -19,14 +17,14 @@ private void Awake() Instance = this; } - private static bool _alerting; + private static bool _alertsEnabled; internal static bool AlertsEnabled { - get => _alerting; + get => _alertsEnabled; set { - if (_alerting == value) return; - _alerting = value; + if (_alertsEnabled == value) return; + _alertsEnabled = value; OnAlertsEnabledChanged?.Invoke(); } } @@ -36,7 +34,7 @@ internal static bool AlertsEnabled public static void AttachToTechType(TechType techType) { - _attached.Add(techType); + if (!_attached.Add(techType)) return; foreach (GameObject obj in GameObjectEnumerableHelpers.AllOfTechType(techType)) { AttachContentAlert(obj.transform); @@ -56,34 +54,35 @@ public static void DetachFromTechType(TechType techType) [HarmonyPostfix] private static void ClassIdAwake(UniqueIdentifier __instance) { - if (__instance is PrefabIdentifier) - CoroutineHost.StartCoroutine(Coro(__instance)); + if (CraftData.entClassTechTable is null) return; + + if (__instance is not PrefabIdentifier { classId.Length: >0 } pid) return; + + TechType techType = CraftData.entClassTechTable.GetOrDefault(pid.classId); + if (!_attached.Contains(techType)) return; + + AttachContentAlert(pid.transform); } - private static IEnumerator Coro(UniqueIdentifier uid) + [HarmonyPatch(typeof(TechTag), MethodType.Constructor)] + [HarmonyPostfix] + private static void TechTagAwake(TechTag __instance) { - while (CraftData.entClassTechTable is null) - yield return null; - yield return new WaitForSeconds(UnityEngine.Random.Range(0.1f, 0.15f)); - if (!uid || uid.classId is null) yield break; - - TechType techType = CraftData.GetTechType(uid.gameObject, out _); - if (techType == TechType.None) yield break; - if (!_attached.Contains(techType)) yield break; + if (!_attached.Contains(__instance.type)) return; - AttachContentAlert(uid.transform); + AttachContentAlert(__instance.transform); } public static void AttachContentAlert(Transform target) { - if (!target || target.transform.Find($"{Instance.alertPrefab.name} (Clone)")) return; + if (!target || target.transform.Find($"{Instance.alertPrefab.name}(Clone)")) return; Instantiate(Instance.alertPrefab, target); } public static void DetachContentAlert(Transform target) { - foreach (ContentVisibilityHelper alert in target.GetComponentsInChildren()) + foreach (ContentVisibilityHelper alert in target.GetComponentsInChildren(true)) { if (alert) GameObject.Destroy(alert.gameObject); } diff --git a/Unity/Assets/Scripts/ECCLibrary.meta b/Unity/Assets/Scripts/ECCLibrary.meta deleted file mode 100644 index 9517f3ce..00000000 --- a/Unity/Assets/Scripts/ECCLibrary.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8b252cbb856a3504a9132df05993f018 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Unity/Assets/Scripts/ECCLibrary/ECCLibrary.asmdef b/Unity/Assets/Scripts/ECCLibrary/ECCLibrary.asmdef deleted file mode 100644 index a57c04a9..00000000 --- a/Unity/Assets/Scripts/ECCLibrary/ECCLibrary.asmdef +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "ECCLibrary", - "references": [ - "GUID:3d316254c8cfea64cb626dce93a4def6", - "GUID:324caed91501a9c47a04ebfd87b68794" - ], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": true, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Unity/Assets/Scripts/ECCLibrary/ECCLibrary.asmdef.meta b/Unity/Assets/Scripts/ECCLibrary/ECCLibrary.asmdef.meta deleted file mode 100644 index 0632f88c..00000000 --- a/Unity/Assets/Scripts/ECCLibrary/ECCLibrary.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 9ff74c496b10a80448018987762fdbfd -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Unity/Assets/Scripts/ECCLibrary/SwimInSchoolFieldSetter.cs b/Unity/Assets/Scripts/SCHIZO/Creatures/Components/SwimInSchoolFieldSetter.cs similarity index 55% rename from Unity/Assets/Scripts/ECCLibrary/SwimInSchoolFieldSetter.cs rename to Unity/Assets/Scripts/SCHIZO/Creatures/Components/SwimInSchoolFieldSetter.cs index 70de23e6..2cd69c3a 100644 --- a/Unity/Assets/Scripts/ECCLibrary/SwimInSchoolFieldSetter.cs +++ b/Unity/Assets/Scripts/SCHIZO/Creatures/Components/SwimInSchoolFieldSetter.cs @@ -3,9 +3,12 @@ using UnityEngine; // ReSharper disable once CheckNamespace -namespace ECCLibrary.Mono +namespace SCHIZO.Creatures.Components { - public sealed class SwimInSchoolFieldSetter : MonoBehaviour + /// + /// Copied from ECCLibrary + /// + public sealed partial class SwimInSchoolFieldSetter : MonoBehaviour { [Required, ExposedType("SwimInSchool")] public MonoBehaviour behaviour; diff --git a/Unity/Assets/Scripts/ECCLibrary/SwimInSchoolFieldSetter.cs.meta b/Unity/Assets/Scripts/SCHIZO/Creatures/Components/SwimInSchoolFieldSetter.cs.meta similarity index 100% rename from Unity/Assets/Scripts/ECCLibrary/SwimInSchoolFieldSetter.cs.meta rename to Unity/Assets/Scripts/SCHIZO/Creatures/Components/SwimInSchoolFieldSetter.cs.meta diff --git a/Unity/Assets/Scripts/Subnautica/PDANotification.cs.meta b/Unity/Assets/Scripts/Subnautica/PDANotification.cs.meta index 243e828d..85c269f8 100644 --- a/Unity/Assets/Scripts/Subnautica/PDANotification.cs.meta +++ b/Unity/Assets/Scripts/Subnautica/PDANotification.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: c1fd612b90b20714aa76f9096a6d366e, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Unity/Assets/Scripts/Subnautica/PingInstance.cs.meta b/Unity/Assets/Scripts/Subnautica/PingInstance.cs.meta index d8904854..9830765f 100644 --- a/Unity/Assets/Scripts/Subnautica/PingInstance.cs.meta +++ b/Unity/Assets/Scripts/Subnautica/PingInstance.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: c1fd612b90b20714aa76f9096a6d366e, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Unity/Assets/Scripts/Subnautica/PingType.cs.meta b/Unity/Assets/Scripts/Subnautica/PingType.cs.meta index dac6e8fd..5a454343 100644 --- a/Unity/Assets/Scripts/Subnautica/PingType.cs.meta +++ b/Unity/Assets/Scripts/Subnautica/PingType.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: c1fd612b90b20714aa76f9096a6d366e, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Unity/Assets/Scripts/Subnautica/SignalPing.cs.meta b/Unity/Assets/Scripts/Subnautica/SignalPing.cs.meta index 84f605a1..9940318f 100644 --- a/Unity/Assets/Scripts/Subnautica/SignalPing.cs.meta +++ b/Unity/Assets/Scripts/Subnautica/SignalPing.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: c1fd612b90b20714aa76f9096a6d366e, type: 3} userData: assetBundleName: assetBundleVariant: