Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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.0.0-alpha.3</Version>
<Version Condition="$(Version) == ''">9.0.0-alpha.4</Version>
<!-- Enables public beta warning via the PUBLIC_BETA constant -->
<PublicBeta>false</PublicBeta>

Expand Down
7 changes: 6 additions & 1 deletion EXILED/Exiled.API/Enums/DoorType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,12 @@ public enum DoorType
/// <summary>
/// Represents the Gate in the Checkpoint between EZ and HCZ.
/// </summary>
CheckpointGate,
CheckpointGateA,

/// <summary>
/// Represents the Gate in the Checkpoint between EZ and HCZ.
/// </summary>
CheckpointGateB,

/// <summary>
/// Represents the Gate in the Checkpoint between EZ and HCZ.
Expand Down
42 changes: 41 additions & 1 deletion EXILED/Exiled.API/Enums/RoomType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,12 @@ public enum RoomType
/// <summary>
/// Entrance Zone's straight hall before the entrance/heavy checkpoint.
/// </summary>
EzCheckpointHallway,
EzCheckpointHallwayA,

/// <summary>
/// Entrance Zone's straight hall before the entrance/heavy checkpoint.
/// </summary>
EzCheckpointHallwayB,

/// <summary>
/// Heavy Containment Zone's test room's straight hall.
Expand All @@ -293,5 +298,40 @@ public enum RoomType
/// Lazy TODO.
/// </summary>
HczCrossRoomWater,

/// <summary>
/// Lazy TODO.
/// </summary>
HczCornerDeep,

/// <summary>
/// Lazy TODO.
/// </summary>
HczIntersectionJunk,

/// <summary>
/// Lazy TODO.
/// </summary>
HczIntersection,

/// <summary>
/// Lazy TODO.
/// </summary>
HczStraightC,

/// <summary>
/// Lazy TODO.
/// </summary>
HczStraightPipeRoom,

/// <summary>
/// Lazy TODO.
/// </summary>
HczStraightVariant,

/// <summary>
/// Lazy TODO.
/// </summary>
EzSmallrooms,
}
}
3 changes: 2 additions & 1 deletion EXILED/Exiled.API/Features/Doors/Door.cs
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,8 @@ private DoorType GetDoorType()
},
"Unsecured Pryable GateDoor" => Room?.Type switch
{
RoomType.EzCheckpointHallway => DoorType.CheckpointGate,
RoomType.EzCheckpointHallwayA => DoorType.CheckpointGateA,
RoomType.EzCheckpointHallwayB => DoorType.CheckpointGateB,
RoomType.Hcz049 => Position.y < -805 ? DoorType.Scp049Gate : DoorType.Scp173NewGate,
_ => DoorType.UnknownGate,
},
Expand Down
10 changes: 10 additions & 0 deletions EXILED/Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace Exiled.API.Features
using Mirror.LiteNetLib4Mirror;
using PlayerRoles;
using PlayerRoles.FirstPersonControl;
using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers;
using PlayerRoles.RoleAssign;
using PlayerRoles.Spectating;
using PlayerRoles.Voice;
Expand Down Expand Up @@ -732,6 +733,15 @@ public bool IsBypassModeEnabled
set => ReferenceHub.serverRoles.BypassMode = value;
}

/// <summary>
/// Gets or sets the player's emotion.
/// </summary>
public EmotionPresetType Emotion
{
get => EmotionSync.GetEmotionPreset(ReferenceHub);
set => EmotionSync.ServerSetEmotionPreset(ReferenceHub, value);
}

