Add support for loose loot
This commit is contained in:
parent
087714d394
commit
b176d90467
@ -1,4 +1,6 @@
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using BepInEx.Logging;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace CactusPie.ContainerQuickLoot
|
||||
@ -6,9 +8,37 @@ namespace CactusPie.ContainerQuickLoot
|
||||
[BepInPlugin("com.cactuspie.containerquikloot", "CactusPie.ContainerQuickLoot", "1.0.0")]
|
||||
public class ContainerQuickLootPlugin : BaseUnityPlugin
|
||||
{
|
||||
internal static ConfigEntry<bool> EnableForCtrlClick { get; set; }
|
||||
|
||||
internal static ConfigEntry<bool> EnableForLooseLoot { get; set; }
|
||||
|
||||
[UsedImplicitly]
|
||||
internal void Start()
|
||||
{
|
||||
const string sectionName = "Container quick loot setting";
|
||||
|
||||
EnableForCtrlClick = Config.Bind
|
||||
(
|
||||
sectionName,
|
||||
"Enable for Ctrl+click",
|
||||
true,
|
||||
new ConfigDescription
|
||||
(
|
||||
"Automatically put the items in containers while transferring them with ctrl+click"
|
||||
)
|
||||
);
|
||||
|
||||
EnableForLooseLoot = Config.Bind
|
||||
(
|
||||
sectionName,
|
||||
"Enable for loose loot",
|
||||
true,
|
||||
new ConfigDescription
|
||||
(
|
||||
"Automatically put loose loot in containers"
|
||||
)
|
||||
);
|
||||
|
||||
new QuickTransferPatch().Enable();
|
||||
}
|
||||
}
|
||||
|
@ -26,12 +26,27 @@ namespace CactusPie.ContainerQuickLoot
|
||||
GClass2585.EMoveItemOrder order,
|
||||
bool simulate)
|
||||
{
|
||||
// We only execute this for ctrl+click move
|
||||
if (order != GClass2585.EMoveItemOrder.MoveToAnotherSide)
|
||||
// If is ctrl+click loot
|
||||
if (order == GClass2585.EMoveItemOrder.MoveToAnotherSide)
|
||||
{
|
||||
if (!ContainerQuickLootPlugin.EnableForCtrlClick.Value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// If is loose loot pick up
|
||||
else if (order == GClass2585.EMoveItemOrder.PickUp && controller.OwnerType == EOwnerType.Profile)
|
||||
{
|
||||
if (!ContainerQuickLootPlugin.EnableForLooseLoot.Value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
GameWorld gameWorld = Singleton<GameWorld>.Instance;
|
||||
|
||||
// If gameWorld is null that means the game is currently not in progress, for instance you're in your hideout
|
||||
|
Loading…
x
Reference in New Issue
Block a user