client: fix behavior of walking where there are no tiles
This only happens with a plugin force setting checkClick. This would cause the client to possibly incorrectly send a walk packet next tick if viewportWalking was set, since nothing ever clears it.
This commit is contained in:
@@ -409,23 +409,6 @@ public interface Client extends GameEngine
|
||||
*/
|
||||
int getMouseCurrentButton();
|
||||
|
||||
/**
|
||||
* Schedules checking of current region tile for next frame, so ${@link Client#getSelectedSceneTile()} ()} will
|
||||
* return actual value.
|
||||
*
|
||||
* @param checkClick when true next frame selected region tile will be updated
|
||||
*/
|
||||
void setCheckClick(boolean checkClick);
|
||||
|
||||
/**
|
||||
* Sets current mouse hover position. This value is automatically updated only when right-clicking in game.
|
||||
* Setting this value together with ${@link Client#setCheckClick(boolean)} will update ${@link Client#getSelectedSceneTile()} ()}
|
||||
* for next frame.
|
||||
*
|
||||
* @param position current mouse hover position
|
||||
*/
|
||||
void setMouseCanvasHoverPosition(Point position);
|
||||
|
||||
/**
|
||||
* Gets the currently selected tile (ie. last right clicked tile).
|
||||
*
|
||||
|
||||
@@ -32,7 +32,6 @@ import java.util.Iterator;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.client.plugins.party.data.PartyTilePingData;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -60,18 +59,6 @@ class PartyPingOverlay extends Overlay
|
||||
return null;
|
||||
}
|
||||
|
||||
// Update selected scene tile
|
||||
if (!client.isMenuOpen())
|
||||
{
|
||||
Point p = client.getMouseCanvasPosition();
|
||||
p = new Point(
|
||||
p.getX() - client.getViewportXOffset(),
|
||||
p.getY() - client.getViewportYOffset());
|
||||
|
||||
client.setCheckClick(true);
|
||||
client.setMouseCanvasHoverPosition(p);
|
||||
}
|
||||
|
||||
synchronized (plugin.getPendingTilePings())
|
||||
{
|
||||
final Iterator<PartyTilePingData> iterator = plugin.getPendingTilePings().iterator();
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.awt.Polygon;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
@@ -59,18 +58,6 @@ public class TileIndicatorsOverlay extends Overlay
|
||||
{
|
||||
if (config.highlightHoveredTile())
|
||||
{
|
||||
// Update selected scene tile
|
||||
if (!client.isMenuOpen())
|
||||
{
|
||||
Point p = client.getMouseCanvasPosition();
|
||||
p = new Point(
|
||||
p.getX() - client.getViewportXOffset(),
|
||||
p.getY() - client.getViewportYOffset());
|
||||
|
||||
client.setCheckClick(true);
|
||||
client.setMouseCanvasHoverPosition(p);
|
||||
}
|
||||
|
||||
// If we have tile "selected" render it
|
||||
if (client.getSelectedSceneTile() != null)
|
||||
{
|
||||
|
||||
@@ -290,14 +290,6 @@ public abstract class RSClientMixin implements RSClient
|
||||
return AccountType.NORMAL;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setMouseCanvasHoverPosition(final Point position)
|
||||
{
|
||||
setMouseCanvasHoverPositionX(position.getX());
|
||||
setMouseCanvasHoverPositionY(position.getY());
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Tile getSelectedSceneTile()
|
||||
|
||||
@@ -84,6 +84,16 @@ public abstract class RSSceneMixin implements RSScene
|
||||
}
|
||||
|
||||
final boolean isGpu = client.isGpu();
|
||||
final boolean checkClick = client.isCheckClick();
|
||||
if (!client.isMenuOpen())
|
||||
{
|
||||
// Force check click to update the selected tile
|
||||
client.setCheckClick(true);
|
||||
final int mouseX = client.getMouseX();
|
||||
final int mouseY = client.getMouseY();
|
||||
client.setMouseCanvasHoverPositionX(mouseX - client.getViewportXOffset());
|
||||
client.setMouseCanvasHoverPositionY(mouseY - client.getViewportYOffset());
|
||||
}
|
||||
|
||||
if (!isGpu)
|
||||
{
|
||||
@@ -292,6 +302,10 @@ public abstract class RSSceneMixin implements RSScene
|
||||
client.setEntitiesAtMouseCount(0);
|
||||
}
|
||||
client.setCheckClick(false);
|
||||
if (!checkClick)
|
||||
{
|
||||
client.setViewportWalking(false);
|
||||
}
|
||||
client.getCallbacks().drawScene();
|
||||
return;
|
||||
}
|
||||
@@ -363,6 +377,10 @@ public abstract class RSSceneMixin implements RSScene
|
||||
client.setEntitiesAtMouseCount(0);
|
||||
}
|
||||
client.setCheckClick(false);
|
||||
if (!checkClick)
|
||||
{
|
||||
client.setViewportWalking(false);
|
||||
}
|
||||
client.getCallbacks().drawScene();
|
||||
return;
|
||||
}
|
||||
@@ -376,6 +394,12 @@ public abstract class RSSceneMixin implements RSScene
|
||||
client.setEntitiesAtMouseCount(0);
|
||||
}
|
||||
client.setCheckClick(false);
|
||||
if (!checkClick)
|
||||
{
|
||||
// If checkClick was false, then the selected tile wouldn't have existed next tick,
|
||||
// so clear viewport walking in order to prevent it triggering a walk
|
||||
client.setViewportWalking(false);
|
||||
}
|
||||
client.getCallbacks().drawScene();
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,6 @@ public interface RSClient extends RSGameEngine, Client
|
||||
int getRSGameState();
|
||||
|
||||
@Import("checkClick")
|
||||
@Override
|
||||
void setCheckClick(boolean checkClick);
|
||||
|
||||
@Import("mouseX2")
|
||||
@@ -1007,4 +1006,7 @@ public interface RSClient extends RSGameEngine, Client
|
||||
|
||||
@Import("soundEffectVolume")
|
||||
int getSoundEffectVolume();
|
||||
|
||||
@Import("viewportWalking")
|
||||
void setViewportWalking(boolean viewportWalking);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user