devtools: add roofs tool

This commit is contained in:
Hydrox6
2021-07-06 18:25:42 +01:00
committed by Adam
parent 7bb7f3cf86
commit ad11bd6cea
3 changed files with 45 additions and 0 deletions

View File

@@ -135,9 +135,50 @@ class DevToolsOverlay extends Overlay
renderGraphicsObjects(graphics);
}
if (plugin.getRoofs().isActive())
{
renderRoofs(graphics);
}
return null;
}
private void renderRoofs(Graphics2D graphics)
{
Scene scene = client.getScene();
Tile[][][] tiles = scene.getTiles();
byte[][][] settings = client.getTileSettings();
int z = client.getPlane();
String text = "R";
for (int x = 0; x < Constants.SCENE_SIZE; ++x)
{
for (int y = 0; y < Constants.SCENE_SIZE; ++y)
{
Tile tile = tiles[z][x][y];
if (tile == null)
{
continue;
}
int flag = settings[z][x][y];
if ((flag & Constants.TILE_FLAG_UNDER_ROOF) == 0)
{
continue;
}
Point loc = Perspective.getCanvasTextLocation(client, graphics, tile.getLocalLocation(), text, z);
if (loc == null)
{
continue;
}
OverlayUtil.renderTextLocation(graphics, loc, text, Color.RED);
}
}
}
private void renderPlayers(Graphics2D graphics)
{
List<Player> players = client.getPlayers();

View File

@@ -177,6 +177,8 @@ class DevToolsPanel extends PluginPanel
disconnectBtn.addActionListener(e -> clientThread.invoke(() -> client.setGameState(GameState.CONNECTION_LOST)));
container.add(disconnectBtn);
container.add(plugin.getRoofs());
try
{
ShellFrame sf = plugin.getInjector().getInstance(ShellFrame.class);

View File

@@ -144,6 +144,7 @@ public class DevToolsPlugin extends Plugin
private DevToolsButton soundEffects;
private DevToolsButton scriptInspector;
private DevToolsButton inventoryInspector;
private DevToolsButton roofs;
private DevToolsButton shell;
private NavigationButton navButton;
@@ -189,6 +190,7 @@ public class DevToolsPlugin extends Plugin
soundEffects = new DevToolsButton("Sound Effects");
scriptInspector = new DevToolsButton("Script Inspector");
inventoryInspector = new DevToolsButton("Inventory Inspector");
roofs = new DevToolsButton("Roofs");
shell = new DevToolsButton("Shell");
overlayManager.add(overlay);