Skip to content

Commit 61ec80a

Browse files
authored
Rework (#1)
* changes * more changes * indents I think * mainly event handler changes * more handler changes * updated bug template * fuck off stylecop * custom item and custom role support for input and output of 914 custom recipes, name consistency changes * mostly readme * better naming * possible fix * work on some errors * asd * tested spawn inventories, removed unncecessary shit * readded api methods as yamato suggested, slightly changed project structure * requested changes * forgot these two lol * I did indeed forgot about the second handler * brainfart moment * revert breaking config changes * disabled most configs by default * v bumpo * the point of not removing this was to not break shit lol
1 parent 62b095c commit 61ec80a

File tree

19 files changed

+962
-934
lines changed

19 files changed

+962
-934
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Bug report
33
about: Create a report to help us improve
44
title: ''
55
labels: needs testing
6-
assignees: joker-119
6+
assignees: Mikihero
77

88
---
99

@@ -20,17 +20,17 @@ Steps to reproduce the behavior:
2020
**Expected behavior**
2121
A clear and concise description of what you expected to happen.
2222

23-
**Server logs**
24-
Please include a pastebin of your localadmin log file (or both MA_log and SCP_log files if you use MultiAdmin) from the time in which the bug occured
25-
26-
**Copy of current CU config section**
23+
**Actual behavior**
24+
A clear and concise description of what actually happens.
2725

26+
**Copy of the relevant CU config section**
27+
If you're experiencing an issue with the Class Max Health module, then post that entire part. Skip this if config is not relevant.
2828

2929
**EXILED Version ("latest" is not a version):**
30+
For example 8.9.2
3031

31-
32-
**Results of `show plugins` command in console:**
32+
**Screenshot of the results of the `plym show` command in server console:**
3333

3434

3535
**Additional context**
36-
Add any other context about the problem here.
36+
Add any other relevant context about the problem here.

Common Utilities/API.cs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
namespace Common_Utilities
2-
{
3-
using System.Collections.Generic;
4-
5-
using Exiled.API.Features;
6-
using PlayerRoles;
7-
8-
public static class API
9-
{
10-
public static List<ItemType> GetStartItems(RoleTypeId role) => Main.Instance.PlayerHandlers.StartItems(role);
11-
12-
public static List<ItemType> GetStartItems(RoleTypeId role, Player player) => Main.Instance.PlayerHandlers.StartItems(role, player);
13-
14-
public static float GetHealthOnKill(RoleTypeId role) => Main.Instance.Config.HealthOnKill?.ContainsKey(role) ?? false ? Main.Instance.Config.HealthOnKill[role] : 0f;
15-
}
1+
namespace Common_Utilities.API;
2+
3+
using System.Collections.Generic;
4+
using Exiled.API.Features;
5+
using PlayerRoles;
6+
7+
public static class API
8+
{
9+
// API methods for potential use by other plugins, not sure if anyone actually uses this
10+
public static float GetHealthOnKill(RoleTypeId role) => Plugin.Instance.Config.HealthOnKill?.ContainsKey(role) ?? false ? Plugin.Instance.Config.HealthOnKill[role] : 0f;
11+
12+
public static List<ItemType> GetStartItems(RoleTypeId role, Player player = null) => Plugin.Instance.playerHandlers.GetStartingInventory(role, player);
1613
}

Common Utilities/Common Utilities.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26-
<PackageReference Include="EXILED" Version="8.4.3" />
26+
<PackageReference Include="EXILEDOFFICIAL" Version="8.11.0" />
2727
<PackageReference Include="StyleCop.Analyzers" Version="$(StyleCopVersion)" IncludeAssets="All" PrivateAssets="All" />
28-
<PackageReference Include="Lib.Harmony" Version="$(HarmonyVersion)" />
2928
</ItemGroup>
3029

3130
<ItemGroup>

Common Utilities/Config.cs

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,41 @@ namespace Common_Utilities
1414

1515
public class Config : IConfig
1616
{
17+
[Description("If the plugin is enabled or not.")]
18+
public bool IsEnabled { get; set; } = true;
19+
1720
[Description("Whether or not debug messages should be shown.")]
1821
public bool Debug { get; set; } = false;
1922

20-
[Description("Whether or not MTF/CI can 'escape' while disarmed to switch teams.")]
21-
public bool DisarmSwitchTeams { get; set; } = true;
22-
23-
[Description("Whether or not disarmed people will be prevented from interacting with doors/elevators.")]
24-
public bool RestrictiveDisarming { get; set; } = true;
23+
[Description("Roles that when cuffed in the escape area will change into the target one.")]
24+
public Dictionary<RoleTypeId, RoleTypeId> DisarmedEscapeSwitchRole { get; set; } =
25+
new()
26+
{
27+
{
28+
RoleTypeId.NtfCaptain, RoleTypeId.ChaosMarauder
29+
},
30+
{
31+
RoleTypeId.ChaosMarauder, RoleTypeId.NtfCaptain
32+
},
33+
};
2534

2635
[Description("The text displayed at the timed interval specified below.")]
27-
public string TimedBroadcast { get; set; } = "<color=#bfff00>This server is running </color><color=red>EXILED Common-Utilities</color><color=lime>, enjoy your stay!</color>";
36+
public string TimedBroadcast { get; set; } = "<color=#bfff00>This server is running </color><color=red>EXILED Common-Utilities</color><color=#bfff00>, enjoy your stay!</color>";
2837

2938
[Description("The time each timed broadcast will be displayed.")]
3039
public ushort TimedBroadcastDuration { get; set; } = 5;
3140

3241
[Description("The delay between each timed broadcast. To disable timed broadcasts, set this to 0")]
33-
public float TimedBroadcastDelay { get; set; } = 300f;
42+
public float TimedBroadcastDelay { get; set; } = 0;
3443

3544
[Description("The message displayed to the player when they first join the server. Setting this to empty will disable these broadcasts.")]
36-
public string JoinMessage { get; set; } = "<color=lime>Welcome %player%! Please read our rules!</color>";
45+
public string JoinMessage { get; set; } = string.Empty;
3746

3847
[Description("The amount of time (in seconds) the join message is displayed.")]
3948
public ushort JoinMessageDuration { get; set; } = 5;
4049

41-
[Description("The amount of time (in seconds) after the round starts, before the facilities auto-nuke will start.")]
42-
public float AutonukeTime { get; set; } = 1500f;
50+
[Description("The amount of time (in seconds) after the round starts, before the facilities auto-nuke will start. Set to -1 to disable.")]
51+
public float AutonukeTime { get; set; } = -1;
4352

4453
[Description("Wether or not the nuke should be unable to be disabled during the auto-nuke countdown.")]
4554
public bool AutonukeLock { get; set; } = true;
@@ -54,26 +63,31 @@ public class Config : IConfig
5463
};
5564

5665
[Description("Whether or not to show player's health under their name when you look at them.")]
57-
public bool PlayerHealthInfo { get; set; } = true;
66+
public bool PlayerHealthInfo { get; set; } = false;
5867

5968
[Description("Whether or not friendly fire should automatically turn on when a round ends (it will turn itself back off before the next round starts).")]
6069
public bool FriendlyFireOnRoundEnd { get; set; } = false;
6170

6271
[Description("The multiplier applied to radio battery usage. Set to 0 to disable radio battery drain.")]
6372
public float RadioBatteryDrainMultiplier { get; set; } = 1f;
6473

65-
[Description("The color to use for lights while the warhead is active.")]
66-
public Color WarheadColor { get; set; } = new(1f, 0.2f, 0.2f);
74+
[Description("Whether to change the color of lights while warhead is active.")]
75+
public bool ChangeWarheadColor { get; set; } = false;
76+
77+
[Description("The color to use for lights while the warhead is active. In the RGBA format using values between 0 and 1. Ignored if ChangeWarheadColor is set to false.")]
78+
public Color WarheadColor { get; set; } = new(1f, 0.2f, 0.2f, 1);
6779

6880
[Description("The maximum time, in seconds, that a player can be AFK before being kicked. Set to -1 to disable AFK system.")]
69-
public int AfkLimit { get; set; } = 120;
81+
public int AfkLimit { get; set; } = -1;
7082

7183
[Description("The roles that are ignored by the AFK system.")]
7284
public List<RoleTypeId> AfkIgnoredRoles { get; set; } = new()
7385
{
7486
RoleTypeId.Scp079,
7587
RoleTypeId.Spectator,
7688
RoleTypeId.Tutorial,
89+
RoleTypeId.Filmmaker,
90+
RoleTypeId.Overwatch,
7791
};
7892

7993
[Description("Whether or not probabilities should be additive (50 + 50 = 100) or not (50 + 50 = 2 seperate 50% chances)")]
@@ -114,7 +128,7 @@ public class Config : IConfig
114128
{
115129
new()
116130
{
117-
Type = ItemType.Ammo556x45,
131+
AmmoType = ItemType.Ammo556x45,
118132
Amount = 200,
119133
Group = "none",
120134
},
@@ -123,19 +137,17 @@ public class Config : IConfig
123137
},
124138
};
125139

126-
[Description("The list of custom 914 recipies. Original is the item being upgraded, New is the item to upgrade to, and Chance is the percent chance of the upgrade happening. You can specify multiple upgrade choices for the same item.")]
127-
public Dictionary<Scp914KnobSetting, List<ItemUpgradeChance>> Scp914ItemChanges { get; set; } = new()
140+
[Description("The list of custom 914 recipies. OriginalItem is the item being upgraded, NewItem is the item to upgrade to, and Chance is the percent chance of the upgrade happening. You can specify multiple upgrade choices for the same item.")]
141+
public Dictionary<Scp914KnobSetting, List<ItemUpgradeChance>> Scp914ItemChances { get; set; } = new()
128142
{
129143
{
130144
Scp914KnobSetting.Rough, new List<ItemUpgradeChance>
131145
{
146+
new()
132147
{
133-
new()
134-
{
135-
Original = ItemType.KeycardO5,
136-
New = ItemType.MicroHID,
137-
Chance = 50,
138-
}
148+
Original = ItemType.KeycardO5.ToString(),
149+
New = ItemType.MicroHID.ToString(),
150+
Chance = 50,
139151
},
140152
}
141153
},
@@ -150,7 +162,7 @@ public class Config : IConfig
150162
{
151163
new()
152164
{
153-
Original = RoleTypeId.ClassD,
165+
Original = RoleTypeId.ClassD.ToString(),
154166
New = RoleTypeId.Spectator.ToString(),
155167
Chance = 100,
156168
}
@@ -159,7 +171,7 @@ public class Config : IConfig
159171
},
160172
};
161173

162-
[Description("The list of 914 teleport settings. Note that if you set \"zone\" to anything other than Unspecified, it will always select a random room from that zone that isn't in the ignoredRooms list, instead of the room type defined.")]
174+
[Description("The list of 914 teleport settings. Note that if you set \"zone\" to anything other than Unspecified, it will always select a random room from that zone that isn't in the ignoredRooms list, instead of the provided room type.")]
163175
public Dictionary<Scp914KnobSetting, List<Scp914TeleportChance>> Scp914TeleportChances { get; set; } = new()
164176
{
165177
{
@@ -168,7 +180,7 @@ public class Config : IConfig
168180
new()
169181
{
170182
Room = RoomType.LczClassDSpawn,
171-
Chance = 100,
183+
Chance = 50,
172184
},
173185
new()
174186
{
@@ -177,6 +189,7 @@ public class Config : IConfig
177189
{
178190
RoomType.Lcz173,
179191
},
192+
Chance = 100,
180193
},
181194
}
182195
},
@@ -237,9 +250,6 @@ public class Config : IConfig
237250
{
238251
RoleTypeId.Scp173, 0
239252
},
240-
{
241-
RoleTypeId.Scp939, 10
242-
},
243253
};
244254