/// <summary>
/// Gets or sets a value indicating whether the player is muted.
/// </summary>
Expand Down
21 changes: 16 additions & 5 deletions EXILED/Exiled.API/Features/Room.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,16 @@ private static RoomType FindType(GameObject gameObject)
"HCZ_Nuke" => RoomType.HczNuke,
"HCZ_Tesla_Rework" => RoomType.HczTesla,
"HCZ_Servers" => RoomType.HczServers,
"HCZ_Room3" or "HCZ_Intersection_Junk" or "HCZ_Intersection" => RoomType.HczTCross,
"HCZ_Room3" => RoomType.HczTCross,
"HCZ_Intersection_Junk" => RoomType.HczIntersectionJunk,
"HCZ_Intersection" => RoomType.HczIntersectionJunk,
"HCZ_096" => RoomType.Hcz096,
"HCZ_Curve" or "HCZ_Corner_Deep" => RoomType.HczCurve,
"HCZ_Straight_C" or "HCZ_Straight" or "HCZ_Straight_PipeRoom" or "HCZ_Straight Variant" => RoomType.HczStraight,
"HCZ_Curve" => RoomType.HczCurve,
"HCZ_Corner_Deep" => RoomType.HczCornerDeep,
"HCZ_Straight_C" => RoomType.HczStraightC,
"HCZ_Straight" => RoomType.HczStraight,
"HCZ_Straight_PipeRoom"=> RoomType.HczStraightPipeRoom,
"HCZ_Straight Variant" => RoomType.HczStraightVariant,
"HCZ_Crossroom_Water" => RoomType.HczCrossRoomWater,
"EZ_Endoof" => RoomType.EzVent,
"EZ_Intercom" => RoomType.EzIntercom,
Expand All @@ -451,7 +457,8 @@ private static RoomType FindType(GameObject gameObject)
"EZ_PCs" => RoomType.EzPcs,
"EZ_Crossing" => RoomType.EzCrossing,
"EZ_CollapsedTunnel" => RoomType.EzCollapsedTunnel,
"EZ_Smallrooms2" or "EZ_Smallrooms1" => RoomType.EzConference,
"EZ_Smallrooms1" => RoomType.EzConference,
"EZ_Smallrooms2" => RoomType.EzSmallrooms,
"EZ_Chef" => RoomType.EzChef,
"EZ_Straight" => RoomType.EzStraight,
"EZ_Cafeteria" => RoomType.EzCafeteria,
Expand All @@ -462,7 +469,11 @@ private static RoomType FindType(GameObject gameObject)
"PocketWorld" => RoomType.Pocket,
"Outside" => RoomType.Surface,
"HCZ_939" => RoomType.Hcz939,
"EZ_HCZ_Checkpoint Part" => RoomType.EzCheckpointHallway,
"EZ_HCZ_Checkpoint Part" => gameObject.transform.position.z switch
{
> 80 => RoomType.EzCheckpointHallwayA,
_ => RoomType.EzCheckpointHallwayB,
},
"HCZ_ChkpA" => RoomType.HczElevatorA,
"HCZ_ChkpB" => RoomType.HczElevatorB,
"HCZ_EZ_Checkpoint Part" => gameObject.transform.position.z switch
Expand Down
38 changes: 38 additions & 0 deletions EXILED/Exiled.Events/EventArgs/Player/ChangedEmotionEventArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// -----------------------------------------------------------------------
// <copyright file="ChangedEmotionEventArgs.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.EventArgs.Player
{
using Exiled.API.Features;
using Exiled.Events.EventArgs.Interfaces;
using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers;

/// <summary>
/// Contains all the information after the player's emotion.
/// </summary>
public class ChangedEmotionEventArgs : IPlayerEvent
{
/// <summary>
/// Initializes a new instance of the <see cref="ChangedEmotionEventArgs"/> class.
/// </summary>
/// <param name="hub"><inheritdoc cref="Player"/></param>
/// <param name="emotionPresetType"><inheritdoc cref="EmotionPresetType"/></param>
public ChangedEmotionEventArgs(ReferenceHub hub, EmotionPresetType emotionPresetType)
{
Player = Exiled.API.Features.Player.Get(hub);
EmotionPresetType = emotionPresetType;
}

/// <summary>
/// Gets the player's emotion.
/// </summary>
public EmotionPresetType EmotionPresetType { get; }

/// <inheritdoc/>
public Player Player { get; }
}
}
50 changes: 50 additions & 0 deletions EXILED/Exiled.Events/EventArgs/Player/ChangingEmotionEventArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// -----------------------------------------------------------------------
// <copyright file="ChangingEmotionEventArgs.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.EventArgs.Player
{
using Exiled.API.Features;
using Exiled.Events.EventArgs.Interfaces;
using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers;

/// <summary>
/// Contains all the information before the player's emotion changes.
/// </summary>
public class ChangingEmotionEventArgs : IDeniableEvent, IPlayerEvent
{
/// <summary>
/// Initializes a new instance of the <see cref="ChangingEmotionEventArgs"/> class.
/// </summary>
/// <param name="hub"><inheritdoc cref="Player"/></param>
/// <param name="emotionPresetTypeNew"><inheritdoc cref="EmotionPresetTypeNew"/></param>
/// <param name="emotionPresetTypeOld"><inheritdoc cref="EmotionPresetTypeOld"/></param>
/// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param>
public ChangingEmotionEventArgs(ReferenceHub hub, EmotionPresetType emotionPresetTypeNew, EmotionPresetType emotionPresetTypeOld, bool isAllowed = true)
{
Player = Exiled.API.Features.Player.Get(hub);
EmotionPresetTypeNew = emotionPresetTypeNew;
EmotionPresetTypeOld = emotionPresetTypeOld;
IsAllowed = isAllowed;
}

/// <inheritdoc/>
public bool IsAllowed { get; set; }

/// <summary>
/// Gets the old player's emotion.
/// </summary>
public EmotionPresetType EmotionPresetTypeOld { get; }

/// <summary>
/// Gets or sets the new player's emotion.
/// </summary>
public EmotionPresetType EmotionPresetTypeNew { get; set; }

/// <inheritdoc/>
public Player Player { get; }
}
}
22 changes: 22 additions & 0 deletions EXILED/Exiled.Events/Handlers/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,28 @@ public class Player
/// </summary>
public static Event<ChangingNicknameEventArgs> ChangingNickname { get; set; } = new();

