Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
47 changes: 47 additions & 0 deletions EXILED/Exiled.API/Enums/ScenesType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// -----------------------------------------------------------------------
// <copyright file="ScenesType.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Enums
{
/// <summary>
/// Unique identifier for the different types of Scenes the client and server can load.
/// </summary>
public enum ScenesType
{
/// <summary>
/// The facility itself.
/// </summary>
Facility,

/// <summary>
/// The current main menu.
/// ! Will cause crash when trying joining servers !
/// </summary>
NewMainMenu,

/// <summary>
/// The old main menu.
/// </summary>
MainMenuRemastered,

/// <summary>
/// The old server list.
/// </summary>
FastMenu,

/// <summary>
/// The loading Screen.
/// ! Will cause crash when trying joining servers !
/// </summary>
PreLoader,

/// <summary>
/// A black menu before loading the <see cref="NewMainMenu"/>.
/// </summary>
Loader,
}
}
20 changes: 20 additions & 0 deletions EXILED/Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3516,6 +3516,26 @@ public void SetCooldownItem(float time, ItemType itemType)
/// <param name="projectileType">The projectile that will create the effect.</param>
public void ExplodeEffect(ProjectileType projectileType) => Map.ExplodeEffect(Position, projectileType);

/// <summary>
/// Sends to the player a Fake Change Scene.
/// </summary>
/// <param name="newSceneName">The new Scene the client will load.</param>
public void SendFakeSceneLoading(string newSceneName)
{
SceneMessage message = new()
{
sceneName = newSceneName,
};

Connection.Send(message);
}

/// <summary>
/// Sends to the player a Fake Change Scene.
/// </summary>
/// <param name="newSceneName">The new Scene the client will load.</param>
public void SendFakeSceneLoading(ScenesType newSceneName) => SendFakeSceneLoading(newSceneName.ToString());

Comment thread
NotZer0Two marked this conversation as resolved.
Outdated
/// <summary>
/// Converts the player in a human-readable format.
/// </summary>
Expand Down
22 changes: 22 additions & 0 deletions EXILED/Exiled.API/Features/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ namespace Exiled.API.Features
using System.Collections.Generic;
using System.Reflection;

using Exiled.API.Enums;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not useless?


using GameCore;

using Interfaces;
Expand Down Expand Up @@ -267,6 +269,26 @@ public static bool ShutdownRedirect(ushort redirectPort)
/// <returns>Command response, if there is one; otherwise, <see langword="null"/>.</returns>
public static string ExecuteCommand(string command, CommandSender sender = null) => GameCore.Console.singleton.TypeCommand(command, sender);

/// <summary>
/// Emulation of the method SCP:SL uses to change scene.
/// </summary>
/// <param name="newSceneName">The new Scene the client will load.</param>
public static void ChangeSceneToAllClients(string newSceneName)
{
SceneMessage message = new()
{
sceneName = newSceneName,
};

NetworkServer.SendToAll(message);
}

/// <summary>
/// Emulation of the method SCP:SL uses to change scene.
/// </summary>
/// <param name="scene">The new Scene the client will load.</param>
public static void ChangeSceneToAllClients(ScenesType scene) => ChangeSceneToAllClients(scene.ToString());

/// <summary>
/// Safely gets an <see cref="object"/> from <see cref="SessionVariables"/>, then casts it to <typeparamref name="T"/>.
/// </summary>
Expand Down