Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Commit

Permalink
Update to Deli.H3VR 0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Maiq-The-Dude committed May 13, 2021
1 parent c40a813 commit 87d3222
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion PortableItemSpawner/PortableItemSpawner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<ItemGroup>
<PackageReference Include="Deli" Version="0.3.2" />
<PackageReference Include="Deli.H3VR" Version="0.1.1" />
<PackageReference Include="Deli.H3VR" Version="0.2.0" />

<PackageReference Include="jnm2.ReferenceAssemblies.net35" Version="1.0.1" PrivateAssets="all" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions PortableItemSpawner/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"M'aiq"
],
"guid": "maiq.portableitemspawner",
"version": "1.1.0",
"version": "1.2.0",
"require": "0.3.2",
"dependencies": {
"deli.h3vr": "0.1.0"
"deli.h3vr": "0.2.0"
},
"assets": {
"patcher": {
Expand Down
13 changes: 8 additions & 5 deletions PortableItemSpawner/src/Hooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ namespace PortableItemSpawner
{
public class Hooks
{
private readonly H3Api _api = H3Api.Instance;

private GameObject _itemSpawner;

private FVRPhysicalObject _portableItemSpawner;
Expand All @@ -19,7 +21,7 @@ public FVRPhysicalObject PortableItemSpawner
}

// Get panel prefab from Deli
var panelObject = LockablePanel.GetCleanLockablePanel();
var panelObject = _api.GetCleanLockablePanel();
panelObject.name = "PortableItemSpawner";
var panelTransform = panelObject.transform;
panelTransform.localPosition = Vector3.zero;
Expand All @@ -39,15 +41,16 @@ public FVRPhysicalObject PortableItemSpawner
_portableItemSpawner = panelObject.GetComponent<FVRPhysicalObject>();
_portableItemSpawner.SetIsKinematicLocked(true);
_portableItemSpawner.m_colliders = _portableItemSpawner.GetComponentsInChildren<Collider>(true);
_portableItemSpawner.PoseOverride.transform.rotation = Quaternion.Euler(40, 0, 0);
_portableItemSpawner.PoseOverride.transform.rotation = Quaternion.Euler(0, 0, 0);

return _portableItemSpawner;
}
}

public void Hook()
{
WristMenu.RegisterWristMenuButton("Spawn ItemSpawner Panel", WristMenuButtonClicked);
// Create our button
_api.WristMenuButtons.Add(new WristMenuButton("Spawn ItemSpawner Panel", SpawnItemSpawner));

// Get the ItemSpawner gameobject
On.FistVR.ItemSpawnerUI.Start += (orig, self) => {
Expand All @@ -62,9 +65,9 @@ public void Hook()
};
}

// Spawn our panel whenever options panel is clicked
private void WristMenuButtonClicked(FVRWristMenu wristMenu)
private void SpawnItemSpawner(H3Api api, WristMenuButton caller)
{
var wristMenu = api.WristMenu;
if (_itemSpawner != null)
{
wristMenu.m_currentHand.RetrieveObject(PortableItemSpawner);
Expand Down

0 comments on commit 87d3222

Please sign in to comment.