Added a lot of features (see description)
Added infinite jetpack, upgrade plot on buy, override max slot, change time multiplier
This commit is contained in:
@@ -26,14 +26,15 @@ namespace SlimeRanger.Hacks
|
|||||||
{
|
{
|
||||||
pos += -tpp.transform.right * speed * Time.deltaTime;
|
pos += -tpp.transform.right * speed * Time.deltaTime;
|
||||||
}
|
}
|
||||||
if (Input.GetKey(KeyCode.Keypad8))
|
if (Input.GetKey(KeyCode.Space))
|
||||||
{
|
{
|
||||||
pos += tpp.transform.up * speed * Time.deltaTime;
|
pos += tpp.transform.up * speed * Time.deltaTime;
|
||||||
}
|
}
|
||||||
if (Input.GetKey(KeyCode.Keypad2))
|
if (Input.GetKey(KeyCode.LeftShift))
|
||||||
{
|
{
|
||||||
pos += -tpp.transform.up * speed * Time.deltaTime;
|
pos += -tpp.transform.up * speed * Time.deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
Misc.SetPlayerPosition(pos);
|
Misc.SetPlayerPosition(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ namespace SlimeRanger.Hacks
|
|||||||
StateHelpers.GetPlayerState().AddCurrency(amount, type);
|
StateHelpers.GetPlayerState().AddCurrency(amount, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddKey()
|
public static void AddKey()
|
||||||
{
|
{
|
||||||
StateHelpers.GetPlayerState().AddKey();
|
StateHelpers.GetPlayerState().AddKey();
|
||||||
}
|
}
|
||||||
@@ -62,5 +63,6 @@ namespace SlimeRanger.Hacks
|
|||||||
TeleportablePlayer tpp = UnityEngine.Object.FindObjectOfType<TeleportablePlayer>();
|
TeleportablePlayer tpp = UnityEngine.Object.FindObjectOfType<TeleportablePlayer>();
|
||||||
tpp.playerEventHandler.Position.Set(position);
|
tpp.playerEventHandler.Position.Set(position);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,30 @@ namespace SlimeRanger.Hacks
|
|||||||
{
|
{
|
||||||
StateHelpers.GetPlayerState().AddUpgrade(up);
|
StateHelpers.GetPlayerState().AddUpgrade(up);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProgressDirector progressDirector = UnityEngine.Object.FindObjectOfType<ProgressDirector>();
|
||||||
|
foreach (ProgressDirector.ProgressType pt in Enum.GetValues(typeof(ProgressDirector.ProgressType)))
|
||||||
|
{
|
||||||
|
progressDirector.AddProgress(pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Gadget.Id id in Enum.GetValues(typeof(Gadget.Id)))
|
||||||
|
{
|
||||||
|
SRSingleton<SceneContext>.Instance.GadgetDirector.AddBlueprint(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
progressDirector.AddProgress(ProgressDirector.ProgressType.CORPORATE_PARTNER);
|
||||||
|
CorporatePartnerUI corporatePartnerUI = UnityEngine.Object.FindObjectOfType<CorporatePartnerUI>();
|
||||||
|
corporatePartnerUI.RebuildUI();
|
||||||
|
corporatePartnerUI.PlayPurchaseFX();
|
||||||
|
SRSingleton<SceneContext>.Instance.PediaDirector.UnlockWithoutPopup(PediaDirector.Id.CHROMA);
|
||||||
|
SRSingleton<SceneContext>.Instance.PediaDirector.UnlockWithoutPopup(PediaDirector.Id.SLIME_TOYS);
|
||||||
|
|
||||||
|
PediaDirector pediaDirector = UnityEngine.Object.FindObjectOfType<PediaDirector>();
|
||||||
|
foreach (PediaDirector.Id id in Enum.GetValues(typeof(PediaDirector.Id)))
|
||||||
|
{
|
||||||
|
pediaDirector.Unlock(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ using HarmonyLib;
|
|||||||
using SlimeRanger.Settings;
|
using SlimeRanger.Settings;
|
||||||
using SlimeRanger.Helpers;
|
using SlimeRanger.Helpers;
|
||||||
using System.Runtime;
|
using System.Runtime;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace SlimeRanger.Hooks
|
namespace SlimeRanger.Hooks
|
||||||
@@ -26,6 +28,21 @@ namespace SlimeRanger.Hooks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(GordoDisplayOnMap))]
|
||||||
|
[HarmonyPatch(nameof(GordoDisplayOnMap.ShowOnMap))] //annotation boiler plate to tell Harmony what to patch. Refer to docs.
|
||||||
|
static class GordoDisplayOnMap_ShowOnMap
|
||||||
|
{
|
||||||
|
static void Postfix(ref bool __result)
|
||||||
|
{
|
||||||
|
if (Settings.Settings.map_reveal)
|
||||||
|
{
|
||||||
|
__result = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Used to delete the fog
|
// Used to delete the fog
|
||||||
[HarmonyPatch(typeof(PlayerState))]
|
[HarmonyPatch(typeof(PlayerState))]
|
||||||
[HarmonyPatch(nameof(PlayerState.HasUnlockedMap))] //annotation boiler plate to tell Harmony what to patch. Refer to docs.
|
[HarmonyPatch(nameof(PlayerState.HasUnlockedMap))] //annotation boiler plate to tell Harmony what to patch. Refer to docs.
|
||||||
@@ -85,7 +102,7 @@ namespace SlimeRanger.Hooks
|
|||||||
|
|
||||||
[HarmonyPatch(typeof(EnergyJetpack))]
|
[HarmonyPatch(typeof(EnergyJetpack))]
|
||||||
[HarmonyPatch("CanStart_Jetpack")] //annotation boiler plate to tell Harmony what to patch. Refer to docs.
|
[HarmonyPatch("CanStart_Jetpack")] //annotation boiler plate to tell Harmony what to patch. Refer to docs.
|
||||||
static class PlayerState_CanStart_Jetpack
|
static class EnergyJetpack_CanStart_Jetpack
|
||||||
{
|
{
|
||||||
static void Postfix(ref bool __result)
|
static void Postfix(ref bool __result)
|
||||||
{
|
{
|
||||||
@@ -96,5 +113,75 @@ namespace SlimeRanger.Hooks
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(EnergyJetpack))]
|
||||||
|
[HarmonyPatch("DownwardExtraGravity")] //annotation boiler plate to tell Harmony what to patch. Refer to docs.
|
||||||
|
static class EnergyJetpack_DownwardExtraGravity
|
||||||
|
{
|
||||||
|
static void Prefix(ref float y, ref float yVel)
|
||||||
|
{
|
||||||
|
if (Settings.Settings.infinite_jetpack)
|
||||||
|
{
|
||||||
|
yVel = 0f;
|
||||||
|
y = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(LandPlotUI))]
|
||||||
|
[HarmonyPatch("BuyPlot")] //annotation boiler plate to tell Harmony what to patch. Refer to docs.
|
||||||
|
static class LandPlotUI_BuyPlot
|
||||||
|
{
|
||||||
|
static void Prefix(ref LandPlotUI.PlotPurchaseItem plot)
|
||||||
|
{
|
||||||
|
if (Settings.Settings.max_plot)
|
||||||
|
{
|
||||||
|
Settings.Settings.plot = plot;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(LandPlotUI))]
|
||||||
|
[HarmonyPatch("BuyPlot")] //annotation boiler plate to tell Harmony what to patch. Refer to docs.
|
||||||
|
static class LandPlotUI_BuyPlot_post
|
||||||
|
{
|
||||||
|
static void Postfix(ref bool __result)
|
||||||
|
{
|
||||||
|
if (__result == true && Settings.Settings.plot != null && Settings.Settings.max_plot)
|
||||||
|
{
|
||||||
|
Settings.Settings.plot.plotPrefab.gameObject.SetActive(true);
|
||||||
|
|
||||||
|
LandPlot landPlot = UnityEngine.Object.FindObjectOfType<LandPlot>();
|
||||||
|
|
||||||
|
foreach (LandPlot.Upgrade upgrade in Enum.GetValues(typeof(LandPlot.Upgrade)))
|
||||||
|
{
|
||||||
|
if (upgrade == LandPlot.Upgrade.SOLAR_SHIELD) //yeah nah we don't want solar shield, most of the slimes don't need that
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
landPlot.AddUpgrade(upgrade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(AmmoModel))]
|
||||||
|
[HarmonyPatch(nameof(AmmoModel.GetSlotMaxCount))] //annotation boiler plate to tell Harmony what to patch. Refer to docs.
|
||||||
|
static class AmmoModel_GetSlotMaxCount
|
||||||
|
{
|
||||||
|
static void Postfix(ref int __result)
|
||||||
|
{
|
||||||
|
if (Settings.Settings.max_slot_override)
|
||||||
|
{
|
||||||
|
__result = (int)Settings.Settings.max_slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
30
Plugin.cs
30
Plugin.cs
@@ -31,8 +31,19 @@ namespace SlimeRanger
|
|||||||
|
|
||||||
if (Settings.Settings.fly)
|
if (Settings.Settings.fly)
|
||||||
{
|
{
|
||||||
|
Settings.Settings.need_to_restore_gravity = true;
|
||||||
|
|
||||||
|
Physics.set_gravity_Injected(ref Settings.Settings.zero_gravity);
|
||||||
Hacks.Misc.Fly(Settings.Settings.fly_speed);
|
Hacks.Misc.Fly(Settings.Settings.fly_speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Settings.Settings.fly && Settings.Settings.need_to_restore_gravity)
|
||||||
|
{
|
||||||
|
Settings.Settings.need_to_restore_gravity = false;
|
||||||
|
Physics.set_gravity_Injected(ref Settings.Settings.original_gravity);
|
||||||
|
}
|
||||||
|
|
||||||
|
Time.timeScale = (float)Settings.Settings.time_multiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGUI()
|
private void OnGUI()
|
||||||
@@ -56,6 +67,13 @@ namespace SlimeRanger
|
|||||||
fontStyle = FontStyle.Bold
|
fontStyle = FontStyle.Bold
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GUIStyle Statestoggle_smol;
|
||||||
|
Statestoggle_smol = new GUIStyle(GUI.skin.toggle)
|
||||||
|
{
|
||||||
|
fontSize = 10,
|
||||||
|
fontStyle = FontStyle.Bold
|
||||||
|
};
|
||||||
|
|
||||||
GUI.contentColor = Color.cyan;
|
GUI.contentColor = Color.cyan;
|
||||||
|
|
||||||
GUI.Label(new Rect(200, Settings.Settings.y, 200, 50), "SlimeRanger", StatesLabel); //Titre du menu
|
GUI.Label(new Rect(200, Settings.Settings.y, 200, 50), "SlimeRanger", StatesLabel); //Titre du menu
|
||||||
@@ -124,6 +142,18 @@ namespace SlimeRanger
|
|||||||
Logger.LogInfo("Teleported to position : " + Settings.Settings.savedposition.ToString());
|
Logger.LogInfo("Teleported to position : " + Settings.Settings.savedposition.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Settings.Settings.infinite_jetpack = GUI.Toggle(new Rect(350, Settings.Settings.y + 235, 130, 25), Settings.Settings.infinite_jetpack, "∞ jetpack", Statestoggle);
|
||||||
|
Settings.Settings.max_plot = GUI.Toggle(new Rect(350, Settings.Settings.y + 265, 130, 25), Settings.Settings.max_plot, "Upgrade plot on buy", Statestoggle_smol);
|
||||||
|
|
||||||
|
Settings.Settings.max_slot_override = GUI.Toggle(new Rect(350, Settings.Settings.y + 290, 130, 25), Settings.Settings.max_slot_override, "Override max slot", Statestoggle_smol);
|
||||||
|
GUI.Label(new Rect(350, Settings.Settings.y + 310, 200, 30), "Max : ");
|
||||||
|
Settings.Settings.max_slot = GUI.HorizontalSlider(new Rect(350, Settings.Settings.y + 330, 100, 10), Settings.Settings.max_slot, 0f, 1000f);
|
||||||
|
GUI.Label(new Rect(455, Settings.Settings.y + 325, 100, 30), ((int)Settings.Settings.max_slot).ToString());
|
||||||
|
|
||||||
|
GUI.Label(new Rect(500, Settings.Settings.y + 50, 200, 30), "Time multiplier :");
|
||||||
|
Settings.Settings.time_multiplier = GUI.HorizontalSlider(new Rect(500, Settings.Settings.y + 70, 100, 10), Settings.Settings.time_multiplier, 1f, 100f);
|
||||||
|
GUI.Label(new Rect(605, Settings.Settings.y + 65, 100, 30), ((int)Settings.Settings.time_multiplier).ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,15 +11,26 @@ namespace SlimeRanger.Settings
|
|||||||
public static float y = 0;
|
public static float y = 0;
|
||||||
|
|
||||||
public static Vector3 savedposition;
|
public static Vector3 savedposition;
|
||||||
|
public static Vector3 original_gravity = new Vector3(0.0f, -9.8f, 0.0f);
|
||||||
|
public static Vector3 zero_gravity = new Vector3(0f, 0f, 0f);
|
||||||
|
|
||||||
|
public static LandPlotUI.PlotPurchaseItem plot;
|
||||||
|
|
||||||
|
public static bool need_to_restore_gravity = false;
|
||||||
|
|
||||||
|
public static bool max_plot = false;
|
||||||
public static bool map_reveal = false;
|
public static bool map_reveal = false;
|
||||||
|
public static bool max_slot_override = false;
|
||||||
public static bool godmode = false;
|
public static bool godmode = false;
|
||||||
public static bool no_rad = false;
|
public static bool no_rad = false;
|
||||||
public static bool infinite_energy = false;
|
public static bool infinite_energy = false;
|
||||||
|
public static bool infinite_jetpack = false;
|
||||||
public static bool fly = false;
|
public static bool fly = false;
|
||||||
public static float fly_speed = 50f;
|
public static float fly_speed = 50f;
|
||||||
public static float energy_to_set = 0f;
|
public static float energy_to_set = 0f;
|
||||||
public static float health_to_set = 0f;
|
public static float health_to_set = 0f;
|
||||||
public static float money_to_add = 0f;
|
public static float money_to_add = 0f;
|
||||||
|
public static float max_slot = 0f;
|
||||||
|
public static float time_multiplier = 1f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,14 @@
|
|||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
<NoWarn>1701;1702;AD0001</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
|
<NoWarn>1701;1702;AD0001</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" />
|
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" />
|
||||||
<PackageReference Include="BepInEx.Unity" Version="6.0.0-*" IncludeAssets="compile" />
|
<PackageReference Include="BepInEx.Unity" Version="6.0.0-*" IncludeAssets="compile" />
|
||||||
|
|||||||
Reference in New Issue
Block a user