Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 791d04e

Browse files
committedApr 6, 2023
Update to Synapse 1.2 Beta
1 parent 245bcc9 commit 791d04e

File tree

7 files changed

+53
-37
lines changed

7 files changed

+53
-37
lines changed
 

‎AdvancedCustomRoles/AdvancedCustomRoles.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-

2-
using AdvancedCustomRoles.Handlers;
1+
using AdvancedCustomRoles.Handlers;
32
using Neuron.Core.Plugins;
43
using Synapse3.SynapseModule;
54
using Synapse3.SynapseModule.Events;

‎AdvancedCustomRoles/AdvancedCustomRoles.csproj

+7-7
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
<HintPath>..\packages\Lib.Harmony.2.2.2\lib\net48\0Harmony.dll</HintPath>
4141
</Reference>
4242
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
43-
<HintPath>..\packages\SynapseSL.3.0.0-pre1.1\lib\net48\Assembly-CSharp.dll</HintPath>
43+
<HintPath>..\packages\SynapseSL.3.0.0-pre1.2\lib\net48\Assembly-CSharp.dll</HintPath>
4444
</Reference>
4545
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
46-
<HintPath>..\packages\SynapseSL.3.0.0-pre1.1\lib\net48\Assembly-CSharp-firstpass.dll</HintPath>
46+
<HintPath>..\packages\SynapseSL.3.0.0-pre1.2\lib\net48\Assembly-CSharp-firstpass.dll</HintPath>
4747
</Reference>
4848
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
4949
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
@@ -67,7 +67,7 @@
6767
<HintPath>..\packages\Microsoft.Extensions.Primitives.6.0.0\lib\net461\Microsoft.Extensions.Primitives.dll</HintPath>
6868
</Reference>
6969
<Reference Include="Mirror, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
70-
<HintPath>..\packages\SynapseSL.3.0.0-pre1.1\lib\net48\Mirror.dll</HintPath>
70+
<HintPath>..\packages\SynapseSL.3.0.0-pre1.2\lib\net48\Mirror.dll</HintPath>
7171
</Reference>
7272
<Reference Include="mscorlib" />
7373
<Reference Include="Neuron.Core, Version=1.0.2.0, Culture=neutral, processorArchitecture=Amd64">
@@ -89,7 +89,7 @@
8989
<HintPath>..\packages\SYML.1.0.2\lib\netstandard2.0\SYML.dll</HintPath>
9090
</Reference>
9191
<Reference Include="Synapse3.SynapseModule, Version=3.0.0.0, Culture=neutral, processorArchitecture=Amd64">
92-
<HintPath>..\packages\SynapseSL.3.0.0-pre1.1\lib\net48\Synapse3.SynapseModule.dll</HintPath>
92+
<HintPath>..\packages\SynapseSL.3.0.0-pre1.2\lib\net48\Synapse3.SynapseModule.dll</HintPath>
9393
</Reference>
9494
<Reference Include="System" />
9595
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
@@ -118,13 +118,13 @@
118118
<Reference Include="System.Net.Http" />
119119
<Reference Include="System.Xml" />
120120
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
121-
<HintPath>..\packages\SynapseSL.3.0.0-pre1.1\lib\net48\UnityEngine.dll</HintPath>
121+
<HintPath>..\packages\SynapseSL.3.0.0-pre1.2\lib\net48\UnityEngine.dll</HintPath>
122122
</Reference>
123123
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
124-
<HintPath>..\packages\SynapseSL.3.0.0-pre1.1\lib\net48\UnityEngine.CoreModule.dll</HintPath>
124+
<HintPath>..\packages\SynapseSL.3.0.0-pre1.2\lib\net48\UnityEngine.CoreModule.dll</HintPath>
125125
</Reference>
126126
<Reference Include="UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
127-
<HintPath>..\packages\SynapseSL.3.0.0-pre1.1\lib\net48\UnityEngine.PhysicsModule.dll</HintPath>
127+
<HintPath>..\packages\SynapseSL.3.0.0-pre1.2\lib\net48\UnityEngine.PhysicsModule.dll</HintPath>
128128
</Reference>
129129
<Reference Include="YamlDotNet, Version=11.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
130130
<HintPath>..\packages\YamlDotNet.11.2.1\lib\net45\YamlDotNet.dll</HintPath>

‎AdvancedCustomRoles/CustomRoleHandler.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ public void CreateExampleFile()
111111
MaxHealth = 150,
112112
RoleId = 101,
113113
TeamId = 2,
114-
SetPlayerAtRoundStartChance = 100,
114+
SetPlayerAtRoundStartChance = 0,
115115
RespawnReplace = new()
116116
{
117-
{ (uint)RoleTypeId.NtfCaptain, 100 }
117+
{ (uint)RoleTypeId.NtfCaptain, 0 }
118118
},
119119
Health = 100,
120120
Role = RoleTypeId.ClassD,
+33-18
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,64 @@
11
using System.Linq;
2+
using Neuron.Core.Events;
3+
using Neuron.Core.Meta;
4+
using Ninject;
5+
using PlayerRoles;
6+
using Synapse3.SynapseModule.Dummy;
27
using Synapse3.SynapseModule.Events;
38
using Synapse3.SynapseModule.Player;
9+
using UnityEngine;
410

511
namespace AdvancedCustomRoles.Handlers;
612

