Skwizzy / SPT-LootingBots

AI Looting mod for Singleplayer Tarkov
https://hub.sp-tarkov.com/files/file/1096-looting-bots/#overview
29 stars 11 forks source link

Add Interop Support to Force or Inhibit Loot Scans #98

Closed dwesterwick closed 6 months ago

dwesterwick commented 6 months ago

Adds support for external commands without requiring Looting Bots as a dependency for mods. This allows users to choose whether or not they want to include a supporting mod and therefore allows them to better customize their SPT experience.

The two external commands this PR introduces are:

  1. Force a loot scan: Resets IsScheduledScan until the external command "expires" or the bot starts a loot scan. If the bot is already scanning for loot or looting, this command will be ignored and discarded.
  2. Inhibit looting: Extends IsScheduledScan until the external command "expires". If IsScheduledScan is already later than this, the external command will have no impact on it.

I created the external-request system to mimic how Drakia implemented something similar in a recent SAIN update. Basically, modders can copy LootingBotsInterop.cs to their project, and those methods will invoke matching ones in External.cs in your mod. I'm currently using this approach for force bots to extract via SAIN, and it works very well.

I would like to use this feature in the upcoming Questing Bots 0.4.0 release if possible (hopefully in late January). That way, I can better control when bots loot as they travel to and reach their objective locations.

Thanks!