Skip to content

Commit

Permalink
- Fixes to restrict bulk scrapping to only MechBay
Browse files Browse the repository at this point in the history
  • Loading branch information
IceRaptor committed Nov 22, 2020
1 parent 344150b commit ddaf23f
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions IRTweaks/IRTweaks/Modules/UI/BulkScrapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,14 @@ static class BulkScrapping_MechBayMechStorageWidget_Filter_WeightAll
{
static bool Prepare() => Mod.Config.Fixes.BulkScrapping;

static void Postfix(MechBayMechStorageWidget __instance, List<IMechLabDraggableItem> ___inventory)
static void Postfix(MechBayMechStorageWidget __instance, List<IMechLabDraggableItem> ___inventory, IMechLabDropTarget ___parentDropTarget)
{
if (___parentDropTarget == null || !(___parentDropTarget is MechBayPanel mechBayPanel))
{
Mod.Log.Info?.Write("Parent is not MechBay, skipping.");
return;
}

if (___inventory != null && ___inventory.Count > 0 &&
Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
{
Expand All @@ -142,8 +148,14 @@ static class BulkScrapping_MechBayMechStorageWidget_Filter_WeightAssault
{
static bool Prepare() => Mod.Config.Fixes.BulkScrapping;

static void Postfix(MechBayMechStorageWidget __instance, List<IMechLabDraggableItem> ___inventory)
static void Postfix(MechBayMechStorageWidget __instance, List<IMechLabDraggableItem> ___inventory, IMechLabDropTarget ___parentDropTarget)
{
if (___parentDropTarget == null || !(___parentDropTarget is MechBayPanel mechBayPanel))
{
Mod.Log.Info?.Write("Parent is not MechBay, skipping.");
return;
}

if (___inventory != null && ___inventory.Count > 0 &&
Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
{
Expand All @@ -166,8 +178,14 @@ static class BulkScrapping_MechBayMechStorageWidget_Filter_WeightHeavy
{
static bool Prepare() => Mod.Config.Fixes.BulkScrapping;

static void Postfix(MechBayMechStorageWidget __instance, List<IMechLabDraggableItem> ___inventory)
static void Postfix(MechBayMechStorageWidget __instance, List<IMechLabDraggableItem> ___inventory, IMechLabDropTarget ___parentDropTarget)
{
if (___parentDropTarget == null || !(___parentDropTarget is MechBayPanel mechBayPanel))
{
Mod.Log.Info?.Write("Parent is not MechBay, skipping.");
return;
}

if (___inventory != null && ___inventory.Count > 0 &&
Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
{
Expand All @@ -190,8 +208,14 @@ static class BulkScrapping_MechBayMechStorageWidget_Filter_WeightLight
{
static bool Prepare() => Mod.Config.Fixes.BulkScrapping;

static void Postfix(MechBayMechStorageWidget __instance, List<IMechLabDraggableItem> ___inventory)
static void Postfix(MechBayMechStorageWidget __instance, List<IMechLabDraggableItem> ___inventory, IMechLabDropTarget ___parentDropTarget)
{
if (___parentDropTarget == null || !(___parentDropTarget is MechBayPanel mechBayPanel))
{
Mod.Log.Info?.Write("Parent is not MechBay, skipping.");
return;
}

if (___inventory != null && ___inventory.Count > 0 &&
Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
{
Expand All @@ -214,8 +238,14 @@ static class BulkScrapping_MechBayMechStorageWidget_Filter_WeightMedium
{
static bool Prepare() => Mod.Config.Fixes.BulkScrapping;

static void Postfix(MechBayMechStorageWidget __instance, List<IMechLabDraggableItem> ___inventory)
static void Postfix(MechBayMechStorageWidget __instance, List<IMechLabDraggableItem> ___inventory, IMechLabDropTarget ___parentDropTarget)
{
if (___parentDropTarget == null || !(___parentDropTarget is MechBayPanel mechBayPanel))
{
Mod.Log.Info?.Write("Parent is not MechBay, skipping.");
return;
}

if (___inventory != null && ___inventory.Count > 0 &&
Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
{
Expand Down

0 comments on commit ddaf23f

Please sign in to comment.