-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLocalLocation.cs
More file actions
38 lines (30 loc) · 1.14 KB
/
Copy pathLocalLocation.cs
File metadata and controls
38 lines (30 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using CommandSystem;
using Exiled.API.Features;
using UnityEngine;
namespace Scp3114SpawnControl
{
[CommandHandler(typeof(RemoteAdminCommandHandler))]
public class LocalLocation : ICommand
{
public string Command { get; } = "mylocallocation";
public string[] Aliases { get; } = ["myloc"];
public string Description { get; } = "Shows your local position and rotation in your current room.";
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
if (!Player.TryGet(sender, out Player player))
{
response = "This command can only be used by players.";
return false;
}
Room room = player.CurrentRoom;
if (room == null)
{
response = "You are not in a room.";
return false;
}
response = $"Room: {room.Type}, Local Position: {room.LocalPosition(player.Position)}, Local Rotation: {(Quaternion.Inverse(room.Rotation) * player.Rotation).eulerAngles}";
return true;
}
}
}