Skip to content

Commit ce6f209

Browse files
committed
I forgor
1 parent 8426a72 commit ce6f209

17 files changed

Lines changed: 293 additions & 305 deletions

ChangeLog.md

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
># Update 3.2.1
2-
>
3-
>>## General
4-
>>> - Added new custom weapon: **AdminAbuse ("Regert")**. Fires a frag grenade on shot and prevents attachment changes.
5-
>>> - Introduced new debug/admin commands for C4 detonation and plugin debugging.
6-
>>> - Improved error handling and logging, including more detailed error messages with timestamps and time zone info.
7-
>
8-
>>## SCP-1162
9-
>>> - Removed the `SCP-1162` item from the game, as it was moved to a dedicated plugin.
10-
>
11-
>>## Sniper
12-
>>> - Prevented attachment changes on the Sniper (SR-118) and provided user feedback.
13-
>>> - Ensured the Sniper's magazine and barrel are emptied after each shot.
14-
>
15-
>>## Utils
16-
>>> - Added and improved utility methods for item handling, color conversion, and candy logic.
17-
>>> - Updated item name mappings and added new item types.
18-
>>> - Improved documentation and code comments for maintainability.
19-
>
20-
>>## Internal
21-
>>> - Refactored and organized command registration and permission checks for better maintainability.
22-
>>> - Improved event subscription management to prevent duplicate event handler calls.
1+
># Update 3.2.2
2+
>
3+
>> ## General
4+
>>> - Refactored a lot of code to make it easier to read
5+
>
6+
>>## Plastic (C-4)
7+
>>> - Added the ability to explode the C-4 via a keybind (default: Delete)
8+
>>>
9+
>
10+
>>## Tranquilizer
11+
>>>- Changed from a person who is tranqed being invulnerable to just having a 60% damage resistance
12+
>>>
13+
>

Commands/Plastic.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
namespace ExtendedItems.Commands
55
{
66
[CommandHandler(typeof(ClientCommandHandler))]
7-
8-
class Plastic : ICommand
7+
internal class Plastic : ICommand
98
{
109
public string Command => "detonate";
1110

@@ -15,19 +14,18 @@ class Plastic : ICommand
1514

1615
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
1716
{
18-
Player ply = Player.Get(sender);
17+
var ply = Player.Get(sender);
1918
Log.Debug($"Player: {ply.Nickname} executed the detonate command.");
2019
if (!Items.Plastic.PlacedCharges.ContainsValue(ply))
2120
{
2221
response = "\n<color=red>You've haven't placed any C4 charges!</color>";
2322
return false;
24-
2523
}
2624

27-
int i = 0;
25+
var i = 0;
2826
foreach (var charge in Items.Plastic.PlacedCharges.ToList())
2927
{
30-
float posy = charge.Key.Position.y;
28+
var posy = charge.Key.Position.y;
3129
if (charge.Value != ply) continue;
3230

3331
if (ply.Position.y >= posy - 100 && ply.Position.y <= posy + 100)
@@ -36,13 +34,15 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
3634
i++;
3735
}
3836
else
39-
{
40-
ply.SendConsoleMessage($"One of your charges is out of range. You need to get within the zone that it was placed", "yellow");
41-
}
37+
ply.SendConsoleMessage(
38+
"One of your charges is out of range. You need to get within the zone that it was placed",
39+
"yellow");
4240
}
4341

44-
response = i == 1 ? $"\n<color=green>{i} C4 charge has been detonated!</color>" : $"\n<color=green>{i} C4 charges have been detonated!</color>";
42+
response = i == 1
43+
? $"\n<color=green>{i} C4 charge has been detonated!</color>"
44+
: $"\n<color=green>{i} C4 charges have been detonated!</color>";
4545
return true;
4646
}
4747
}
48-
}
48+
}

Config.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
using Exiled.API.Enums;
1+
using System.ComponentModel;
22
using Exiled.API.Interfaces;
33
using ExtendedItems.Items;
4-
using System.ComponentModel;
5-
using UnityEngine;
64

