diff --git a/SCHIZO/Creatures/UnityCreaturePrefab.cs b/SCHIZO/Creatures/UnityCreaturePrefab.cs index 8e12f919..42da590f 100644 --- a/SCHIZO/Creatures/UnityCreaturePrefab.cs +++ b/SCHIZO/Creatures/UnityCreaturePrefab.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics.CodeAnalysis; using ECCLibrary; using Nautilus.Handlers; @@ -27,9 +27,9 @@ protected override void SetItemProperties() if (UnityData.acidImmune) CreatureDataUtils.SetAcidImmune(ModItem); if (UnityData.bioReactorCharge > 0) CreatureDataUtils.SetBioreactorCharge(ModItem, UnityData.bioReactorCharge); - if (UnityData.PDAEncyclopediaInfo) + if (UnityData.pdaEncyInfo) { - PDAHandler.AddCustomScannerEntry(ModItem, UnityData.PDAEncyclopediaInfo.scanTime, encyclopediaKey: PrefabInfo.ClassID); + PDAHandler.AddCustomScannerEntry(ModItem, UnityData.pdaEncyInfo.scanTime, encyclopediaKey: PrefabInfo.ClassID); } if (UnityData.isPickupable) diff --git a/SCHIZO/Items/Data/ItemData.cs b/SCHIZO/Items/Data/ItemData.cs index d9447243..c1a3c102 100644 --- a/SCHIZO/Items/Data/ItemData.cs +++ b/SCHIZO/Items/Data/ItemData.cs @@ -12,7 +12,6 @@ partial class ItemData public string[] CraftTreePath => RetargetHelpers.Pick(craftTreePathSN, craftTreePathBZ).Split('/'); public TechGroup TechGroup => (TechGroup) RetargetHelpers.Pick(techGroupSN, techGroupBZ); public TechCategory TechCategory => (TechCategory) RetargetHelpers.Pick(techCategorySN, techCategoryBZ); - public PDAEncyclopediaInfo PDAEncyclopediaInfo => RetargetHelpers.Pick(pdaEncyclopediaInfoSN, pdaEncyclopediaInfoBZ); public KnownTechInfo KnownTechInfo => RetargetHelpers.Pick(knownTechInfoSN, knownTechInfoBZ); public bool UnlockAtStart => RetargetHelpers.Pick(unlockAtStartSN, unlockAtStartBZ); public TechType RequiredForUnlock => RetargetHelpers.Pick(requiredForUnlockSN, requiredForUnlockBZ).GetTechType(); diff --git a/SCHIZO/Items/UnityPrefab.cs b/SCHIZO/Items/UnityPrefab.cs index ca63f298..300c602d 100644 --- a/SCHIZO/Items/UnityPrefab.cs +++ b/SCHIZO/Items/UnityPrefab.cs @@ -132,11 +132,12 @@ protected virtual void SetItemProperties() CraftDataHandler.AddToGroup(ModItem.ItemData.TechGroup, ModItem.ItemData.TechCategory, ModItem); } - if (ModItem.ItemData.PDAEncyclopediaInfo) + if (ModItem.ItemData.pdaEncyInfo) { - PDAEncyclopediaInfo i = ModItem.ItemData.PDAEncyclopediaInfo; + PDAEncyclopediaInfo i = ModItem.ItemData.pdaEncyInfo; + string encyPath = RetargetHelpers.Pick(i.encyPathSN, i.encyPathBZ); - PDAHandler.AddEncyclopediaEntry(ModItem.PrefabInfo.ClassID, i.encyPath, i.title, i.description.text, i.texture, i.unlockSprite, + PDAHandler.AddEncyclopediaEntry(ModItem.PrefabInfo.ClassID, encyPath, i.title, i.description.text, i.texture, i.unlockSprite, i.isImportantUnlock ? PDAHandler.UnlockImportant : PDAHandler.UnlockBasic); if (i.scanSounds) ScanSoundHandler.Register(ModItem, i.scanSounds); diff --git a/SCHIZO/Spawns/CoordinatedSpawns.cs b/SCHIZO/Spawns/CoordinatedSpawns.cs new file mode 100644 index 00000000..bf5dc24e --- /dev/null +++ b/SCHIZO/Spawns/CoordinatedSpawns.cs @@ -0,0 +1,21 @@ +using Nautilus.Handlers; +using NSpawnInfo = Nautilus.Handlers.SpawnInfo; + +namespace SCHIZO.Spawns; + +partial class CoordinatedSpawns +{ + protected override void Register() + { + foreach (SpawnInfo spawnInfo in spawns) + { + if (!spawnInfo.game.HasFlag(GAME)) continue; + + foreach (SpawnInfo.SpawnLocation location in spawnInfo.locations) + { + NSpawnInfo nSpawnInfo = new((TechType)spawnInfo.item.techType, location.position, location.rotation); + CoordinatedSpawnsHandler.RegisterCoordinatedSpawn(nSpawnInfo); + } + } + } +} diff --git a/Unity/Assets/Editor/Scripts/Editor.asmdef b/Unity/Assets/Editor/Scripts/Editor.asmdef index 33eb1adc..4686232e 100644 --- a/Unity/Assets/Editor/Scripts/Editor.asmdef +++ b/Unity/Assets/Editor/Scripts/Editor.asmdef @@ -20,4 +20,4 @@ "defineConstraints": [], "versionDefines": [], "noEngineReferences": false -} \ No newline at end of file +} diff --git a/Unity/Assets/Editor/Scripts/Extensions.meta b/Unity/Assets/Editor/Scripts/Extensions.meta new file mode 100644 index 00000000..2971be8c --- /dev/null +++ b/Unity/Assets/Editor/Scripts/Extensions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fd27378a63d0f1e4eaf99fca753899d9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Editor/Scripts/Extensions/GameAttributeExtensions.cs b/Unity/Assets/Editor/Scripts/Extensions/GameAttributeExtensions.cs new file mode 100644 index 00000000..0faaad96 --- /dev/null +++ b/Unity/Assets/Editor/Scripts/Extensions/GameAttributeExtensions.cs @@ -0,0 +1,21 @@ +using SCHIZO.Helpers; +using SCHIZO.Registering; +using UnityEditor; + +namespace Editor.Scripts.Extensions +{ + public static class GameAttributeExtensions + { + public static bool TryGetGame(this GameAttribute attr, out Game game) => TryGetGame(attr, null, out game); + public static bool TryGetGame(this GameAttribute attr, SerializedProperty property, out Game game) + { + game = attr.game; + if (game > 0 || string.IsNullOrEmpty(attr.gameMember)) return true; + if (property == null) return false; + + object target = property.GetParent().GetSerializedValue(); + game = ReflectionHelpers.GetMemberValue(target, attr.gameMember); + return true; + } + } +} \ No newline at end of file diff --git a/Unity/Assets/Editor/Scripts/Extensions/GameAttributeExtensions.cs.meta b/Unity/Assets/Editor/Scripts/Extensions/GameAttributeExtensions.cs.meta new file mode 100644 index 00000000..a655dbd3 --- /dev/null +++ b/Unity/Assets/Editor/Scripts/Extensions/GameAttributeExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fc2116a8cedd2f84da2c7a876ac0db4e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Editor/Scripts/Extensions/SerializedPropertyExtensions.cs b/Unity/Assets/Editor/Scripts/Extensions/SerializedPropertyExtensions.cs new file mode 100644 index 00000000..16e3ca0a --- /dev/null +++ b/Unity/Assets/Editor/Scripts/Extensions/SerializedPropertyExtensions.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using SCHIZO.Helpers; +using UnityEditor; + +namespace Editor.Scripts.Extensions +{ + public static class SerializedPropertyExtensions + { + // most (all) of the code is adapted from this thread: https://forum.unity.com/threads/get-a-general-object-value-from-serializedproperty.327098/ + private delegate FieldInfo GetFieldInfo(SerializedProperty prop, out Type type); + private static readonly GetFieldInfo fieldInfoGetter = Setup(); + + public static FieldInfo GetFieldInfoAndStaticType(this SerializedProperty prop, out Type type) + { + return fieldInfoGetter(prop, out type); + } + + private static GetFieldInfo Setup() + { + Type t = Type.GetType("UnityEditor.ScriptAttributeUtility, UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"); + MethodInfo mi = t.GetMethod("GetFieldInfoAndStaticTypeFromProperty", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); + return (GetFieldInfo) Delegate.CreateDelegate(typeof(GetFieldInfo), mi); + } + + public static T GetCustomAttribute(this SerializedProperty prop) where T : Attribute + { + FieldInfo info = prop.GetFieldInfoAndStaticType(out _); + return info.GetCustomAttribute(); + } + + public static bool TryGetAttributeInHierarchy(this SerializedProperty prop, out T attribute, out SerializedProperty ancestorWithAttribute) where T : Attribute + { + attribute = null; + ancestorWithAttribute = null; + foreach (SerializedProperty ancestor in prop.WalkHierarchy()) + { + attribute = ancestor.GetCustomAttribute(); + if (attribute != null) + { + ancestorWithAttribute = ancestor; + return true; + } + } + return false; + } + + public static SerializedProperty GetParent(this SerializedProperty property) + { + int i = property.propertyPath.LastIndexOf('.'); + return i < 0 ? null + : property.serializedObject.FindProperty(property.propertyPath.Substring(0, i)); + } + + public static IEnumerable WalkHierarchy(this SerializedProperty prop) + { + for (SerializedProperty curr = prop; curr != null; curr = curr.GetParent()) + yield return curr; + } + + public static T GetSerializedValue(this SerializedProperty property) + { + // adapted from https://github.com/lordofduct/spacepuppy-unity-framework-4.0/blob/679088a9fca826764de39390b4e08c6feaa06b52/Framework/com.spacepuppy.core/Editor/src/EditorHelper.cs#L278 + string path = property.propertyPath.Replace(".Array.data[", "["); + object obj = property.serializedObject.targetObject; + + foreach (string elem in path.Split('.')) + { + if (elem[elem.Length - 1] == ']') + { + string memberName = elem.Substring(0, elem.LastIndexOf('[')); + string indexer = elem.Substring(memberName.Length, elem.Length - memberName.Length); + int index = int.Parse(indexer.Substring(1, indexer.Length - 2)); + IList valueList = ReflectionHelpers.GetMemberValue(obj, memberName); + obj = valueList[index]; + } + else + { + obj = ReflectionHelpers.GetMemberValue(obj, elem); + } + } + + return (T)obj; + } + } +} diff --git a/Unity/Assets/Editor/Scripts/Extensions/SerializedPropertyExtensions.cs.meta b/Unity/Assets/Editor/Scripts/Extensions/SerializedPropertyExtensions.cs.meta new file mode 100644 index 00000000..516bfbb8 --- /dev/null +++ b/Unity/Assets/Editor/Scripts/Extensions/SerializedPropertyExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 950b95980461b6947b1eba125ea9bf5b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Editor/Scripts/PropertyDrawers/Enums/GameSpecificEnumDrawer.cs b/Unity/Assets/Editor/Scripts/PropertyDrawers/Enums/GameSpecificEnumDrawer.cs index d9b5c143..d8a640a4 100644 --- a/Unity/Assets/Editor/Scripts/PropertyDrawers/Enums/GameSpecificEnumDrawer.cs +++ b/Unity/Assets/Editor/Scripts/PropertyDrawers/Enums/GameSpecificEnumDrawer.cs @@ -1,7 +1,8 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; +using Editor.Scripts.Extensions; using Editor.Scripts.PropertyDrawers.Utilities; using SCHIZO.Registering; using UnityEditor; @@ -12,16 +13,35 @@ namespace Editor.Scripts.PropertyDrawers.Enums public abstract class GameSpecificEnumDrawer : PropertyDrawer where T : Enum { protected static readonly List SubnauticaValues = typeof(T).GetEnumNames() - .Where(n => typeof(T).GetField(n).GetCustomAttribute().game.HasFlag(Game.Subnautica)).ToList(); + .Where(n => typeof(T).GetField(n).GetCustomAttribute().TryGetGame(out Game game) && game.HasFlag(Game.Subnautica)) + .ToList(); protected static readonly List BelowZeroValues = typeof(T).GetEnumNames() - .Where(n => typeof(T).GetField(n).GetCustomAttribute().game.HasFlag(Game.BelowZero)).ToList(); + .Where(n => typeof(T).GetField(n).GetCustomAttribute().TryGetGame(out Game game) && game.HasFlag(Game.BelowZero)).ToList(); - protected virtual bool IsValueAcceptable(string entry, string propertyPath) + protected bool? hasGameAttr; + protected GameAttribute gameAttribute; + protected SerializedProperty parentWithGameAttribute; + protected virtual bool IsValueAcceptable(SerializedProperty property, string entry) { - if (propertyPath.ToLower().Contains("sn")) return SubnauticaValues.Contains(entry); - if (propertyPath.ToLower().Contains("bz")) return BelowZeroValues.Contains(entry); - return SubnauticaValues.Contains(entry) || BelowZeroValues.Contains(entry); + Game game = default; + if (!hasGameAttr.HasValue) + { + hasGameAttr = property.TryGetAttributeInHierarchy(out gameAttribute, out parentWithGameAttribute); + } + + gameAttribute?.TryGetGame(parentWithGameAttribute, out game); + // todo replace with attributes to be explicit? + if (property.propertyPath.EndsWith("SN")) game = Game.Subnautica; + if (property.propertyPath.EndsWith("BZ")) game = Game.BelowZero; + + return IsValueAcceptable(entry, game); + } + + protected bool IsValueAcceptable(string value, Game game) + { + return (!game.HasFlag(Game.Subnautica) || SubnauticaValues.Contains(value)) + && (!game.HasFlag(Game.BelowZero) || BelowZeroValues.Contains(value)); } public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) @@ -45,11 +65,11 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten protected void DrawDropdownButton(SerializedProperty property, int controlid, Rect position) { Color oldColor = GUI.backgroundColor; - if (!IsValueAcceptable(property.enumNames[property.enumValueIndex], property.propertyPath)) GUI.backgroundColor = Color.red; + if (!IsValueAcceptable(property, property.enumNames[property.enumValueIndex])) GUI.backgroundColor = Color.red; if (DropdownButton(controlid, position, new GUIContent(property.enumDisplayNames[property.enumValueIndex]))) { - SearchablePopup.Show(position, property.enumDisplayNames, property.enumNames, property.enumValueIndex, property.propertyPath, IsValueAcceptable, i => + SearchablePopup.Show(position, property, IsValueAcceptable, i => { property.enumValueIndex = i; property.serializedObject.ApplyModifiedProperties(); diff --git a/Unity/Assets/Editor/Scripts/PropertyDrawers/Enums/TechType_AllDrawer.cs b/Unity/Assets/Editor/Scripts/PropertyDrawers/Enums/TechType_AllDrawer.cs index 744a5fb1..98966be0 100644 --- a/Unity/Assets/Editor/Scripts/PropertyDrawers/Enums/TechType_AllDrawer.cs +++ b/Unity/Assets/Editor/Scripts/PropertyDrawers/Enums/TechType_AllDrawer.cs @@ -1,4 +1,6 @@ -using SCHIZO.Interop.Subnautica.Enums; +using Editor.Scripts.Extensions; +using SCHIZO.Helpers; +using SCHIZO.Interop.Subnautica.Enums; using SCHIZO.Registering; using UnityEditor; using UnityEngine; @@ -8,32 +10,21 @@ namespace Editor.Scripts.PropertyDrawers.Enums [CustomPropertyDrawer(typeof(TechType_All))] public sealed class TechType_AllDrawer : GameSpecificEnumDrawer { - public static Game TargetGame = 0; + public static Game TargetGame; - protected override bool IsValueAcceptable(string entry, string propertyPath) + protected override bool IsValueAcceptable(SerializedProperty property, string entry) { - switch (TargetGame) - { - case 0: - return base.IsValueAcceptable(entry, propertyPath); - - case Game.Subnautica: - return SubnauticaValues.Contains(entry); - - case Game.BelowZero: - return BelowZeroValues.Contains(entry); - - case Game.Subnautica | Game.BelowZero: - return SubnauticaValues.Contains(entry) && BelowZeroValues.Contains(entry); - - default: - return false; - } + return TargetGame != default + ? IsValueAcceptable(entry, TargetGame) + : base.IsValueAcceptable(property, entry); } public static void DrawDropdownButtonStatic(SerializedProperty property, int controlid, Rect position) { - new TechType_AllDrawer().DrawDropdownButton(property, controlid, position); + TechType_AllDrawer drawer = new(); + ReflectionCache.GetField(typeof(PropertyDrawer), "m_FieldInfo") + .SetValue(drawer, property.GetFieldInfoAndStaticType(out _)); + drawer.DrawDropdownButton(property, controlid, position); } } } diff --git a/Unity/Assets/Editor/Scripts/PropertyDrawers/Objects/RecipeDrawer.cs b/Unity/Assets/Editor/Scripts/PropertyDrawers/Objects/RecipeDrawer.cs index 35ab09b9..5ff8e952 100644 --- a/Unity/Assets/Editor/Scripts/PropertyDrawers/Objects/RecipeDrawer.cs +++ b/Unity/Assets/Editor/Scripts/PropertyDrawers/Objects/RecipeDrawer.cs @@ -14,8 +14,8 @@ private static bool IsOk(SerializedProperty property) Recipe recipe = (Recipe) property.objectReferenceValue; - if (property.propertyPath.ToLower().Contains("sn") && !recipe.game.HasFlag(Game.Subnautica)) return false; - if (property.propertyPath.ToLower().Contains("bz") && !recipe.game.HasFlag(Game.BelowZero)) return false; + if (property.propertyPath.EndsWith("SN") && !recipe.game.HasFlag(Game.Subnautica)) return false; + if (property.propertyPath.EndsWith("BZ") && !recipe.game.HasFlag(Game.BelowZero)) return false; return true; } diff --git a/Unity/Assets/Editor/Scripts/PropertyDrawers/Utilities/SearchablePopup.cs b/Unity/Assets/Editor/Scripts/PropertyDrawers/Utilities/SearchablePopup.cs index fa2062c0..5998f17d 100644 --- a/Unity/Assets/Editor/Scripts/PropertyDrawers/Utilities/SearchablePopup.cs +++ b/Unity/Assets/Editor/Scripts/PropertyDrawers/Utilities/SearchablePopup.cs @@ -28,20 +28,14 @@ public class SearchablePopup : PopupWindowContent /// /// Rectangle of the button that triggered the popup. /// - /// List of strings to choose from. - /// - /// Index of the currently selected string. - /// - /// - /// + /// /// /// /// Callback to trigger when a choice is made. /// - public static void Show(Rect activatorRect, string[] options, string[] enumNames, int current, string propertyPath, Func isAcceptableFunc, Action onSelectionMade) + public static void Show(Rect activatorRect, SerializedProperty property, Func isAcceptableFunc, Action onSelectionMade) { - SearchablePopup win = - new SearchablePopup(options, enumNames, current, propertyPath, isAcceptableFunc, onSelectionMade); + SearchablePopup win = new(property, isAcceptableFunc, onSelectionMade); PopupWindow.Show(activatorRect, win); } @@ -130,7 +124,7 @@ public bool UpdateFilter(string filter) for (int i = 0; i < allItems.Length; i++) { - if (string.IsNullOrEmpty(Filter) || allItems[i].ToLower().Contains(Filter.ToLower())) + if (string.IsNullOrEmpty(Filter) || allItems[i].IndexOf(Filter, StringComparison.OrdinalIgnoreCase) >= 0) { Entry entry = new Entry { @@ -161,7 +155,7 @@ public bool UpdateFilter(string filter) /// private readonly int currentIndex; - private string propertyPath; + private readonly SerializedProperty property; /// /// Container for all available options that does the actual string @@ -206,13 +200,13 @@ public bool UpdateFilter(string filter) #region -- Initialization --------------------------------------------- - private SearchablePopup(string[] names, string[] itemNames, int currentIndex, string propertyPath, Func isAcceptableFunc, Action onSelectionMade) + private SearchablePopup(SerializedProperty property, Func isAcceptableFunc, Action onSelectionMade) { - list = new FilteredList(names, itemNames); - this.currentIndex = currentIndex; - this.propertyPath = propertyPath; + list = new FilteredList(property.enumDisplayNames, property.enumNames); + currentIndex = property.enumValueIndex; + this.property = property; + _isValueAcceptableFunction = isAcceptableFunc; this.onSelectionMade = onSelectionMade; - this._isValueAcceptableFunction = isAcceptableFunc; hoverIndex = currentIndex; scrollToIndex = currentIndex; @@ -291,13 +285,13 @@ private void DrawSearch(Rect rect) } } - private readonly Dictionary<(string entry, string propertyPath), bool> _isValueAcceptableCache = new Dictionary<(string entry, string propertyPath), bool>(); - private readonly Func _isValueAcceptableFunction; - private bool IsValueAcceptableCached(string entry, string propPath) + private readonly Dictionary<(SerializedProperty property, string entry), bool> _isValueAcceptableCache = new(); + private readonly Func _isValueAcceptableFunction; + private bool IsValueAcceptableCached(SerializedProperty targetProp, string entry) { - if (_isValueAcceptableCache.TryGetValue((entry, propPath), out bool result)) return result; - result = _isValueAcceptableFunction(entry, propPath); - _isValueAcceptableCache.Add((entry, propPath), result); + if (_isValueAcceptableCache.TryGetValue((targetProp, entry), out bool result)) return result; + result = _isValueAcceptableFunction(targetProp, entry); + _isValueAcceptableCache.Add((targetProp, entry), result); return result; } @@ -324,7 +318,7 @@ private void DrawSelectionArea(Rect scrollRect) scroll.x = 0; } - if (rowRect.Contains(Event.current.mousePosition) && (IsValueAcceptableCached(list.Entries[i].ItemName, propertyPath) || + if (rowRect.Contains(Event.current.mousePosition) && (IsValueAcceptableCached(property, list.Entries[i].ItemName) || Event.current.shift)) { if (Event.current.type == EventType.MouseMove || @@ -356,7 +350,7 @@ private void DrawRow(Rect rowRect, int i) labelRect.xMin += ROW_INDENT; Color oldColor = GUI.contentColor; - if (!IsValueAcceptableCached(list.Entries[i].ItemName, propertyPath)) GUI.contentColor = Color.gray; + if (!IsValueAcceptableCached(property, list.Entries[i].ItemName)) GUI.contentColor = Color.gray; GUI.Label(labelRect, list.Entries[i].Text); @@ -376,7 +370,7 @@ private void HandleKeyboard() while (tempHoverIndex < list.Entries.Count - 1) { tempHoverIndex++; - if (IsValueAcceptableCached(list.Entries[tempHoverIndex].ItemName, propertyPath) || Event.current.shift) + if (IsValueAcceptableCached(property, list.Entries[tempHoverIndex].ItemName) || Event.current.shift) { hoverIndex = tempHoverIndex; break; @@ -394,7 +388,7 @@ private void HandleKeyboard() while (tempHoverIndex > 0) { tempHoverIndex--; - if (IsValueAcceptableCached(list.Entries[tempHoverIndex].ItemName, propertyPath) || + if (IsValueAcceptableCached(property, list.Entries[tempHoverIndex].ItemName) || Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { hoverIndex = tempHoverIndex; diff --git a/Unity/Assets/Mod/Coordinated Spawns.asset b/Unity/Assets/Mod/Coordinated Spawns.asset new file mode 100644 index 00000000..f5e160dc --- /dev/null +++ b/Unity/Assets/Mod/Coordinated Spawns.asset @@ -0,0 +1,31 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a6ccb8c039e34e44ebdee40c7d89e4a4, type: 3} + m_Name: Coordinated Spawns + m_EditorClassIdentifier: + spawns: + - game: 2 + item: + isCustom: 0 + techType: 2007 + itemData: {fileID: 0} + locations: + - position: {x: -327, y: 15, z: 265} + rotation: {x: 0, y: 0, z: 0} + - game: 1 + item: + isCustom: 0 + techType: 2000 + itemData: {fileID: 0} + locations: + - position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0} diff --git a/Unity/Assets/Mod/Ermshark/Databank/Databank BZ.asset.meta b/Unity/Assets/Mod/Coordinated Spawns.asset.meta similarity index 79% rename from Unity/Assets/Mod/Ermshark/Databank/Databank BZ.asset.meta rename to Unity/Assets/Mod/Coordinated Spawns.asset.meta index 489e6b71..49811225 100644 --- a/Unity/Assets/Mod/Ermshark/Databank/Databank BZ.asset.meta +++ b/Unity/Assets/Mod/Coordinated Spawns.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c07efc17b4a326141b084b80f348be78 +guid: e84785f0b1b5820488bdff72c72ebe81 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Unity/Assets/Mod/Ermfish/Databank/Databank.asset b/Unity/Assets/Mod/Ermfish/Databank/Databank.asset index f38c7eeb..a5b37ef0 100644 --- a/Unity/Assets/Mod/Ermfish/Databank/Databank.asset +++ b/Unity/Assets/Mod/Ermfish/Databank/Databank.asset @@ -17,7 +17,8 @@ MonoBehaviour: isImportantUnlock: 0 scanSounds: {fileID: 8990697991671373227, guid: 1138c2d796e81ac43a4f257daf9651b7, type: 2} - encyPath: Lifeforms/Fauna/SmallHerbivores + encyPathSN: Lifeforms/Fauna/SmallHerbivores + encyPathBZ: Research/Lifeforms/Fauna/SmallHerbivores title: Ermfish texture: {fileID: 2800000, guid: d49d9f150a353394d84717884b9d8c8f, type: 3} description: {fileID: 4900000, guid: a784ad2033ad64a409b8d4ad1cda86a4, type: 3} diff --git a/Unity/Assets/Mod/Ermfish/Ermfish regular.asset b/Unity/Assets/Mod/Ermfish/Ermfish regular.asset index 5f85b706..85eff59a 100644 --- a/Unity/Assets/Mod/Ermfish/Ermfish regular.asset +++ b/Unity/Assets/Mod/Ermfish/Ermfish regular.asset @@ -46,14 +46,13 @@ MonoBehaviour: isBuildable: 0 craftingTime: 2.5 itemSounds: {fileID: 11400000, guid: bfb77f100ed7e6e4fb42c9b05bcb00af, type: 2} + pdaEncyInfo: {fileID: 11400000, guid: 8b76d116f9af8fc499d4c055bf652966, type: 2} registerInSN: 1 recipeSN: {fileID: 0} craftTreeTypeSN: 0 craftTreePathSN: techGroupSN: 14 techCategorySN: 0 - pdaEncyclopediaInfoSN: {fileID: 11400000, guid: 8b76d116f9af8fc499d4c055bf652966, - type: 2} knownTechInfoSN: {fileID: 11400000, guid: 89b8b3505e3ad2e48b2f9b7c378e4bbe, type: 2} unlockAtStartSN: 1 requiredForUnlockSN: @@ -67,8 +66,6 @@ MonoBehaviour: craftTreePathBZ: techGroupBZ: 13 techCategoryBZ: 0 - pdaEncyclopediaInfoBZ: {fileID: 11400000, guid: 8b76d116f9af8fc499d4c055bf652966, - type: 2} knownTechInfoBZ: {fileID: 11400000, guid: 89b8b3505e3ad2e48b2f9b7c378e4bbe, type: 2} soundTypeBZ: 31 unlockAtStartBZ: 1 diff --git a/Unity/Assets/Mod/Ermshark/Databank/Databank SN.asset b/Unity/Assets/Mod/Ermshark/Databank/Databank SN.asset deleted file mode 100644 index 635f5d65..00000000 --- a/Unity/Assets/Mod/Ermshark/Databank/Databank SN.asset +++ /dev/null @@ -1,23 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1160e7f4151348eb97332e6bb0a2a034, type: 3} - m_Name: Databank SN - m_EditorClassIdentifier: - scanTime: 5 - unlockSprite: {fileID: 21300000, guid: 85c36857a3ce21c49b2b3d2d1c09ecb6, type: 3} - isImportantUnlock: 0 - scanSounds: {fileID: -2996190608115189883, guid: 935233e4761193a489883563680a8478, - type: 2} - encyPath: Lifeforms/Fauna/Sharks - title: Ermshark - texture: {fileID: 2800000, guid: cee0542806d2bae418d81f925da9a9fa, type: 3} - description: {fileID: 4900000, guid: fa554e7d1e7ed174981f0e8702f16f2d, type: 3} diff --git a/Unity/Assets/Mod/Ermshark/Databank/Databank BZ.asset b/Unity/Assets/Mod/Ermshark/Databank/Databank.asset similarity index 87% rename from Unity/Assets/Mod/Ermshark/Databank/Databank BZ.asset rename to Unity/Assets/Mod/Ermshark/Databank/Databank.asset index ee200408..538f2767 100644 --- a/Unity/Assets/Mod/Ermshark/Databank/Databank BZ.asset +++ b/Unity/Assets/Mod/Ermshark/Databank/Databank.asset @@ -10,14 +10,15 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 1160e7f4151348eb97332e6bb0a2a034, type: 3} - m_Name: Databank BZ + m_Name: Databank m_EditorClassIdentifier: scanTime: 5 unlockSprite: {fileID: 21300000, guid: 85c36857a3ce21c49b2b3d2d1c09ecb6, type: 3} isImportantUnlock: 0 scanSounds: {fileID: -2996190608115189883, guid: 935233e4761193a489883563680a8478, type: 2} - encyPath: Lifeforms/Fauna/Carnivores + encyPathSN: Lifeforms/Fauna/Carnivores + encyPathBZ: Research/Lifeforms/Fauna/Carnivores title: Ermshark texture: {fileID: 2800000, guid: cee0542806d2bae418d81f925da9a9fa, type: 3} description: {fileID: 4900000, guid: fa554e7d1e7ed174981f0e8702f16f2d, type: 3} diff --git a/Unity/Assets/Mod/Ermshark/Databank/Databank SN.asset.meta b/Unity/Assets/Mod/Ermshark/Databank/Databank.asset.meta similarity index 100% rename from Unity/Assets/Mod/Ermshark/Databank/Databank SN.asset.meta rename to Unity/Assets/Mod/Ermshark/Databank/Databank.asset.meta diff --git a/Unity/Assets/Mod/Ermshark/Ermshark.asset b/Unity/Assets/Mod/Ermshark/Ermshark.asset index 8bd2dfd0..b7d47588 100644 --- a/Unity/Assets/Mod/Ermshark/Ermshark.asset +++ b/Unity/Assets/Mod/Ermshark/Ermshark.asset @@ -21,14 +21,14 @@ MonoBehaviour: isCraftable: 0 isBuildable: 0 craftingTime: 2.5 + itemSounds: {fileID: 0} + pdaEncyInfo: {fileID: 11400000, guid: dbc6837d8eb5b9f42a96dcb82632b52e, type: 2} registerInSN: 1 recipeSN: {fileID: 0} craftTreeTypeSN: 0 craftTreePathSN: techGroupSN: 14 techCategorySN: 0 - pdaEncyclopediaInfoSN: {fileID: 11400000, guid: dbc6837d8eb5b9f42a96dcb82632b52e, - type: 2} knownTechInfoSN: {fileID: 0} unlockAtStartSN: 0 requiredForUnlockSN: @@ -37,13 +37,13 @@ MonoBehaviour: itemData: {fileID: 0} registerInBZ: 1 recipeBZ: {fileID: 0} + canBeRecycledBZ: 1 craftTreeTypeBZ: 0 craftTreePathBZ: techGroupBZ: 13 techCategoryBZ: 0 - pdaEncyclopediaInfoBZ: {fileID: 11400000, guid: c07efc17b4a326141b084b80f348be78, - type: 2} knownTechInfoBZ: {fileID: 0} + soundTypeBZ: 0 unlockAtStartBZ: 0 requiredForUnlockBZ: isCustom: 0 diff --git a/Unity/Assets/Mod/Registry.asset b/Unity/Assets/Mod/Registry.asset index 7aa03eda..0b9a8afd 100644 --- a/Unity/Assets/Mod/Registry.asset +++ b/Unity/Assets/Mod/Registry.asset @@ -27,6 +27,7 @@ MonoBehaviour: - {fileID: 11400000, guid: d650fbe7797f4e44180438b95b09620f, type: 2} - {fileID: 11400000, guid: b81a466a47b11be4e870eaaa30acf5aa, type: 2} - {fileID: 11400000, guid: f240113ab1d4a1d42bcd6fc85fda4541, type: 2} + - {fileID: 11400000, guid: e84785f0b1b5820488bdff72c72ebe81, type: 2} - {fileID: 11400000, guid: 007ce99e929c7f7468c68ebf8977f560, type: 2} - {fileID: 11400000, guid: 24b80f032226d244e8d8bdd0ceb1cc0f, type: 2} - {fileID: 11400000, guid: 701583dc8b02d354ea6c2d189ce33872, type: 2} diff --git a/Unity/Assets/Mod/Tutel/Databank/PDA Encyclopedia Info.asset b/Unity/Assets/Mod/Tutel/Databank/Tutel Ency.asset similarity index 86% rename from Unity/Assets/Mod/Tutel/Databank/PDA Encyclopedia Info.asset rename to Unity/Assets/Mod/Tutel/Databank/Tutel Ency.asset index 82adf8ac..9b38514f 100644 --- a/Unity/Assets/Mod/Tutel/Databank/PDA Encyclopedia Info.asset +++ b/Unity/Assets/Mod/Tutel/Databank/Tutel Ency.asset @@ -10,14 +10,15 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 1160e7f4151348eb97332e6bb0a2a034, type: 3} - m_Name: PDA Encyclopedia Info + m_Name: Tutel Ency m_EditorClassIdentifier: scanTime: 5 unlockSprite: {fileID: 21300000, guid: 3b57e6f5b26fa7645b62b4b09d12d18e, type: 3} isImportantUnlock: 0 scanSounds: {fileID: 5553836039373703376, guid: ef492aad68c54354fbddb8f880c89f34, type: 2} - encyPath: Lifeforms/Fauna/SmallHerbivores + encyPathSN: Lifeforms/Fauna/SmallHerbivores + encyPathBZ: Research/Lifeforms/Fauna/SmallHerbivores title: Tutel texture: {fileID: 2800000, guid: 7b273e37743f05b4d9823beffcd9c2a6, type: 3} description: {fileID: 4900000, guid: 40be8119d6a5f7840bf2056fa5123359, type: 3} diff --git a/Unity/Assets/Mod/Tutel/Databank/PDA Encyclopedia Info.asset.meta b/Unity/Assets/Mod/Tutel/Databank/Tutel Ency.asset.meta similarity index 100% rename from Unity/Assets/Mod/Tutel/Databank/PDA Encyclopedia Info.asset.meta rename to Unity/Assets/Mod/Tutel/Databank/Tutel Ency.asset.meta diff --git a/Unity/Assets/Mod/Tutel/Tutel fish.asset b/Unity/Assets/Mod/Tutel/Tutel fish.asset index f61251e3..24d1d474 100644 --- a/Unity/Assets/Mod/Tutel/Tutel fish.asset +++ b/Unity/Assets/Mod/Tutel/Tutel fish.asset @@ -49,14 +49,13 @@ MonoBehaviour: isBuildable: 0 craftingTime: 2.5 itemSounds: {fileID: 11400000, guid: 848cf4fb2ef44a84987c76d50f291e0d, type: 2} + pdaEncyInfo: {fileID: 11400000, guid: aa86b808e104bfa49905cfd6c27e78fd, type: 2} registerInSN: 1 recipeSN: {fileID: 0} craftTreeTypeSN: 0 craftTreePathSN: techGroupSN: 14 techCategorySN: 0 - pdaEncyclopediaInfoSN: {fileID: 11400000, guid: aa86b808e104bfa49905cfd6c27e78fd, - type: 2} knownTechInfoSN: {fileID: 11400000, guid: ba024ae7fd4b2f649bbb22d395a493fe, type: 2} unlockAtStartSN: 1 requiredForUnlockSN: @@ -70,8 +69,6 @@ MonoBehaviour: craftTreePathBZ: techGroupBZ: 13 techCategoryBZ: 0 - pdaEncyclopediaInfoBZ: {fileID: 11400000, guid: aa86b808e104bfa49905cfd6c27e78fd, - type: 2} knownTechInfoBZ: {fileID: 11400000, guid: ba024ae7fd4b2f649bbb22d395a493fe, type: 2} soundTypeBZ: 31 unlockAtStartBZ: 1 diff --git a/Unity/Assets/Scripts/ECCLibrary/ECCLibrary.asmdef b/Unity/Assets/Scripts/ECCLibrary/ECCLibrary.asmdef index 6c83d0e1..d829c1d6 100644 --- a/Unity/Assets/Scripts/ECCLibrary/ECCLibrary.asmdef +++ b/Unity/Assets/Scripts/ECCLibrary/ECCLibrary.asmdef @@ -13,4 +13,4 @@ "defineConstraints": [], "versionDefines": [], "noEngineReferences": false -} \ No newline at end of file +} diff --git a/Unity/Assets/Scripts/SCHIZO/Creatures/CreatureData.cs b/Unity/Assets/Scripts/SCHIZO/Creatures/CreatureData.cs index 6f6c6563..2ac330ed 100644 --- a/Unity/Assets/Scripts/SCHIZO/Creatures/CreatureData.cs +++ b/Unity/Assets/Scripts/SCHIZO/Creatures/CreatureData.cs @@ -1,4 +1,5 @@ -using SCHIZO.Interop.Subnautica.Enums.Subnautica; +using SCHIZO.Attributes; +using SCHIZO.Interop.Subnautica.Enums.Subnautica; using SCHIZO.Items.Data; using TriInspector; using UnityEngine; @@ -9,7 +10,7 @@ namespace SCHIZO.Creatures [DeclareBoxGroup("creaturedata", Title = "Creature Data")] public partial class CreatureData : ItemData { - [PropertyOrder(1)] public bool isPickupable; + [PropertyOrder(1), Careful] public bool isPickupable; [Group("creaturedata"), ValidateInput(nameof(Validate_behaviourType)), SerializeField] private BehaviourType_SN behaviourType; diff --git a/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/Enums/EcoTargetType_All.cs b/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/Enums/EcoTargetType_All.cs index f97297b4..8d023924 100644 --- a/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/Enums/EcoTargetType_All.cs +++ b/Unity/Assets/Scripts/SCHIZO/Interop/Subnautica/Enums/EcoTargetType_All.cs @@ -4,33 +4,33 @@ namespace SCHIZO.Interop.Subnautica.Enums { public enum EcoTargetType_All { - [Game(GameX.Both)] None = 0, - [Game(GameX.Both)] Shiny = 1, - [Game(GameX.Both)] DeadMeat = 2, - [Game(GameX.Both)] Coral = 3, - [Game(GameX.Both)] HeatArea = 4, - [Game(GameX.Both)] Tech = 100, // 0x00000064 - [Game(GameX.Both)] Fragment = 150, // 0x00000096 - [Game(GameX.Both)] HoleFish = 1000, // 0x000003E8 - [Game(GameX.Both)] HoopFish = 1010, // 0x000003F2 - [Game(GameX.Both)] Peeper = 1020, // 0x000003FC - [Game(GameX.Both)] Oculus = 1030, // 0x00000406 - [Game(GameX.Both)] SpadeFish = 1040, // 0x00000410 - [Game(GameX.Both)] CuteFish = 1050, // 0x0000041A - [Game(GameX.Both)] LavaLarva = 1060, // 0x00000424 - [Game(GameX.Both)] Biter = 1070, // 0x0000042E - [Game(GameX.Both)] Mushroom = 2000, // 0x000007D0 - [Game(GameX.Both)] HeatSource = 2005, // 0x000007D5 - [Game(GameX.Both)] SmallFish = 2010, // 0x000007DA - [Game(GameX.Both)] MediumFish = 2020, // 0x000007E4 + [Game(Game.Subnautica | Game.BelowZero)] None = 0, + [Game(Game.Subnautica | Game.BelowZero)] Shiny = 1, + [Game(Game.Subnautica | Game.BelowZero)] DeadMeat = 2, + [Game(Game.Subnautica | Game.BelowZero)] Coral = 3, + [Game(Game.Subnautica | Game.BelowZero)] HeatArea = 4, + [Game(Game.Subnautica | Game.BelowZero)] Tech = 100, // 0x00000064 + [Game(Game.Subnautica | Game.BelowZero)] Fragment = 150, // 0x00000096 + [Game(Game.Subnautica | Game.BelowZero)] HoleFish = 1000, // 0x000003E8 + [Game(Game.Subnautica | Game.BelowZero)] HoopFish = 1010, // 0x000003F2 + [Game(Game.Subnautica | Game.BelowZero)] Peeper = 1020, // 0x000003FC + [Game(Game.Subnautica | Game.BelowZero)] Oculus = 1030, // 0x00000406 + [Game(Game.Subnautica | Game.BelowZero)] SpadeFish = 1040, // 0x00000410 + [Game(Game.Subnautica | Game.BelowZero)] CuteFish = 1050, // 0x0000041A + [Game(Game.Subnautica | Game.BelowZero)] LavaLarva = 1060, // 0x00000424 + [Game(Game.Subnautica | Game.BelowZero)] Biter = 1070, // 0x0000042E + [Game(Game.Subnautica | Game.BelowZero)] Mushroom = 2000, // 0x000007D0 + [Game(Game.Subnautica | Game.BelowZero)] HeatSource = 2005, // 0x000007D5 + [Game(Game.Subnautica | Game.BelowZero)] SmallFish = 2010, // 0x000007DA + [Game(Game.Subnautica | Game.BelowZero)] MediumFish = 2020, // 0x000007E4 [Game(Game.BelowZero)] FishSchool = 2025, // 0x000007E9 - [Game(GameX.Both)] Shark = 2030, // 0x000007EE - [Game(GameX.Both)] Whale = 2040, // 0x000007F8 - [Game(GameX.Both)] Leviathan = 2045, // 0x000007FD - [Game(GameX.Both)] Poison = 2050, // 0x00000802 - [Game(GameX.Both)] Trap = 2060, // 0x0000080C - [Game(GameX.Both)] Cure = 2070, // 0x00000816 - [Game(GameX.Both)] CuredWarp = 2080, // 0x00000820 - [Game(GameX.Both)] SubDecoy = 2090, // 0x0000082A + [Game(Game.Subnautica | Game.BelowZero)] Shark = 2030, // 0x000007EE + [Game(Game.Subnautica | Game.BelowZero)] Whale = 2040, // 0x000007F8 + [Game(Game.Subnautica | Game.BelowZero)] Leviathan = 2045, // 0x000007FD + [Game(Game.Subnautica | Game.BelowZero)] Poison = 2050, // 0x00000802 + [Game(Game.Subnautica | Game.BelowZero)] Trap = 2060, // 0x0000080C + [Game(Game.Subnautica | Game.BelowZero)] Cure = 2070, // 0x00000816 + [Game(Game.Subnautica | Game.BelowZero)] CuredWarp = 2080, // 0x00000820 + [Game(Game.Subnautica | Game.BelowZero)] SubDecoy = 2090, // 0x0000082A } } diff --git a/Unity/Assets/Scripts/SCHIZO/Items/Data/ItemData.cs b/Unity/Assets/Scripts/SCHIZO/Items/Data/ItemData.cs index bb2a6599..749b9f4b 100644 --- a/Unity/Assets/Scripts/SCHIZO/Items/Data/ItemData.cs +++ b/Unity/Assets/Scripts/SCHIZO/Items/Data/ItemData.cs @@ -9,7 +9,6 @@ using SCHIZO.Sounds; using TriInspector; using UnityEngine; -using UnityEngine.Serialization; namespace SCHIZO.Items.Data { @@ -45,7 +44,7 @@ public partial class ItemData : ModRegistryItem [CommonData, ShowIf(nameof(IsActuallyCraftable))] public float craftingTime = 2.5f; - + [CommonData, ReadOnly] public ItemLoader loader; @@ -53,9 +52,12 @@ public partial class ItemData : ModRegistryItem [CommonData, ShowIf(nameof(Sounds_ShowIf))] public ItemSounds itemSounds; + [CommonData, LabelText("PDA Ency Info")] + public PDAEncyclopediaInfo pdaEncyInfo; + #region Subnautica Data - [SNData, LabelText("Register"), SerializeField, Careful] + [SNData, LabelText("Register"), Careful] public bool registerInSN = true; [SNData, LabelText("Recipe"), SerializeField, ShowIf(nameof(registerInSN)), ShowIf(nameof(IsBuildableOrCraftable)), Careful] @@ -73,9 +75,6 @@ public partial class ItemData : ModRegistryItem [SNData, LabelText("Tech Category"), SerializeField, ShowIf(nameof(registerInSN)), ShowIf(nameof(techCategorySN_ShowIf)), UsedImplicitly] private TechCategory_SN techCategorySN; - [SNData, LabelText("PDA Ency Info"), SerializeField, UsedImplicitly, ShowIf(nameof(registerInSN)), FormerlySerializedAs("databankInfoSN")] - private PDAEncyclopediaInfo pdaEncyclopediaInfoSN; - [SNData, LabelText("Known Tech Info"), SerializeField, UsedImplicitly, ShowIf(nameof(registerInSN)), ShowIf(nameof(ShowPickupableProps))] private KnownTechInfo knownTechInfoSN; @@ -89,7 +88,7 @@ public partial class ItemData : ModRegistryItem #region Below Zero Data - [BZData, LabelText("Register"), SerializeField, Careful] + [BZData, LabelText("Register"), Careful] public bool registerInBZ = true; [BZData, LabelText("Recipe"), SerializeField, ShowIf(nameof(registerInBZ)), ShowIf(nameof(IsBuildableOrCraftable)), Careful] @@ -110,9 +109,6 @@ public partial class ItemData : ModRegistryItem [BZData, LabelText("Tech Category"), SerializeField, ShowIf(nameof(registerInBZ)), ShowIf(nameof(techCategoryBZ_ShowIf)), UsedImplicitly] private TechCategory_BZ techCategoryBZ; - [BZData, LabelText("PDA Ency Info"), SerializeField, UsedImplicitly, ShowIf(nameof(registerInBZ)), FormerlySerializedAs("databankInfoBZ")] - private PDAEncyclopediaInfo pdaEncyclopediaInfoBZ; - [BZData, LabelText("Known Tech Info"), SerializeField, UsedImplicitly, ShowIf(nameof(registerInBZ)), ShowIf(nameof(ShowPickupableProps))] private KnownTechInfo knownTechInfoBZ; @@ -154,7 +150,7 @@ private TriDropdownList SNCraftTreePath() case CraftTree_Type_All.Constructor: return new TriDropdownList() { - {"(root)", ""}, + {"", ""}, {"Vehicles", "Vehicles"}, {"Rocket", "Rocket"}, }; @@ -162,7 +158,7 @@ private TriDropdownList SNCraftTreePath() case CraftTree_Type_All.SeamothUpgrades: return new TriDropdownList() { - {"(root)", ""}, + {"", ""}, {"Common Modules", "CommonModules"}, {"Seamoth Modules", "SeamothModules"}, {"Prawn Suit Modules", "ExosuitModules"}, @@ -172,7 +168,7 @@ private TriDropdownList SNCraftTreePath() default: return new TriDropdownList() { - {"(root)", ""}, + {"", ""}, }; } } @@ -206,7 +202,7 @@ private TriDropdownList BZCraftTreePath() case CraftTree_Type_All.Constructor: return new TriDropdownList() { - {"(root)", ""}, + {"", ""}, {"Vehicles", "Vehicles"}, {"Modules", "Modules"}, }; @@ -214,7 +210,7 @@ private TriDropdownList BZCraftTreePath() case CraftTree_Type_All.SeamothUpgrades: return new TriDropdownList() { - {"(root)", ""}, + {"", ""}, {"Prawn Suit Upgrades", "ExosuitModules"}, {"Seatruck Upgrades", "SeaTruckUpgrade"}, }; @@ -222,7 +218,7 @@ private TriDropdownList BZCraftTreePath() default: return new TriDropdownList() { - {"(root)", ""}, + {"", ""}, }; } } diff --git a/Unity/Assets/Scripts/SCHIZO/Items/Data/PDAEncyclopediaInfo.cs b/Unity/Assets/Scripts/SCHIZO/Items/Data/PDAEncyclopediaInfo.cs index bcaf07d6..481f3e5a 100644 --- a/Unity/Assets/Scripts/SCHIZO/Items/Data/PDAEncyclopediaInfo.cs +++ b/Unity/Assets/Scripts/SCHIZO/Items/Data/PDAEncyclopediaInfo.cs @@ -1,4 +1,4 @@ -using SCHIZO.Sounds.Collections; +using SCHIZO.Sounds.Collections; using TriInspector; using UnityEngine; @@ -9,14 +9,107 @@ namespace SCHIZO.Items.Data [DeclareBoxGroup("Databank")] public sealed class PDAEncyclopediaInfo : ScriptableObject { - [Group("Scanning")] public float scanTime = 3; - [Group("Scanning")] public Sprite unlockSprite; - [Group("Scanning")] public bool isImportantUnlock; - [Group("Scanning")] public SoundCollectionInstance scanSounds; - - [Group("Databank")] public string encyPath; - [Group("Databank")] public string title; - [Group("Databank")] public Texture2D texture; - [Group("Databank")] public TextAsset description; + [GroupNext("Scanning")] + public float scanTime = 3; + public Sprite unlockSprite; + public bool isImportantUnlock; + public SoundCollectionInstance scanSounds; + + [GroupNext("Databank")] + [Dropdown(nameof(SNEncyPaths))] public string encyPathSN; + [Dropdown(nameof(BZEncyPaths))] public string encyPathBZ; + public string title; + public Texture2D texture; + public TextAsset description; + + private TriDropdownList SNEncyPaths() => new() + { + {"", ""}, + + {"Advanced Theories", "Advanced"}, + + {"Blueprints/", "Tech"}, + {"Blueprints/Equipment", "Tech/Equipment"}, + {"Blueprints/Habitat Installations", "Tech/Habitats"}, + {"Blueprints/Vehicles", "Tech/Vehicles"}, + {"Blueprints/Power", "Tech/Power"}, + + {"Data Downloads/", "DownloadedData"}, + {"Data Downloads/Alien Data/", "DownloadedData/Precursor"}, + {"Data Downloads/Alien Data/Artifacts", "DownloadedData/Precursor/Artifacts"}, + {"Data Downloads/Alien Data/Scan Data", "DownloadedData/Precursor/Scan"}, + {"Data Downloads/Alien Data/Terminal Data", "DownloadedData/Precursor/Terminal"}, + {"Data Downloads/Aurora Survivors", "DownloadedData/AuroraSurvivors"}, + {"Data Downloads/Codes && Clues", "DownloadedData/Codes"}, + {"Data Downloads/Degasi Survivors/", "DownloadedData/Degasi"}, + {"Data Downloads/Degasi Survivors/Alterra Search && Rescue Mission", "DownloadedData/Degasi/Orders"}, + {"Data Downloads/Operations Logs", "DownloadedData/BeforeCrash"}, + {"Data Downloads/Public Documents", "DownloadedData/PublicDocs"}, + + {"Indigenous Lifeforms/", "Lifeforms"}, + {"Indigenous Lifeforms/Coral", "Lifeforms/Coral"}, + {"Indigenous Lifeforms/Fauna/", "Lifeforms/Fauna"}, + {"Indigenous Lifeforms/Fauna/Carnivores", "Lifeforms/Fauna/Carnivores"}, + {"Indigenous Lifeforms/Fauna/Deceased", "Lifeforms/Fauna/Deceased"}, + {"Indigenous Lifeforms/Fauna/Herbivores - Large", "Lifeforms/Fauna/LargeHerbivores"}, + {"Indigenous Lifeforms/Fauna/Herbivores - Small", "Lifeforms/Fauna/SmallHerbivores"}, + {"Indigenous Lifeforms/Fauna/Leviathans", "Lifeforms/Fauna/Leviathans"}, + {"Indigenous Lifeforms/Fauna/Scavengers && Parasites", "Lifeforms/Fauna/Scavengers"}, + + {"Indigenous Lifeforms/Flora/", "Lifeforms/Flora"}, + {"Indigenous Lifeforms/Flora/Exploitable", "Lifeforms/Flora/Exploitable"}, + {"Indigenous Lifeforms/Flora/Land", "Lifeforms/Flora/Land"}, + {"Indigenous Lifeforms/Flora/Sea", "Lifeforms/Flora/Sea"}, + + {"Geological Data", "PlanetaryGeology"}, + + {"Survival Package/", "Welcome"}, + {"Survival Package/Additional Technical", "Welcome/StartGear"}, + + {"Time Capsules", "TimeCapsules"}, + }; + + private TriDropdownList BZEncyPaths() => new() + { + {"", ""}, + + {"Logs && Communications/", "DownloadedData"}, + {"Logs && Communications/Alterra", "DownloadedData/Alterra"}, + {"Logs && Communications/Alterra Personnel", "DownloadedData/AlterraPersonnel"}, + {"Logs && Communications/Maps", "DownloadedData/Maps"}, + {"Logs && Communications/Marguerit", "DownloadedData/Marguerit"}, + {"Logs && Communications/Memos && Miscellany", "DownloadedData/Memos"}, + {"Logs && Communications/Mercury II Logs", "DownloadedData/ShipWreck"}, + {"Logs && Communications/News", "DownloadedData/News"}, + {"Logs && Communications/Sam", "DownloadedData/Sam"}, + + {"Personal Log", "PersonalLog"}, + + {"Research/", "Research"}, + {"Research/Alien Data", "Research/Precursor"}, + {"Research/Geological Data", "Research/PlanetaryGeology"}, + {"Research/Indigenous Lifeforms/", "Research"}, + {"Research/Indigenous Lifeforms/Coral", "Research/Lifeforms/Coral"}, + {"Research/Indigenous Lifeforms/Fauna/", "Research/Lifeforms/Fauna"}, + {"Research/Indigenous Lifeforms/Fauna/Carnivores", "Research/Lifeforms/Fauna/Carnivores"}, + {"Research/Indigenous Lifeforms/Fauna/Herbivores - Large", "Research/Lifeforms/Fauna/LargeHerbivores"}, + {"Research/Indigenous Lifeforms/Fauna/Herbivores - Small", "Research/Lifeforms/Fauna/SmallHerbivores"}, + {"Research/Indigenous Lifeforms/Fauna/Leviathans/", "Research/Lifeforms/Fauna/Leviathans"}, + {"Research/Indigenous Lifeforms/Fauna/Leviathans/Frozen Creature", "Research/Lifeforms/Fauna/Leviathans/FrozenCreature"}, + {"Research/Indigenous Lifeforms/Fauna/Other", "Research/Lifeforms/Fauna/Other"}, + {"Research/Indigenous Lifeforms/Fauna/Scavengers && Parasites", "Research/Lifeforms/Fauna/Scavengers"}, + {"Research/Indigenous Lifeforms/Flora/", "Lifeforms/Flora"}, + {"Research/Indigenous Lifeforms/Flora/Exploitable", "Lifeforms/Flora/Exploitable"}, + {"Research/Indigenous Lifeforms/Flora/Land", "Lifeforms/Flora/Land"}, + {"Research/Indigenous Lifeforms/Flora/Sea", "Lifeforms/Flora/Sea"}, + + {"Survival", "Survival"}, + + {"Tech/", "Tech"}, + {"Tech/Equipment", "Tech/Equipment"}, + {"Tech/Habitat Installations", "Tech/Habitats"}, + {"Tech/Power", "Tech/Power"}, + {"Tech/Vehicles", "Tech/Vehicles"}, + }; } } diff --git a/Unity/Assets/Scripts/SCHIZO/Registering/Game.cs b/Unity/Assets/Scripts/SCHIZO/Registering/Game.cs index 9bc6aa17..3d6800e2 100644 --- a/Unity/Assets/Scripts/SCHIZO/Registering/Game.cs +++ b/Unity/Assets/Scripts/SCHIZO/Registering/Game.cs @@ -1,25 +1,11 @@ -using System; +using System; namespace SCHIZO.Registering { - [AttributeUsage(AttributeTargets.Field)] - public sealed class GameAttribute(Game game) : Attribute - { - public readonly Game game = game; - - public GameAttribute() : this(GameX.Any) { } - } - [Flags] public enum Game { Subnautica = 1, BelowZero = 2, } - - public static class GameX - { - public const Game Any = 0; - public const Game Both = Game.Subnautica | Game.BelowZero; - } } diff --git a/Unity/Assets/Scripts/SCHIZO/Registering/GameAttribute.cs b/Unity/Assets/Scripts/SCHIZO/Registering/GameAttribute.cs new file mode 100644 index 00000000..801a3953 --- /dev/null +++ b/Unity/Assets/Scripts/SCHIZO/Registering/GameAttribute.cs @@ -0,0 +1,20 @@ +using System; + +namespace SCHIZO.Registering +{ + [AttributeUsage(AttributeTargets.Field)] + public sealed class GameAttribute : Attribute + { + internal readonly Game game; + internal readonly string gameMember; + + public GameAttribute(Game game = default) + { + this.game = game; + } + public GameAttribute(string memberName) + { + gameMember = memberName; + } + } +} diff --git a/Unity/Assets/Scripts/SCHIZO/Registering/GameAttribute.cs.meta b/Unity/Assets/Scripts/SCHIZO/Registering/GameAttribute.cs.meta new file mode 100644 index 00000000..e7ecbda0 --- /dev/null +++ b/Unity/Assets/Scripts/SCHIZO/Registering/GameAttribute.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 02af39cdbb454398b163a18568032f46 +timeCreated: 1699298922 \ No newline at end of file diff --git a/Unity/Assets/Scripts/SCHIZO/SCHIZO.asmdef b/Unity/Assets/Scripts/SCHIZO/SCHIZO.asmdef index b527da2a..cd2378b7 100644 --- a/Unity/Assets/Scripts/SCHIZO/SCHIZO.asmdef +++ b/Unity/Assets/Scripts/SCHIZO/SCHIZO.asmdef @@ -13,4 +13,4 @@ "defineConstraints": [], "versionDefines": [], "noEngineReferences": false -} \ No newline at end of file +} diff --git a/Unity/Assets/Scripts/SCHIZO/Spawns.meta b/Unity/Assets/Scripts/SCHIZO/Spawns.meta new file mode 100644 index 00000000..2243b5bd --- /dev/null +++ b/Unity/Assets/Scripts/SCHIZO/Spawns.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c7851ea92e5e9634fb94667e545b6835 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Scripts/SCHIZO/Spawns/CoordinatedSpawns.cs b/Unity/Assets/Scripts/SCHIZO/Spawns/CoordinatedSpawns.cs new file mode 100644 index 00000000..2a0dfa68 --- /dev/null +++ b/Unity/Assets/Scripts/SCHIZO/Spawns/CoordinatedSpawns.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using SCHIZO.Registering; +using SCHIZO.Items.Data.Crafting; +using TriInspector; + +namespace SCHIZO.Spawns +{ + [CreateAssetMenu(menuName = "SCHIZO/Registering/Coordinated Spawns")] + public sealed partial class CoordinatedSpawns : ModRegistryItem + { + [ListDrawerSettings(AlwaysExpanded = true)] + public List spawns; + } + [Serializable] + public sealed partial class SpawnInfo + { + public Game game; + [Game(nameof(game))] + public Item item; + public SpawnLocation[] locations; + + [Serializable] + public partial struct SpawnLocation + { + public Vector3 position; + public Vector3 rotation; + } + } +} diff --git a/Unity/Assets/Scripts/SCHIZO/Spawns/CoordinatedSpawns.cs.meta b/Unity/Assets/Scripts/SCHIZO/Spawns/CoordinatedSpawns.cs.meta new file mode 100644 index 00000000..f0b91b0b --- /dev/null +++ b/Unity/Assets/Scripts/SCHIZO/Spawns/CoordinatedSpawns.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a6ccb8c039e34e44ebdee40c7d89e4a4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: