Skip to content

Commit 1efab43

Browse files
committed
this is a temp thing
1 parent ad46b44 commit 1efab43

6 files changed

Lines changed: 42 additions & 20 deletions

File tree

Items/Plastic.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
using UnityEngine;
1616
using YamlDotNet.Serialization;
1717

18-
// System imports
19-
2018
// shortcuted imports
2119
using PlayerEvent = Exiled.Events.Handlers.Player;
2220
using ServerEvent = Exiled.Events.Handlers.Server;
@@ -75,7 +73,6 @@ public void Handler(Pickup? charge, C4RemoveMethod method = C4RemoveMethod.Drop,
7573
if (detonator == null && charge != null) { method = C4RemoveMethod.Drop; }
7674
else { detonator = Charges.TryGetValue(charge.Serial, out var foundPlayer) ? foundPlayer : null; }
7775

78-
7976
switch (method)
8077
{
8178
case C4RemoveMethod.Detonate:
@@ -120,6 +117,7 @@ protected override void UnsubscribeEvents()
120117
PlayerEvent.Destroying -= OnDestroying;
121118
PlayerEvent.Died -= OnDied;
122119
PlayerEvent.Shooting -= OnShooting;
120+
123121
ServerEvent.RoundEnded -= OnRoundEnded;
124122

125123
base.UnsubscribeEvents();

Items/Scp1162.cs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
using YamlDotNet.Serialization;
1111
using Random = System.Random;
1212
using ServerEvents = Exiled.Events.Handlers.Server;
13+
using PlayerEvent = Exiled.Events.Handlers.Player;
14+
using E = ExtendedItems.Utils;
1315

1416
namespace ExtendedItems.Items
1517
{
@@ -56,13 +58,14 @@ public class Scp1162 : CustomItem
5658
ItemType.Coin,
5759
ItemType.Flashlight,
5860
ItemType.Radio,
61+
ItemType.None,
5962

6063
];
6164

6265
private void OnRoundStarted()
6366
{
6467
Room room = Room.Get(Plugin.Instance.Config.Scp1162Room);
65-
Vector3 globalPos = Utils.GetGlobalCords(Plugin.Instance.Config.Scp1162Room, new Vector3(16.68f, 11.6f, 8.11f));
68+
Vector3 globalPos = E.GetGlobalCords(Plugin.Instance.Config.Scp1162Room, new Vector3(16.68f, 11.6f, 8.11f));
6669

6770
Quaternion rotation = room.Rotation;
6871
Vector3 rot = new(0f, 1f, 0.0f);
@@ -78,23 +81,28 @@ private void OnRoundStarted()
7881
protected override void SubscribeEvents()
7982
{
8083
ServerEvents.RoundStarted += OnRoundStarted;
84+
PlayerEvent.PickingUpItem += OnPickingUp;
85+
PlayerEvent.DroppingItem += OnDroppingItem;
8186

8287
base.SubscribeEvents();
8388
}
8489

8590
protected override void UnsubscribeEvents()
8691
{
8792
ServerEvents.RoundStarted -= OnRoundStarted;
93+
PlayerEvent.PickingUpItem -= OnPickingUp;
94+
PlayerEvent.DroppingItem -= OnDroppingItem;
8895

8996
base.UnsubscribeEvents();
9097
}
9198

9299
protected override void OnDroppingItem(DroppingItemEventArgs ev)
93100
{
101+
if(!Check(ev.Item))
94102
ev.Item.Destroy();
95103

96104
Room room = Room.Get(Plugin.Instance.Config.Scp1162Room);
97-
Vector3 globalPos = Utils.GetGlobalCords(Plugin.Instance.Config.Scp1162Room, new Vector3(16.68f, 11.6f, 8.11f));
105+
Vector3 globalPos = E.GetGlobalCords(Plugin.Instance.Config.Scp1162Room, new Vector3(16.68f, 11.6f, 8.11f));
98106

99107
Quaternion rotation = room.Rotation;
100108
Vector3 rot = new(0f, 1f, 0.0f);
@@ -111,11 +119,13 @@ protected override void OnDroppingItem(DroppingItemEventArgs ev)
111119

112120
protected override void OnPickingUp(PickingUpItemEventArgs ev)
113121
{
114-
ev.IsAllowed = false;
122+
if(!Check(ev.Pickup)) return;
123+
ev.IsAllowed = false;
115124

116125
try
117126
{
118127
Item item = ev.Player.CurrentItem;
128+
int rnad;
119129
if (item == null)
120130
{
121131
ev.Player.EnableEffect(EffectType.SeveredHands, byte.MaxValue);
@@ -130,18 +140,21 @@ protected override void OnPickingUp(PickingUpItemEventArgs ev)
130140
}
131141
ev.Player.RemoveItem(item);
132142
if (_rng.NextDouble() < LoseChance) return;
143+
rnad = _rng.Next(0, ItemTypes.Length);
144+
if (ItemTypes[rnad] == ItemType.None)
145+
{
146+
ev.Player.TryAddCandy(E.AddCandy(_rng.Next(0,6)));
147+
}
133148
item = ev.Player.AddItem(ItemTypes[_rng.Next(0, ItemTypes.Length)]);
134149

135-
136-
137150
ev.Player.CurrentItem = item;
138-
139151
}
140152
return;
141153
}
142-
catch
154+
catch (Exception ex)
143155
{
144-
// ignored
156+
Log.Warn($"Error: {ex}");
157+
ev.Player.ShowHint("Something went wrong", 5);
145158
}
146159

147160
base.OnPickingUp(ev);

Items/Sniper.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ public class Sniper : CustomWeapon
1515
{
1616
public override uint Id { get; set; } = 802;
1717
public override string Name { get; set; } = "SR-118";
18-
1918
public override string Description { get; set; } = "A modified E-11 that fires 5.56 at supersonic velocity that deals significantly more damage";
20-
21-
public override float Weight { get; set; } = 8f;
19+
public override float Weight { get; set; } = 5f;
2220
public override float Damage { get; set; } = 112f;
2321
public override byte ClipSize { get; set; } = 1;
2422

@@ -29,8 +27,8 @@ public class Sniper : CustomWeapon
2927
AttachmentName.Foregrip,
3028
AttachmentName.DotSight,
3129
AttachmentName.RecoilReducingStock,
32-
AttachmentName.RifleBody,
33-
AttachmentName.SoundSuppressor
30+
AttachmentName.CarbineBody,
31+
AttachmentName.MuzzleBrake
3432
];
3533

3634
public override SpawnProperties? SpawnProperties { get; set; } = new()

Items/Tranquilizer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ private void OnChangingRole(ChangingRoleEventArgs ev)
8080

8181
protected override void OnShot(ShotEventArgs ev)
8282
{
83+
if(!Check(ev.Item)) return;
8384
Affected = true;
8485

8586
if (ev.Target == null || Plugin.Instance == null) return;
@@ -93,7 +94,7 @@ protected override void OnShot(ShotEventArgs ev)
9394

9495
Exiled.API.Features.Items.Item? item = null;
9596

96-
if ((bool)(Plugin.Instance.Config.ReholdItems!))
97+
if ((Plugin.Instance.Config.ReholdItems!))
9798
{
9899
item = ev.Target.CurrentItem;
99100
}

Plugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class Plugin : Plugin<Config>
88
public override string Prefix => "Cactus Patch";
99
public override string Name => "Extended Items";
1010
public override string Author => "Noobest1001";
11-
public override Version Version => new(3, 0, 1);
11+
public override Version Version => new(3, 3, 0);
1212
public override Version RequiredExiledVersion => new(9, 6, 0);
1313
public static Plugin? Instance;
1414

Utils.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Exiled.API.Enums;
22
using Exiled.API.Extensions;
33
using Exiled.API.Features;
4+
using InventorySystem.Items.Usables.Scp330;
45
using UnityEngine;
56
using CK = Exiled.CustomItems.API.Features;
67
using EP = Exiled.API.Features.Player;
@@ -151,8 +152,19 @@ public static List<string> GetPropertiesOfHeldOrFirst(EP player)
151152
helditem.CopyProperties(response);
152153
return response;
153154
}
154-
155-
155+
public static CandyKindID AddCandy(int candy)
156+
{
157+
return candy switch
158+
{
159+
0 => CandyKindID.Pink,
160+
1 => CandyKindID.Blue,
161+
2 => CandyKindID.Green,
162+
3 => CandyKindID.Yellow,
163+
4 => CandyKindID.Purple,
164+
5 => CandyKindID.Rainbow,
165+
_ => CandyKindID.Red,
166+
};
167+
}
156168

157169
}
158170
}

0 commit comments

Comments
 (0)