Skip to content

Commit

Permalink
Merge pull request #7 from Maiq-The-Dude/bepinex
Browse files Browse the repository at this point in the history
Bepinex
  • Loading branch information
Maiq-The-Dude authored Jun 15, 2021
2 parents f2b05db + 8d86ffd commit 7e72829
Show file tree
Hide file tree
Showing 27 changed files with 95 additions and 104 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build project

on: [ push ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow

- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

- name: Install dependencies
run: dotnet restore src/

- name: Build
run: dotnet build src/ --configuration Release --no-restore

- name: Package
run: bash thunderstore/make_package.sh

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Thunderstore Package
path: thunderstore/BetterHands.zip
30 changes: 0 additions & 30 deletions .github/workflows/makefile.yml

This file was deleted.

1 change: 0 additions & 1 deletion BetterHands/hookgen.conf

This file was deleted.

17 changes: 0 additions & 17 deletions BetterHands/manifest.json

This file was deleted.

11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# BetterHands
[![version](https://img.shields.io/github/v/release/Maiq-The-Dude/BetterHands?&label=version&style=flat-square)](https://github.com/Maiq-The-Dude/BetterHands/releases/latest) [![discord](https://img.shields.io/discord/777351065950879744?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2&style=flat-square)](https://discord.gg/g8xeFyt42j)

A Deli mod to recolor controller geo, resize interaction spheres, and add mag palming.
A mod to recolor controller geo, resize interaction spheres, and add mag palming.
All features are optional and configured via the config file. Configs can be edited mid-game, but will require a scene reload to take effect.

## Mag Palming
Expand Down Expand Up @@ -32,7 +32,10 @@ Mag palming allows you to carry two small sized magazines in one hand. To do thi

## Manual Installation
Requires
- [Deli 0.4+](https://github.com/Deli-Collective/Deli/releases)
- [Sodalite](https://github.com/H3VR-Modding/Sodalite/releases)
- [BepInEx 5.4.x](https://github.com/BepInEx/BepInEx)
- [BepInEx.Monomod.Loader](https://github.com/BepInEx/BepInEx.MonoMod.Loader)
- [BepInEx.Monomod.HookGenPatcher](https://github.com/harbingerofme/Bepinex.Monomod.HookGenPatcher)
- [Sodalite](https://github.com/H3VR-Modding/Sodalite)

Extract the BetterHands `.zip` into the BepInEx plugins folder

Download and open [BetterHands.zip](https://github.com/Maiq-The-Dude/BetterHands/releases/latest), then drag `BetterHands.dll` within into the `h3vr/bepinex/plugins/` directory
25 changes: 0 additions & 25 deletions makefile

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Deli" Version="0.4.1" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" />
<PackageReference Include="jnm2.ReferenceAssemblies.net35" Version="1.0.1" PrivateAssets="all" />
<PackageReference Include="Sodalite" Version="1.0.0" />
Expand All @@ -22,13 +21,4 @@
</Reference>
</ItemGroup>

<ItemGroup>
<None Update="hookgen.conf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="manifest.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private void FVRFireArmReloadTriggerMag_OnTriggerEnter(On.FistVR.FVRFireArmReloa
{
var triggerWell = collider.GetComponent<FVRFireArmReloadTriggerWell>();
var firearm = triggerWell.FireArm;
if (mag.MagazineType == triggerWell.TypeOverride || mag.MagazineType == firearm.MagazineType && (firearm.EjectDelay <= 0f || mag != firearm.LastEjectedMag) && firearm.Magazine == null)
if (mag.MagazineType == triggerWell.TypeOverride || (mag.MagazineType == firearm.MagazineType && (firearm.EjectDelay <= 0f || mag != firearm.LastEjectedMag) && firearm.Magazine == null))
{
// Remove mag from qb, load, buzz loading hand, and unhide controller geo
mag.SetQuickBeltSlot(null);
Expand All @@ -65,7 +65,7 @@ private void FVRFireArmClipTriggerClip_OnTriggerEnter(On.FistVR.FVRFireArmClipTr
{
var triggerWell = collider.gameObject.GetComponent<FVRFireArmClipTriggerWell>();
var firearm = triggerWell.FireArm;
if (triggerWell != null && triggerWell.FireArm != null && firearm.ClipType == clip.ClipType && firearm.ClipEjectDelay <= 0f && firearm.Clip == null)
if (triggerWell?.FireArm != null && firearm.ClipType == clip.ClipType && firearm.ClipEjectDelay <= 0f && firearm.Clip == null)
{
// Remove from qb, load, buzz loading hand, and unhide controller geo
clip.SetQuickBeltSlot(null);
Expand Down Expand Up @@ -93,7 +93,7 @@ private bool FirearmLoadCheck(FVRPhysicalObject obj, Collider col, string layer)

if (fvrObj != null && MP.ObjInPalmSlot(fvrObj.QuickbeltSlot))
{
return (col.gameObject.CompareTag(layer));
return col.gameObject.CompareTag(layer);
}
}

Expand Down Expand Up @@ -140,7 +140,7 @@ private void PhysicalMagazineReleaseLatch_OnCollisionStay(On.FistVR.PhysicalMaga

if (GM.CurrentSceneSettings.AreQuickbeltSlotsEnabled)
{
if (col.collider.attachedRigidbody != null && col.collider.attachedRigidbody.gameObject.GetComponent<FVRPhysicalObject>() != null)
if (col.collider.attachedRigidbody?.gameObject.GetComponent<FVRPhysicalObject>() != null)
{
self.timeSinceLastCollision = 0f;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ private bool AllowPalming(FVRPhysicalObject item)
{
var cheatCfg = _config.zCheat;

return (item is FVRFireArmMagazine mag && mag.Size <= cheatCfg.SizeLimit.Value ||
return (item is FVRFireArmMagazine mag && mag.Size <= cheatCfg.SizeLimit.Value) ||
item is FVRFireArmClip ||
item is FVRFireArmRound && _config.MagPalm.RoundPalm.Value ||
cheatCfg.CursedPalms.Value && !item.m_isHardnessed);
(item is FVRFireArmRound && _config.MagPalm.RoundPalm.Value) ||
(cheatCfg.CursedPalms.Value && !item.m_isHardnessed);
}

// If mag palm keybind matches grabbity keybind, suppress mag palm input if grabbity sphere is on an item
Expand All @@ -181,8 +181,8 @@ private bool GrabbityProtection(FVRViveHand hand, MagPalmControlsConfig.Keybind
if (_config.MagPalm.Controls.GrabbityProtection.Value)
{
var grabbityState = GM.Options.ControlOptions.WIPGrabbityButtonState;
var grabbityConflict = (grabbityState == ControlOptions.WIPGrabbityButton.Trigger && (keybind == MagPalmControlsConfig.Keybind.Trigger)
|| grabbityState == ControlOptions.WIPGrabbityButton.Grab && (keybind == MagPalmControlsConfig.Keybind.Grip));
var grabbityConflict = ((grabbityState == ControlOptions.WIPGrabbityButton.Trigger && (keybind == MagPalmControlsConfig.Keybind.Trigger))
|| (grabbityState == ControlOptions.WIPGrabbityButton.Grab && (keybind == MagPalmControlsConfig.Keybind.Grip)));
if (grabbityConflict)
{
return !hand.Grabbity_HoverSphere.gameObject.activeSelf;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ private void ConfigMagPalming(Transform hand)
// Is object in any magpalm slot
public bool ObjInPalmSlot(FVRQuickBeltSlot slot)
{
return (slot != null && (slot == QBList[HandSlots[0]] || slot == QBList[HandSlots[1]]));
return slot != null && (slot == QBList[HandSlots[0]] || slot == QBList[HandSlots[1]]);
}

public bool IsSpecificPalmSlotEmpty(FVRViveHand hand)
{
var qbSlot = hand.IsThisTheRightHand ? QBList[HandSlots[0]] : QBList[HandSlots[1]];

return (qbSlot.CurObject == null);
return qbSlot.CurObject == null;
}

public FVRViveHand GetHandFromSlot(FVRQuickBeltSlot slot)
Expand Down
File renamed without changes.
14 changes: 8 additions & 6 deletions BetterHands/Plugin.cs → src/BetterHands/Plugin.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
using BetterHands.Configs;
using BepInEx;
using BetterHands.Configs;
using BetterHands.Customization;
using BetterHands.MagPalming;
using Deli.Setup;
using FistVR;
using Sodalite.Api;
using System;
using System.Linq;
using UnityEngine;

namespace BetterHands
{
public class Plugin : DeliBehaviour
[BepInPlugin("maiq.BetterHands", "BetterHands", "1.4.0")]
[BepInDependency("nrgill28.Sodalite")]
[BepInProcess("h3vr.exe")]
public class Plugin : BaseUnityPlugin
{
private readonly RootConfig _config;

Expand Down Expand Up @@ -62,7 +64,7 @@ private void OnDestroy()
private void ScoreSubmissionManager()
{
var cfg = _config.zCheat;
if (_config.MagPalm.Enable.Value && cfg.CursedPalms.Value || cfg.SizeLimit.Value > FVRPhysicalObject.FVRPhysicalObjectSize.Medium)
if ((_config.MagPalm.Enable.Value && cfg.CursedPalms.Value) || cfg.SizeLimit.Value > FVRPhysicalObject.FVRPhysicalObjectSize.Medium)
{
Logger.LogDebug("TNH scoring is disabled");
_leaderboardLock ??= LeaderboardAPI.GetLeaderboardDisableLock();
Expand Down Expand Up @@ -113,7 +115,7 @@ public static GameObject GetControllerFrom(FVRViveHand hand)
hand.Display_Controller_WMR
};

var geo = controllerGeos.FirstOrDefault(g => g.activeSelf);
var geo = Array.Find(controllerGeos, g => g.activeSelf);

return geo ?? hand.Display_Controller;
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions thunderstore/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
TEMP/
BetterHands.zip
Binary file added thunderstore/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions thunderstore/make_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
export TS_DIR="$(dirname "${BASH_SOURCE[0]}")"
export VERSION=$(git describe --tags --abbrev=0 | sed -n 's/v\(.\+\)/\1/p')
cd $TS_DIR

# Delete the existing build if it exists
rm BetterHands.zip

# Create our temp folders
mkdir -p TEMP/

# Copy the files into them
cp manifest.json TEMP/manifest.json
cp icon.png TEMP/icon.png
cp ../README.md TEMP/README.md
cp ../src/BetterHands/bin/Release/net35/BetterHands.dll TEMP/BetterHands.dll

# Modify the version number
sed -i "s/{VERSION}/$VERSION/g" TEMP/manifest.json

# Zip the folder
cd TEMP
zip -9r ../BetterHands.zip *

# Delete the temp dir
cd ..
rm -r TEMP
9 changes: 9 additions & 0 deletions thunderstore/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "BetterHands",
"version_number": "1.4.0",
"dependencies": [
"nrgill28-Sodalite-1.0.0"
],
"description": "Adds mag palming and controller color customization.",
"website_url": "https://github.com/Maiq-The-Dude/BetterHands"
}

0 comments on commit 7e72829

Please sign in to comment.