245255
[Description("A list of roles and what their default starting health should be.")]
@@ -248,12 +258,6 @@ public class Config : IConfig
248258
{
249259
RoleTypeId.Scp173, 3200
250260
},
251-
{
252-
RoleTypeId.NtfCaptain, 150
253-
},
254261
};
255-
256-
[Description("If the plugin is enabled or not.")]
257-
public bool IsEnabled { get; set; } = true;
258262
}
259263
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
namespace Common_Utilities.ConfigObjects;
22

3-
public class ItemChance
3+
public class ItemChance : IChanceObject
44
{
55
public string ItemName { get; set; } = ItemType.None.ToString();
66

77
public double Chance { get; set; }
88

99
public string Group { get; set; } = "none";
1010

11-
public void Deconstruct(out string name, out double i, out string groupKey)
11+
public void Deconstruct(out string name, out double i)
1212
{
1313
name = ItemName;
1414
i = Chance;
15-
groupKey = Group;
1615
}
1716
}

Common Utilities/ConfigObjects/ItemUpgradeChance.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
namespace Common_Utilities.ConfigObjects
22
{
3-
public class ItemUpgradeChance
3+
public class ItemUpgradeChance : IChanceObject
44
{
5-
public ItemType Original { get; set; }
5+
public string Original { get; set; }
66

7-
public ItemType New { get; set; }
7+
public string New { get; set; }
88

99
public double Chance { get; set; }
1010

1111
public int Count { get; set; } = 1;
1212

13-
public void Deconstruct(out ItemType itemType, out ItemType itemType1, out double i, out int count)
13+
public void Deconstruct(out string originalItem, out string destinationItem, out double chance, out int count)
1414
{
15-
itemType = Original;
16-
itemType1 = New;
17-
i = Chance;
15+
originalItem = Original;
16+
destinationItem = New;
17+
chance = Chance;
1818
count = Count;
1919
}
2020
}

Common Utilities/ConfigObjects/PlayerUpgradeChance.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ namespace Common_Utilities.ConfigObjects
22
{
33
using PlayerRoles;
44

5-
public class PlayerUpgradeChance
5+
public class PlayerUpgradeChance : IChanceObject
66
{
7-
public RoleTypeId Original { get; set; }
7+
public string Original { get; set; }
88

99
public string New { get; set; } = RoleTypeId.Spectator.ToString();
1010

@@ -14,11 +14,11 @@ public class PlayerUpgradeChance
1414

1515
public bool KeepHealth { get; set; } = true;
1616

17-
public void Deconstruct(out RoleTypeId old, out string newRole, out double i, out bool keepInventory, out bool keepHealth)
17+
public void Deconstruct(out string oldRole, out string newRole, out double chance, out bool keepInventory, out bool keepHealth)
1818
{
19-
old = Original;
19+
oldRole = Original;
2020
newRole = New;
21-
i = Chance;
21+
chance = Chance;
2222
keepInventory = KeepInventory;
2323
keepHealth = KeepHealth;
2424
}

Common Utilities/ConfigObjects/Scp914EffectChance.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace Common_Utilities.ConfigObjects
22
{
33
using Exiled.API.Enums;
44

5-
public class Scp914EffectChance
5+
public class Scp914EffectChance : IChanceObject
66
{
77
public EffectType Effect { get; set; }
88

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
1+
namespace Common_Utilities.ConfigObjects;
2+
13
using System.Collections.Generic;
4+
using Exiled.API.Enums;
5+
using UnityEngine;
26

3-
namespace Common_Utilities.ConfigObjects
7+
public class Scp914TeleportChance : IChanceObject
48
{
5-
using Exiled.API.Enums;
6-
using UnityEngine;
9+
public ZoneType Zone { get; set; } = ZoneType.Unspecified;
710

8-
public class Scp914TeleportChance
9-
{
10-
public ZoneType Zone { get; set; } = ZoneType.Unspecified;
11-
12-
public List<RoomType> IgnoredRooms { get; set; }
11+
public List<RoomType> IgnoredRooms { get; set; } = new();
1312

14-
public RoomType Room { get; set; }
13+
public RoomType Room { get; set; } = RoomType.Unknown;
1514

16-
public Vector3 Offset { get; set; } = Vector3.zero;
15+
public Vector3 Offset { get; set; } = Vector3.zero;
1716

18-
public double Chance { get; set; }
17+
public double Chance { get; set; }
1918

20-
public float Damage { get; set; } = 0f;
19+
public float Damage { get; set; } = 0f;
2120

22-
public void Deconstruct(out RoomType room, out List<RoomType> ignoredRooms, out Vector3 offset, out double chance, out float damage, out ZoneType zone)
23-
{
24-
room = Room;
25-
ignoredRooms = IgnoredRooms;
26-
offset = Offset;
27-
chance = Chance;
28-
damage = Damage;
29-
zone = Zone;
30-
}
21+
public void Deconstruct(out RoomType room, out List<RoomType> ignoredRooms, out Vector3 offset, out double chance, out float damage, out ZoneType zone)
22+
{
23+
room = Room;
24+
ignoredRooms = IgnoredRooms;
25+
offset = Offset;
26+
chance = Chance;
27+
damage = Damage;
28+
zone = Zone;
3129
}
3230
}

0 commit comments

Comments
 (0)