Skip to content

Commit 86f7835

Browse files
authored
Merge branch 'dev' into FixNpcNoclip
2 parents fd8e5c0 + 1f2d209 commit 86f7835

File tree

19 files changed

+301
-32
lines changed

19 files changed

+301
-32
lines changed

.github/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ Localization: # Add the 'Localization' label
3535
- changed-files:
3636
- any-glob-to-any-file: EXILED/Localization/** # Any modifications to Localization
3737

38-
GitHub_Actions: # Add the 'GitHub' label
38+
GitHub: # Add the 'GitHub' label
3939
- changed-files:
4040
- any-glob-to-any-file: .github/** # Any modifications to github related files

.github/pull_request_template.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Description
2+
**Describe the changes**
3+
4+
5+
**What is the current behavior?** (You can also link to an open issue here)
6+
7+
8+
**What is the new behavior?** (if this is a feature change)
9+
10+
11+
**Does this PR introduce a breaking change?** (What changes might users need to make in their application due to this PR?)
12+
13+
14+
**Other information**:
15+
16+
<br />
17+
18+
## Types of changes
19+
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
20+
- [ ] Bug fix (non-breaking change which fixes an issue)
21+
- [ ] New feature (non-breaking change which adds functionality)
22+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
23+
- [ ] Documentations
24+
<br />
25+
26+
## Submission checklist
27+
<!--- Put an `x` in all the boxes that apply: -->
28+
- [ ] I have checked the project can be compiled
29+
- [ ] I have tested my changes and it worked as expected
30+
31+
### Patches (if there are any changes related to Harmony patches)
32+
- [ ] I have checked no IL patching errors in the console
33+
34+
### Other
35+
- [ ] Still requires more testing

.github/workflows/dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ defaults:
1414
working-directory: ./EXILED
1515

1616
env:
17-
EXILED_REFERENCES_URL: https://Exiled-Official.github.io/SL-References/Dev.zip
17+
EXILED_REFERENCES_URL: https://exmod-team.github.io/SL-References/Dev.zip
1818
EXILED_REFERENCES_PATH: ${{ github.workspace }}/EXILED/References
19-
EXILED_DLL_ARCHIVER_URL: https://github.com/Exiled-Official/EXILED-DLL-Archiver/releases/latest/download/EXILED-DLL-Archiver.exe
19+
EXILED_DLL_ARCHIVER_URL: https://github.com/ExMod-Team/EXILED-DLL-Archiver/releases/latest/download/EXILED-DLL-Archiver.exe
2020

2121
jobs:
2222

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
id-token: write
1313

1414
env:
15-
EXILED_REFERENCES_URL: https://Exiled-Official.github.io/SL-References/Dev.zip
15+
EXILED_REFERENCES_URL: https://exmod-team.github.io/SL-References/Master.zip
1616
EXILED_REFERENCES_PATH: ${{ github.workspace }}/EXILED/References
1717

1818
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.

.github/workflows/labeler.yml renamed to .github/workflows/pull_request_opened.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@ jobs:
2020
repo-token: ${{ secrets.GITHUB_TOKEN }}
2121
configuration-path: .github/labeler.yml
2222
sync-labels: true
23+
assign-author:
24+
runs-on: ubuntu-latest
25+
permissions:
26+
pull-requests: write
27+
28+
steps:
29+
- uses: toshimaru/auto-author-assign@v2.1.1

EXILED/Exiled.API/Extensions/MirrorExtensions.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace Exiled.API.Extensions
2525
using PlayerRoles;
2626
using PlayerRoles.FirstPersonControl;
2727
using PlayerRoles.PlayableScps.Scp049.Zombies;
28+
using PlayerRoles.Voice;
2829
using RelativePositioning;
2930

3031
using Respawning;
@@ -181,6 +182,18 @@ public static void PlayGunSound(this Player player, Vector3 position, ItemType i
181182
player.Connection.Send(message);
182183
}
183184

185+
/// <summary>
186+
/// Sets <see cref="Features.Intercom.DisplayText"/> that only the <paramref name="target"/> player can see.
187+
/// </summary>
188+
/// <param name="target">Only this player can see Display Text.</param>
189+
/// <param name="text">Text displayed to the player.</param>
190+
public static void SetIntercomDisplayTextForTargetOnly(this Player target, string text) => target.SendFakeSyncVar(IntercomDisplay._singleton.netIdentity, typeof(IntercomDisplay), nameof(IntercomDisplay.Network_overrideText), text);
191+
192+
/// <summary>
193+
/// Resync <see cref="Features.Intercom.DisplayText"/>.
194+
/// </summary>
195+
public static void ResetIntercomDisplayText() => ResyncSyncVar(IntercomDisplay._singleton.netIdentity, typeof(IntercomDisplay), nameof(IntercomDisplay.Network_overrideText));
196+
184197
/// <summary>
185198
/// Sets <see cref="Room.Color"/> of a <paramref name="room"/> that only the <paramref name="target"/> player can see.
186199
/// </summary>

EXILED/Exiled.API/Features/Items/Jailbird.cs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77

88
namespace Exiled.API.Features.Items
99
{
10+
using System;
11+
1012
using Exiled.API.Features.Pickups;
1113
using Exiled.API.Interfaces;
1214
using InventorySystem.Items.Autosync;
1315
using InventorySystem.Items.Jailbird;
1416
using Mirror;
17+
using UnityEngine;
1518

1619
using JailbirdPickup = Pickups.JailbirdPickup;
1720

@@ -114,12 +117,35 @@ public JailbirdWearState WearState
114117
get => Base._deterioration.WearState;
115118
set
116119
{
117-
if (JailbirdDeteriorationTracker.ReceivedStates.ContainsKey(Serial))
118-
JailbirdDeteriorationTracker.ReceivedStates[Serial] = value;
120+
TotalDamageDealt = GetDamage(value);
121+
TotalCharges = GetCharge(value);
119122
Base._deterioration.RecheckUsage();
120123
}
121124
}
122125

126+
/// <summary>
127+
/// Calculates the damage corresponding to a given <see cref="JailbirdWearState"/>.
128+
/// </summary>
129+
/// <param name="wearState">The wear state to calculate damage for.</param>
130+
/// <returns>The amount of damage associated with the specified wear state.</returns>
131+
public float GetDamage(JailbirdWearState wearState)
132+
{
133+
foreach (Keyframe keyframe in Base._deterioration._damageToWearState.keys)
134+
{
135+
if (Base._deterioration.FloatToState(keyframe.value) == wearState)
136+
return keyframe.time;
137+
}
138+
139+
throw new Exception("Wear state not found in damage to wear state mapping.");
140+
}
141+
142+
/// <summary>
143+
/// Gets the charge needed to reach a specific <see cref="JailbirdWearState"/>.
144+
/// </summary>
145+
/// <param name="wearState">The desired wear state to calculate the charge for.</param>
146+
/// <returns>The charge value required to achieve the specified wear state.</returns>
147+
public int GetCharge(JailbirdWearState wearState) => (int)wearState;
148+
123149
/// <summary>
124150
/// Breaks the Jailbird.
125151
/// </summary>

EXILED/Exiled.API/Features/Map.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ public static class Map
5757
/// </summary>
5858
internal static readonly List<PocketDimensionTeleport> TeleportsValue = new(8);
5959

60-
/// <summary>
61-
/// A list of <see cref="AdminToy"/>s on the map.
62-
/// </summary>
63-
internal static readonly List<AdminToy> ToysValue = new();
64-
6560
private static TantrumEnvironmentalHazard tantrumPrefab;
6661
private static Scp939AmnesticCloudInstance amnesticCloudPrefab;
6762

@@ -130,7 +125,7 @@ DecontaminationController.Singleton.NetworkDecontaminationOverride is Decontamin
130125
/// <summary>
131126
/// Gets all <see cref="AdminToy"/> objects.
132127
/// </summary>
133-
public static ReadOnlyCollection<AdminToy> Toys { get; } = ToysValue.AsReadOnly();
128+
public static ReadOnlyCollection<AdminToy> Toys => AdminToy.BaseToAdminToy.Values.ToList().AsReadOnly(); // TODO: Obsolete it and make people use AdminToy.List
134129

135130
/// <summary>
136131
/// Gets or sets the current seed of the map.

EXILED/Exiled.API/Features/Player.cs

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,8 +1266,13 @@ public static Player Get(GameObject gameObject)
12661266
if (Dictionary.TryGetValue(gameObject, out Player player))
12671267
return player;
12681268

1269-
UnverifiedPlayers.TryGetValue(gameObject, out player);
1270-
return player;
1269+
if (UnverifiedPlayers.TryGetValue(gameObject, out player))
1270+
return player;
1271+
1272+
if (ReferenceHub.TryGetHub(gameObject, out ReferenceHub hub))
1273+
return new(hub);
1274+
1275+
return null;
12711276
}
12721277

12731278
/// <summary>
@@ -2319,6 +2324,16 @@ public void Broadcast(ushort duration, string message, global::Broadcast.Broadca
23192324
public void AddAmmo(AmmoType ammoType, ushort amount) =>
23202325
Inventory.ServerAddAmmo(ammoType.GetItemType(), amount);
23212326

2327+
/// <summary>
2328+
/// Adds the amount of a specified <see cref="AmmoType">ammo type</see> to player's inventory.
2329+
/// </summary>
2330+
/// <param name="ammoBag">A dictionary of <see cref="AmmoType">ammo types</see> that will be added.</param>
2331+
public void AddAmmo(Dictionary<AmmoType, ushort> ammoBag)
2332+
{
2333+
foreach (KeyValuePair<AmmoType, ushort> kvp in ammoBag)
2334+
AddAmmo(kvp.Key, kvp.Value);
2335+
}
2336+
23222337
/// <summary>
23232338
/// Adds the amount of a weapon's <see cref="AmmoType">ammo type</see> to the player's inventory.
23242339
/// </summary>
@@ -2338,6 +2353,16 @@ public void SetAmmo(AmmoType ammoType, ushort amount)
23382353
Inventory.ServerSetAmmo(itemType, amount);
23392354
}
23402355

2356+
/// <summary>
2357+
/// Sets the amount of a specified <see cref="AmmoType">ammo type</see> to player's inventory.
2358+
/// </summary>
2359+
/// <param name="ammoBag">A dictionary of <see cref="AmmoType">ammo types</see> that will be added.</param>
2360+
public void SetAmmo(Dictionary<AmmoType, ushort> ammoBag)
2361+
{
2362+
foreach (KeyValuePair<AmmoType, ushort> kvp in ammoBag)
2363+
SetAmmo(kvp.Key, kvp.Value);
2364+
}
2365+
23412366
/// <summary>
23422367
/// Gets the ammo count of a specified <see cref="AmmoType">ammo type</see> in a player's inventory.
23432368
/// </summary>
@@ -2728,8 +2753,8 @@ public void ResetInventory(IEnumerable<Item> newItems)
27282753
/// <seealso cref="DropItems()"/>
27292754
public void ClearInventory(bool destroy = true)
27302755
{
2731-
ClearItems(destroy);
27322756
ClearAmmo();
2757+
ClearItems(destroy);
27332758
}
27342759

27352760
/// <summary>

EXILED/Exiled.API/Features/Server.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ public static bool IsWhitelisted
178178
set => ServerConsole.WhiteListEnabled = value;
179179
}
180180

181+
/// <summary>
182+
/// Gets the list of user IDs of players currently whitelisted.
183+
/// </summary>
184+
public static HashSet<string> WhitelistedPlayers => WhiteList.Users;
185+
181186
/// <summary>
182187
/// Gets a value indicating whether or not this server is verified.
183188
/// </summary>

0 commit comments

Comments
 (0)