Closed CaffeineBytes closed 2 years ago
Didn't really see a scenario in the existing codebase that had multiple HarmonyPatch attributes on it, so even though a majority of the patches are just prefixes that skip code, I separated them. However, let me know if I can stack attributes all onto one generic method inside GearManager_Patches
for the prefixes I want to completely skip over code.
Is there a particular reason RegisterGearInSlotAsEquipped
and RegisterBotGearInSlotAsEquipped
are being patched away? I threw a quick glance over the code in GearManager and those functions just seem to modify the runtime favorites then commit to the file on disk. Which would mean we just need to patch out SaveFavoritesData
so we don't commit favorites to disk
What is the motivation behind resetting FavoritesData and BotFavoritesData in LoadOfflineGearDatas
?
If it causes issue for bots only shouldn't we reset BotFavoritesData
only? I might be completely incorrect as I haven't looked over that
@Kasuromi RegisterGearInSlotAsEquipped
and RegisterBotGearInSlotAsEquipped
is what is executed for the on button press when selecting a weapon. I had to resort to this because SaveBotsFavoritesData
was never called when the event was fired. SaveFavoritesData
was, but I figured I'd keep the methods patched between players and bots consistent. I'm open to suggestions if you think I missed something.
I reset player favorites because weapons can be different between switching mods. One rundown can save several weapons that are custom, while the other uses just vanilla weapons. The slots are loaded by IDs and for bots I saw it prevent selecting weapons for a slot with an invalid ID; figure I apply the same with players.
@Kasuromi if you think it would be beneficial to re-implement favorite saving, but to a different file, I was able to save and load a file in those patches originally, but there were issues with getting the updates to apply and it would require some thought on how to handle saves across different mods. Up to you if this PR provides value and it could be added later as an enhancement?
Going to take a different approach with this after some discussions with others.
Prevent saving favorites that would cause users to have to delete their favorites files to switch mods or move back to vanilla. Force default loadouts for players and bots on startup.