75
namespace ExtendedItems
86
{
@@ -13,12 +11,15 @@ public class Config : IConfig
1311

1412
#region Config Settings
1513

16-
[Description("Weather a tranqed target hold the item they had when they were tranqed")]
17-
public bool ReholdItems { get; set; } = false;
18-
1914
[Description("Weather the Tranq is effective on Tutorials")]
2015
public bool EffectiveOnTutorials { get; set; } = false;
2116

17+
[Description("The Distance from Larry a player can be before they can no longer use SCP-1499")]
18+
public float LarryDistance { get; set; } = 1f;
19+
20+
[Description("Ammount of ammo to remove when Grenade Launcher is fired (Can not be negitive)")]
21+
public ushort GrenadeLauncherAmmoUsage { get; set; } = 10;
22+
2223
[Description("The possable hints shown when you Win")]
2324
public string[] WinHints { get; set; } =
2425
[
@@ -44,6 +45,7 @@ public class Config : IConfig
4445
];
4546

4647
#endregion
48+
4749
#region Custom Items setup
4850

4951
public Coin Coin { get; set; } = new();
@@ -54,8 +56,6 @@ public class Config : IConfig
5456
public Plastic Plastic { get; set; } = new();
5557
public AdminAbuse AdminAbuse { get; set; } = new();
5658

57-
5859
#endregion
5960
}
60-
61-
}
61+
}

ExtendedItems.csproj

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
32

43
<PropertyGroup>
54
<TargetFramework>net48</TargetFramework>
@@ -9,15 +8,15 @@
98
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
109
</PropertyGroup>
1110

12-
<PropertyGroup>
13-
<NoWarn>$(NoWarn);MSB3270</NoWarn>
14-
</PropertyGroup>
11+
<PropertyGroup>
12+
<NoWarn>$(NoWarn);MSB3270</NoWarn>
13+
</PropertyGroup>
1514

1615
<ItemGroup>
17-
<PackageReference Include="ExMod.Exiled" Version="9.7.0" />
16+
<PackageReference Include="ExMod.Exiled" Version="9.8.1"/>
1817
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3">
19-
<PrivateAssets>all</PrivateAssets>
20-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18+
<PrivateAssets>all</PrivateAssets>
19+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2120
</PackageReference>
2221
</ItemGroup>
2322

Items/AdminAbuse.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Exiled.API.Enums;
1+
using System.ComponentModel;
2+
using Exiled.API.Enums;
23
using Exiled.API.Features;
34
using Exiled.API.Features.Attributes;
45
using Exiled.API.Features.Components;
@@ -8,26 +9,27 @@
89
using Exiled.Events.EventArgs.Item;
910
using Exiled.Events.EventArgs.Player;
1011
using InventorySystem.Items.Firearms.Attachments;
11-
using System.ComponentModel;
1212
using E = ExtendedItems.Utils;
1313
using ItemEvents = Exiled.Events.Handlers.Item;
1414

