-
Notifications
You must be signed in to change notification settings - Fork 0
/
PvpArenaAddon.cs
44 lines (37 loc) · 1.32 KB
/
PvpArenaAddon.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using SLHub.Addons;
using Synapse;
namespace PvPArena
{
public class PvpArenaAddon : IHubAddon
{
[AddonConfig("PvPArena")]
public HubAddonConfig Config { get; set; }
public void Reload() { }
public void Load()
{
Server.Get.Events.Player.PlayerShootEvent += Shoot;
Server.Get.Events.Player.PlayerThrowGrenadeEvent += Throw;
Server.Get.Events.Player.PlayerUseMicroEvent += Micro;
}
private void Micro(Synapse.Api.Events.SynapseEventArguments.PlayerUseMicroEventArgs ev)
{
if (!Config.PvpRooms.Contains(ev.Player.Room.RoomType))
ev.State = InventorySystem.Items.MicroHID.HidState.Idle;
}
private void Throw(Synapse.Api.Events.SynapseEventArguments.PlayerThrowGrenadeEventArgs ev)
{
if (!Config.PvpRooms.Contains(ev.Player.Room.RoomType))
ev.Allow = false;
}
private void Shoot(Synapse.Api.Events.SynapseEventArguments.PlayerShootEventArgs ev)
{
if (!Config.PvpRooms.Contains(ev.Player.Room.RoomType))
ev.Allow = false;
}
public void NewRound()
{
foreach (var holder in Config.ItemHolders)
new ItemHolder(holder.Item, holder.Teleporter);
}
}
}