7-
public class PlayerHandler
13+
[Automatic]
14+
public class PlayerHandler : Listener
815
{
9-
private readonly AdvancedCustomRoles _plugin;
10-
private readonly PlayerService _player;
16+
[Inject]
17+
public AdvancedCustomRoles Plugin { get; set; }
18+
19+
[Inject]
20+
public PlayerService Player { get; set; }
1121

12-
public PlayerHandler(AdvancedCustomRoles plugin, PlayerEvents playerEvents, PlayerService player)
13-
{
14-
_plugin = plugin;
15-
_player = player;
16-
17-
playerEvents.SetClass.Subscribe(SetClass);
18-
}
19-
20-
private void SetClass(SetClassEvent ev)
22+
[EventHandler]
23+
public void SetClass(SetClassEvent ev)
2124
{
2225
//CustomRoles are to unpredictable to replace
2326
if (ev.Player.CustomRole != null) return;
2427
var id = (uint)ev.Role;
2528

2629
//This handles the Players that will be respawned
27-
if (_plugin.RoundHandler.RespawnPlayers.Contains(ev.Player))
30+
if (Plugin.RoundHandler.RespawnPlayers.Contains(ev.Player))
2831
{
29-
foreach(var respawnRole in _plugin.RoleHandler.CustomRoles)
32+
foreach(var respawnRole in Plugin.RoleHandler.CustomRoles)
3033
{
3134
if (respawnRole.RespawnReplace == null || !respawnRole.RespawnReplace.ContainsKey(id) ||
3235
UnityEngine.Random.Range(1f, 100f) > respawnRole.RespawnReplace[id]) continue;
3336

34-
if (respawnRole.MaxAmount >= 0 && _player.GetPlayers(x => x.RoleID == respawnRole.RoleId).Count() >=
37+
if (respawnRole.MaxAmount >= 0 && Player.GetPlayers(x => x.RoleID == respawnRole.RoleId).Count() >=
3538
respawnRole.MaxAmount) continue;
3639

3740
if (respawnRole.MaxRespawnAmount >= 0 &&
38-
_plugin.RoundHandler.SpawnedRoles.Count(x => x == respawnRole.RoleId) >=
41+
Plugin.RoundHandler.SpawnedRoles.Count(x => x == respawnRole.RoleId) >=
3942
respawnRole.MaxRespawnAmount) continue;
4043

4144
ev.Allow = false;
42-
_plugin.RoundHandler.RespawnPlayers.Remove(ev.Player);
43-
_plugin.RoundHandler.SpawnedRoles.Add(respawnRole.RoleId);
45+
Plugin.RoundHandler.RespawnPlayers.Remove(ev.Player);
46+
Plugin.RoundHandler.SpawnedRoles.Add(respawnRole.RoleId);
4447
ev.Player.RoleID = respawnRole.RoleId;
4548
return;
4649
}
4750
}
4851
}
52+
53+
[EventHandler]
54+
public void KeyPress(KeyPressEvent ev)
55+
{
56+
if (ev.KeyCode == KeyCode.Alpha1)
57+
{
58+
new SynapseDummy(ev.Player.Position, ev.Player.Rotation, RoleTypeId.ClassD, "testdummy")
59+
{
60+
RaVisible = true
61+
};
62+
}
63+
}
4964
}

‎AdvancedCustomRoles/Handlers/RoundHandler.cs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Neuron.Core.Meta;
66
using Ninject;
77
using PlayerRoles.RoleAssign;
8-
using Synapse3.SynapseModule;
98
using Synapse3.SynapseModule.Enums;
109
using Synapse3.SynapseModule.Events;
1110
using Synapse3.SynapseModule.Player;

‎AdvancedCustomRoles/Handlers/ScpHandler.cs

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
using Synapse3.SynapseModule.Events;
1+
using Neuron.Core.Events;
2+
using Neuron.Core.Meta;
3+
using Synapse3.SynapseModule.Events;
24

35
namespace AdvancedCustomRoles.Handlers;
46

5-
public class ScpHandler
7+
[Automatic]
8+
public class ScpHandler : Listener
69
{
710
public ScpHandler(ScpEvents scp)
811
{
@@ -11,17 +14,17 @@ public ScpHandler(ScpEvents scp)
1114
scp.Scp0492Attack.Subscribe(ScpAttack);
1215
scp.Scp173Attack.Subscribe(ScpAttack);
1316
scp.Scp939Attack.Subscribe(ScpAttack);
14-
scp.Scp106Attack.Subscribe(Scp106Attack);
1517
}
16-
18+
1719
private void ScpAttack(ScpAttackEvent ev)
1820
{
1921
if (ev.Scp.CustomRole is not AdvancedRoleScript script) return;
20-
if(script.RoleConfig?.Scp?.ScpAttackDamage == null) return;
22+
if (script.RoleConfig?.Scp?.ScpAttackDamage == null) return;
2123
ev.Damage = script.RoleConfig.Scp.ScpAttackDamage;
2224
}
2325

24-
private void Scp106Attack(Scp106AttackEvent ev)
26+
[EventHandler]
27+
public void Scp106Attack(Scp106AttackEvent ev)
2528
{
2629
if (ev.Scp.CustomRole is not AdvancedRoleScript script) return;
2730
if(script.RoleConfig?.Scp == null) return;

‎AdvancedCustomRoles/packages.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<package id="NeuronModding.Modules.Patcher" version="1.0.2" targetFramework="net48" />
1515
<package id="Ninject" version="3.3.6" targetFramework="net48" />
1616
<package id="SYML" version="1.0.2" targetFramework="net48" />
17-
<package id="SynapseSL" version="3.0.0-pre1.1" targetFramework="net48" />
17+
<package id="SynapseSL" version="3.0.0-pre1.2" targetFramework="net48" />
1818
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
1919
<package id="System.Memory" version="4.5.4" targetFramework="net48" />
2020
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />

0 commit comments

Comments
 (0)
Please sign in to comment.