From 835625a38341ec4281c63430748999f87d095184 Mon Sep 17 00:00:00 2001 From: GrafDimenzio <66207264+GrafDimenzio@users.noreply.github.com> Date: Sat, 12 Feb 2022 12:40:50 +0100 Subject: [PATCH] Update to 2.8.3 --- Pets/EventHandlers.cs | 26 ++++++----- Pets/Pet.cs | 7 ++- Pets/PetConfiguration.cs | 4 +- Pets/PetHandler.cs | 8 ++-- Pets/Pets.csproj | 20 ++++----- Pets/PluginClass.cs | 10 ++--- Pets/PluginConfig.cs | 2 +- Pets/PluginPatches.cs | 77 +++------------------------------ Pets/Properties/AssemblyInfo.cs | 4 +- Pets/packages.config | 4 +- 10 files changed, 49 insertions(+), 113 deletions(-) diff --git a/Pets/EventHandlers.cs b/Pets/EventHandlers.cs index dbebfe8..0d135e8 100644 --- a/Pets/EventHandlers.cs +++ b/Pets/EventHandlers.cs @@ -1,6 +1,6 @@ -using ev = Synapse.Api.Events.EventHandler; -using Synapse.Api; +using Synapse.Api; using System.Linq; +using ev = Synapse.Api.Events.EventHandler; namespace Pets { @@ -11,13 +11,6 @@ public EventHandlers() ev.Get.Player.LoadComponentsEvent += LoadComponents; ev.Get.Server.TransmitPlayerDataEvent += TransmitData; ev.Get.Player.PlayerDamagePermissionEvent += DamagePermission; - ev.Get.Player.PlayerDeathEvent += DeathEvent; - } - - private void DeathEvent(Synapse.Api.Events.SynapseEventArguments.PlayerDeathEventArgs ev) - { - if (ev.Victim.IsDummy && ev.Victim.Team == Team.SCP) - TerminationPatch.Killer.Add(ev.Killer); } private void DamagePermission(Synapse.Api.Events.SynapseEventArguments.PlayerDamagePermissionEventArgs ev) @@ -39,16 +32,25 @@ private void TransmitData(Synapse.Api.Events.SynapseEventArguments.TransmitPlaye if (dummy != null && dummy is Pet p && p.Owner != ev.Player) { - if (PluginClass.PetPlugin.Config.InvisiblePet || (p.Owner.Invisible && !ev.Player.HasPermission("synapse.see.invisible")) || p.Owner.PlayerEffectsController.GetEffect().IsEnabled) + if(p.Owner.RoleType == RoleType.Spectator) { ev.Invisible = true; return; } - if (ev.Player.RoleType == RoleType.Scp93953 || ev.Player.RoleType == RoleType.Scp93989) + if(p.Owner != ev.Player) { - if (SynapseExtensions.CanHarmScp(p.Owner, false) && !p.Owner.GetComponent().CanSee(ev.Player.PlayerEffectsController.GetEffect())) + if (PluginClass.PetPlugin.Config.InvisiblePet || (p.Owner.Invisible && !ev.Player.HasPermission("synapse.see.invisible")) || p.Owner.PlayerEffectsController.GetEffect().IsEnabled) + { ev.Invisible = true; + return; + } + + if (ev.Player.RoleType == RoleType.Scp93953 || ev.Player.RoleType == RoleType.Scp93989) + { + if (SynapseExtensions.CanHarmScp(p.Owner, false) && !p.Owner.GetComponent().CanSee(ev.Player.PlayerEffectsController.GetEffect())) + ev.Invisible = true; + } } } } diff --git a/Pets/Pet.cs b/Pets/Pet.cs index ba93e89..2e1e2f4 100644 --- a/Pets/Pet.cs +++ b/Pets/Pet.cs @@ -1,7 +1,7 @@ -using System.Collections.Generic; -using System.Linq; -using MEC; +using MEC; using Synapse.Api; +using System.Collections.Generic; +using System.Linq; using UnityEngine; namespace Pets @@ -94,7 +94,6 @@ private IEnumerator Walk() else if (distance <= 1.25f) Direction = Synapse.Api.Enum.MovementDirection.Stop; - } } } diff --git a/Pets/PetConfiguration.cs b/Pets/PetConfiguration.cs index 3b65cf5..094ed44 100644 --- a/Pets/PetConfiguration.cs +++ b/Pets/PetConfiguration.cs @@ -1,5 +1,5 @@ -using System.Collections.Generic; -using Synapse.Config; +using Synapse.Config; +using System.Collections.Generic; namespace Pets { diff --git a/Pets/PetHandler.cs b/Pets/PetHandler.cs index 78d05db..62485cd 100644 --- a/Pets/PetHandler.cs +++ b/Pets/PetHandler.cs @@ -1,10 +1,10 @@ -using System; +using Synapse; +using Synapse.Api; +using Synapse.Config; +using System; using System.Collections.Generic; using System.IO; using System.Linq; -using Synapse; -using Synapse.Api; -using Synapse.Config; namespace Pets { diff --git a/Pets/Pets.csproj b/Pets/Pets.csproj index 23ad37d..c3d51da 100644 --- a/Pets/Pets.csproj +++ b/Pets/Pets.csproj @@ -32,23 +32,23 @@ true - - ..\packages\Lib.Harmony.2.1.1\lib\net472\0Harmony.dll + + ..\packages\Lib.Harmony.2.2.0\lib\net472\0Harmony.dll - ..\packages\SynapseSL.2.7.1\lib\net472\Assembly-CSharp.dll + ..\packages\SynapseSL.2.8.3-pre1\lib\net472\Assembly-CSharp.dll - ..\packages\SynapseSL.2.7.1\lib\net472\Assembly-CSharp-firstpass.dll + ..\packages\SynapseSL.2.8.3-pre1\lib\net472\Assembly-CSharp-firstpass.dll ..\packages\LiteDB.5.0.11\lib\net45\LiteDB.dll - ..\packages\SynapseSL.2.7.1\lib\net472\Mirror.dll + ..\packages\SynapseSL.2.8.3-pre1\lib\net472\Mirror.dll - - ..\packages\SynapseSL.2.7.1\lib\net472\Synapse.dll + + ..\packages\SynapseSL.2.8.3-pre1\lib\net472\Synapse.dll @@ -63,13 +63,13 @@ - ..\packages\SynapseSL.2.7.1\lib\net472\UnityEngine.dll + ..\packages\SynapseSL.2.8.3-pre1\lib\net472\UnityEngine.dll - ..\packages\SynapseSL.2.7.1\lib\net472\UnityEngine.CoreModule.dll + ..\packages\SynapseSL.2.8.3-pre1\lib\net472\UnityEngine.CoreModule.dll - ..\packages\SynapseSL.2.7.1\lib\net472\UnityEngine.PhysicsModule.dll + ..\packages\SynapseSL.2.8.3-pre1\lib\net472\UnityEngine.PhysicsModule.dll ..\packages\YamlDotNet.11.2.1\lib\net45\YamlDotNet.dll diff --git a/Pets/PluginClass.cs b/Pets/PluginClass.cs index bf2d6c9..423e294 100644 --- a/Pets/PluginClass.cs +++ b/Pets/PluginClass.cs @@ -1,8 +1,8 @@ -using System; -using HarmonyLib; +using HarmonyLib; using Synapse.Api; using Synapse.Api.Plugin; using Synapse.Translation; +using System; namespace Pets { @@ -12,9 +12,9 @@ namespace Pets Description = "A Plugin for Pets in SL", LoadPriority = 0, SynapseMajor = 2, - SynapseMinor = 7, - SynapsePatch = 2, - Version = "v.1.0.2" + SynapseMinor = 8, + SynapsePatch = 3, + Version = "v.1.0.3" )] public class PluginClass : AbstractPlugin { diff --git a/Pets/PluginConfig.cs b/Pets/PluginConfig.cs index f66a868..bd61d53 100644 --- a/Pets/PluginConfig.cs +++ b/Pets/PluginConfig.cs @@ -5,7 +5,7 @@ namespace Pets { public class PluginConfig : AbstractConfigSection { - [Description("The max Amount of Pets a Player can have at the same time")] + [Description("The max Amount of Pets a Player can spawn during one Round")] public int MaxPets { get; set; } = 1; [Description("If enabled only the Owner of the pet can see it")] diff --git a/Pets/PluginPatches.cs b/Pets/PluginPatches.cs index fc8888c..9e3bfab 100644 --- a/Pets/PluginPatches.cs +++ b/Pets/PluginPatches.cs @@ -1,80 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using HarmonyLib; -using Respawning.NamingRules; -using Synapse; -using Synapse.Api; +using HarmonyLib; namespace Pets { - [HarmonyPatch(typeof(NineTailedFoxNamingRule), nameof(NineTailedFoxNamingRule.PlayEntranceAnnouncement))] - internal static class AnnouncePatch - { - private static bool Prefix(NineTailedFoxNamingRule __instance, string regular) - { - try - { - string cassieUnitName = __instance.GetCassieUnitName(regular); - int num = Server.Get.GetPlayers(x => x.RealTeam == Team.SCP && !x.IsDummy).Count; - StringBuilder stringBuilder = new StringBuilder(); - if (ClutterSpawner.IsHolidayActive(Holidays.Christmas)) - { - stringBuilder.Append("XMAS_EPSILON11 "); - stringBuilder.Append(cassieUnitName); - stringBuilder.Append("XMAS_HASENTERED "); - stringBuilder.Append(num); - stringBuilder.Append(" XMAS_SCPSUBJECTS"); - } - else - { - stringBuilder.Append("MTFUNIT EPSILON 11 DESIGNATED "); - stringBuilder.Append(cassieUnitName); - stringBuilder.Append(" HASENTERED ALLREMAINING "); - if (num == 0) - { - stringBuilder.Append("NOSCPSLEFT"); - } - else - { - stringBuilder.Append("AWAITINGRECONTAINMENT "); - stringBuilder.Append(num); - if (num == 1) - { - stringBuilder.Append(" SCPSUBJECT"); - } - else - { - stringBuilder.Append(" SCPSUBJECTS"); - } - } - } - __instance.ConfirmAnnouncement(ref stringBuilder); - return false; - } - catch (Exception e) - { - Logger.Get.Error($"Error while announcing mtf:\n{e}"); - return true; - } - } - } - - [HarmonyPatch(typeof(NineTailedFoxAnnouncer), nameof(NineTailedFoxAnnouncer.AnnounceScpTermination))] + [HarmonyPatch(typeof(NineTailedFoxAnnouncer), nameof(NineTailedFoxAnnouncer.AnnounceScpTermination))] internal static class TerminationPatch { - public static List Killer = new List(); - - private static bool Prefix(PlayerStats.HitInfo hit) + [HarmonyPrefix] + private static bool Prefix(ReferenceHub scp) { - var ply = Killer.FirstOrDefault(x => x.PlayerId == hit.PlayerId); - if (ply != null) - { - Killer.Remove(ply); - return false; - } - + var pet = scp.GetPlayer(); + if (pet.IsDummy) return false; return true; } } diff --git a/Pets/Properties/AssemblyInfo.cs b/Pets/Properties/AssemblyInfo.cs index 3560803..edf2a95 100644 --- a/Pets/Properties/AssemblyInfo.cs +++ b/Pets/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.3.0")] +[assembly: AssemblyFileVersion("1.0.3.0")] diff --git a/Pets/packages.config b/Pets/packages.config index 5ceb75f..9d6efe8 100644 --- a/Pets/packages.config +++ b/Pets/packages.config @@ -1,8 +1,8 @@  - + - + \ No newline at end of file