Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f9f3656
fix: Critical CustomRole api Error & Invalid ragdoll error (#560)
MS-crew Jun 18, 2025
5a55e62
fix: Update spawning logic to use IsFpcRole for role validation (#573)
MikeSus1 Jun 19, 2025
23ae2fd
fix: DoorType.Scp173NewGate is DoorType.Scp049Gate (#569)
GoldenPig1205 Jun 19, 2025
e38d4b6
fix: RemainingDecontaminationTime is wrong (#572)
NaxefirYT Jun 19, 2025
4ee1686
fix: Correct role validation logic in spawning events
MikeSus1 Jun 19, 2025
6650b95
feat: Player hint update 14.1.1 (#549)
GoldenPig1205 Jun 19, 2025
3016997
fix: Correct role validation logic in spawning events (#575)
MikeSus1 Jun 19, 2025
da8b884
Fix custom role ragdoll chechk
MS-crew Jun 19, 2025
3c3ce56
fix: Custom role ragdoll validate correction (#577)
MikeSus1 Jun 20, 2025
463fd1f
Missing ServerRoom Elevator recognised as Unknown
louis1706 Jul 5, 2025
79d5f41
fix: CustomRoles GotRoleHint.Show config (#583)
officialvirtualrain Jul 5, 2025
a3a650d
feat: Add UpgradedInventoryItem and UpgradedPickup on Scp914 (#579)
GoldenPig1205 Jul 5, 2025
24795f4
fix: ChangingLeverStatusEventArgs (#582)
GoldenPig1205 Jul 5, 2025
d80e4de
feat: New Changed Aspect Ratio Event & Player::AspectRatio Property (…
MS-crew Jul 5, 2025
b7df292
feat: Server with more interaction (#535)
GoldenPig1205 Jul 5, 2025
573cc6a
fix: Fix IsWeapon() did not check for jailbird (#584)
GoldenPig1205 Jul 5, 2025
254c27a
feat: Add Exiled.API.Features.Workstation (#568)
GoldenPig1205 Jul 5, 2025
f1d2007
fix: OnEscaping Exiled and LabAPI bug (#580)
MS-crew Jul 5, 2025
1aeeb08
feat: Rework and Fix Custom Role Spawn Logic & Limits (#578)
MS-crew Jul 5, 2025
44afe85
Bump Version
louis1706 Jul 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion EXILED/EXILED.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<PropertyGroup>
<!-- This is the global version and is used for all projects that don't have a version -->
<Version Condition="$(Version) == ''">9.6.1</Version>
<Version Condition="$(Version) == ''">9.6.2</Version>
<!-- Enables public beta warning via the PUBLIC_BETA constant -->
<PublicBeta>false</PublicBeta>

Expand Down
60 changes: 60 additions & 0 deletions EXILED/Exiled.API/Enums/AspectRatioType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// -----------------------------------------------------------------------
// <copyright file="AspectRatioType.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Enums
{
/// <summary>
/// All available screen aspect ratio types.
/// </summary>
public enum AspectRatioType : byte
{
/// <summary>
/// Unknown aspect ratio.
/// </summary>
Unknown,

/// <summary>
/// 1:1 aspect ratio (square screen).
/// </summary>
Ratio1_1,

/// <summary>
/// 3:2 aspect ratio.
/// </summary>
Ratio3_2,

/// <summary>
/// 4:3 aspect ratio (standard definition TVs, older monitors).
/// </summary>
Ratio4_3,

/// <summary>
/// 5:4 aspect ratio (some older computer monitors).
/// </summary>
Ratio5_4,

/// <summary>
/// 16:9 aspect ratio (modern widescreen displays, HDTV).
/// </summary>
Ratio16_9,

/// <summary>
/// 16:10 aspect ratio (common in productivity monitors and laptops).
/// </summary>
Ratio16_10,

/// <summary>
/// 21:9 aspect ratio (ultrawide displays).
/// </summary>
Ratio21_9,

/// <summary>
/// 32:9 aspect ratio (super ultrawide displays).
/// </summary>
Ratio32_9,
}
}
6 changes: 3 additions & 3 deletions EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ public static class DamageTypeExtensions
/// Check if a <see cref="DamageType">damage type</see> is caused by a weapon.
/// </summary>
/// <param name="type">The damage type to be checked.</param>
/// <param name="checkMicro">Indicates whether the MicroHid damage type should be taken into account.</param>
/// <param name="checkNonFirearm">Indicates whether the MicroHid and Jailbird damage type should be taken into account.</param>
/// <returns>Returns whether the <see cref="DamageType"/> is caused by weapon.</returns>
public static bool IsWeapon(this DamageType type, bool checkMicro = true) => type switch
public static bool IsWeapon(this DamageType type, bool checkNonFirearm = true) => type switch
{
DamageType.Crossvec or DamageType.Logicer or DamageType.Revolver or DamageType.Shotgun or DamageType.AK or DamageType.Com15 or DamageType.Com18 or DamageType.E11Sr or DamageType.Fsp9 or DamageType.ParticleDisruptor or DamageType.Com45 or DamageType.Frmg0 or DamageType.A7 => true,
DamageType.MicroHid when checkMicro => true,
DamageType.MicroHid or DamageType.Jailbird when checkNonFirearm => true,
_ => false,
};

Expand Down
56 changes: 56 additions & 0 deletions EXILED/Exiled.API/Extensions/FloatExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// -----------------------------------------------------------------------
// <copyright file="FloatExtensions.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Extensions
{
using System;
using System.Collections.Generic;

using Exiled.API.Enums;

/// <summary>
/// A set of extensions for <see cref="float"/>.
/// </summary>
public static class FloatExtensions
{
private static readonly Dictionary<AspectRatioType, float> AspectRatioReferences = new()
{
{ AspectRatioType.Unknown, 0f },
{ AspectRatioType.Ratio1_1, 1f },
{ AspectRatioType.Ratio3_2, 3f / 2f },
{ AspectRatioType.Ratio4_3, 4f / 3f },
{ AspectRatioType.Ratio5_4, 5f / 4f },
{ AspectRatioType.Ratio16_9, 16f / 9f },
{ AspectRatioType.Ratio16_10, 16f / 10f },
{ AspectRatioType.Ratio21_9, 21f / 9f },
{ AspectRatioType.Ratio32_9, 32f / 9f },
};

/// <summary>
/// Gets the closest <see cref="AspectRatioType"/> for a given aspect ratio value.
/// </summary>
/// <param name="ratio">The aspect ratio value to compare.</param>
/// <returns>The closest matching <see cref="AspectRatioType"/>.</returns>
public static AspectRatioType GetAspectRatioLabel(this float ratio)
{
float closestDiff = float.MaxValue;
AspectRatioType closestRatio = AspectRatioType.Unknown;

foreach (KeyValuePair<AspectRatioType, float> kvp in AspectRatioReferences)
{
float diff = Math.Abs(ratio - kvp.Value);
if (diff < closestDiff)
{
closestDiff = diff;
closestRatio = kvp.Key;
}
}

return closestRatio;
}
}
}
4 changes: 2 additions & 2 deletions EXILED/Exiled.API/Extensions/ItemExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public static class ItemExtensions
/// Check if an <see cref="ItemType">item</see> is a weapon.
/// </summary>
/// <param name="type">The item to be checked.</param>
/// <param name="checkMicro">Indicates whether the MicroHID item should be taken into account.</param>
/// <param name="checkNonFirearm">Indicates whether the MicroHID and Jailbird item should be taken into account.</param>
/// <returns>Returns whether the <see cref="ItemType"/> is a weapon.</returns>
public static bool IsWeapon(this ItemType type, bool checkMicro = true) => type.GetFirearmType() is not FirearmType.None || (checkMicro && type is ItemType.MicroHID);
public static bool IsWeapon(this ItemType type, bool checkNonFirearm = true) => type.GetFirearmType() is not FirearmType.None || (checkNonFirearm && type is ItemType.MicroHID or ItemType.Jailbird);

/// <summary>
/// Check if an <see cref="ItemType">item</see> is an SCP.
Expand Down
2 changes: 1 addition & 1 deletion EXILED/Exiled.API/Features/Doors/Door.cs
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ private DoorType GetDoorType()
{
RoomType.EzCheckpointHallwayA => DoorType.CheckpointGateA,
RoomType.EzCheckpointHallwayB => DoorType.CheckpointGateB,
RoomType.Hcz049 => Position.y < -805 ? DoorType.Scp049Gate : DoorType.Scp173NewGate,
RoomType.Hcz049 => Position.y < -10 ? DoorType.Scp049Gate : DoorType.Scp173NewGate,
_ => DoorType.UnknownGate,
},
"Elevator Door" or "Nuke Elevator Door" or "Elevator Door 02" => (Base as Interactables.Interobjects.ElevatorDoor)?.Group switch
Expand Down
1 change: 1 addition & 0 deletions EXILED/Exiled.API/Features/Lift.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public ElevatorSequence Status
ElevatorGroup.Scp049 => ElevatorType.Scp049,
ElevatorGroup.GateA => ElevatorType.GateA,
ElevatorGroup.GateB => ElevatorType.GateB,
ElevatorGroup.ServerRoom => ElevatorType.ServerRoom,
ElevatorGroup.LczA01 or ElevatorGroup.LczA02 => ElevatorType.LczA,
ElevatorGroup.LczB01 or ElevatorGroup.LczB02 => ElevatorType.LczB,
ElevatorGroup.Nuke01 or ElevatorGroup.Nuke02 => ElevatorType.Nuke,
Expand Down
4 changes: 2 additions & 2 deletions EXILED/Exiled.API/Features/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ DecontaminationController.Singleton.NetworkDecontaminationOverride is Decontamin
/// <returns>
/// The remaining time in seconds for the decontamination process.
/// </returns>
public static float RemainingDecontaminationTime => Mathf.Min(0, (float)(DecontaminationController.Singleton.DecontaminationPhases[DecontaminationController.Singleton.DecontaminationPhases.Length - 1].TimeTrigger - DecontaminationController.GetServerTime));
public static float RemainingDecontaminationTime => Mathf.Max(0, (float)(DecontaminationController.Singleton.DecontaminationPhases[DecontaminationController.Singleton.DecontaminationPhases.Length - 1].TimeTrigger - DecontaminationController.GetServerTime));

/// <summary>
/// Gets all <see cref="PocketDimensionTeleport"/> objects.
Expand Down Expand Up @@ -419,4 +419,4 @@ internal static void ClearCache()
#pragma warning restore CS0618
}
}
}
}
34 changes: 33 additions & 1 deletion EXILED/Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ public PlayerInfoArea InfoArea
set => ReferenceHub.nicknameSync.Network_playerInfoToShow = value;
}

/// <summary>
/// Gets the player's current aspect ratio type.
/// </summary>
public AspectRatioType AspectRatio => ReferenceHub.aspectRatioSync.AspectRatio.GetAspectRatioLabel();

/// <summary>
/// Gets or sets the player's custom player info string. This string is displayed along with the player's <see cref="InfoArea"/>.
/// </summary>
Expand Down Expand Up @@ -3020,9 +3025,36 @@ public void ThrowItem(Throwable throwable, bool fullForce = true)
/// <param name="message">The message to be shown.</param>
/// <param name="duration">The duration the text will be on screen.</param>
public void ShowHint(string message, float duration = 3f)
{
ShowHint(message, new HintParameter[] { new StringHintParameter(message) }, null, duration);
}

/// <summary>
/// Shows a hint to the player with the specified message, hint effects, and duration.
/// </summary>
/// <param name="message">The message to be shown as a hint.</param>
/// <param name="hintEffects">The array of hint effects to apply.</param>
/// <param name="duration">The duration the hint will be displayed, in seconds.</param>
public void ShowHint(string message, HintEffect[] hintEffects, float duration = 3f)
{
ShowHint(message, new HintParameter[] { new StringHintParameter(message) }, hintEffects, duration);
}

/// <summary>
/// Shows a hint to the player with the specified message, hint parameters, hint effects, and duration.
/// </summary>
/// <param name="message">The message to be shown as a hint.</param>
/// <param name="hintParameters">The array of hint parameters to use.</param>
/// <param name="hintEffects">The array of hint effects to apply.</param>
/// <param name="duration">The duration the hint will be displayed, in seconds.</param>
public void ShowHint(string message, HintParameter[] hintParameters, HintEffect[] hintEffects, float duration = 3f)
{
message ??= string.Empty;
HintDisplay.Show(new TextHint(message, new HintParameter[] { new StringHintParameter(message) }, null, duration));
HintDisplay.Show(new TextHint(
message,
(!hintParameters.IsEmpty()) ? hintParameters : new HintParameter[] { new StringHintParameter(message) },
hintEffects,
duration));
}

/// <summary>
Expand Down
36 changes: 35 additions & 1 deletion EXILED/Exiled.API/Features/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,15 @@ public static bool IsIdleModeEnabled
/// <seealso cref="RestartRedirect(ushort)"/>
public static void Restart() => Round.Restart(false, true, ServerStatic.NextRoundAction.Restart);

/// <summary>
/// Restarts the server with specified options.
/// </summary>
/// <param name="fastRestart">Indicates whether the restart should be fast.</param>
/// <param name="overrideRestartAction">Indicates whether to override the default restart action.</param>
/// <param name="restartAction">Specifies the action to perform after the restart.</param>
public static void Restart(bool fastRestart, bool overrideRestartAction = false, ServerStatic.NextRoundAction restartAction = ServerStatic.NextRoundAction.DoNothing) =>
Round.Restart(fastRestart, overrideRestartAction, restartAction);

/// <summary>
/// Shutdowns the server, disconnects all players.
/// </summary>
Expand Down Expand Up @@ -266,6 +275,19 @@ public static bool RestartRedirect(ushort redirectPort)
return true;
}

/// <summary>
/// Redirects players to a server on another port, restarts the current server.
/// </summary>
/// <param name="redirectPort">The port to redirect players to.</param>
/// <param name="fastRestart">Indicates whether the restart should be fast.</param>
/// <param name="overrideRestartAction">Indicates whether to override the default restart action.</param>
/// <param name="restartAction">Specifies the action to perform after the restart.</param>
public static void RestartRedirect(ushort redirectPort, bool fastRestart, bool overrideRestartAction = false, ServerStatic.NextRoundAction restartAction = ServerStatic.NextRoundAction.DoNothing)
{
NetworkServer.SendToAll(new RoundRestartMessage(RoundRestartType.RedirectRestart, 0.0f, redirectPort, true, false));
Timing.CallDelayed(0.5f, () => { Restart(fastRestart, overrideRestartAction, restartAction); });
}

/// <summary>
/// Redirects players to a server on another port, shutdowns the current server.
/// </summary>
Expand All @@ -280,6 +302,18 @@ public static bool ShutdownRedirect(ushort redirectPort)
return true;
}

/// <summary>
/// Redirects players to a server on another port, shutdowns the current server.
/// </summary>
/// <param name="redirectPort">The port to redirect players to.</param>
/// <param name="quit">Indicates whether to terminate the application after shutting down the server.</param>
/// <param name="suppressShutdownBroadcast">Indicates whether to suppress the broadcast notification about the shutdown.</param>
public static void ShutdownRedirect(ushort redirectPort, bool quit, bool suppressShutdownBroadcast = false)
{
NetworkServer.SendToAll(new RoundRestartMessage(RoundRestartType.RedirectRestart, 0.0f, redirectPort, true, false));
Timing.CallDelayed(0.5f, () => { Shutdown(quit, suppressShutdownBroadcast); });
}

/// <summary>
/// Executes a server command.
/// </summary>
Expand Down Expand Up @@ -307,4 +341,4 @@ public static bool TryGetSessionVariable<T>(string key, out T result)
return false;
}
}
}
}
Loading