/// <summary> /// Initializes a new instance of the <see cref="TryingNotToCryEventArgs"/> class. /// </summary> /// <param name="scp096"><inheritdoc cref="Scp096"/></param> /// <param name="player"><inheritdoc cref="Player"/></param> /// <param name="door"><inheritdoc cref="Door"/></param> /// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param> public TryingNotToCryEventArgs(Scp096 scp096, Player player, DoorVariant door, bool isAllowed = true) { Scp096 = scp096; Player = player; Door = door; IsAllowed = isAllowed; }
private void Start() { scpObject = this.gameObject; scpPlayer = Player.Get(scpObject); this096 = scpObject.GetComponent <PlayableScpsController>().CurrentScp as PlayableScps.Scp096; }
/// <summary> /// Initializes a new instance of the <see cref="StartPryingGateEventArgs"/> class. /// </summary> /// <param name="player"><inheritdoc cref="Player"/></param> /// <param name="scp096"><inheritdoc cref="Scp096"/></param> /// <param name="gate"><inheritdoc cref="Gate"/></param> /// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param> public StartPryingGateEventArgs(Scp096 scp096, Player player, PryableDoor gate, bool isAllowed = true) { Scp096 = scp096; Player = player; Gate = Door.Get(gate); IsAllowed = isAllowed; }
public override bool Check(Npc n, Player p) { PlayableScps.Scp096 scp = n.NPCPlayer.ReferenceHub.scpsController.CurrentScp as PlayableScps.Scp096; if (scp != null) { return(scp.Enraged && scp.HasTarget(p.ReferenceHub)); } return(false); }
/// <summary> /// Initializes a new instance of the <see cref="ChargingPlayerEventArgs"/> class. /// </summary> /// <param name="scp096"><inheritdoc cref="Scp096"/></param> /// <param name="player"><inheritdoc cref="Player"/></param> /// <param name="victim"><inheritdoc cref="Victim"/></param> /// <param name="isTarget"><inheritdoc cref="IsTarget"/></param> /// <param name="damage"><inheritdoc cref="Damage"/></param> public ChargingPlayerEventArgs(Scp096 scp096, Player player, Player victim, bool isTarget, float damage) { Scp096 = scp096; Player = player; Victim = victim; IsTarget = isTarget; Damage = damage; EndCharge = IsTarget; }
/// <summary> /// Initializes a new instance of the <see cref="ChargingPlayerEventArgs"/> class. /// </summary> /// <param name="scp096"><inheritdoc cref="Scp096"/></param> /// <param name="player"><inheritdoc cref="Player"/></param> /// <param name="victim"><inheritdoc cref="Victim"/></param> /// <param name="isTarget"><inheritdoc cref="IsTarget"/></param> /// <param name="damage"><inheritdoc cref="Damage"/></param> /// <param name="endCharge"><inheritdoc cref="EndCharge"/></param> /// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param> public ChargingPlayerEventArgs(Scp096 scp096, Player player, Player victim, bool isTarget, float damage, bool endCharge, bool isAllowed = true) { Scp096 = scp096; Player = player; Victim = victim; IsTarget = isTarget; Damage = damage; EndCharge = endCharge; IsAllowed = isAllowed; }
private static bool Prefix(Scp096 __instance, GameObject target) { ReferenceHub hub = ReferenceHub.GetHub(target); if (!__instance.CanReceiveTargets || hub == null || __instance._targets.Contains(hub)) { return(false); } API.Features.Player scp096 = API.Features.Player.Get(__instance.Hub.gameObject); API.Features.Player targetPlayer = API.Features.Player.Get(target); if (scp096 == null) { Log.Error("SCP-096.AddTarget: Could not get SCP-096 player object."); return(true); } if (targetPlayer == null) { Log.Error("SCP-096.AddTarget: Could not get Target player object."); return(true); } AddingTargetEventArgs ev = new AddingTargetEventArgs(scp096, targetPlayer, 70, __instance.EnrageTimePerReset); Exiled.Events.Handlers.Scp096.OnAddingTarget(ev); if (ev.IsAllowed) { if (!__instance._targets.IsEmpty() || __instance.Enraged) { if (__instance.AddedTimeThisRage + ev.EnrageTimeToAdd >= __instance.MaximumAddedEnrageTime) { ev.EnrageTimeToAdd = 0f; } else if (__instance.AddedTimeThisRage + ev.EnrageTimeToAdd > __instance.MaximumAddedEnrageTime) { ev.EnrageTimeToAdd = __instance.AddedTimeThisRage + ev.EnrageTimeToAdd - __instance.MaximumAddedEnrageTime; } __instance.EnrageTimeLeft += ev.EnrageTimeToAdd; __instance.AddedTimeThisRage += ev.EnrageTimeToAdd; } __instance._targets.Add(hub); __instance.AdjustShield(ev.AhpToAdd); NetworkServer.SendToClientOfPlayer <Scp096ToTargetMessage>(hub.characterClassManager.netIdentity, new Scp096ToTargetMessage(hub)); } return(false); }
private static void GetMaxShield(PlayableScps.Scp096 __instance, ref float __result) { try { var ply = __instance?.GetPlayer(); if (ply == null) { return; } __result = ply.Scp096Controller.MaxShield; } catch (Exception e) { Logger.Get.Error($"Synapse-Wrapper: SCP-096 MaxShield failed!!\n{e}\nStackTrace:\n{e.StackTrace}"); } }
private static bool Prefix(Scp096 __instance, GameObject target) { ReferenceHub hub = ReferenceHub.GetHub(target); if (!__instance.CanReceiveTargets || hub == null || __instance._targets.Contains(hub)) { return(false); } API.Features.Player scp096 = API.Features.Player.Get(__instance.Hub.gameObject); API.Features.Player targetPlayer = API.Features.Player.Get(target); if (scp096 == null) { Log.Error("SCP-096.AddTarget: Could not get SCP-096 player object."); return(true); } if (targetPlayer == null) { Log.Error("SCP-096.AddTarget: Could not get Target player object."); return(true); } AddingTargetEventArgs ev = new AddingTargetEventArgs(scp096, targetPlayer, 200, __instance.EnrageTimePerReset); if (targetPlayer.Role == RoleType.Tutorial && !Exiled.Events.Events.Instance.Config.CanTutorialTriggerScp096) { ev.IsAllowed = false; } Exiled.Events.Handlers.Scp096.OnAddingTarget(ev); if (ev.IsAllowed) { if (!__instance._targets.IsEmpty()) { __instance.EnrageTimeLeft += ev.EnrageTimeToAdd; } __instance._targets.Add(hub); __instance.AdjustShield(ev.AhpToAdd); } return(false); }
private static bool Prefix(Scp096 __instance, ref float __result) { __result = Exiled.API.Features.Scp096.MaxShield; return(false); }
/// <summary> /// Initializes a new instance of the <see cref="EnragingEventArgs"/> class. /// </summary> /// <param name="scp096"><inheritdoc cref="Scp096"/></param> /// <param name="player"><inheritdoc cref="Player"/></param> /// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param> public EnragingEventArgs(Scp096 scp096, Player player, bool isAllowed = true) { Scp096 = scp096; Player = player; IsAllowed = isAllowed; }
/// <summary> /// Initializes a new instance of the <see cref="CalmingDownEventArgs"/> class. /// </summary> /// <param name="scp096">The <see cref="Scp096"/> instance.</param> /// <param name="player">The player who's controlling SCP-096.</param> /// <param name="isAllowed">Indicates whether the event can be executed or not.</param> public CalmingDownEventArgs(Scp096 scp096, Player player, bool isAllowed = true) : base(scp096, player, isAllowed) { }
// Keep in mind, changes affecting this code // have a high breakage rate, so be careful when // updating or adding new things private static bool Prefix(PlayerPositionManager __instance) { try { if (++__instance._frame != __instance._syncFrequency) { return(false); } __instance._frame = 0; List <GameObject> players = PlayerManager.players; __instance._usedData = players.Count; if (__instance.ReceivedData == null || __instance.ReceivedData.Length < __instance._usedData) { __instance.ReceivedData = new PlayerPositionData[__instance._usedData * 2]; } for (int index = 0; index < __instance._usedData; ++index) { __instance.ReceivedData[index] = new PlayerPositionData(ReferenceHub.GetHub(players[index])); } if (__instance._transmitBuffer == null || __instance._transmitBuffer.Length < __instance._usedData) { __instance._transmitBuffer = new PlayerPositionData[__instance._usedData * 2]; } foreach (GameObject gameObject in players) { Player player = GetPlayerOrServer(gameObject); if (player == null || player.ReferenceHub.queryProcessor._ipAddress == "127.0.0.WAN") { continue; } Array.Copy(__instance.ReceivedData, __instance._transmitBuffer, __instance._usedData); if (player.Role.Is939()) { for (int index = 0; index < __instance._usedData; ++index) { if (__instance._transmitBuffer[index].position.y < 800f) { ReferenceHub hub2 = ReferenceHub.GetHub(__instance._transmitBuffer[index].playerID); if (hub2.characterClassManager.CurRole.team != Team.SCP && hub2.characterClassManager.CurRole.team != Team.RIP && !hub2 .GetComponent <Scp939_VisionController>() .CanSee(player.ReferenceHub.playerEffectsController.GetEffect <Visuals939>())) { MakeGhost(index, __instance._transmitBuffer); } } } } else if (player.Role != RoleType.Spectator && player.Role != RoleType.Scp079) { for (int index = 0; index < __instance._usedData; ++index) { PlayerPositionData ppd = __instance._transmitBuffer[index]; if (!ReferenceHub.TryGetHub(ppd.playerID, out ReferenceHub targetHub)) { continue; } Player currentTarget = GetPlayerOrServer(targetHub.gameObject); if (currentTarget == null) { continue; } Scp096 scp096 = player.ReferenceHub.scpsController.CurrentScp as Scp096; Vector3 vector3 = ppd.position - player.ReferenceHub.playerMovementSync.RealModelPosition; if (Math.Abs(vector3.y) > 35f) { MakeGhost(index, __instance._transmitBuffer); } else { float sqrMagnitude = vector3.sqrMagnitude; if (player.ReferenceHub.playerMovementSync.RealModelPosition.y < 800f) { if (sqrMagnitude >= 1764f) { if (!(sqrMagnitude < 4225f)) { MakeGhost(index, __instance._transmitBuffer); continue; } if (!(currentTarget.ReferenceHub.scpsController.CurrentScp is Scp096 scp) || !scp.EnragedOrEnraging) { MakeGhost(index, __instance._transmitBuffer); continue; } } } else if (sqrMagnitude >= 7225f) { MakeGhost(index, __instance._transmitBuffer); continue; // As the target is already ghosted } // The code below doesn't have to follow a ELSE statement! // Otherwise Scp268 won't be processed if (scp096 != null && scp096.EnragedOrEnraging && !scp096.HasTarget(currentTarget.ReferenceHub) && currentTarget.Team != Team.SCP) { #if DEBUG Log.Debug($"[Scp096@GhostModePatch] {player.UserId} can't see {currentTarget.UserId}"); #endif MakeGhost(index, __instance._transmitBuffer); } else if (currentTarget.ReferenceHub.playerEffectsController.GetEffect <Invisible>().IsEnabled) { bool flag2 = false; if (scp096 != null) { flag2 = scp096.HasTarget(currentTarget.ReferenceHub); } if (currentTarget != player && player.Role != RoleType.Scp079 && player.Role != RoleType.Spectator && !flag2) { MakeGhost(index, __instance._transmitBuffer); } } } } } // We do another FOR for the ghost things // because it's hard to do it without // whole code changes in the game code for (int z = 0; z < __instance._usedData; z++) { PlayerPositionData ppd = __instance._transmitBuffer[z]; // Do you remember the bug // when you can't pick up any item? // - Me too; // It was because for a reason // we made the source player // invisible to themself if (player.Id == ppd.playerID) { continue; } // If it's already has the ghost position if (ppd.position == GhostPos) { continue; } if (!ReferenceHub.TryGetHub(ppd.playerID, out ReferenceHub targetHub)) { continue; } Player target = GetPlayerOrServer(targetHub.gameObject); if (target == null || target.ReferenceHub.queryProcessor._ipAddress == "127.0.0.WAN") { continue; } // If for some reason the player/their ref hub is null if (target?.ReferenceHub == null) { continue; } if (target.IsInvisible || PlayerCannotSee(player, target.Id)) { MakeGhost(z, __instance._transmitBuffer); } // Rotate the player because // those movement checks are // in client-side else if (player.Role == RoleType.Scp173 && ((!Exiled.Events.Events.Instance.Config.CanTutorialBlockScp173 && target.Role == RoleType.Tutorial) || Scp173.TurnedPlayers.Contains(target))) { RotatePlayer(z, __instance._transmitBuffer, FindLookRotation(player.Position, target.Position)); } } if (player.ReferenceHub.characterClassManager.netIdentity != null) { NetworkConnection networkConnection = player.ReferenceHub.characterClassManager.netIdentity.isLocalPlayer ? NetworkServer.localConnection : player.ReferenceHub.characterClassManager.netIdentity.connectionToClient; if (__instance._usedData <= 20) { networkConnection.Send <PositionPPMMessage>( new PositionPPMMessage(__instance._transmitBuffer, (byte)__instance._usedData, 0), 1); } else { byte part; for (part = 0; part < __instance._usedData / 20; ++part) { networkConnection.Send <PositionPPMMessage>(new PositionPPMMessage(__instance._transmitBuffer, 20, part), 1); } byte count = (byte)(__instance._usedData % (part * 20)); if (count > 0) { networkConnection.Send <PositionPPMMessage>(new PositionPPMMessage(__instance._transmitBuffer, count, part), 1); } } } } return(false); } catch (Exception exception) { Log.Error($"GhostMode error: {exception}"); return(true); } }
private static IEnumerator <float> NewAttackTriggerPhysics(PlayableScps.Scp096 __instance) { var scp = __instance.GetPlayer(); var alreadyHit = new HashSet <GameObject>(); var alreadyDamagedDoors = HashSetPool <Interactables.Interobjects.DoorUtils.IDamageableDoor> .Shared.Rent(); int armAttack = __instance._leftAttack ? 1 : -1; do { var b = scp.CameraReference.TransformDirection(0.25f * armAttack, 0f, 1.3f); int num = Physics.OverlapSphereNonAlloc(scp.CameraReference.position + b, 1f, PlayableScps.Scp096._cachedAttackSwingColliders, PlayableScps.Scp096._attackHitMask); var num2 = 0f; for (int i = 0; i < num; i++) { var collider = PlayableScps.Scp096._cachedAttackSwingColliders[i]; var comp = collider.GetComponentInParent <Interactables.Interobjects.DoorUtils.DoorVariant>(); if (comp != null && (object)comp is Interactables.Interobjects.DoorUtils.IDamageableDoor damageableDoor) { if (alreadyDamagedDoors.Add(damageableDoor)) { damageableDoor.ServerDamage(250f, Interactables.Interobjects.DoorUtils.DoorDamageType.Scp096); if (num2 < 1f) { num2 = 1f; } } } else { var comp2 = collider.GetComponentInParent <BreakableWindow>(); if (comp2 != null) { comp2.ServerDamageWindow(500f); if (num2 < 0.5f) { num2 = 0.5f; } } else { var player = collider.GetComponentInParent <Synapse.Api.Player>(); if (player == null || player == scp) { continue; } if (!alreadyHit.Add(player.gameObject) || Physics.Linecast(scp.transform.position, player.transform.position, PlayableScps.Scp096._solidObjectMask)) { continue; } if (!scp.WeaponManager.GetShootPermission(player.ClassManager)) { continue; } var allow = true; try { ev.Get.Scp.InvokeScpAttack(scp, player, Api.Enum.ScpAttackType.Scp096_Tear, out allow); } catch (Exception e) { Synapse.Api.Logger.Get.Error($"Synapse-Event: ScpAttackEvent(Scp096) failed!!\n{e}\nStackTrace:\n{e.StackTrace}"); } if (allow) { num2 = 1.35f; player.Hurt(9696, DamageTypes.Scp096, scp); __instance._targets.Remove(player.Hub); NetworkServer.SendToAll(default(PlayableScps.Messages.Scp096OnKillMessage), 0); } } } } if (num > 0f) { NetworkServer.SendToClientOfPlayer(scp.NetworkIdentity, new PlayableScps.Messages.Scp096HitmarkerMessage(num2)); } yield return(MEC.Timing.WaitForOneFrame); }while (__instance._attackDuration >= 0.099999994f); yield break; }
private static bool Prefix(PlayableScps.Scp096 __instance, out IEnumerator <float> __result) { __result = NewAttackTriggerPhysics(__instance); return(false); }
private static bool Prefix(PlayerPositionManager __instance) { try { ++__instance._frame; if (__instance._frame != __instance._syncFrequency) { return(false); } __instance._frame = 0; List <GameObject> players = PlayerManager.players; __instance._usedData = players.Count; if (__instance._receivedData == null || __instance._receivedData.Length < __instance._usedData) { __instance._receivedData = new PlayerPositionData[__instance._usedData * 2]; } for (int index = 0; index < __instance._usedData; ++index) { __instance._receivedData[index] = new PlayerPositionData(ReferenceHub.GetHub(players[index])); } if (__instance._transmitBuffer == null || __instance._transmitBuffer.Length < __instance._usedData) { __instance._transmitBuffer = new PlayerPositionData[__instance._usedData * 2]; } foreach (GameObject gameObject in players) { Player player = Player.Get(gameObject); Array.Copy(__instance._receivedData, __instance._transmitBuffer, __instance._usedData); if (player.Role.Is939()) { for (int index = 0; index < __instance._usedData; ++index) { if (__instance._transmitBuffer[index].position.y < 800.0) { ReferenceHub hub2 = ReferenceHub.GetHub(players[index]); if (hub2.characterClassManager.CurRole.team != Team.SCP && hub2.characterClassManager.CurRole.team != Team.RIP && !players[index] .GetComponent <Scp939_VisionController>() .CanSee(player.ReferenceHub.characterClassManager.Scp939)) { __instance._transmitBuffer[index] = new PlayerPositionData(Vector3.up * 6000f, 0.0f, __instance._transmitBuffer[index].playerID); } } } } else if (player.Role != RoleType.Spectator && player.Role != RoleType.Scp079) { for (int index = 0; index < __instance._usedData; ++index) { PlayerPositionData ppd = __instance._transmitBuffer[index]; Player currentTarget = Player.Get(players[index]); Scp096 scp096 = player.ReferenceHub.scpsController.CurrentScp as Scp096; bool canSee = true; bool shouldRotate = false; if (currentTarget?.ReferenceHub == null) { continue; } if (currentTarget.IsInvisible || player.TargetGhosts.Contains(ppd.playerID)) { canSee = false; } Vector3 vector3 = __instance._transmitBuffer[index].position - player.ReferenceHub.playerMovementSync.RealModelPosition; if (Math.Abs(vector3.y) > 35.0) { canSee = false; } else { float sqrMagnitude = vector3.sqrMagnitude; if (player.ReferenceHub.playerMovementSync.RealModelPosition.y < 800.0) { if (sqrMagnitude >= 1764.0) { canSee = false; continue; } } else if (sqrMagnitude >= 7225.0) { canSee = false; continue; } if (ReferenceHub.TryGetHub(__instance._transmitBuffer[index].playerID, out ReferenceHub hub2)) { if (player.ReferenceHub.scpsController.CurrentScp is Scp096 currentScp && currentScp.Enraged && (!currentScp.HasTarget(hub2) && hub2.characterClassManager.CurRole.team != Team.SCP)) { canSee = false; } else if (hub2.playerEffectsController.GetEffect <Scp268>().Enabled) { bool flag = false; if (scp096 != null) { flag = scp096._targets.Contains(hub2); } canSee = flag; } } switch (player.Role) { case RoleType.Scp173 when !Exiled.Events.Events.Instance.Config.CanTutorialBlockScp173 && currentTarget.Role == RoleType.Tutorial: shouldRotate = true; break; case RoleType.Scp096 when !Exiled.Events.Events.Instance.Config.CanTutorialTriggerScp096 && currentTarget.Role == RoleType.Tutorial: shouldRotate = true; break; } if (!canSee) { ppd = new PlayerPositionData(Vector3.up * 6000f, 0.0f, ppd.playerID); } else if (shouldRotate) { ppd = new PlayerPositionData(ppd.position, Quaternion.LookRotation(FindLookRotation(player.Position, currentTarget.Position)).eulerAngles.y, ppd.playerID); } __instance._transmitBuffer[index] = ppd; } } } NetworkConnection networkConnection = player.ReferenceHub.characterClassManager.netIdentity.isLocalPlayer ? NetworkServer.localConnection : player.ReferenceHub.characterClassManager.netIdentity.connectionToClient; if (__instance._usedData <= 20) { networkConnection.Send( new PlayerPositionManager.PositionMessage(__instance._transmitBuffer, (byte)__instance._usedData, 0), 1); } else { byte part; for (part = 0; part < __instance._usedData / 20; ++part) { networkConnection.Send(new PlayerPositionManager.PositionMessage(__instance._transmitBuffer, 20, part), 1); } byte count = (byte)(__instance._usedData % (part * 20)); if (count > 0) { networkConnection.Send(new PlayerPositionManager.PositionMessage(__instance._transmitBuffer, count, part), 1); } } } return(false); }
// Keep in mind, changes affecting this code // have a high breakage rate, so be careful when // updating or adding new things private static bool Prefix(PlayerPositionManager __instance) { try { if (!Round.IsStarted) { return(true); } if (++__instance._frame != __instance._syncFrequency) { return(false); } __instance._frame = 0; List <GameObject> players = PlayerManager.players; __instance._usedData = players.Count; if (__instance.ReceivedData is null || __instance.ReceivedData.Length < __instance._usedData) { __instance.ReceivedData = new PlayerPositionData[__instance._usedData * 2]; } for (int index = 0; index < __instance._usedData; ++index) { __instance.ReceivedData[index] = new PlayerPositionData(ReferenceHub.GetHub(players[index])); } if (__instance._transmitBuffer is null || __instance._transmitBuffer.Length < __instance._usedData) { __instance._transmitBuffer = new PlayerPositionData[__instance._usedData * 2]; } foreach (GameObject gameObject in players) { Player player = GetPlayerOrServer(gameObject); if (player is null || player.ReferenceHub.queryProcessor._ipAddress == "127.0.0.WAN") { continue; } Array.Copy(__instance.ReceivedData, __instance._transmitBuffer, __instance._usedData); if (player.Role.Type.Is939()) { for (int index = 0; index < __instance._usedData; ++index) { if (__instance._transmitBuffer[index].position.y < 800f) { ReferenceHub hub2 = ReferenceHub.GetHub(__instance._transmitBuffer[index].playerID); if (hub2.characterClassManager.CurRole.team != Team.SCP && hub2.characterClassManager.CurRole.team != Team.RIP && !hub2 .GetComponent <Scp939_VisionController>() .CanSee(player.ReferenceHub.playerEffectsController.GetEffect <Visuals939>())) { MakeGhost(index, __instance._transmitBuffer); } } } } else if (player.Role.Type != RoleType.Spectator && player.Role.Type != RoleType.Scp079) { for (int index = 0; index < __instance._usedData; ++index) { PlayerPositionData ppd = __instance._transmitBuffer[index]; if (!ReferenceHub.TryGetHub(ppd.playerID, out ReferenceHub targetHub)) { continue; } Player currentTarget = GetPlayerOrServer(targetHub.gameObject); if (currentTarget is null) { continue; } Scp096 scp096 = player.ReferenceHub.scpsController.CurrentScp as Scp096; Vector3 vector3 = ppd.position - player.ReferenceHub.playerMovementSync.RealModelPosition; if (Math.Abs(vector3.y) > 35f) { MakeGhost(index, __instance._transmitBuffer); } else { float sqrMagnitude = vector3.sqrMagnitude; if (player.ReferenceHub.playerMovementSync.RealModelPosition.y < 800f) { if (sqrMagnitude >= 1764f) { if (!(sqrMagnitude < 4225f)) { MakeGhost(index, __instance._transmitBuffer); continue; } if (!(currentTarget.ReferenceHub.scpsController.CurrentScp is Scp096 scp) || !scp.EnragedOrEnraging) { MakeGhost(index, __instance._transmitBuffer); continue; } } } else if (sqrMagnitude >= 7225f) { MakeGhost(index, __instance._transmitBuffer); continue; // As the target is already ghosted } // The code below doesn't have to follow a ELSE statement! // Otherwise Scp268 won't be processed if (scp096 is not null && scp096.EnragedOrEnraging && !scp096.HasTarget(currentTarget.ReferenceHub) && currentTarget.Role.Team != Team.SCP) { #if DEBUG Log.Debug($"[Scp096@GhostModePatch] {player.UserId} can't see {currentTarget.UserId}"); #endif MakeGhost(index, __instance._transmitBuffer); } else if (currentTarget.ReferenceHub.playerEffectsController.GetEffect <Invisible>().IsEnabled) { bool flag2 = false; if (scp096 is not null) { flag2 = scp096.HasTarget(currentTarget.ReferenceHub); } if (currentTarget != player && player.Role.Type != RoleType.Scp079 && player.Role.Type != RoleType.Spectator && !flag2) { MakeGhost(index, __instance._transmitBuffer); } } } } }
private static bool ChargePlayer(PlayableScps.Scp096 __instance, ReferenceHub player) { try { var scp = __instance.GetPlayer(); var target = player.GetPlayer(); if (!HitboxIdentity.CheckFriendlyFire(scp.Hub, target.Hub)) { return(false); } if (Physics.Linecast(scp.transform.position, player.transform.position, LayerMask.GetMask(new string[] { "Default", "Door", "Glass" }))) { return(false); } if (__instance._chargeHitTargets.Contains(player)) { return(false); } try { ev.Get.Scp.InvokeScpAttack(scp, target, Api.Enum.ScpAttackType.Scp096_Tear, out var allow); if (!allow) { return(false); } } catch (Exception e) { Synapse.Api.Logger.Get.Error($"Synapse-Event: ScpAttackEvent(Scp096-Charge) failed!!\n{e}"); } var flag = __instance._targets.Contains(player); var damage = flag ? 9696f : 40f; var flag2 = player.playerStats.DealDamage(new Scp096DamageHandler(__instance, damage, Scp096DamageHandler.AttackType.Charge)); __instance._chargeHitTargets.Add(player); if (flag2) { __instance._targets.Remove(player); Hitmarker.SendHitmarker(__instance.Hub, 1.35f); if (!__instance._chargeKilled) { __instance._chargeCooldownPenaltyAmount++; __instance._chargeKilled = true; } } if (flag) { __instance.EndChargeNextFrame(); } return(false); } catch (Exception e) { Synapse.Api.Logger.Get.Error($"Synapse-Event: Scp096AttackEvent(Charge) failed!!\n{e}"); return(true); } }
private static bool Pry(PlayableScps.Scp096 __instance) { try { if (!__instance.PryingGate) { return(false); } var num = Physics.OverlapSphereNonAlloc(__instance.Hub.playerMovementSync.RealModelPosition, 0.5f, PlayableScps.Scp096._sphereHits, LayerMask.GetMask(new string[] { "Hitbox" })); if (num <= 0) { return(false); } for (int i = 0; i < num; i++) { ReferenceHub componentInParent = PlayableScps.Scp096._sphereHits[i].gameObject.GetComponentInParent <ReferenceHub>(); if (componentInParent == null || componentInParent == __instance.Hub) { continue; } var scp = __instance.GetPlayer(); var target = componentInParent.GetPlayer(); if (!HitboxIdentity.CheckFriendlyFire(scp.Hub, target.Hub)) { continue; } try { ev.Get.Scp.InvokeScpAttack(scp, target, Api.Enum.ScpAttackType.Scp096_Tear, out var allow); if (!allow) { continue; } } catch (Exception e) { Synapse.Api.Logger.Get.Error($"Synapse-Event: ScpAttackEvent(Scp096-Charge) failed!!\n{e}"); } // if (__instance.Hub.playerStats.HurtPlayer(new PlayerStats.HitInfo(9696f, null, DamageTypes.Scp096, __instance.Hub.playerId, false), componentInParent.gameObject, false, true)) if (componentInParent.playerStats.DealDamage(new Scp096DamageHandler(__instance, 9696f, Scp096DamageHandler.AttackType.GateKill))) { if (__instance._targets.Contains(componentInParent)) { __instance._targets.Remove(componentInParent); } NetworkServer.SendToAll(default(PlayableScps.Messages.Scp096OnKillMessage), 0); } } if (Physics.Raycast(__instance.Hub.PlayerCameraReference.position, __instance.Hub.PlayerCameraReference.forward, 2f, LayerMask.GetMask(new string[] { "Default" }))) { __instance.EndChargeNextFrame(); } return(false); } catch (Exception e) { Synapse.Api.Logger.Get.Error($"Synapse-Event: Scp096AttackEvent(Pry) failed!!\n{e}"); return(true); } }
private static bool HitObject(PlayableScps.Scp096 __instance, GameObject target, out bool __result) { try { __result = false; if (target.TryGetComponent <BreakableWindow>(out var window)) { __result = window.Damage(500f, new Scp096DamageHandler(__instance, 500f, Scp096DamageHandler.AttackType.Slap), target.transform.position); return(false); } if (target.TryGetComponent <DoorVariant>(out var door) && (object)door is IDamageableDoor damageable && !door.IsConsideredOpen()) { __result = damageable.ServerDamage(250f, DoorDamageType.Scp096); return(false); } if (!ReferenceHub.TryGetHub(target, out var hub) || hub == null || hub == __instance.Hub || hub.characterClassManager.IsAnyScp()) { return(false); } var scp = __instance.GetPlayer(); var player = hub.GetPlayer(); if (Physics.Linecast(scp.Position, player.Position, PlayableScps.Scp096._solidObjectMask)) { return(false); } if (Vector3.Distance(scp.Position, player.Position) > 5f) { return(false); } if (!SynapseExtensions.GetHarmPermission(scp, player)) { return(false); } try { ev.Get.Scp.InvokeScpAttack(scp, player, Api.Enum.ScpAttackType.Scp096_Tear, out var allow); if (!allow) { return(false); } } catch (Exception e) { Synapse.Api.Logger.Get.Error($"Synapse-Event: ScpAttackEvent(Scp096-Charge) failed!!\n{e}"); } if (hub.playerStats.DealDamage(new Scp096DamageHandler(__instance, 9696f, Scp096DamageHandler.AttackType.Slap))) { __instance._targets.Remove(hub); NetworkServer.SendToAll(default(PlayableScps.Messages.Scp096OnKillMessage), 0, false); } __result = true; return(false); } catch (Exception e) { Synapse.Api.Logger.Get.Error($"Synapse-Event: ScpAttackEvent(HitObject) failed!!\n{e}"); __result = false; return(true); } }