diff --git a/Refs/UnityEngine.AnimationModule.dll b/Refs/UnityEngine.AnimationModule.dll new file mode 100644 index 00000000..c5746578 Binary files /dev/null and b/Refs/UnityEngine.AnimationModule.dll differ diff --git a/Synapse/Patches/SynapsePatches/AntiCheatPatch.cs b/Synapse/Patches/SynapsePatches/AntiCheatPatch.cs index 7e4085bc..aaf1dd83 100644 --- a/Synapse/Patches/SynapsePatches/AntiCheatPatch.cs +++ b/Synapse/Patches/SynapsePatches/AntiCheatPatch.cs @@ -1,10 +1,12 @@ using System; using HarmonyLib; +using PlayableScps; +using Scp914; using UnityEngine; namespace Synapse.Patches.SynapsePatches { - [HarmonyPatch(typeof(PlayerMovementSync),nameof(PlayerMovementSync.AnticheatIsIntersecting))] + [HarmonyPatch(typeof(PlayerMovementSync), nameof(PlayerMovementSync.AnticheatIsIntersecting))] internal static class AntiCheatPatch { private static bool Prefix(PlayerMovementSync __instance, out bool __result, Vector3 pos) @@ -42,39 +44,71 @@ private static bool Prefix(PlayerMovementSync __instance, out bool __result, Vec var number = Physics.OverlapCapsuleNonAlloc(pos1, pos2, radius, PlayerMovementSync._sphereHits, PlayerMovementSync._r3CollidableSurfaces); - for(int i = 0; i < number; i++) + for (int i = 0; i < number; i++) { - PlayableScps.Scp096 scp; - if ((__instance._hub.characterClassManager.CurClass != RoleType.Scp106 || (PlayerMovementSync._sphereHits[i].gameObject.layer != 27 && PlayerMovementSync._sphereHits[i].gameObject.layer != 14)) && (PlayerMovementSync._sphereHits[i].gameObject.layer != 27 || (scp = (__instance._hub.scpsController.CurrentScp as PlayableScps.Scp096)) == null || !scp.Enraged)) - continue; + Scp096 scp; - if (PlayerMovementSync._sphereHits[i].gameObject.layer == 27) + if ((__instance._hub.characterClassManager.CurClass != RoleType.Scp106 || + ((PlayerMovementSync._sphereHits[i].gameObject.layer != 27 || + PlayerMovementSync._sphereHits[i].gameObject.CompareTag("LiftDoor")) && PlayerMovementSync._sphereHits[i].gameObject.layer != 14)) && (PlayerMovementSync._sphereHits[i].gameObject.layer != 27 || + (scp = (__instance._hub.scpsController.CurrentScp as Scp096)) == null || + !scp.Enraged || + PlayerMovementSync._sphereHits[i].gameObject.CompareTag("LiftDoor") || + PlayerMovementSync._sphereHits[i].gameObject.CompareTag("SCP914Door"))) { - Door componentInParent = PlayerMovementSync._sphereHits[i].GetComponentInParent(); - if (componentInParent != null && componentInParent.curCooldown > 0f && !componentInParent.isOpen) - continue; - } + if (PlayerMovementSync._sphereHits[i].gameObject.layer == 27) + { + if ((Scp914Machine.singleton.DoorMoving && PlayerMovementSync._sphereHits[i].gameObject.CompareTag("SCP914Door")) || PlayerMovementSync._sphereHits[i].gameObject.CompareTag("AnticheatIgnore")) + continue; + + if (PlayerMovementSync._sphereHits[i].gameObject.CompareTag("LiftDoor")) + { + LiftDoor componentInParent = PlayerMovementSync._sphereHits[i].gameObject.GetComponentInParent(); + if (componentInParent == null || componentInParent.Animator == null) + { + __result = false; + break; + } + + if (Time.fixedTime - componentInParent.Animator.GetFloat(Lift.LastChange) >= 0.9f && !componentInParent.Animator.GetBool(Lift.IsOpen)) + { + __result = false; + break; + } - __result = true; + continue; + } + else + { + Door componentInParent2 = PlayerMovementSync._sphereHits[i].GetComponentInParent(); + if (componentInParent2 != null && componentInParent2.curCooldown > 0f && !componentInParent2.isOpen) + { + continue; + } + } + } + __result = true; + break; + } } return false; } - catch(Exception e) + catch (Exception e) { - Synapse.Api.Logger.Get.Error($"Synapse-Api: AntiCheatPatch failed!!\n{e}\nStackTrace:\n{e.StackTrace}"); + Api.Logger.Get.Error($"Synapse-Api: AntiCheatPatch failed!!\n{e}\nStackTrace:\n{e.StackTrace}"); return true; } } } - [HarmonyPatch(typeof(PlayerMovementSync),nameof(PlayerMovementSync.AnticheatRaycast))] + [HarmonyPatch(typeof(PlayerMovementSync), nameof(PlayerMovementSync.AnticheatRaycast))] internal static class AntiCheatPatch2 { - private static void Prefix(PlayerMovementSync __instance,ref Vector3 offset) + private static void Prefix(PlayerMovementSync __instance, ref Vector3 offset) { var player = __instance.GetPlayer(); offset.y *= player.Scale.y; } } -} +} \ No newline at end of file diff --git a/Synapse/Properties/AssemblyInfo.cs b/Synapse/Properties/AssemblyInfo.cs index c49def3d..5e942282 100644 --- a/Synapse/Properties/AssemblyInfo.cs +++ b/Synapse/Properties/AssemblyInfo.cs @@ -5,5 +5,5 @@ [assembly: AssemblyCompany("Synapse-DevTeam")] [assembly: AssemblyProduct("Synapse")] [assembly: AssemblyCopyright("Copyright © Synapse-DevTeam 2020")] -[assembly: AssemblyVersion("2.3.2.0")] -[assembly: AssemblyFileVersion("2.3.2.0")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.3.0")] +[assembly: AssemblyFileVersion("2.3.3.0")] \ No newline at end of file diff --git a/Synapse/Synapse.csproj b/Synapse/Synapse.csproj index 52074ef0..340c6902 100644 --- a/Synapse/Synapse.csproj +++ b/Synapse/Synapse.csproj @@ -226,6 +226,10 @@ False ..\Refs\UnityEngine.dll + + False + ..\Refs\UnityEngine.AnimationModule.dll + False ..\Refs\UnityEngine.CoreModule.dll diff --git a/Synapse/SynapseController.cs b/Synapse/SynapseController.cs index 6993ff2f..639e6ca8 100644 --- a/Synapse/SynapseController.cs +++ b/Synapse/SynapseController.cs @@ -54,6 +54,6 @@ private void PatchMethods() public const int SynapseMajor = 2; public const int SynapseMinor = 3; - public const int SynapsePatch = 1; - public const string SynapseVersion = "2.3.2"; + public const int SynapsePatch = 3; + public const string SynapseVersion = "2.3.3"; }