grasscutter
This commit is contained in:
parent
c13e1ccc0e
commit
18f4b57fb5
32
Live/CWX_GrassCutter/CWX_GrassCutter.csproj
Normal file
32
Live/CWX_GrassCutter/CWX_GrassCutter.csproj
Normal file
@ -0,0 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>CWX-GrassCutter</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Aki.Reflection">
|
||||
<HintPath>..\..\..\Shared\Aki.Reflection.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>..\..\..\Shared\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>..\..\..\Shared\BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Comfort">
|
||||
<HintPath>..\..\..\Shared\Comfort.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\..\..\Shared\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>..\..\..\Shared\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>..\..\..\Shared\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
13
Live/CWX_GrassCutter/GrassCutter.cs
Normal file
13
Live/CWX_GrassCutter/GrassCutter.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using BepInEx;
|
||||
|
||||
namespace CWX_GrassCutter
|
||||
{
|
||||
[BepInPlugin("com.CWX.GrassCutter", "CWX-GrassCutter", "1.0.0")]
|
||||
public class GrassCutter : BaseUnityPlugin
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
new GrassCutterPatch().Enable();
|
||||
}
|
||||
}
|
||||
}
|
22
Live/CWX_GrassCutter/GrassCutterPatch.cs
Normal file
22
Live/CWX_GrassCutter/GrassCutterPatch.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Aki.Reflection.Patching;
|
||||
using EFT;
|
||||
using System.Reflection;
|
||||
|
||||
namespace CWX_GrassCutter
|
||||
{
|
||||
public class GrassCutterPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return typeof(GameWorld).GetMethod("OnGameStarted", BindingFlags.Public | BindingFlags.Instance);
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
private static void PatchPostFix()
|
||||
{
|
||||
GrassCutterScript grassCutter = new GrassCutterScript();
|
||||
|
||||
grassCutter.Start();
|
||||
}
|
||||
}
|
||||
}
|
24
Live/CWX_GrassCutter/GrassCutterScript.cs
Normal file
24
Live/CWX_GrassCutter/GrassCutterScript.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using GPUInstancer;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace CWX_GrassCutter
|
||||
{
|
||||
public class GrassCutterScript
|
||||
{
|
||||
public void Start()
|
||||
{
|
||||
List<GPUInstancerDetailManager> allGrass = GameObject.FindObjectsOfType<GPUInstancerDetailManager>().ToList();
|
||||
GameObject streetsGrass = GameObject.Find("GrassPrefabManager");
|
||||
|
||||
foreach (var grass in allGrass)
|
||||
{
|
||||
grass.enabled = false;
|
||||
}
|
||||
|
||||
streetsGrass?.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
@ -17,7 +17,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CWX_ColourAdderPrePatch", "
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CWX_ColourAdderPatcher", "CWX_ColourAdderPatcher\CWX_ColourAdderPatcher.csproj", "{6D696C6A-011B-4D53-8D97-D62105B20E0E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CWX_AlarmChanger", "CWX_AlarmChanger\CWX_AlarmChanger.csproj", "{518D3743-AE98-41CD-8A6A-7B537C3FC293}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CWX_AlarmChanger", "CWX_AlarmChanger\CWX_AlarmChanger.csproj", "{518D3743-AE98-41CD-8A6A-7B537C3FC293}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "test-layout", "test-layout\test-layout.csproj", "{CBDE7880-21AE-45AC-B216-D1061FD6A8A0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CWX_GrassCutter", "CWX_GrassCutter\CWX_GrassCutter.csproj", "{CC095831-11F9-4429-9A5C-BF60EF451E96}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -57,6 +61,14 @@ Global
|
||||
{518D3743-AE98-41CD-8A6A-7B537C3FC293}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{518D3743-AE98-41CD-8A6A-7B537C3FC293}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{518D3743-AE98-41CD-8A6A-7B537C3FC293}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CBDE7880-21AE-45AC-B216-D1061FD6A8A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CBDE7880-21AE-45AC-B216-D1061FD6A8A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CBDE7880-21AE-45AC-B216-D1061FD6A8A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CBDE7880-21AE-45AC-B216-D1061FD6A8A0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CC095831-11F9-4429-9A5C-BF60EF451E96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CC095831-11F9-4429-9A5C-BF60EF451E96}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CC095831-11F9-4429-9A5C-BF60EF451E96}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CC095831-11F9-4429-9A5C-BF60EF451E96}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
13
Live/test-layout/Class1.cs
Normal file
13
Live/test-layout/Class1.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using BepInEx;
|
||||
|
||||
namespace test_layout
|
||||
{
|
||||
[BepInPlugin("com.test_layout", "test_layout", "1.0.0")]
|
||||
public class test_layout : BaseUnityPlugin
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
new test_layoutPatch().Enable();
|
||||
}
|
||||
}
|
||||
}
|
48
Live/test-layout/patch.cs
Normal file
48
Live/test-layout/patch.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using Aki.Reflection.Patching;
|
||||
using EFT.InventoryLogic;
|
||||
using EFT.UI.DragAndDrop;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace test_layout
|
||||
{
|
||||
public class test_layoutPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
Debug.LogError("fucker");
|
||||
var methods = getMethods();
|
||||
|
||||
foreach (var method in methods)
|
||||
{
|
||||
Debug.LogError(method.Name);
|
||||
}
|
||||
|
||||
return typeof(ContainedGridsView).GetMethod("CreateGrids", BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
}
|
||||
|
||||
public MethodInfo[] getMethods()
|
||||
{
|
||||
return typeof(ContainedGridsView).GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
}
|
||||
|
||||
[PatchPrefix]
|
||||
private static bool PatchPrefix(ref ContainedGridsView __result, Item item, ContainedGridsView containedGridsTemplate)
|
||||
{
|
||||
Debug.LogError(item.TemplateId);
|
||||
|
||||
if (item.TemplateId == "5648a69d4bdc2ded0b8b457b")
|
||||
{
|
||||
foreach (var grid in containedGridsTemplate.GridViews)
|
||||
{
|
||||
Debug.LogError(grid.transform.ToString());
|
||||
}
|
||||
|
||||
__result = Object.Instantiate(containedGridsTemplate);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
29
Live/test-layout/test-layout.csproj
Normal file
29
Live/test-layout/test-layout.csproj
Normal file
@ -0,0 +1,29 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<RootNamespace>test_layout</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Aki.Reflection">
|
||||
<HintPath>..\..\..\Shared\Aki.Reflection.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>..\..\..\Shared\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>..\..\..\Shared\BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Comfort">
|
||||
<HintPath>..\..\..\Shared\Comfort.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>..\..\..\Shared\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>..\..\..\Shared\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Loading…
x
Reference in New Issue
Block a user