mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
[DropPropTweak] Initial release
This commit is contained in:
parent
db9d5a24b6
commit
a4781c18e7
5 changed files with 129 additions and 0 deletions
11
DropPropTweak/DropPropTweak.csproj
Normal file
11
DropPropTweak/DropPropTweak.csproj
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net48</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="TheClapper">
|
||||||
|
<HintPath>..\.ManagedLibs\TheClapper.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
49
DropPropTweak/Main.cs
Normal file
49
DropPropTweak/Main.cs
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using ABI_RC.Core.Player;
|
||||||
|
using ABI_RC.Core.Util;
|
||||||
|
using HarmonyLib;
|
||||||
|
using MelonLoader;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NAK.DropPropTweak;
|
||||||
|
|
||||||
|
public class DropPropTweakMod : MelonMod
|
||||||
|
{
|
||||||
|
public override void OnInitializeMelon()
|
||||||
|
{
|
||||||
|
HarmonyInstance.Patch( // make drop prop actually usable
|
||||||
|
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.DropProp),
|
||||||
|
BindingFlags.Public | BindingFlags.Instance),
|
||||||
|
new HarmonyMethod(typeof(DropPropTweakMod).GetMethod(nameof(OnDropProp),
|
||||||
|
BindingFlags.NonPublic | BindingFlags.Static))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool OnDropProp(string propGuid, ref PlayerSetup __instance)
|
||||||
|
{
|
||||||
|
Vector3 position = __instance.activeCam.transform.position + __instance.GetPlayerForward() * 1.5f; // 1f -> 1.5f
|
||||||
|
|
||||||
|
if (Physics.Raycast(position,
|
||||||
|
__instance.CharacterController.GetGravityDirection(), // align with gravity, not player up
|
||||||
|
out RaycastHit raycastHit, 4f, __instance.dropPlacementMask))
|
||||||
|
{
|
||||||
|
// native method passes false, so DropProp doesn't align with gravity :)
|
||||||
|
CVRSyncHelper.SpawnProp(propGuid, raycastHit.point.x, raycastHit.point.y, raycastHit.point.z, true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// unlike original, we will still spawn prop even if raycast fails, giving the method actual utility :3
|
||||||
|
|
||||||
|
// hack- we want to align with *our* rotation, not affecting gravity
|
||||||
|
Vector3 ogGravity = __instance.CharacterController.GetGravityDirection();
|
||||||
|
__instance.CharacterController.gravity = -__instance.transform.up; // align with our rotation
|
||||||
|
|
||||||
|
// spawn prop with useTargetLocationGravity false, so it pulls our gravity dir we've modified
|
||||||
|
CVRSyncHelper.SpawnProp(propGuid, position.x, position.y, position.z, false);
|
||||||
|
|
||||||
|
__instance.CharacterController.gravity = ogGravity; // restore gravity
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
32
DropPropTweak/Properties/AssemblyInfo.cs
Normal file
32
DropPropTweak/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
using NAK.DropPropTweak.Properties;
|
||||||
|
using MelonLoader;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
|
||||||
|
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
|
||||||
|
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
|
||||||
|
[assembly: AssemblyTitle(nameof(NAK.DropPropTweak))]
|
||||||
|
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
|
||||||
|
[assembly: AssemblyProduct(nameof(NAK.DropPropTweak))]
|
||||||
|
|
||||||
|
[assembly: MelonInfo(
|
||||||
|
typeof(NAK.DropPropTweak.DropPropTweakMod),
|
||||||
|
nameof(NAK.DropPropTweak),
|
||||||
|
AssemblyInfoParams.Version,
|
||||||
|
AssemblyInfoParams.Author,
|
||||||
|
downloadLink: "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/DropPropTweak"
|
||||||
|
)]
|
||||||
|
|
||||||
|
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||||
|
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
|
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||||
|
[assembly: MelonColor(255, 246, 25, 99)] // red-pink
|
||||||
|
[assembly: MelonAuthorColor(255, 158, 21, 32)] // red
|
||||||
|
[assembly: HarmonyDontPatchAll]
|
||||||
|
|
||||||
|
namespace NAK.DropPropTweak.Properties;
|
||||||
|
internal static class AssemblyInfoParams
|
||||||
|
{
|
||||||
|
public const string Version = "1.0.0";
|
||||||
|
public const string Author = "Exterrata & NotAKidoS";
|
||||||
|
}
|
14
DropPropTweak/README.md
Normal file
14
DropPropTweak/README.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# DropPropTweak
|
||||||
|
|
||||||
|
Gives the Drop Prop button more utility by allowing you to drop props in the air.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Here is the block of text where I tell you this mod is not affiliated with or endorsed by ABI.
|
||||||
|
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
|
||||||
|
|
||||||
|
> This mod is an independent creation not affiliated with, supported by, or approved by Alpha Blend Interactive.
|
||||||
|
|
||||||
|
> Use of this mod is done so at the user's own risk and the creator cannot be held responsible for any issues arising from its use.
|
||||||
|
|
||||||
|
> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive.
|
23
DropPropTweak/format.json
Normal file
23
DropPropTweak/format.json
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"_id": -1,
|
||||||
|
"name": "DropPropTweak",
|
||||||
|
"modversion": "1.0.0",
|
||||||
|
"gameversion": "2024r175",
|
||||||
|
"loaderversion": "0.6.1",
|
||||||
|
"modtype": "Mod",
|
||||||
|
"author": "NotAKidoS",
|
||||||
|
"description": "Gives the Drop Prop button more utility by allowing you to drop props in the air.",
|
||||||
|
"searchtags": [
|
||||||
|
"prop",
|
||||||
|
"spawn",
|
||||||
|
"indicator",
|
||||||
|
"loading"
|
||||||
|
],
|
||||||
|
"requirements": [
|
||||||
|
"None"
|
||||||
|
],
|
||||||
|
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r34/DropPropTweak.dll",
|
||||||
|
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/DropPropTweak/",
|
||||||
|
"changelog": "- Initial Release",
|
||||||
|
"embedcolor": "#f61963"
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue