Remote projectile target and length tracking
Continuation of 4c293e612cd4b08fc7230a5e6722c8acc74e5a9e
This commit is contained in:
@@ -32,10 +32,6 @@ public interface Projectile extends Renderable
|
|||||||
|
|
||||||
Actor getInteracting();
|
Actor getInteracting();
|
||||||
|
|
||||||
Point getTarget();
|
|
||||||
|
|
||||||
int getTargetZ();
|
|
||||||
|
|
||||||
int getX1();
|
int getX1();
|
||||||
|
|
||||||
int getY1();
|
int getY1();
|
||||||
@@ -48,12 +44,6 @@ public interface Projectile extends Renderable
|
|||||||
|
|
||||||
int getStartMovementCycle();
|
int getStartMovementCycle();
|
||||||
|
|
||||||
int getSpawnCycle();
|
|
||||||
|
|
||||||
int getCycleLength();
|
|
||||||
|
|
||||||
Duration getLength();
|
|
||||||
|
|
||||||
int getEndCycle();
|
int getEndCycle();
|
||||||
|
|
||||||
int getRemainingCycles();
|
int getRemainingCycles();
|
||||||
|
|||||||
@@ -350,7 +350,6 @@ public class DevToolsOverlay extends Overlay
|
|||||||
OverlayUtil.renderPolygon(graphics, poly, Color.RED);
|
OverlayUtil.renderPolygon(graphics, poly, Color.RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
long projectileLength = projectile.getLength().toMillis();
|
|
||||||
int projectileId = projectile.getId();
|
int projectileId = projectile.getId();
|
||||||
Actor projectileInteracting = projectile.getInteracting();
|
Actor projectileInteracting = projectile.getInteracting();
|
||||||
|
|
||||||
@@ -365,18 +364,12 @@ public class DevToolsOverlay extends Overlay
|
|||||||
infoString += "Targeted (T: " + projectileInteracting.getName() + ")";
|
infoString += "Targeted (T: " + projectileInteracting.getName() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
infoString += " (ID: " + projectileId + ") (L: " + projectileLength + "ms)";
|
infoString += " (ID: " + projectileId + ")";
|
||||||
|
|
||||||
if (projectileInteracting != null)
|
if (projectileInteracting != null)
|
||||||
{
|
{
|
||||||
OverlayUtil.renderActorOverlay(graphics, projectile.getInteracting(), infoString, Color.RED);
|
OverlayUtil.renderActorOverlay(graphics, projectile.getInteracting(), infoString, Color.RED);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
net.runelite.api.Point targetPoint = projectile.getTarget();
|
|
||||||
OverlayUtil.renderTilePointOverlay(graphics, client, targetPoint, infoString, Color.RED);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,11 +26,8 @@ package net.runelite.mixins;
|
|||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import net.runelite.api.Actor;
|
import net.runelite.api.Actor;
|
||||||
import net.runelite.api.Point;
|
|
||||||
import net.runelite.api.mixins.Copy;
|
|
||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import net.runelite.api.mixins.Replace;
|
|
||||||
import net.runelite.api.mixins.Shadow;
|
import net.runelite.api.mixins.Shadow;
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSNPC;
|
import net.runelite.rs.api.RSNPC;
|
||||||
@@ -43,65 +40,6 @@ public abstract class RSProjectileMixin implements RSProjectile
|
|||||||
@Shadow("clientInstance")
|
@Shadow("clientInstance")
|
||||||
private static RSClient client;
|
private static RSClient client;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private int targetX;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private int targetY;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private int targetZ;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
Integer spawnCycle;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
@Override
|
|
||||||
public Point getTarget()
|
|
||||||
{
|
|
||||||
if (targetX == -1 || targetY == -1)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Point(targetX, targetY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
@Override
|
|
||||||
public int getTargetZ()
|
|
||||||
{
|
|
||||||
return targetZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
@Override
|
|
||||||
public int getSpawnCycle()
|
|
||||||
{
|
|
||||||
return spawnCycle == null ? -1 : spawnCycle;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the cycles returned are for the amount of time moving this works
|
|
||||||
* better with the projectile movement event as it only gets called
|
|
||||||
* after the projectile starts moving
|
|
||||||
*
|
|
||||||
* @return total time projectile will move for in gamecycles
|
|
||||||
*/
|
|
||||||
@Inject
|
|
||||||
@Override
|
|
||||||
public int getCycleLength()
|
|
||||||
{
|
|
||||||
return getEndCycle() - getSpawnCycle();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
@Override
|
|
||||||
public Duration getLength()
|
|
||||||
{
|
|
||||||
return Duration.ofMillis(getCycleLength() * 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Override
|
@Override
|
||||||
public int getRemainingCycles()
|
public int getRemainingCycles()
|
||||||
@@ -140,22 +78,4 @@ public abstract class RSProjectileMixin implements RSProjectile
|
|||||||
return players[idx];
|
return players[idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Copy("moveProjectile")
|
|
||||||
abstract void moveProjectile(int targetX, int targetY, int targetZ, int gameCycle);
|
|
||||||
|
|
||||||
@Replace("moveProjectile")
|
|
||||||
public void rl$moveProjectile(int targetX, int targetY, int targetZ, int gameCycle)
|
|
||||||
{
|
|
||||||
this.targetX = targetX;
|
|
||||||
this.targetY = targetY;
|
|
||||||
this.targetZ = targetZ;
|
|
||||||
|
|
||||||
if (spawnCycle == null)
|
|
||||||
{
|
|
||||||
spawnCycle = client.getGameCycle();
|
|
||||||
}
|
|
||||||
|
|
||||||
moveProjectile(targetX, targetY, targetZ, gameCycle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user