skybox: add custom sky color options
Co-authored-by: Adam <Adam@sigterm.info>
This commit is contained in:
@@ -82,6 +82,11 @@ public class Constants
|
|||||||
|
|
||||||
public static final int TILE_FLAG_BRIDGE = 2;
|
public static final int TILE_FLAG_BRIDGE = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The height of the overworld, in tiles. Coordinates above this are in caves and other such zones.
|
||||||
|
*/
|
||||||
|
public static final int OVERWORLD_MAX_Y = 4160;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of milliseconds in a client tick.
|
* The number of milliseconds in a client tick.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -25,13 +25,17 @@
|
|||||||
package net.runelite.client.plugins.skybox;
|
package net.runelite.client.plugins.skybox;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
import java.awt.Color;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.Constants;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.coords.LocalPoint;
|
import net.runelite.api.coords.LocalPoint;
|
||||||
import net.runelite.api.events.BeforeRender;
|
import net.runelite.api.events.BeforeRender;
|
||||||
import net.runelite.api.events.GameStateChanged;
|
import net.runelite.api.events.GameStateChanged;
|
||||||
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
@@ -47,6 +51,9 @@ public class SkyboxPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private SkyboxPluginConfig config;
|
||||||
|
|
||||||
private Skybox skybox;
|
private Skybox skybox;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -62,6 +69,12 @@ public class SkyboxPlugin extends Plugin
|
|||||||
skybox = null;
|
skybox = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
SkyboxPluginConfig provideConfig(ConfigManager configManager)
|
||||||
|
{
|
||||||
|
return configManager.getConfig(SkyboxPluginConfig.class);
|
||||||
|
}
|
||||||
|
|
||||||
private int mapChunk(int cx, int cy, int plane)
|
private int mapChunk(int cx, int cy, int plane)
|
||||||
{
|
{
|
||||||
cx -= client.getBaseX() / 8;
|
cx -= client.getBaseX() / 8;
|
||||||
@@ -91,6 +104,14 @@ public class SkyboxPlugin extends Plugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color overrideColor = player.getWorldLocation().getY() < Constants.OVERWORLD_MAX_Y
|
||||||
|
? config.customOverworldColor() : config.customOtherColor();
|
||||||
|
if (overrideColor != null)
|
||||||
|
{
|
||||||
|
client.setSkyboxColor(overrideColor.getRGB());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int px, py;
|
int px, py;
|
||||||
if (client.getOculusOrbState() == 1)
|
if (client.getOculusOrbState() == 1)
|
||||||
{
|
{
|
||||||
@@ -99,7 +120,7 @@ public class SkyboxPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LocalPoint p = client.getLocalPlayer().getLocalLocation();
|
LocalPoint p = player.getLocalLocation();
|
||||||
px = p.getX();
|
px = p.getX();
|
||||||
py = p.getY();
|
py = p.getY();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019 logarrhytmic <https://github.com/logarrhythmic>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.plugins.skybox;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import net.runelite.client.config.Config;
|
||||||
|
import net.runelite.client.config.ConfigGroup;
|
||||||
|
import net.runelite.client.config.ConfigItem;
|
||||||
|
|
||||||
|
@ConfigGroup("skybox")
|
||||||
|
public interface SkyboxPluginConfig extends Config
|
||||||
|
{
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "customOverworldColor",
|
||||||
|
name = "Overworld sky color",
|
||||||
|
description = "Sets the color to use for the sky in overworld areas.",
|
||||||
|
position = 1
|
||||||
|
)
|
||||||
|
Color customOverworldColor();
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "customOtherColor",
|
||||||
|
name = "Cave sky color",
|
||||||
|
description = "Sets the color to use for the sky in non-overworld areas.",
|
||||||
|
position = 2
|
||||||
|
)
|
||||||
|
Color customOtherColor();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user