Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion COTL_API.Common.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<Version>0.2.13</Version>
<Version>0.3.0</Version>
<LangVersion>latest</LangVersion>
<DebugType>portable</DebugType>
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions COTL_API/CustomInventory/CustomCrops/CustomCropManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
9 changes: 5 additions & 4 deletions COTL_API/CustomInventory/Patches/CustomItemRefineryPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
6 changes: 4 additions & 2 deletions COTL_API/CustomObjectives/CustomObjectiveManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,14 @@ public static CustomObjective PerformRitual(UpgradeSystem.Type ritual, int targe
}

/// <param name="category">The category of structure to place.</param>
/// <param name="type">The type of structure to place.</param>
/// <param name="target">The target amount to complete the objective.</param>
/// <param name="expireDuration">How long the player has to complete the objective.</param>
/// <returns>Returns a CustomObjective object.</returns>
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)
Comment on lines +173 to +174

Copilot AI Jan 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking API change. The PlaceStructure method signature has been modified to add a required parameter type of type Objectives_PlaceStructure.DecorationType between the existing category and target parameters. This will break any existing code that calls this method with the old signature. Consider overloading the method instead by keeping the old signature and having it call the new one with a default value for the type parameter to maintain backward compatibility.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gork fix issue pls no bugs

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chatgpt fix issue pls no bugs

{
Objectives_PlaceStructure q = new(GroupId, category, target, expireDuration);
Objectives_PlaceStructure q = new(GroupId, category, type, target, expireDuration);
return WorkMagic(q.ID, DefaultQuestText, q);
}

Expand Down
2 changes: 1 addition & 1 deletion COTL_API/CustomStructures/CustomStructurePatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions COTL_API/Debug/DebugManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
};

// TODO: Can't we just harmony.GetPatchedMethods().Select(mB => mB.DeclaringType);
internal static List<Type> PatchedClass = new()
{
internal static List<Type> PatchedClass =
[
typeof(CropController),
typeof(StructuresData),
typeof(StructureBrain),
Expand Down Expand Up @@ -124,7 +124,7 @@
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; }
Expand All @@ -140,18 +140,18 @@
return str is null or "" ? "" : str + ".";
}

internal void ShowPatches(Type a)
internal static void ShowPatches(Type a)
{
var harmony = Plugin.Instance._harmony;

Check warning on line 145 in COTL_API/Debug/DebugManager.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.

Check warning on line 145 in COTL_API/Debug/DebugManager.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.

Check warning on line 145 in COTL_API/Debug/DebugManager.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Dereference of a possibly null reference.

Check warning on line 145 in COTL_API/Debug/DebugManager.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Dereference of a possibly null reference.

Check warning on line 145 in COTL_API/Debug/DebugManager.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 145 in COTL_API/Debug/DebugManager.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 145 in COTL_API/Debug/DebugManager.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Dereference of a possibly null reference.

Check warning on line 145 in COTL_API/Debug/DebugManager.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Dereference of a possibly null reference.

Check warning on line 145 in COTL_API/Debug/DebugManager.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.

Check warning on line 145 in COTL_API/Debug/DebugManager.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.

Check warning on line 145 in COTL_API/Debug/DebugManager.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 145 in COTL_API/Debug/DebugManager.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.
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);
}
Expand Down
2 changes: 1 addition & 1 deletion COTL_API/Saves/SavePatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
Loading