Skip to content

Commit 835625a

Browse files
committed
Update to 2.8.3
1 parent 99ec90d commit 835625a

10 files changed

+49
-113
lines changed

Pets/EventHandlers.cs

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using ev = Synapse.Api.Events.EventHandler;
2-
using Synapse.Api;
1+
using Synapse.Api;
32
using System.Linq;
3+
using ev = Synapse.Api.Events.EventHandler;
44

55
namespace Pets
66
{
@@ -11,13 +11,6 @@ public EventHandlers()
1111
ev.Get.Player.LoadComponentsEvent += LoadComponents;
1212
ev.Get.Server.TransmitPlayerDataEvent += TransmitData;
1313
ev.Get.Player.PlayerDamagePermissionEvent += DamagePermission;
14-
ev.Get.Player.PlayerDeathEvent += DeathEvent;
15-
}
16-
17-
private void DeathEvent(Synapse.Api.Events.SynapseEventArguments.PlayerDeathEventArgs ev)
18-
{
19-
if (ev.Victim.IsDummy && ev.Victim.Team == Team.SCP)
20-
TerminationPatch.Killer.Add(ev.Killer);
2114
}
2215

2316
private void DamagePermission(Synapse.Api.Events.SynapseEventArguments.PlayerDamagePermissionEventArgs ev)
@@ -39,16 +32,25 @@ private void TransmitData(Synapse.Api.Events.SynapseEventArguments.TransmitPlaye
3932

4033
if (dummy != null && dummy is Pet p && p.Owner != ev.Player)
4134
{
42-
if (PluginClass.PetPlugin.Config.InvisiblePet || (p.Owner.Invisible && !ev.Player.HasPermission("synapse.see.invisible")) || p.Owner.PlayerEffectsController.GetEffect<CustomPlayerEffects.Invisible>().IsEnabled)
35+
if(p.Owner.RoleType == RoleType.Spectator)
4336
{
4437
ev.Invisible = true;
4538
return;
4639
}
4740

48-
if (ev.Player.RoleType == RoleType.Scp93953 || ev.Player.RoleType == RoleType.Scp93989)
41+
if(p.Owner != ev.Player)
4942
{
50-
if (SynapseExtensions.CanHarmScp(p.Owner, false) && !p.Owner.GetComponent<Scp939_VisionController>().CanSee(ev.Player.PlayerEffectsController.GetEffect<CustomPlayerEffects.Visuals939>()))
43+
if (PluginClass.PetPlugin.Config.InvisiblePet || (p.Owner.Invisible && !ev.Player.HasPermission("synapse.see.invisible")) || p.Owner.PlayerEffectsController.GetEffect<CustomPlayerEffects.Invisible>().IsEnabled)
44+
{
5145
ev.Invisible = true;
46+
return;
47+
}
48+
49+
if (ev.Player.RoleType == RoleType.Scp93953 || ev.Player.RoleType == RoleType.Scp93989)
50+
{
51+
if (SynapseExtensions.CanHarmScp(p.Owner, false) && !p.Owner.GetComponent<Scp939_VisionController>().CanSee(ev.Player.PlayerEffectsController.GetEffect<CustomPlayerEffects.Visuals939>()))
52+
ev.Invisible = true;
53+
}
5254
}
5355
}
5456
}

Pets/Pet.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using System.Collections.Generic;
2-
using System.Linq;
3-
using MEC;
1+
using MEC;
42
using Synapse.Api;
3+
using System.Collections.Generic;
4+
using System.Linq;
55
using UnityEngine;
66

77
namespace Pets
@@ -94,7 +94,6 @@ private IEnumerator<float> Walk()
9494

9595
else if (distance <= 1.25f)
9696
Direction = Synapse.Api.Enum.MovementDirection.Stop;
97-
9897
}
9998
}
10099
}

Pets/PetConfiguration.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using System.Collections.Generic;
2-
using Synapse.Config;
1+
using Synapse.Config;
2+
using System.Collections.Generic;
33

