Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Commit

Permalink
more commits pogthat
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsNovaHere committed Jul 7, 2019
1 parent 2406dec commit 8f86400
Show file tree
Hide file tree
Showing 29 changed files with 685 additions and 133 deletions.
66 changes: 44 additions & 22 deletions NovasFuckery/FuckeryMods.cs
Original file line number Diff line number Diff line change
@@ -1,47 +1,69 @@
using BS_Utils.Gameplay;
using NovasFuckery.MonoBehaviours;
using System;
using BS_Utils.Gameplay;
using BS_Utils.Utilities;
using NovasFuckery.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NovasFuckery.Mods;
using UnityEngine;
using BS_Utils.Utilities;
using System.Collections;
using Harmony;
using System.Reflection;
using Object = UnityEngine.Object;
using UnityEngine.XR;

namespace NovasFuckery
{
class FuckeryMods
{

internal static class FuckeryMods {
internal static BeatmapObjectSpawnController SpawnController;
internal static StandardLevelGameplayManager PauseManager;
internal static SaberManager SaberManager;

internal static void SetupMods () {
bool disableScore = false;

BS_Utils.Plugin.LevelDidFinishEvent += Plugin_LevelDidFinishEvent;

SpawnController = Resources.FindObjectsOfTypeAll<BeatmapObjectSpawnController>().First();
SpawnController.noteWasMissedEvent += FuckeryMods_noteWasMissedEvent;

PauseManager = Resources.FindObjectsOfTypeAll<StandardLevelGameplayManager>().First();
SaberManager = Resources.FindObjectsOfTypeAll<SaberManager>().First();

if (FuckeryUI.OneAtATime.Enabled)
OAAT();

if (FuckeryUI.InvisibleSabers.Enabled)
InvisbleSabers();

if (FuckeryUI.MegaJump.Enabled ||
FuckeryUI.RandomPositionX.Enabled ||
FuckeryUI.RandomPositionY.Enabled ||
FuckeryUI.RandomDirection.Enabled ||
FuckeryUI.RandomColors.Enabled ||
FuckeryUI.RandomBombs.Enabled ||
FuckeryUI.InvisibleSabers.Enabled ||
FuckeryUI.OneAtATime.Enabled) {

if (FuckeryUI.ModsEnabled()) {
disableScore = true;
}

if (disableScore) {
ScoreSubmission.DisableSubmission("Nova's Fuckery");
}
}

private static void Plugin_LevelDidFinishEvent(StandardLevelScenesTransitionSetupDataSO levelScenesTransitionSetupDataSO, LevelCompletionResults levelCompletionResults) {
SpawnController.noteWasMissedEvent -= FuckeryMods_noteWasMissedEvent;
SpawnController = null;

PauseManager = null;
SaberManager = null;

BS_Utils.Plugin.LevelDidFinishEvent -= Plugin_LevelDidFinishEvent;
}

private static void FuckeryMods_noteWasMissedEvent(BeatmapObjectSpawnController arg1, NoteController arg2) {
if (FuckeryUI.PauseOnMiss.Enabled) {
if (PauseManager) {
PauseManager.Pause();
}
}

if (FuckeryUI.AYYYYYOnMiss.Enabled) {
Plugin.MissSounds[UnityEngine.Random.Range(0, Plugin.MissSounds.Count - 1)].Play();
}
}

private static void InvisbleSabers () {
Resources.FindObjectsOfTypeAll<PlayerController>().First().gameObject.AddComponent<InvisibleSabers>();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using BS_Utils.Utilities;
using Harmony;
using NovasFuckery.Util;

namespace NovasFuckery.HarmonyPatches
{
[HarmonyPatch(typeof(BeatmapObjectSpawnController))]
[HarmonyPatch("BeatmapObjectSpawnCallback", MethodType.Normal)]
class BeatmapObjectSpawnControllerCallback
{
static void Prefix (ref BeatmapObjectData beatmapObjectData) {
if (beatmapObjectData.beatmapObjectType == BeatmapObjectType.Note) {
var noteData = (NoteData) beatmapObjectData;

if (FuckeryUI.RandomEverything.Enabled) {
var layer = (NoteLineLayer) UnityEngine.Random.Range(0, 3);
noteData.SetProperty("noteLineLayer", layer);
noteData.SetProperty("startNoteLineLayer", layer);

noteData.SetProperty("lineIndex", UnityEngine.Random.Range(0, 4));

switch (UnityEngine.Random.Range(0, 3)) {
case 0:
break;
case 1:
noteData.SwitchNoteType();
break;
case 2:
noteData.SetProperty("noteType", NoteType.Bomb);
break;
}
return;
}

if (FuckeryUI.RandomPositionY.Enabled) {
var layer = (NoteLineLayer) UnityEngine.Random.Range(0, 3);
noteData.SetProperty("noteLineLayer", layer);
noteData.SetProperty("startNoteLineLayer", layer);
}

if (FuckeryUI.RandomPositionX.Enabled) {
noteData.SetProperty("lineIndex", UnityEngine.Random.Range(0, 4));
}

if (FuckeryUI.RandomDirection.Enabled && noteData.noteType.IsBasicNote()) {
noteData.SetProperty("cutDirection", (NoteCutDirection) UnityEngine.Random.Range(1, 7));
}

if(FuckeryUI.RandomColors.Enabled && FuckeryUI.RandomBombs.Enabled) {
switch(UnityEngine.Random.Range(0, 3)) {
case 0:
break;
case 1:
noteData.SwitchNoteType();
break;
case 2:
noteData.SetProperty("noteType", NoteType.Bomb);
break;
}
} else if (FuckeryUI.RandomColors.Enabled) {
if(UnityEngine.Random.Range(0, 2) == 1) {
noteData.SwitchNoteType();
}
} else if (FuckeryUI.RandomBombs.Enabled) {
if (UnityEngine.Random.Range(0, 2) == 1) {
noteData.SetProperty("noteType", NoteType.Bomb);
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
using Harmony;
using NovasFuckery.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NovasFuckery.HarmonyPatches
{
[HarmonyPatch(typeof(BeatmapObjectSpawnController))]
[HarmonyPatch("Init", MethodType.Normal)]
class BeatmapObjectSpawnControllerInit
{
static void Prefix (BeatmapObjectSpawnController __instance, float beatsPerMinute, int noteLinesCount, ref float noteJumpMovementSpeed, int noteJumpStartBeatOffset, bool disappearingArrows, bool ghostNotes) {
static void Prefix (BeatmapObjectSpawnController __instance, float beatsPerMinute, int noteLinesCount, ref float noteJumpMovementSpeed, float noteJumpStartBeatOffset, bool disappearingArrows, bool ghostNotes) {
if (FuckeryUI.NJSFix.Enabled) noteJumpMovementSpeed *= .8f;
}
}
Expand Down
10 changes: 4 additions & 6 deletions NovasFuckery/HarmonyPatches/NoteControllerInit.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
using Harmony;
using NovasFuckery.MonoBehaviours;
using NovasFuckery.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using BS_Utils.Utilities;

namespace NovasFuckery.HarmonyPatches
{
Expand All @@ -22,6 +16,10 @@ static void Prefix (ref NoteData noteData, ref Vector3 moveStartPos, ref Vector3
moveStartPos.y += UnityEngine.Random.Range(-4, 4);
moveEndPos.x *= FuckeryUI.Mirror.Enabled ? -10 : 10;
}

if (FuckeryUI.WideNotes.Enabled) {
__instance.gameObject.transform.localScale = new Vector3(2, 1, 1);
}
}
}
}
2 changes: 1 addition & 1 deletion NovasFuckery/Mods/InvisibleSabers.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections;
using UnityEngine;

namespace NovasFuckery.MonoBehaviours
namespace NovasFuckery.Mods
{
class InvisibleSabers : MonoBehaviour
{
Expand Down
47 changes: 24 additions & 23 deletions NovasFuckery/Mods/OneAtATime.cs
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
using UnityEngine;
using BS_Utils.Utilities;
using BS_Utils.Utilities;
using UnityEngine;
using SaberType = Saber.SaberType;

namespace NovasFuckery.MonoBehaviours
namespace NovasFuckery.Mods
{
class OneAtATime : MonoBehaviour

internal class OneAtATime : MonoBehaviour
{
PlayerController player;
VRController controllerL;
VRController controllerR;
private PlayerController _player;
private VRController _controllerL;
private VRController _controllerR;

void Start () {
player = GetComponent<PlayerController>();
player.rightSaber.gameObject.SetActive(false);
private void Start () {
_player = GetComponent<PlayerController>();
_player.rightSaber.gameObject.SetActive(false);

controllerL = (VRController) player.leftSaber.GetField("_vrController");
controllerR = (VRController) player.rightSaber.GetField("_vrController");
_controllerL = (VRController) _player.leftSaber.GetField("_vrController");
_controllerR = (VRController) _player.rightSaber.GetField("_vrController");
}

void Update () {
if (controllerL.triggerValue > .5f && controllerR.triggerValue > .5f) return;
private void Update () {
if (_controllerL.triggerValue > .5f && _controllerR.triggerValue > .5f) return;

if (controllerL.triggerValue > .5f) {
if (player.rightSaber.gameObject.activeSelf) {
player.leftSaber.gameObject.SetActive(true);
player.rightSaber.gameObject.SetActive(false);
if (_controllerL.triggerValue > .5f) {
if (_player.rightSaber.gameObject.activeSelf) {
_player.leftSaber.gameObject.SetActive(true);
_player.rightSaber.gameObject.SetActive(false);
}
} else if(controllerR.triggerValue > .5f) {
if (player.leftSaber.gameObject.activeSelf) {
player.rightSaber.gameObject.SetActive(true);
player.leftSaber.gameObject.SetActive(false);
} else if(_controllerR.triggerValue > .5f) {
if (_player.leftSaber.gameObject.activeSelf) {
_player.rightSaber.gameObject.SetActive(true);
_player.leftSaber.gameObject.SetActive(false);
}
}
}

static SaberType GetOpposite(SaberType saberType) {
private static SaberType GetOpposite(SaberType saberType) {
if (saberType == SaberType.SaberA)
return SaberType.SaberB;

Expand Down
Loading

0 comments on commit 8f86400

Please sign in to comment.