-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Updated to a new version of the game (14.0.0) - Updated the lobby system, now more rooms are available to a custom location - Added commands to simplify the control of custom locations
- Loading branch information
Showing
14 changed files
with
571 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
using CommandSystem; | ||
using Lobby.Extensions; | ||
using PluginAPI.Core; | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace Lobby.Command.ControlCommands | ||
{ | ||
public class AddLocationCommand : ICommand | ||
{ | ||
public string Command => "addloc"; | ||
|
||
public string[] Aliases { get; } = { "add", "ad" }; | ||
|
||
public string Description => "Add a new lobby location."; | ||
|
||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
Player playerSender = Player.Get(sender); | ||
|
||
if (!playerSender.IsAllowCommand()) | ||
{ | ||
response = $"You don't have permission to use this command!"; | ||
return false; | ||
} | ||
|
||
if (arguments.Count != 1) | ||
{ | ||
response = "Incorrect command, use: \nlobby addloc room\nlobby addloc static"; | ||
return false; | ||
} | ||
|
||
var handler = PluginHandler.Get(Lobby.Instance); | ||
|
||
switch (arguments.At(0)) | ||
{ | ||
case "room": | ||
GameObject Point = new GameObject("Point"); | ||
Point.transform.position = playerSender.Position; | ||
Point.transform.eulerAngles = playerSender.Rotation; | ||
Point.transform.SetParent(playerSender.Room.transform); | ||
|
||
CustomRoomLocationData roomLocationData = new CustomRoomLocationData(); | ||
roomLocationData.RoomNameType = playerSender.Room.name; | ||
roomLocationData.OffsetX = Point.transform.localPosition.x; roomLocationData.OffsetY = Point.transform.localPosition.y + 0.05f; roomLocationData.OffsetZ = Point.transform.localPosition.z; | ||
roomLocationData.RotationX = Point.transform.localEulerAngles.x; roomLocationData.RotationY = Point.transform.localEulerAngles.y; roomLocationData.RotationZ = Point.transform.localEulerAngles.z; | ||
|
||
Lobby.Config.CustomRoomLocations.Add(roomLocationData); | ||
handler.SaveConfig(Lobby.Instance, nameof(Lobby.Config)); | ||
response = "New custom location added to the config."; | ||
return true; | ||
case "static": | ||
CustomLocationData locationData = new CustomLocationData(); | ||
locationData.PositionX = playerSender.Position.x; locationData.PositionY = playerSender.Position.y + 0.05f; locationData.PositionZ = playerSender.Position.z; | ||
locationData.RotationX = playerSender.Rotation.x; locationData.RotationY = playerSender.Rotation.y; locationData.RotationZ = playerSender.Rotation.z; | ||
|
||
Lobby.Config.CustomLocations.Add(locationData); | ||
handler.SaveConfig(Lobby.Instance, nameof(Lobby.Config)); | ||
response = "New custom location added to the config."; | ||
return true; | ||
default: | ||
response = "Incorrect command, use: \nlobby addloc room\nlobby addloc static"; | ||
return false; | ||
} | ||
} | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using CommandSystem; | ||
using Lobby.Extensions; | ||
using PluginAPI.Core; | ||
using System; | ||
|
||
namespace Lobby.Command.ControlCommands | ||
{ | ||
public class RemoveLocationCommand : ICommand | ||
{ | ||
public string Command => "removeloc"; | ||
|
||
public string[] Aliases { get; } = { "remloc", "rloc", "rl" }; | ||
|
||
public string Description => "Remove a new lobby location."; | ||
|
||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
Player playerSender = Player.Get(sender); | ||
|
||
if (!playerSender.IsAllowCommand()) | ||
{ | ||
response = $"You don't have permission to use this command!"; | ||
return false; | ||
} | ||
|
||
if (arguments.Count != 2) | ||
{ | ||
response = "Incorrect command, use: \nlobby removeloc room (index)\nlobby removeloc static (index)"; | ||
return false; | ||
} | ||
|
||
if (!Int32.TryParse(arguments.At(1), out int index)) | ||
{ | ||
response = "The index must be a number!"; | ||
return false; | ||
} | ||
|
||
var handler = PluginHandler.Get(Lobby.Instance); | ||
|
||
switch (arguments.At(0)) | ||
{ | ||
case "room": | ||
if (Lobby.Config.CustomRoomLocations == null || Lobby.Config.CustomRoomLocations?.Count - 1 < index) | ||
{ | ||
response = $"Custom location at index {index} was not found."; | ||
return false; | ||
} | ||
|
||
Lobby.Config.CustomRoomLocations.RemoveAt(index); | ||
|
||
handler.SaveConfig(Lobby.Instance, nameof(Lobby.Config)); | ||
response = $"Custom location at index {index} has been removed."; | ||
return true; | ||
case "static": | ||
if (Lobby.Config.CustomLocations == null || Lobby.Config.CustomLocations?.Count - 1 < index) | ||
{ | ||
response = $"Custom location at index {index} was not found."; | ||
return false; | ||
} | ||
|
||
Lobby.Config.CustomLocations.RemoveAt(index); | ||
|
||
handler.SaveConfig(Lobby.Instance, nameof(Lobby.Config)); | ||
response = $"Custom location at index {index} has been removed."; | ||
return true; | ||
default: | ||
response = "Incorrect command, use: \nlobby removeloc room (index)\nlobby removeloc static (index)"; | ||
return false; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using CommandSystem; | ||
using Lobby.Extensions; | ||
using PluginAPI.Core; | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace Lobby.Command.DebugCommands | ||
{ | ||
public class GetLocalDataCommand : ICommand | ||
{ | ||
public string Command => "getlocaldata"; | ||
|
||
public string[] Aliases { get; } = { "getlocdat", "getld", "gld" }; | ||
|
||
public string Description => "Shows the exact position and rotation in the room where the player is located."; | ||
|
||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
Player playerSender = Player.Get(sender); | ||
|
||
if (!playerSender.IsAllowCommand()) | ||
{ | ||
response = $"You don't have permission to use this command!"; | ||
return false; | ||
} | ||
|
||
if (arguments.Count > 0) | ||
{ | ||
response = "Incorrect command, use: \nlobby getlocalpos"; | ||
return false; | ||
} | ||
|
||
if (playerSender.Room == null) | ||
{ | ||
response = "An error occurred when getting the room you are in."; | ||
return false; | ||
} | ||
|
||
GameObject Point = new GameObject("Point"); | ||
Point.transform.position = playerSender.Position; | ||
Point.transform.eulerAngles = playerSender.Rotation; | ||
Point.transform.SetParent(playerSender.Room.transform); | ||
|
||
response = $"Room name {playerSender.Room.name}; Local position: {Point.transform.localPosition.ToString()}; Local Rotation: {Point.transform.localEulerAngles.ToString()}."; | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
using CommandSystem; | ||
using Lobby.Extensions; | ||
using PluginAPI.Core; | ||
using System; | ||
|
||
namespace Lobby.Command.DebugCommands | ||
{ | ||
public class LocationListCommand : ICommand | ||
{ | ||
public string Command => "loclist"; | ||
|
||
public string[] Aliases { get; } = { "llist", "ll" }; | ||
|
||
public string Description => "Display a list of custom locations in the console."; | ||
|
||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
Player playerSender = Player.Get(sender); | ||
|
||
if (!playerSender.IsAllowCommand()) | ||
{ | ||
response = $"You don't have permission to use this command!"; | ||
return false; | ||
} | ||
|
||
if (arguments.Count != 1) | ||
{ | ||
response = "Incorrect command, use: \nlobby loclist all\nlobby loclist room\nlobby loclist static"; | ||
return false; | ||
} | ||
|
||
string resString = string.Empty; | ||
|
||
switch (arguments.At(0)) | ||
{ | ||
case "all": | ||
resString += "Room locations:\n"; | ||
if (Lobby.Config.CustomRoomLocations?.Count > 0) | ||
{ | ||
foreach (var item in Lobby.Config.CustomRoomLocations) | ||
resString += item.RoomNameType + " " + $"({item.OffsetX}, {item.OffsetY}, {item.OffsetZ})\n"; | ||
} | ||
|
||
resString += "\nStatic locations:\n"; | ||
if (Lobby.Config.CustomLocations?.Count > 0) | ||
{ | ||
foreach (var item in Lobby.Config.CustomLocations) | ||
resString += $"({item.PositionX}, {item.PositionY}, {item.PositionZ})\n"; | ||
} | ||
|
||
response = resString; | ||
return true; | ||
case "room": | ||
resString += "Room locations:\n"; | ||
if (Lobby.Config.CustomRoomLocations?.Count > 0) | ||
{ | ||
for (int i = 0; i < Lobby.Config.CustomRoomLocations.Count; i++) | ||
{ | ||
CustomRoomLocationData data = Lobby.Config.CustomRoomLocations[i]; | ||
resString += $"({i}) " + data.RoomNameType + " " + $"({data.OffsetX}, {data.OffsetY}, {data.OffsetZ})\n"; | ||
} | ||
} | ||
|
||
response = resString; | ||
return true; | ||
case "static": | ||
resString += "Static locations:\n"; | ||
if (Lobby.Config.CustomLocations?.Count > 0) | ||
{ | ||
for (int i = 0; i < Lobby.Config.CustomLocations.Count; i++) | ||
{ | ||
CustomLocationData data = Lobby.Config.CustomLocations[i]; | ||
resString += $"({i}) " + $"({data.PositionX}, {data.PositionY}, {data.PositionZ})\n"; | ||
} | ||
} | ||
|
||
response = resString; | ||
return true; | ||
default: | ||
response = "Incorrect command, use: \nlobby loclist all\nlobby loclist room\nlobby loclist static"; | ||
return false; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.