44
namespace Pets
55
{

Pets/PetHandler.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
using System;
1+
using Synapse;
2+
using Synapse.Api;
3+
using Synapse.Config;
4+
using System;
25
using System.Collections.Generic;
36
using System.IO;
47
using System.Linq;
5-
using Synapse;
6-
using Synapse.Api;
7-
using Synapse.Config;
88

99
namespace Pets
1010
{

Pets/Pets.csproj

+10-10
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,23 @@
3232
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
3333
</PropertyGroup>
3434
<ItemGroup>
35-
<Reference Include="0Harmony, Version=2.1.1.0, Culture=neutral, processorArchitecture=MSIL">
36-
<HintPath>..\packages\Lib.Harmony.2.1.1\lib\net472\0Harmony.dll</HintPath>
35+
<Reference Include="0Harmony, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
36+
<HintPath>..\packages\Lib.Harmony.2.2.0\lib\net472\0Harmony.dll</HintPath>
3737
</Reference>
3838
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
39-
<HintPath>..\packages\SynapseSL.2.7.1\lib\net472\Assembly-CSharp.dll</HintPath>
39+
<HintPath>..\packages\SynapseSL.2.8.3-pre1\lib\net472\Assembly-CSharp.dll</HintPath>
4040
</Reference>
4141
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
42-
<HintPath>..\packages\SynapseSL.2.7.1\lib\net472\Assembly-CSharp-firstpass.dll</HintPath>
42+
<HintPath>..\packages\SynapseSL.2.8.3-pre1\lib\net472\Assembly-CSharp-firstpass.dll</HintPath>
4343
</Reference>
4444
<Reference Include="LiteDB, Version=5.0.11.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
4545
<HintPath>..\packages\LiteDB.5.0.11\lib\net45\LiteDB.dll</HintPath>
4646
</Reference>
4747
<Reference Include="Mirror, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
48-
<HintPath>..\packages\SynapseSL.2.7.1\lib\net472\Mirror.dll</HintPath>
48+
<HintPath>..\packages\SynapseSL.2.8.3-pre1\lib\net472\Mirror.dll</HintPath>
4949
</Reference>
50-
<Reference Include="Synapse, Version=2.7.1.0, Culture=neutral, processorArchitecture=MSIL">
51-
<HintPath>..\packages\SynapseSL.2.7.1\lib\net472\Synapse.dll</HintPath>
50+
<Reference Include="Synapse, Version=2.8.1.0, Culture=neutral, processorArchitecture=MSIL">
51+
<HintPath>..\packages\SynapseSL.2.8.3-pre1\lib\net472\Synapse.dll</HintPath>
5252
</Reference>
5353
<Reference Include="System" />
5454
<Reference Include="System.Core" />
@@ -63,13 +63,13 @@
6363
<Reference Include="System.Net.Http" />
6464
<Reference Include="System.Xml" />
6565
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
66-
<HintPath>..\packages\SynapseSL.2.7.1\lib\net472\UnityEngine.dll</HintPath>
66+
<HintPath>..\packages\SynapseSL.2.8.3-pre1\lib\net472\UnityEngine.dll</HintPath>
6767
</Reference>
6868
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
69-
<HintPath>..\packages\SynapseSL.2.7.1\lib\net472\UnityEngine.CoreModule.dll</HintPath>
69+
<HintPath>..\packages\SynapseSL.2.8.3-pre1\lib\net472\UnityEngine.CoreModule.dll</HintPath>
7070
</Reference>
7171
<Reference Include="UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
72-
<HintPath>..\packages\SynapseSL.2.7.1\lib\net472\UnityEngine.PhysicsModule.dll</HintPath>
72+
<HintPath>..\packages\SynapseSL.2.8.3-pre1\lib\net472\UnityEngine.PhysicsModule.dll</HintPath>
7373
</Reference>
7474
<Reference Include="YamlDotNet, Version=11.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
7575
<HintPath>..\packages\YamlDotNet.11.2.1\lib\net45\YamlDotNet.dll</HintPath>

Pets/PluginClass.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using System;
2-
using HarmonyLib;
1+
using HarmonyLib;
32
using Synapse.Api;
43
using Synapse.Api.Plugin;
54
using Synapse.Translation;
5+
using System;
66

77
namespace Pets
88
{
@@ -12,9 +12,9 @@ namespace Pets
1212
Description = "A Plugin for Pets in SL",
1313
LoadPriority = 0,
1414
SynapseMajor = 2,
15-
SynapseMinor = 7,
16-
SynapsePatch = 2,
17-
Version = "v.1.0.2"
15+
SynapseMinor = 8,
16+
SynapsePatch = 3,
17+
Version = "v.1.0.3"
1818
)]
1919
public class PluginClass : AbstractPlugin
2020
{

Pets/PluginConfig.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Pets
55
{
66
public class PluginConfig : AbstractConfigSection
77
{
8-
[Description("The max Amount of Pets a Player can have at the same time")]
8+
[Description("The max Amount of Pets a Player can spawn during one Round")]
99
public int MaxPets { get; set; } = 1;
1010

1111
[Description("If enabled only the Owner of the pet can see it")]

Pets/PluginPatches.cs

+6-71
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,15 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using HarmonyLib;
6-
using Respawning.NamingRules;
7-
using Synapse;
8-
using Synapse.Api;
1+
using HarmonyLib;
92

103
namespace Pets
114
{
12-
[HarmonyPatch(typeof(NineTailedFoxNamingRule), nameof(NineTailedFoxNamingRule.PlayEntranceAnnouncement))]
13-
internal static class AnnouncePatch
14-
{
15-
private static bool Prefix(NineTailedFoxNamingRule __instance, string regular)
16-
{
17-
try
18-
{
19-
string cassieUnitName = __instance.GetCassieUnitName(regular);
20-
int num = Server.Get.GetPlayers(x => x.RealTeam == Team.SCP && !x.IsDummy).Count;
21-
StringBuilder stringBuilder = new StringBuilder();
22-
if (ClutterSpawner.IsHolidayActive(Holidays.Christmas))
23-
{
24-
stringBuilder.Append("XMAS_EPSILON11 ");
25-
stringBuilder.Append(cassieUnitName);
26-
stringBuilder.Append("XMAS_HASENTERED ");
27-
stringBuilder.Append(num);
28-
stringBuilder.Append(" XMAS_SCPSUBJECTS");
29-
}
30-
else
31-
{
32-
stringBuilder.Append("MTFUNIT EPSILON 11 DESIGNATED ");
33-
stringBuilder.Append(cassieUnitName);
34-
stringBuilder.Append(" HASENTERED ALLREMAINING ");
35-
if (num == 0)
36-
{
37-
stringBuilder.Append("NOSCPSLEFT");
38-
}
39-
else
40-
{
41-
stringBuilder.Append("AWAITINGRECONTAINMENT ");
42-
stringBuilder.Append(num);
43-
if (num == 1)
44-
{
45-
stringBuilder.Append(" SCPSUBJECT");
46-
}
47-
else
48-
{
49-
stringBuilder.Append(" SCPSUBJECTS");
50-
}
51-
}
52-
}
53-
__instance.ConfirmAnnouncement(ref stringBuilder);
54-
return false;
55-
}
56-
catch (Exception e)
57-
{
58-
Logger.Get.Error($"Error while announcing mtf:\n{e}");
59-
return true;
60-
}
61-
}
62-
}
63-
64-
[HarmonyPatch(typeof(NineTailedFoxAnnouncer), nameof(NineTailedFoxAnnouncer.AnnounceScpTermination))]
5+
[HarmonyPatch(typeof(NineTailedFoxAnnouncer), nameof(NineTailedFoxAnnouncer.AnnounceScpTermination))]
656
internal static class TerminationPatch
667
{
67-
public static List<Player> Killer = new List<Player>();
68-
69-
private static bool Prefix(PlayerStats.HitInfo hit)
8+
[HarmonyPrefix]
9+
private static bool Prefix(ReferenceHub scp)
7010
{
71-
var ply = Killer.FirstOrDefault(x => x.PlayerId == hit.PlayerId);
72-
if (ply != null)
73-
{
74-
Killer.Remove(ply);
75-
return false;
76-
}
77-
11+
var pet = scp.GetPlayer();
12+
if (pet.IsDummy) return false;
7813
return true;
7914
}
8015
}

Pets/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
3333
// indem Sie "*" wie unten gezeigt eingeben:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]
35+
[assembly: AssemblyVersion("1.0.3.0")]
36+
[assembly: AssemblyFileVersion("1.0.3.0")]

Pets/packages.config

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Lib.Harmony" version="2.1.1" targetFramework="net472" />
3+
<package id="Lib.Harmony" version="2.2.0" targetFramework="net472" />
44
<package id="LiteDB" version="5.0.11" targetFramework="net472" />
5-
<package id="SynapseSL" version="2.7.1" targetFramework="net472" />
5+
<package id="SynapseSL" version="2.8.3-pre1" targetFramework="net472" />
66
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0-preview.3.21201.4" targetFramework="net472" />
77
<package id="YamlDotNet" version="11.2.1" targetFramework="net472" />
88
</packages>

0 commit comments

Comments
 (0)