Power armor GUI now indicates installed modules with checkmarks. Config-disallowed modules are hidden from view unless they are installed, then they're displayed with an X, allowing them to be salvaged.
This commit is contained in:
parent
a38d0aee23
commit
2f80830224
4 changed files with 63 additions and 4 deletions
BIN
mods/mmmPowersuits/textures/gui/checkmark.png
Normal file
BIN
mods/mmmPowersuits/textures/gui/checkmark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 233 B |
|
@ -606,4 +606,32 @@ public abstract class MuseRenderer {
|
||||||
matrix.put(10, scalez);
|
matrix.put(10, scalez);
|
||||||
GL11.glLoadMatrix(matrix);
|
GL11.glLoadMatrix(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void drawCheckmark(double x, double y, Colour colour) {
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||||
|
texturelessOff();
|
||||||
|
blendingOn();
|
||||||
|
|
||||||
|
if (colour != null) {
|
||||||
|
colour.doGL();
|
||||||
|
}
|
||||||
|
getRenderEngine().bindTexture("/mods/mmmPowersuits/textures/gui/checkmark.png");
|
||||||
|
Tessellator tess = Tessellator.instance;
|
||||||
|
tess.startDrawingQuads();
|
||||||
|
|
||||||
|
tess.addVertexWithUV(x, y, 0.0F, 0.0F, 0.0F);
|
||||||
|
tess.addVertexWithUV(x, y + 16, 0.0F, 0.0F, 1.0F);
|
||||||
|
tess.addVertexWithUV(x + 16, y + 16, 0.0F, 1.0F, 1.0F);
|
||||||
|
tess.addVertexWithUV(x + 16, y, 0.0F, 1.0F, 0.0F);
|
||||||
|
tess.draw();
|
||||||
|
|
||||||
|
MuseRenderer.blendingOff();
|
||||||
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ import net.machinemuse.general.geometry.MusePoint2D;
|
||||||
*/
|
*/
|
||||||
public class ClickableModule extends Clickable {
|
public class ClickableModule extends Clickable {
|
||||||
protected IPowerModule module;
|
protected IPowerModule module;
|
||||||
|
protected boolean allowed = true;
|
||||||
|
protected boolean installed = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param vaug
|
* @param vaug
|
||||||
|
@ -38,13 +40,17 @@ public class ClickableModule extends Clickable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw() {
|
public void draw() {
|
||||||
Colour c1 = new Colour(1.0F, 0.2F, 0.6F, 1.0F);
|
|
||||||
Colour c2 = new Colour(0.6F, 0.2F, 1.0F, 1.0F);
|
|
||||||
|
|
||||||
Colour.getGreyscale(1.0f, 1.0f).doGL();
|
Colour.getGreyscale(1.0f, 1.0f).doGL();
|
||||||
MuseRenderer.TEXTURE_MAP = getModule().getStitchedTexture(null);
|
MuseRenderer.TEXTURE_MAP = getModule().getStitchedTexture(null);
|
||||||
MuseRenderer.drawIconAt(getPosition().x() - 8, getPosition().y() - 8, getModule().getIcon(null), null);
|
MuseRenderer.drawIconAt(getPosition().x() - 8, getPosition().y() - 8, getModule().getIcon(null), null);
|
||||||
|
|
||||||
|
// Draw the status indicators slightly lower and to the right so they stand out a little more.
|
||||||
|
if (! allowed) {
|
||||||
|
String string = MuseStringUtils.wrapFormatTags("x", MuseStringUtils.FormatCodes.DarkRed);
|
||||||
|
MuseRenderer.drawString(string, getPosition().x() + 3, getPosition().y() + 1);
|
||||||
|
} else if (installed) {
|
||||||
|
MuseRenderer.drawCheckmark(getPosition().x() - 8 + 1, getPosition().y() - 8 + 1, new Colour(0.0F, 0.667F, 0.0F, 1.0F));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -67,4 +73,12 @@ public class ClickableModule extends Clickable {
|
||||||
return this.module.equals(other.module);
|
return this.module.equals(other.module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAllowed(boolean allowed) {
|
||||||
|
this.allowed = allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInstalled(boolean installed) {
|
||||||
|
this.installed = installed;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,16 @@ public class ModuleSelectionFrame extends ScrollableFrame {
|
||||||
categories = new HashMap();
|
categories = new HashMap();
|
||||||
|
|
||||||
List<IPowerModule> workingModules = MuseItemUtils.getValidModulesForItem(null, selectedItem.getItem());
|
List<IPowerModule> workingModules = MuseItemUtils.getValidModulesForItem(null, selectedItem.getItem());
|
||||||
|
|
||||||
|
// Prune the list of disallowed modules, if not installed on this item.
|
||||||
|
for (Iterator<IPowerModule> it = workingModules.iterator(); it.hasNext();) {
|
||||||
|
IPowerModule module = it.next();
|
||||||
|
if (module.isAllowed() == false &&
|
||||||
|
MuseItemUtils.itemHasModule(selectedItem.getItem(), module.getName()) == false) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (workingModules.size() > 0) {
|
if (workingModules.size() > 0) {
|
||||||
List<MusePoint2D> points = MuseRenderer.pointsInLine(
|
List<MusePoint2D> points = MuseRenderer.pointsInLine(
|
||||||
workingModules.size(),
|
workingModules.size(),
|
||||||
|
@ -96,6 +106,13 @@ public class ModuleSelectionFrame extends ScrollableFrame {
|
||||||
for (IPowerModule module : workingModules) {
|
for (IPowerModule module : workingModules) {
|
||||||
ModuleSelectionSubFrame frame = getOrCreateCategory(module.getCategory());
|
ModuleSelectionSubFrame frame = getOrCreateCategory(module.getCategory());
|
||||||
ClickableModule moduleClickable = frame.addModule(module);
|
ClickableModule moduleClickable = frame.addModule(module);
|
||||||
|
// Indicate installed modules
|
||||||
|
if (module.isAllowed() == false) {
|
||||||
|
// If a disallowed module made it to the list, indicate it as disallowed
|
||||||
|
moduleClickable.setAllowed(false);
|
||||||
|
} else if (MuseItemUtils.itemHasModule(selectedItem.getItem(), module.getName())) {
|
||||||
|
moduleClickable.setInstalled(true);
|
||||||
|
}
|
||||||
if (moduleClickable.getModule().equals(this.prevSelection)) {
|
if (moduleClickable.getModule().equals(this.prevSelection)) {
|
||||||
this.selectedModule = moduleButtons.size();
|
this.selectedModule = moduleButtons.size();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue