Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/main/java/sh/okx/civmodern/common/CivMapConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class CivMapConfig {
private boolean iceRoadAutoEat;
private boolean iceRoadStop;
private boolean showItems;
private boolean showVehicles;
private boolean northUp;
private int chevronColour;
private boolean minimapEnabled;
Expand Down Expand Up @@ -77,6 +78,7 @@ public CivMapConfig(File file, Properties properties) {
this.iceRoadStop = Boolean.parseBoolean(properties.getProperty("ice_road_stop", "true"));
this.bgTransparency = Float.parseFloat(properties.getProperty("bg_transparency", String.valueOf(this.transparency)));
this.showItems = Boolean.parseBoolean(properties.getProperty("show_items", "true"));
this.showVehicles = Boolean.parseBoolean(properties.getProperty("show_vehicles", "true"));
this.northUp = Boolean.parseBoolean(properties.getProperty("north_up", "false"));
this.chevronColour = Integer.parseInt(properties.getProperty("chevron_colour", Integer.toString(DEFAULT_CHEVRON_COLOUR)));
this.minimapEnabled = Boolean.parseBoolean(properties.getProperty("minimap_enabled", "true"));
Expand Down Expand Up @@ -119,6 +121,7 @@ public void save() {
properties.setProperty("ice_road_auto_eat", Boolean.toString(iceRoadAutoEat));
properties.setProperty("ice_road_stop", Boolean.toString(iceRoadStop));
properties.setProperty("show_items", Boolean.toString(showItems));
properties.setProperty("show_vehicles", Boolean.toString(showVehicles));
properties.setProperty("north_up", Boolean.toString(northUp));
properties.setProperty("chevron_colour", Integer.toString(chevronColour));
properties.setProperty("minimap_enabled", Boolean.toString(minimapEnabled));
Expand Down Expand Up @@ -152,6 +155,14 @@ public void setShowItems(boolean showItems) {
this.showItems = showItems;
}

public boolean isShowVehicles() {
return showVehicles;
}

public void setShowVehicles(boolean showVehicles) {
this.showVehicles = showVehicles;
}

public int getColour() {
return compactedColour;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,28 @@ protected void init() {
);

addRenderableWidget(new ToggleButton(
this.centreX - (Button.DEFAULT_WIDTH / 2),
leftSideX,
offsetY,
Button.DEFAULT_WIDTH,
ToggleButton.DEFAULT_BUTTON_WIDTH,
Component.translatable("civmodern.screen.radar.enabled"),
this.config::isRadarEnabled,
this.config::setRadarEnabled,
Tooltip.create(Component.translatable("civmodern.screen.radar.enabled.tooltip")),
ToggleButton.DEFAULT_NARRATION
));
addRenderableWidget(
Button
.builder(
Component.translatable("civmodern.screen.radar.alignment", this.config.getAlignment().toString()),
(button) -> {
final Alignment next = this.config.getAlignment().next();
this.config.setAlignment(next);
button.setMessage(Component.translatable("civmodern.screen.radar.alignment", next.toString()));
}
)
.pos(rightSideX, offsetY)
.build()
);
offsetY += Button.DEFAULT_HEIGHT + 4;

addRenderableWidget(new ToggleButton(
Expand All @@ -118,21 +131,8 @@ protected void init() {
));
offsetY += Button.DEFAULT_HEIGHT + 4;

addRenderableWidget(
Button
.builder(
Component.translatable("civmodern.screen.radar.alignment", this.config.getAlignment().toString()),
(button) -> {
final Alignment next = this.config.getAlignment().next();
this.config.setAlignment(next);
button.setMessage(Component.translatable("civmodern.screen.radar.alignment", next.toString()));
}
)
.pos(leftSideX, offsetY)
.build()
);
addRenderableWidget(new ToggleButton(
rightSideX,
leftSideX,
offsetY,
ToggleButton.DEFAULT_BUTTON_WIDTH,
Component.translatable("civmodern.screen.radar.items"),
Expand All @@ -141,6 +141,16 @@ protected void init() {
Tooltip.create(Component.translatable("civmodern.screen.radar.items.tooltip")),
ToggleButton.DEFAULT_NARRATION
));
addRenderableWidget(new ToggleButton(
rightSideX,
offsetY,
ToggleButton.DEFAULT_BUTTON_WIDTH,
Component.translatable("civmodern.screen.radar.vehicles"),
this.config::isShowVehicles,
this.config::setShowVehicles,
Tooltip.create(Component.translatable("civmodern.screen.radar.vehicles.tooltip")),
ToggleButton.DEFAULT_NARRATION
));
offsetY += Button.DEFAULT_HEIGHT + 4;

addRenderableWidget(new DoubleOptionUpdateableSliderWidget(
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/sh/okx/civmodern/common/radar/Radar.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ public void render(GuiGraphics guiGraphics, float delta) {
if (config.isShowItems()) {
renderItems(guiGraphics, delta);
}
renderBoatsMinecarts(guiGraphics, delta);
if (config.isShowVehicles()) {
renderBoatsMinecarts(guiGraphics, delta);
}
renderPlayers(guiGraphics, delta);

guiGraphics.pose().popMatrix();
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/assets/civmodern/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"key.civmodern.config": "Open Civ Modern configuration",
"key.civmodern.map": "Open Civ Map",
"key.civmodern.minimapzoom": "Cycle minimap zoom",
"category.civmodern": "${mod_name}",
"key.category.civmodern.category": "${mod_name}",
"civmodern.screen.main.title": "Civ Modern Config",
"civmodern.screen.main.radar": "Radar Settings",
"civmodern.screen.main.ice": "Ice Road Macro",
Expand All @@ -24,6 +24,8 @@
"civmodern.screen.radar.alignment": "Alignment: %s",
"civmodern.screen.radar.items": "Items",
"civmodern.screen.radar.items.tooltip": "Show nearby items on your radar?",
"civmodern.screen.radar.vehicles": "Vehicles",
"civmodern.screen.radar.vehicles.tooltip": "Show nearby vehicles on your radar?",
"civmodern.screen.radar.iconsize": "Icon Size: %s",
"civmodern.screen.radar.textsize": "Text Size: %s",
"civmodern.screen.radar.range": "Range: %s blocks",
Expand Down