Remote projectile target and length tracking
Continuation of 4c293e612cd4b08fc7230a5e6722c8acc74e5a9e
This commit is contained in:
@@ -26,11 +26,8 @@ package net.runelite.mixins;
|
||||
|
||||
import java.time.Duration;
|
||||
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.Mixin;
|
||||
import net.runelite.api.mixins.Replace;
|
||||
import net.runelite.api.mixins.Shadow;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
import net.runelite.rs.api.RSNPC;
|
||||
@@ -43,65 +40,6 @@ public abstract class RSProjectileMixin implements RSProjectile
|
||||
@Shadow("clientInstance")
|
||||
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
|
||||
@Override
|
||||
public int getRemainingCycles()
|
||||
@@ -140,22 +78,4 @@ public abstract class RSProjectileMixin implements RSProjectile
|
||||
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