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
8 changes: 4 additions & 4 deletions Rocket.Unturned/Commands/CommandTp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ public void Execute(IRocketPlayer caller, string[] command)
}
else
{
Node item = LevelNodes.nodes.Where(n => n.type == ENodeType.LOCATION && ((LocationNode)n).name.ToLower().Contains(command[0].ToLower())).FirstOrDefault();
LocationDevkitNode item = LocationDevkitNodeSystem.Get().GetAllNodes().Where(n => n.locationName.IndexOf(command[0]) != -1).FirstOrDefault();
if (item != null)
{
Vector3 c = item.point + new Vector3(0f, 0.5f, 0f);
Vector3 c = item.transform.position + new Vector3(0f, 0.5f, 0f);
player.Teleport(c, MeasurementTool.angleToByte(player.Rotation));
Core.Logging.Logger.Log(U.Translate("command_tp_teleport_console", player.CharacterName, ((LocationNode)item).name));
UnturnedChat.Say(player, U.Translate("command_tp_teleport_private", ((LocationNode)item).name));
Core.Logging.Logger.Log(U.Translate("command_tp_teleport_console", player.CharacterName, item.locationName));
UnturnedChat.Say(player, U.Translate("command_tp_teleport_private", item.locationName));
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions Rocket.Unturned/Player/UnturnedPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,10 @@ public float Rotation

public bool Teleport(string nodeName)
{
Node node = LevelNodes.nodes.Where(n => n.type == ENodeType.LOCATION && ((LocationNode)n).name.ToLower().Contains(nodeName)).FirstOrDefault();
LocationDevkitNode node = LocationDevkitNodeSystem.Get().FindByName(nodeName);
if (node != null)
{
Vector3 c = node.point + new Vector3(0f, 0.5f, 0f);
Vector3 c = node.transform.position + new Vector3(0f, 0.5f, 0f);
player.sendTeleport(c, MeasurementTool.angleToByte(Rotation));
return true;
}
Expand Down