1515
namespace ExtendedItems.Items
1616
{
17-
1817
[CustomItem(ItemType.GunRevolver)]
1918
public class AdminAbuse : CustomWeapon
2019
{
2120
[Description("thanks to hayden for the idea on buckshot or else it wouldnt have worked")]
2221
public override uint Id { get; set; } = 799;
22+
2323
public override string Name { get; set; } = "Regert (dont use this because it crashes the server)";
2424
public override string Description { get; set; } = "you asked for it!";
2525
public override float Weight { get; set; } = 0f;
2626
public override float Damage { get; set; } = 0;
27+
2728
public override SpawnProperties? SpawnProperties { get; set; } = new()
2829
{
2930
Limit = 0,
3031
};
32+
3133
public override AttachmentName[] Attachments { get; set; } =
3234
[
3335
AttachmentName.CylinderMag7,
@@ -43,7 +45,8 @@ protected override void OnShot(ShotEventArgs ev)
4345
// so you need to call ev.Firearm.MagazineAmmo :)
4446
ev.Firearm.MagazineAmmo = E.Subtract((ushort)ev.Firearm.MagazineAmmo);
4547

46-
throwable.Projectile.GameObject.AddComponent<CollisionHandler>().Init(ev.Player.GameObject, throwable.Projectile.Base);
48+
throwable.Projectile.GameObject.AddComponent<CollisionHandler>()
49+
.Init(ev.Player.GameObject, throwable.Projectile.Base);
4750

4851
base.OnShot(ev);
4952
}
@@ -71,9 +74,10 @@ protected override void UnsubscribeEvents()
7174

7275
base.UnsubscribeEvents();
7376
}
77+
7478
private static IEnumerator<float> Detonate(Throwable throwable)
7579
{
76-
for (; ; )
80+
for (;;)
7781
{
7882
float comp = -2;
7983
var yVelocity = throwable.Projectile.Rigidbody.linearVelocity.y - comp;

Items/Coin.cs

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.ComponentModel;
12
using Exiled.API.Enums;
23
using Exiled.API.Features;
34
using Exiled.API.Features.Attributes;
@@ -6,10 +7,9 @@
67
using Exiled.Events.EventArgs.Player;
78
using ExtendedItems.Types;
89
using MEC;
9-
using System.ComponentModel;
1010
using PlayerStatsSystem;
11-
using PlayerEvents = Exiled.Events.Handlers.Player;
1211
using UnityEngine;
12+
using PlayerEvents = Exiled.Events.Handlers.Player;
1313

1414
namespace ExtendedItems.Items
1515
{
@@ -26,35 +26,37 @@ public class Coin : CustomItem
2626
Limit = 3,
2727
RoomSpawnPoints =
2828
[
29-
new RoomSpawnPoint() { Room = RoomType.LczCafe, Chance = 50 },
30-
new RoomSpawnPoint() { Room = RoomType.LczToilets, Chance = 50 },
31-
new RoomSpawnPoint() { Room = RoomType.HczArmory, Chance = 50 },
29+
new RoomSpawnPoint { Room = RoomType.LczCafe, Chance = 50, },
30+
new RoomSpawnPoint { Room = RoomType.LczToilets, Chance = 50, },
31+
new RoomSpawnPoint { Room = RoomType.HczArmory, Chance = 50, },
3232
],
3333
DynamicSpawnPoints =
3434
[
35-
new DynamicSpawnPoint() { Location = SpawnLocationType.InsideEscapePrimary, Chance = 50 },
36-
]
35+
new DynamicSpawnPoint { Location = SpawnLocationType.InsideEscapePrimary, Chance = 50, },
36+
],
3737
};
3838

3939
[Description("Effects to give if coin landed on heads.")]
40-
private static CoinEffect[] Effects =>
40+
private static CoinEffect[] Effects =>
4141
[
42-
new() { Type = EffectType.DamageReduction, Duration = 15, Intensity = 75 },
43-
new() { Type = EffectType.RainbowTaste, Duration = 15, Intensity = byte.MaxValue },
44-
new() { Type = EffectType.Invigorated, Duration = 15, Intensity = byte.MaxValue },
45-
new() { Type = EffectType.MovementBoost, Duration = 15, Intensity = 75 },
42+
new() { Type = EffectType.DamageReduction, Duration = 15, Intensity = 75, },
43+
new() { Type = EffectType.RainbowTaste, Duration = 15, Intensity = byte.MaxValue, },
44+
new() { Type = EffectType.Invigorated, Duration = 15, Intensity = byte.MaxValue, },
45+
new() { Type = EffectType.MovementBoost, Duration = 15, Intensity = 75, },
4646
];
4747

4848
protected override void SubscribeEvents()
4949
{
5050
PlayerEvents.FlippingCoin += OnFlippingCoin;
51+
PlayerEvents.ChangingRole += OnRoleChanging;
5152

5253
base.SubscribeEvents();
5354
}
5455

5556
protected override void UnsubscribeEvents()
5657
{
5758
PlayerEvents.FlippingCoin -= OnFlippingCoin;
59+
PlayerEvents.ChangingRole -= OnRoleChanging;
5860

5961
base.UnsubscribeEvents();
6062
}
@@ -68,27 +70,32 @@ private void OnFlippingCoin(FlippingCoinEventArgs ev)
6870
if (ev.IsTails && !ev.Player.IsDead)
6971
{
7072
ev.Player.Scale = Vector3.zero;
71-
string cause = Plugin.Instance?.Config.LoseCauses.RandomItem() ?? "<Error: Coin Reason Not Found>";
72-
Ragdoll? ragdoll = Ragdoll.CreateAndSpawn(ev.Player.Role.Type, ev.Player.DisplayNickname,
73+
var cause = Plugin.Instance?.Config.LoseCauses.RandomItem() ?? "<Error: Coin Reason Not Found>";
74+
var ragdoll = Ragdoll.CreateAndSpawn(ev.Player.Role.Type, ev.Player.DisplayNickname,
7375
new CustomReasonDamageHandler($"{cause}"),
7476
ev.Player.Position, ev.Player.Rotation, ev.Player);
7577

7678
ev.Player.IsGodModeEnabled = false;
7779

78-
ev.Player.Explode();
80+
ev.Player.ExplodeEffect(ProjectileType.FragGrenade);
7981
ev.Player.Kill($"{cause}");
8082
ev.Player.Scale = Vector3.one;
8183
return;
8284
}
8385

8486
ev.Player.ShowHint($"{Plugin.Instance?.Config.WinHints.RandomItem()}");
8587

86-
Effects.ForEach((effect) =>
88+
Effects.ForEach(effect =>
8789
{
8890
ev.Player.EnableEffect(effect.Type, effect.Intensity, effect.Duration, true);
8991
});
9092
});
9193
}
9294

95+
private void OnRoleChanging(ChangingRoleEventArgs ev)
96+
{
97+
ev.Player.Scale = Vector3.one;
98+
ev.Player.DisableAllEffects();
99+
}
93100
}
94101
}

0 commit comments

Comments
 (0)