public override bool Continue() { DisplayLog("CanContinue()"); bool result = false; if (entityAliveSDX) { result = entityAliveSDX.CanExecuteTask(EntityAliveSDX.Orders.Loot); DisplayLog("CanContinue() Loot Task? " + result); if (result == false) { return(false); } } PathNavigate navigator = this.theEntity.navigator; PathEntity path = navigator.getPath(); if (this.hadPath && path == null) { DisplayLog(" Not Path to continue looting."); return(false); } if (++this.investigateTicks > 40) { this.investigateTicks = 0; if (!this.theEntity.HasInvestigatePosition) { result = FindNearestContainer(); } //float sqrMagnitude = (this.investigatePos - this.theEntity.InvestigatePosition).sqrMagnitude; //if (sqrMagnitude > 4f) //{ // DisplayLog(" Too far away from my investigate Position: " + sqrMagnitude); // return false; //} } float sqrMagnitude2 = (this.seekPos - this.theEntity.position).sqrMagnitude; DisplayLog(" Seek Position: " + this.seekPos + " My Location: " + this.theEntity.position + " Magnitude: " + sqrMagnitude2); if (sqrMagnitude2 < 4f) { DisplayLog("I'm at the loot container: " + sqrMagnitude2); CheckContainer(); result = FindNearestContainer(); } else if (path != null && path.isFinished()) { result = FindNearestContainer(); } DisplayLog(" Blocked Time: " + this.theEntity.getMoveHelper().BlockedTime); if (this.theEntity.getMoveHelper().BlockedTime > 2) { } DisplayLog("Continue() End: " + result); return(result); }
public override bool Continue() { if (!CanContinue()) { this.theEntity.SetInvestigatePosition(Vector3.zero, 0); return(false); } PathNavigate navigator = this.theEntity.navigator; PathEntity path = navigator.getPath(); if (this.hadPath && path == null) { return(false); } if (++this.investigateTicks > 40) { this.investigateTicks = 0; return(false); //if (!this.theEntity.HasInvestigatePosition) // return false; // no invesitgative position //float sqrMagnitude = (this.investigatePos - this.theEntity.InvestigatePosition).sqrMagnitude; //if (sqrMagnitude >= 4f) //{ // return false; // not close enough. //} } float sqrMagnitude2 = (this.seekPos - this.theEntity.position).sqrMagnitude; if (sqrMagnitude2 <= 4f || (path != null && path.isFinished())) { return(PerformAction()); } return(true); }
public override bool Continue() { DisplayLog("CanContinue()"); bool result = false; if (entityAliveSDX) { result = EntityUtilities.CanExecuteTask(this.theEntity.entityId, EntityUtilities.Orders.Loot); DisplayLog("CanContinue() Loot Task? " + result); if (result == false) { return(false); } } if (++this.taskTimeOut > 40) { this.taskTimeOut = 0; return(false); } if (this.theEntity.Buffs.HasCustomVar("Owner")) { DisplayLog(" Checking my Leader"); // Find out who the leader is. int PlayerID = (int)this.theEntity.Buffs.GetCustomVar("Owner"); Entity myLeader = this.theEntity.world.GetEntity(PlayerID); float distance = this.theEntity.GetDistance(myLeader); DisplayLog(" Distance: " + distance); if (distance > this.theEntity.GetSeeDistance()) { DisplayLog("I am too far away from my leader. Teleporting...."); this.theEntity.SetPosition(myLeader.position, true); EntityUtilities.ExecuteCMD(this.theEntity.entityId, "FollowMe", myLeader as EntityPlayer); } } PathNavigate navigator = this.theEntity.navigator; PathEntity path = navigator.getPath(); if (this.hadPath && path == null) { DisplayLog(" Not Path to continue looting."); return(false); } if (++this.investigateTicks > 40) { this.investigateTicks = 0; if (!this.theEntity.HasInvestigatePosition) { result = FindNearestContainer(); } //float sqrMagnitude = (this.investigatePos - this.theEntity.InvestigatePosition).sqrMagnitude; //if (sqrMagnitude > 4f) //{ // DisplayLog(" Too far away from my investigate Position: " + sqrMagnitude); // return false; //} } float sqrMagnitude2 = (this.seekPos - this.theEntity.position).sqrMagnitude; DisplayLog(" Seek Position: " + this.seekPos + " My Location: " + this.theEntity.position + " Magnitude: " + sqrMagnitude2); if (sqrMagnitude2 < 4f) { DisplayLog("I'm at the loot container: " + sqrMagnitude2); CheckContainer(); result = FindNearestContainer(); } else if (path != null && path.isFinished()) { result = FindNearestContainer(); } DisplayLog("Continue() End: " + result); return(result); }