diff --git a/FFXIVClassic Map Server/actors/Actor.cs b/FFXIVClassic Map Server/actors/Actor.cs index 7f85c681..329af346 100644 --- a/FFXIVClassic Map Server/actors/Actor.cs +++ b/FFXIVClassic Map Server/actors/Actor.cs @@ -89,6 +89,9 @@ namespace FFXIVClassic_Map_Server.Actors this.moveSpeeds[1] = SetActorSpeedPacket.DEFAULT_WALK; this.moveSpeeds[2] = SetActorSpeedPacket.DEFAULT_RUN; this.moveSpeeds[3] = SetActorSpeedPacket.DEFAULT_ACTIVE; + + // todo: make this halal + this.moveState = this.oldMoveState; hasMoved = true; } @@ -559,7 +562,7 @@ namespace FFXIVClassic_Map_Server.Actors } else { - Program.Log.Error("Actor.LookAt() unable to find actor!"); + Program.Log.Error("{0} {1} Actor.LookAt() unable to find actor!", actorId, actorName); } } diff --git a/FFXIVClassic Map Server/actors/chara/Character.cs b/FFXIVClassic Map Server/actors/chara/Character.cs index 424e4e96..8b687025 100644 --- a/FFXIVClassic Map Server/actors/chara/Character.cs +++ b/FFXIVClassic Map Server/actors/chara/Character.cs @@ -163,6 +163,9 @@ namespace FFXIVClassic_Map_Server.Actors if (this.target != player) { #region super important performance critical code + + this.ChangeState(SetActorStatePacket.MAIN_STATE_MOUNTED); + var chatMode = Program.Random.Next(13); var emphasis = Program.Random.Next(9); var drag = Program.Random.Next(7); @@ -184,7 +187,7 @@ namespace FFXIVClassic_Map_Server.Actors // imouto aggro player.SendMessage((uint)chatMode, "Rowena", oni + chan); // sing for onii - this.PlayAnimation(Program.Random.Next(0,2) == 1 ? (uint)67111904 : (uint)67108902); + this.PlayAnimation(Program.Random.Next(0, 2) == 1 ? (uint)67111904 : (uint)67108902); #endregion @@ -241,7 +244,6 @@ namespace FFXIVClassic_Map_Server.Actors // target zoned, deaggro target = null; - // tell player to despawn us and we can move back to spawn if (player != null) { @@ -277,6 +279,10 @@ namespace FFXIVClassic_Map_Server.Actors continue; } + // dont aggro if moving to spawn + if (this.isMovingToSpawn) + continue; + // find distance between self and target var distance = Utils.Distance(positionX, positionY, positionZ, player.positionX, player.positionY, player.positionZ); @@ -291,7 +297,7 @@ namespace FFXIVClassic_Map_Server.Actors { if (distance >= 3) { - FollowTarget(player, 2.0f); + FollowTarget(player, 2.4f, 5); } // too close, spread out else if (distance <= 0.64f) @@ -343,7 +349,7 @@ namespace FFXIVClassic_Map_Server.Actors { // this shit gets hit every time, but it wont path to it? Program.Log.Error("{0} Picking random point to walk to!", actorId); - PathTo(oldPositionX, oldPositionY, oldPositionZ, 2.5f, 15, 20.5f); + PathTo(oldPositionX, oldPositionY, oldPositionZ, 2.5f, 7, 15.5f); // face destination if (positionUpdates.Count > 0) @@ -351,12 +357,12 @@ namespace FFXIVClassic_Map_Server.Actors var destinationPos = positionUpdates[positionUpdates.Count - 1]; LookAt(destinationPos.X, destinationPos.Y); } - this.isMovingToSpawn = false; - } - // already at spawn, dont recalculate distance on next ai update - else - { - this.isMovingToSpawn = false; + if (this.isMovingToSpawn) + { + this.isMovingToSpawn = false; + this.ResetMoveSpeedsToDefault(); + this.ChangeState(SetActorStatePacket.MAIN_STATE_DEAD2); + } } } } diff --git a/FFXIVClassic Map Server/utils/NavmeshUtils.cs b/FFXIVClassic Map Server/utils/NavmeshUtils.cs index 1057132d..a39bd752 100644 --- a/FFXIVClassic Map Server/utils/NavmeshUtils.cs +++ b/FFXIVClassic Map Server/utils/NavmeshUtils.cs @@ -112,7 +112,6 @@ namespace FFXIVClassic_Map_Server.utils if (navMesh == null || (startVec.X == endVec.X && startVec.Y == endVec.Y && startVec.Z == endVec.Z && polyRadius == 0.0f)) { - Program.Log.Error("ass"); return null; } @@ -122,7 +121,6 @@ namespace FFXIVClassic_Map_Server.utils // no point pathing if in range if (distanceSquared < 4 && Math.Abs(startVec.Y - endVec.Y) < 1.1f) { - Program.Log.Error("shit"); return null; } @@ -154,10 +152,14 @@ namespace FFXIVClassic_Map_Server.utils navMeshQuery.ClosestPointOnPoly(startPt.Polygon, startPt.Position, ref iterPos); navMeshQuery.ClosestPointOnPoly(path[npolys - 1], endPt.Position, ref targetPos); - smoothPath.Add(new Vector3(iterPos)); + // set target to random point at end of path + if (polyRadius != 0.0f) + { + var randPoly = navMeshQuery.FindRandomPointAroundCircle(endPt, polyRadius); + targetPos = randPoly.Position; + } - if (npolys <= 1) - System.Diagnostics.Debugger.Break(); + smoothPath.Add(new Vector3(iterPos)); //float STEP_SIZE = 0.70f; float SLOP = 0.15f; @@ -201,17 +203,12 @@ namespace FFXIVClassic_Map_Server.utils iterPos = result; //handle end of path when close enough - if (endOfPath && InRange(iterPos, steerPos, SLOP, 10.0f)) + if (endOfPath && InRange(iterPos, steerPos, SLOP, 1000.0f)) { //reached end of path iterPos = targetPos; if (smoothPath.Count < smoothPath.Capacity) { - if (polyRadius != 0.0f) - { - var randPoly = navMeshQuery.FindRandomPointAroundCircle(endPt, polyRadius); - iterPos = randPoly.Position; - } smoothPath.Add(new Vector3(iterPos)); } break;