/// <summary>
/// Invoked before a player's emotion changed.
/// </summary>
public static Event<ChangingEmotionEventArgs> ChangingEmotion { get; set; } = new();

/// <summary>
/// Invoked after a player's emotion changed.
/// </summary>
public static Event<ChangedEmotionEventArgs> ChangedEmotion { get; set; } = new();

/// <summary>
/// Called before a player's emotion changed.
/// </summary>
/// <param name="ev">The <see cref="ChangingEmotionEventArgs"/> instance.</param>
public static void OnChangingEmotion(ChangingEmotionEventArgs ev) => ChangingEmotion.InvokeSafely(ev);

/// <summary>
/// Called after a player's emotion changed.
/// </summary>
/// <param name="ev">The <see cref="ChangedEmotionEventArgs"/> instance.</param>
public static void OnChangedEmotion(ChangedEmotionEventArgs ev) => ChangedEmotion.InvokeSafely(ev);

/// <summary>
/// Called before reserved slot is resolved for a <see cref="API.Features.Player"/>.
/// </summary>
Expand Down
38 changes: 38 additions & 0 deletions EXILED/Exiled.Events/Patches/Events/Player/Emotion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// -----------------------------------------------------------------------
// <copyright file="Emotion.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.Patches.Events.Player
{
using Exiled.Events.Attributes;
using Exiled.Events.EventArgs.Player;
using HarmonyLib;
using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers;

/// <summary>
/// Patches <see cref="EmotionSync.ServerSetEmotionPreset"/>.
/// Adds the <see cref="Handlers.Player.ChangingEmotion" /> event and
/// <see cref="Handlers.Player.ChangedEmotion" /> event.
/// </summary>
[EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.ChangingEmotion))]
[EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.ChangedEmotion))]
[HarmonyPatch(typeof(EmotionSync), nameof(EmotionSync.ServerSetEmotionPreset))]
internal static class Emotion
{
private static bool Prefix(this ReferenceHub hub, EmotionPresetType preset)
{
ChangingEmotionEventArgs ev = new(hub, preset, EmotionSync.GetEmotionPreset(hub));
Handlers.Player.OnChangingEmotion(ev);
return ev.IsAllowed;
}

private static void Postfix(this ReferenceHub hub, EmotionPresetType preset)
{
ChangedEmotionEventArgs ev = new(hub, EmotionSync.GetEmotionPreset(hub));
Handlers.Player.OnChangedEmotion(ev);
}
}
}
6 changes: 3 additions & 3 deletions EXILED/Exiled.Events/Patches/Events/Scp1344/Deactivating.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private static bool Prefix(ref Scp1344Item __instance)
{
if (__instance._useTime == 0)
{
var ev = new TryingDeactivatingEventArgs(Item.Get(__instance));
TryingDeactivatingEventArgs ev = new(Item.Get(__instance));
Exiled.Events.Handlers.Scp1344.OnTryingDeactivating(ev);

if (!ev.IsAllowed)
Expand All @@ -44,7 +44,7 @@ private static bool Prefix(ref Scp1344Item __instance)

if (__instance._useTime + Time.deltaTime >= 5.1f)
{
var deactivating = new DeactivatingEventArgs(Item.Get(__instance));
DeactivatingEventArgs deactivating = new(Item.Get(__instance));
Exiled.Events.Handlers.Scp1344.OnDeactivating(deactivating);

if (!deactivating.IsAllowed)
Expand All @@ -55,7 +55,7 @@ private static bool Prefix(ref Scp1344Item __instance)
__instance.ActivateFinalEffects();
__instance.ServerDropItem(__instance);

var ev = new DeactivatedEventArgs(Item.Get(__instance));
DeactivatedEventArgs ev = new(Item.Get(__instance));
Exiled.Events.Handlers.Scp1344.OnDeactivated(ev);
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions EXILED/Exiled.Loader/Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public Loader()
Log.Warn("You are running a public beta build. It is not compatible with another version of the game.");
#endif

Log.SendRaw($"Exiled.API - Version {PluginAPI.Loader.AssemblyLoader.Dependencies.FirstOrDefault(x => x.GetName().Name == "Exiled.API").GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion}", ConsoleColor.DarkRed);
Log.SendRaw($"{Assembly.GetExecutingAssembly().GetName().Name} - Version {Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion}", ConsoleColor.DarkRed);

if (MultiAdminFeatures.MultiAdminUsed)
Expand Down Expand Up @@ -145,8 +146,7 @@ public static void LoadPlugins()

AssemblyInformationalVersionAttribute attribute = plugin.Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();

Log.Info($"Loaded plugin {plugin.Name}@{(plugin.Version is not null ? $"{plugin.Version.Major}.{plugin.Version.Minor}.{plugin.Version.Build}" : attribute is not null ? attribute.InformationalVersion : string.Empty)}");

Log.Info($"Loaded plugin {plugin.Name}@{(attribute is not null ? attribute.InformationalVersion : plugin.Version is not null ? $"{plugin.Version.Major}.{plugin.Version.Minor}.{plugin.Version.Build}" : string.Empty)}");
Server.PluginAssemblies.Add(assembly, plugin);
Plugins.Add(plugin);
}
Expand Down
15 changes: 12 additions & 3 deletions EXILED/Exiled.Loader/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Exiled.Loader
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

using Exiled.API.Features;
using Exiled.Loader.GHApi;
Expand Down Expand Up @@ -112,9 +113,16 @@ internal static Updater Initialize(Config config)
/// </summary>
internal void CheckUpdate()
{
using HttpClient client = CreateHttpClient();
if (Busy = FindUpdate(client, !File.Exists(Path.Combine(Paths.Dependencies, "Exiled.API.dll")), out NewVersion newVersion))
Update(client, newVersion);
try
{
using HttpClient client = CreateHttpClient();
if (Busy = FindUpdate(client, !PluginAPI.Loader.AssemblyLoader.Dependencies.Exists(x => x.GetName().Name == "Exiled.API"), out NewVersion newVersion))
Update(client, newVersion);
}
catch (Exception e)
{
Log.Error(e);
}
}

/// <summary>
Expand Down Expand Up @@ -144,6 +152,7 @@ private bool FindUpdate(HttpClient client, bool forced, out NewVersion newVersio
{
try
{
Thread.Sleep(5000); // Wait for the assemblies to load
ExiledLib smallestVersion = ExiledLib.Min();

Log.Info($"Found the smallest version of Exiled - {smallestVersion.Library.GetName().Name}:{smallestVersion.Version}");
Expand Down