Skip to content

Commit

Permalink
Improved Outward Mode
Browse files Browse the repository at this point in the history
Fixed an issue with bags falling through the floor when dropped with Outward Mode
  • Loading branch information
Vapok committed Mar 18, 2023
1 parent cfc10ff commit 769e89a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions AdventureBackpacks/AdventureBackpacks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ private void Update()
Backpacks.PerformYardSale(Player.m_localPlayer, backpack.Item);
}

if ((ZInput.GetButton("Forward") || ZInput.GetButton("Backward") || ZInput.GetButton("Left") ||ZInput.GetButton("Right"))
&& ZInput.GetKeyDown(ConfigRegistry.HotKeyDrop.Value.MainKey) && ConfigRegistry.OutwardMode.Value)
{
Player.m_localPlayer.QuickDropBackpack();
}

InventoryPatches.ProcessItemsAddedQueue();
}

Expand Down
3 changes: 3 additions & 0 deletions AdventureBackpacks/AdventureBackpacks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>..\..\References\BepInEx\5.4.2101\unstripped_corlib\UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>..\..\References\BepInEx\5.4.2101\unstripped_corlib\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
<Reference Include="Vapok.Common">
<HintPath>..\..\References\Vapok.Common\Vapok.Common.dll</HintPath>
</Reference>
Expand Down
5 changes: 4 additions & 1 deletion AdventureBackpacks/Extensions/PlayerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using AdventureBackpacks.Components;
using AdventureBackpacks.Patches;
using UnityEngine;
using Vapok.Common.Managers;

namespace AdventureBackpacks.Extensions;
Expand Down Expand Up @@ -96,7 +97,9 @@ public static void QuickDropBackpack(this Player player)
player.m_inventory.RemoveItem(backpack.Item);

// This drops a copy of the backpack itemDrop.itemData
var itemDrop = ItemDrop.DropItem(backpack.Item, 1, player.transform.position - player.transform.up - player.transform.up, player.transform.rotation);
var itemDrop = ItemDrop.DropItem(backpack.Item, 1, player.transform.position - player.transform.forward + player.transform.up, player.transform.rotation);
itemDrop.GetComponent<Rigidbody>().velocity = (Vector3.up - player.transform.forward) * 5f;
player.m_dropEffects.Create(player.transform.position, Quaternion.identity);
itemDrop.Save();

if (swapItemActivated)
Expand Down
4 changes: 3 additions & 1 deletion AdventureBackpacks/Patches/InventoryGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
using System.Linq;
using System.Reflection.Emit;
using AdventureBackpacks.Assets;
using AdventureBackpacks.Assets.Factories;
using AdventureBackpacks.Components;
using AdventureBackpacks.Configuration;
using AdventureBackpacks.Extensions;
using HarmonyLib;
using JetBrains.Annotations;
using UnityEngine;
using Vapok.Common.Managers;

Expand Down Expand Up @@ -149,7 +151,7 @@ public static bool DetectInputToShow(string defaultKeyCode, Player player, Inven

return zInputDown || hotKeyDown || _showBackpack;
}

[HarmonyPatch(typeof(InventoryGui), nameof(InventoryGui.Update))]
static class InventoryGuiUpdateTranspiler
{
Expand Down
1 change: 1 addition & 0 deletions PATCHNOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* All Configuration settings for backpack controls have been validated.
* **Please double check your settings if interactions have changed for you**
* Community has verified controller support from previous version.
* Fixed an issue with bags falling through the floor when dropped with Outward Mode

# 1.6.12.0 - Redefining Keymappings and Open with Inventory Option
* Adjusted Config Keymappings to allow for Gamepad, Mouse, or Keyboard to be set.
Expand Down

0 comments on commit 769e89a

Please sign in to comment.