diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 83a5ad84..cebe7cae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,6 +39,6 @@ jobs: uses: actions/upload-artifact@v4 with: path: | - "build/*" - "bin/Release/COTL_API/*.nupkg" + build/* + bin/Release/COTL_API/*.nupkg name: ${{ matrix.os }} diff --git a/COTL_API.Common.props b/COTL_API.Common.props index 8fff92d9..e4574f8f 100644 --- a/COTL_API.Common.props +++ b/COTL_API.Common.props @@ -1,7 +1,7 @@ net472 - 0.2.13 + 0.3.0 latest portable true diff --git a/COTL_API/CustomFollowerCommand/CustomFollowerCommandPatches.cs b/COTL_API/CustomFollowerCommand/CustomFollowerCommandPatches.cs index 5121f24e..9937ae60 100644 --- a/COTL_API/CustomFollowerCommand/CustomFollowerCommandPatches.cs +++ b/COTL_API/CustomFollowerCommand/CustomFollowerCommandPatches.cs @@ -16,7 +16,7 @@ private static bool CommandItem_GetTitle(CommandItem __instance, Follower follow return false; } - [HarmonyPatch(typeof(CommandItem), nameof(CommandItem.IsAvailable))] + [HarmonyPatch(typeof(CommandItem), nameof(CommandItem.IsAvailable), typeof(Follower))] [HarmonyPrefix] private static bool CommandItem_IsAvailable(CommandItem __instance, Follower follower, ref bool __result) { diff --git a/COTL_API/CustomInventory/CustomCrops/CustomCropManager.cs b/COTL_API/CustomInventory/CustomCrops/CustomCropManager.cs index c398bf52..edaea42c 100644 --- a/COTL_API/CustomInventory/CustomCrops/CustomCropManager.cs +++ b/COTL_API/CustomInventory/CustomCrops/CustomCropManager.cs @@ -92,6 +92,7 @@ public static void InitiateCustomCrops() throw new NullReferenceException("Couldn't Find Berry Crop Object, Send a bug report!"); CropPrefab = handle.Result; + CropPrefab.SetActive(false); CustomCropList.Do(x => CreateCropObject(x.Value)); }; } diff --git a/COTL_API/CustomInventory/CustomFood/Patches/CustomMealPatches.cs b/COTL_API/CustomInventory/CustomFood/Patches/CustomMealPatches.cs index 092ce84f..29f3d4bf 100644 --- a/COTL_API/CustomInventory/CustomFood/Patches/CustomMealPatches.cs +++ b/COTL_API/CustomInventory/CustomFood/Patches/CustomMealPatches.cs @@ -71,7 +71,7 @@ private static bool StructureBrain_CreateBrain(ref StructuresData data, ref Stru StructureBrain.ApplyConfigToData(data); sb.Init(data); - StructureBrain._brainsByID.Add(data.ID, sb); + StructureBrain.TryAddBrain(data.ID, sb); StructureManager.StructuresAtLocation(data.Location).Add(sb); __result = sb; diff --git a/COTL_API/CustomInventory/Patches/CustomItemRefineryPatches.cs b/COTL_API/CustomInventory/Patches/CustomItemRefineryPatches.cs index 00c3dda4..a7a66076 100644 --- a/COTL_API/CustomInventory/Patches/CustomItemRefineryPatches.cs +++ b/COTL_API/CustomInventory/Patches/CustomItemRefineryPatches.cs @@ -53,12 +53,13 @@ public static void UIRefineryMenuController_Show(ref UIMenuBase __instance) } [HarmonyPostfix] - [HarmonyPatch(typeof(RefineryInfoCard), nameof(RefineryInfoCard.Configure), typeof(InventoryItem.ITEM_TYPE))] - public static void RefineryInfoCard_Configure(ref RefineryInfoCard __instance, ref InventoryItem.ITEM_TYPE config) + [HarmonyPatch(typeof(RefineryInfoCard), nameof(RefineryInfoCard.Configure))] + public static void RefineryInfoCard_Configure(ref RefineryInfoCard __instance, ref RefineryItem config) { - if (!CustomItemList.TryGetValue(config, out var value)) return; + var itemtype = config.Type; + if (!CustomItemList.TryGetValue(itemtype, out var value)) return; __instance._descriptionText.text = value.LocalizedDescription(); - __instance._headerText.text = CustomItemList[config].LocalizedName(); + __instance._headerText.text = CustomItemList[itemtype].LocalizedName(); } } \ No newline at end of file diff --git a/COTL_API/CustomObjectives/CustomObjectiveManager.cs b/COTL_API/CustomObjectives/CustomObjectiveManager.cs index 11cd0968..92604a5c 100644 --- a/COTL_API/CustomObjectives/CustomObjectiveManager.cs +++ b/COTL_API/CustomObjectives/CustomObjectiveManager.cs @@ -166,12 +166,14 @@ public static CustomObjective PerformRitual(UpgradeSystem.Type ritual, int targe } /// The category of structure to place. + /// The type of structure to place. /// The target amount to complete the objective. /// How long the player has to complete the objective. /// Returns a CustomObjective object. - public static CustomObjective PlaceStructure(StructureBrain.Categories category, int target, float expireDuration) + public static CustomObjective PlaceStructure(StructureBrain.Categories category, + Objectives_PlaceStructure.DecorationType type, int target, float expireDuration) { - Objectives_PlaceStructure q = new(GroupId, category, target, expireDuration); + Objectives_PlaceStructure q = new(GroupId, category, type, target, expireDuration); return WorkMagic(q.ID, DefaultQuestText, q); } diff --git a/COTL_API/CustomStructures/CustomStructurePatches.cs b/COTL_API/CustomStructures/CustomStructurePatches.cs index 472589fd..88a5ca9a 100644 --- a/COTL_API/CustomStructures/CustomStructurePatches.cs +++ b/COTL_API/CustomStructures/CustomStructurePatches.cs @@ -17,7 +17,7 @@ private static bool StructureBrain_CreateBrain(ref StructureBrain __result, Stru StructureBrain.ApplyConfigToData(data); structureBrain?.Init(data); - StructureBrain._brainsByID.Add(data.ID, structureBrain); + StructureBrain.TryAddBrain(data.ID, structureBrain); StructureManager.StructuresAtLocation(data.Location).Add(structureBrain); __result = structureBrain!; return false; diff --git a/COTL_API/Debug/DebugManager.cs b/COTL_API/Debug/DebugManager.cs index 0c49d1d8..e2027406 100644 --- a/COTL_API/Debug/DebugManager.cs +++ b/COTL_API/Debug/DebugManager.cs @@ -46,8 +46,8 @@ internal class DebugManager }; // TODO: Can't we just harmony.GetPatchedMethods().Select(mB => mB.DeclaringType); - internal static List PatchedClass = new() - { + internal static List PatchedClass = + [ typeof(CropController), typeof(StructuresData), typeof(StructureBrain), @@ -124,7 +124,7 @@ internal class DebugManager typeof(Interaction_TempleAltar), typeof(Interaction), typeof(UITarotChoiceOverlayController) - }; + ]; internal static InventoryItem.ITEM_TYPE DebugItem { get; private set; } internal static InventoryItem.ITEM_TYPE DebugItem2 { get; private set; } @@ -140,18 +140,18 @@ private static string BeautifyNamespace(string? str) return str is null or "" ? "" : str + "."; } - internal void ShowPatches(Type a) + internal static void ShowPatches(Type a) { var harmony = Plugin.Instance._harmony; var patchedMethods = harmony.GetPatchedMethods().Where(methodBase => methodBase.DeclaringType == a); foreach (var method in a.GetMethods()) LogDebug(patchedMethods.Contains(method) - ? $"{BeautifyNamespace(a.Namespace)}{a.Name}: Patched" - : $"{BeautifyNamespace(a.Namespace)}{a.Name}: Unpatched"); + ? $"{BeautifyNamespace(a.Namespace)}{a.Name}.{method.Name}: Patched" + : $"{BeautifyNamespace(a.Namespace)}{a.Name}.{method.Name}: Unpatched"); } - internal void ShowPatchedClasses() + internal static void ShowPatchedClasses() { foreach (var cl in PatchedClass) ShowPatches(cl); } diff --git a/COTL_API/Saves/SavePatches.cs b/COTL_API/Saves/SavePatches.cs index 9373d8d7..e76d06f6 100644 --- a/COTL_API/Saves/SavePatches.cs +++ b/COTL_API/Saves/SavePatches.cs @@ -13,7 +13,7 @@ private static void SaveAndLoad_Load(int saveSlot) saveData.Load(saveSlot); } - [HarmonyPatch(typeof(SaveAndLoad), nameof(SaveAndLoad.Save))] + [HarmonyPatch(typeof(SaveAndLoad), nameof(SaveAndLoad.Save), [])] [HarmonyPostfix] private static void SaveAndLoad_Save() {