Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #19 from SynapseSL/v.2.3.3
Browse files Browse the repository at this point in the history
V.2.3.3
  • Loading branch information
GrafDimenzio authored Dec 27, 2020
2 parents bc35890 + 83528c0 commit 9aa0d46
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 20 deletions.
Binary file added Refs/UnityEngine.AnimationModule.dll
Binary file not shown.
66 changes: 50 additions & 16 deletions Synapse/Patches/SynapsePatches/AntiCheatPatch.cs
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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<Door>();
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<LiftDoor>();
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<Door>();
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;
}
}
}
}
4 changes: 2 additions & 2 deletions Synapse/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
[assembly: AssemblyVersion("2.3.3.0")]
[assembly: AssemblyFileVersion("2.3.3.0")]
4 changes: 4 additions & 0 deletions Synapse/Synapse.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Refs\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AnimationModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Refs\UnityEngine.AnimationModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Refs\UnityEngine.CoreModule.dll</HintPath>
Expand Down
4 changes: 2 additions & 2 deletions Synapse/SynapseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

0 comments on commit 9aa0d46

Please sign in to comment.