Upload from upload_mods.ps1
This commit is contained in:
40
Scripts/Dialog/DialogActionRemoveWaypointRebirth.cs
Normal file
40
Scripts/Dialog/DialogActionRemoveWaypointRebirth.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
public class DialogActionRemoveWaypointRebirth : BaseDialogAction
|
||||
{
|
||||
public override void PerformAction(EntityPlayer player)
|
||||
{
|
||||
LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);
|
||||
if (!string.IsNullOrEmpty(Value) && Value.ToLower() == "self")
|
||||
{
|
||||
var entityNPC = uiforPlayer.xui.Dialog.Respondent;
|
||||
if (entityNPC != null)
|
||||
{
|
||||
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
|
||||
Vector3i blockPosition = World.worldToBlockPos(entityNPC.position);
|
||||
|
||||
foreach (Waypoint waypoint in primaryPlayer.Waypoints.Collection.list)
|
||||
{
|
||||
if ((waypoint.pos.x <= blockPosition.x + 2)
|
||||
&& (waypoint.pos.x >= blockPosition.x - 2)
|
||||
&& (waypoint.pos.y <= blockPosition.y + 2)
|
||||
&& (waypoint.pos.y >= blockPosition.y - 2)
|
||||
&& (waypoint.pos.z <= blockPosition.z + 2)
|
||||
&& (waypoint.pos.z >= blockPosition.z - 2)
|
||||
&& waypoint.name.Text.ToLower().Trim() == Localization.Get(entityNPC.EntityClass.entityClassName).ToLower().Trim()
|
||||
)
|
||||
{
|
||||
primaryPlayer.Waypoints.Collection.Remove(waypoint);
|
||||
NavObjectManager.Instance.UnRegisterNavObject(waypoint.navObject);
|
||||
XUiV_Window window = uiforPlayer.xui.GetWindow("mapTracking");
|
||||
if (window != null)
|
||||
{
|
||||
((XUiC_MapWaypointList)window.Controller.GetChildById("waypointList")).UpdateWaypointsList(null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user