Skip to content

Commit

Permalink
Fixed bug allowing /home to work when player does not have buildpriv …
Browse files Browse the repository at this point in the history
…in target TP anymore
  • Loading branch information
poopnfroosh committed May 24, 2018
1 parent a543a59 commit 5fcfca3
Showing 1 changed file with 42 additions and 41 deletions.
83 changes: 42 additions & 41 deletions NTeleportation.cs
Expand Up @@ -1544,12 +1544,12 @@ private void cmdChatTeleportRequest(BasePlayer player, string command, string[]
PrintMsgL(player, err);
return;
}
err = CheckTargetLocation(target, target.transform.position, configData.TPR.UsableIntoBuildingBlocked, configData.TPR.CupOwnerAllowOnBuildingBlocked);
if (err != null)
{
PrintMsgL(player, err);
return;
}
//err = CheckTargetLocation(target, target.transform.position, configData.TPR.UsableIntoBuildingBlocked, configData.TPR.CupOwnerAllowOnBuildingBlocked);
//if (err != null)
//{
// PrintMsgL(player, err);
// return;
//}
var timestamp = Facepunch.Math.Epoch.Current;
var currentDate = DateTime.Now.ToString("d");
TeleportData tprData;
Expand Down Expand Up @@ -1651,12 +1651,12 @@ private void cmdChatTeleportAccept(BasePlayer player, string command, string[] a
return;
}
var originPlayer = PlayersRequests[player.userID];
err = CheckTargetLocation(originPlayer, player.transform.position, configData.TPR.UsableIntoBuildingBlocked, configData.TPR.CupOwnerAllowOnBuildingBlocked);
if (err != null)
{
SendReply(player, err);
return;
}
//err = CheckTargetLocation(originPlayer, player.transform.position, configData.TPR.UsableIntoBuildingBlocked, configData.TPR.CupOwnerAllowOnBuildingBlocked);
//if (err != null)
//{
// SendReply(player, err);
// return;
//}
if (configData.TPR.BlockTPAOnCeiling)
{
var position = GetGround(player.transform.position);
Expand Down Expand Up @@ -1692,15 +1692,15 @@ private void cmdChatTeleportAccept(BasePlayer player, string command, string[] a
TeleportTimers.Remove(originPlayer.userID);
return;
}
err = CheckTargetLocation(originPlayer, player.transform.position, configData.TPR.UsableIntoBuildingBlocked, configData.TPR.CupOwnerAllowOnBuildingBlocked);
if (err != null)
{
SendReply(player, err);
PrintMsgL(originPlayer, "Interrupted");
SendReply(originPlayer, err);
TeleportTimers.Remove(originPlayer.userID);
return;
}
//err = CheckTargetLocation(originPlayer, player.transform.position, configData.TPR.UsableIntoBuildingBlocked, configData.TPR.CupOwnerAllowOnBuildingBlocked);
//if (err != null)
//{
// SendReply(player, err);
// PrintMsgL(originPlayer, "Interrupted");
// SendReply(originPlayer, err);
// TeleportTimers.Remove(originPlayer.userID);
// return;
//}
err = CanPlayerTeleport(originPlayer) ?? CanPlayerTeleport(player);
if (err != null)
{
Expand Down Expand Up @@ -2318,27 +2318,28 @@ private string CheckPlayer(BasePlayer player, bool build = false, bool craft = f

private string CheckTargetLocation(BasePlayer player, Vector3 targetLocation, bool build, bool owner)
{
var colliders = Pool.GetList<Collider>();
Vis.Colliders(targetLocation, 0.1f, colliders, triggerLayer);
var cups = false;
foreach (var collider in colliders)
var blocks = GetFoundation(targetLocation);
if (blocks == null || blocks.Count < 1)
return null;
var cup = blocks[0].GetBuildingPrivilege();
if (cup == null)
{
var cup = collider.GetComponentInParent<BuildingPrivlidge>();
if (cup == null) continue;
cups = true;
if (owner && player.userID == cup.OwnerID)
{
Pool.FreeList(ref colliders);
return null;
}
if (cup.IsAuthed(player))
{
Pool.FreeList(ref colliders);
return null;
}
Pool.FreeList( ref blocks );
return null;
}
Pool.FreeList(ref colliders);
return cups && !build ? "TPTargetBuildingBlocked" : null;
if (owner && player.userID == cup.OwnerID)
{
Pool.FreeList(ref blocks);
return null;
}
if (cup.IsAuthed(player))
{
Pool.FreeList(ref blocks);
return null;
}

Pool.FreeList(ref blocks);
return !build ? "TPTargetBuildingBlocked" : null;
}

private string CheckInsideBlock(Vector3 targetLocation)
Expand Down Expand Up @@ -2867,4 +2868,4 @@ public override IDictionary Create(Type objectType)
}
}
}
}
}

0 comments on commit 5fcfca3

Please sign in to comment.