Skip to content

Commit 07f981b

Browse files
fix: homing projectile on map border visual bug (AscensionGameDev#2272)
1 parent 9c89d73 commit 07f981b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Intersect.Client/Entities/Entity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,7 +2176,7 @@ protected virtual bool TryGetAnimationTexture(string textureName, SpriteAnimatio
21762176
/// </summary>
21772177
/// <param name="en">entity's target</param>
21782178
/// <returns>direction to player's selected target</returns>
2179-
protected Direction DirectionToTarget(Entity en)
2179+
public Direction DirectionToTarget(Entity en)
21802180
{
21812181
if (en == null)
21822182
{

Intersect.Client/Entities/Projectiles/Projectile.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,18 @@ public void CheckForCollision()
405405
{
406406
var newx = Spawns[i].X + (int)GetRangeX(Spawns[i].Dir, 1);
407407
var newy = Spawns[i].Y + (int)GetRangeY(Spawns[i].Dir, 1);
408+
409+
if (mMyBase.HomingBehavior || mMyBase.DirectShotBehavior)
410+
{
411+
if (TargetId != Guid.Empty && Globals.Entities.ContainsKey(TargetId) && Globals.Entities.ContainsKey(mOwner))
412+
{
413+
var me = Globals.Entities[mOwner];
414+
var target = Globals.Entities[TargetId];
415+
newx = Spawns[i].X + (int)GetRangeX(me.DirectionToTarget(target), 1);
416+
newy = Spawns[i].Y + (int)GetRangeY(me.DirectionToTarget(target), 1);
417+
}
418+
}
419+
408420
var newMapId = Spawns[i].MapId;
409421
var killSpawn = false;
410422

0 commit comments

Comments
 (0)