Skip to content
Closed
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
902 changes: 902 additions & 0 deletions patches/client/0074-refactor-finalize-wall-ore-overlay-layering.patch

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/mindustryX/bundles/UiTextBundleEn.kt
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ internal object UiTextBundleEn : UiTextBundle {
"在建造列表加入被摧毁建筑" to "Add destroyed buildings to build queue",
"在目标点附近的这个范围内随机生成" to "Randomly generated within this range near the target point",
"地形蓝图" to "Terrain Blueprint",
"地板" to "Floor",
"块" to "B",
"基础对比" to "Basic",
"填满核心的所有资源" to "Fill core resources",
Expand All @@ -248,6 +249,8 @@ internal object UiTextBundleEn : UiTextBundle {
"帧率模拟" to "Frame rate simulation",
"平方对比" to "Squared",
"序号" to "Index",
"建筑" to "Block",
"建筑层级" to "Building Detail",
"建筑显示" to "Block Rendering",
"建筑:" to "Buildings:",
"建造区域" to "Build area",
Expand Down Expand Up @@ -322,6 +325,7 @@ internal object UiTextBundleEn : UiTextBundle {
"画板++" to "Artboard++",
"瞬间完成" to "Instant",
"矿机AI" to "Miner AI",
"矿物" to "Ore",
"矿物信息" to "Ore Info",
"矿物矿(地表/墙矿)" to "Ore Count (surface/wall)",
"碰撞箱显示" to "Hitbox Overlay",
Expand Down
4 changes: 2 additions & 2 deletions src/mindustryX/features/BindingExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum class BindingExt(val default: KeybindValue = KeyCode.unset, val category: S
toggle_unit(KeyCode.unset, "mindustryX", onTap = { RenderExt.unitHide.toggle() }),
point(KeyCode.j, onTap = MarkerType::showPanUI),
lockonLastMark(KeyCode.unset, onTap = MarkerType::lockOnLastMark),
toggle_block_render(KeyCode.unset, onTap = { RenderExt.blockRenderLevel0.cycle() }),
toggle_block_render(KeyCode.unset, onTap = { RenderExt.cycleBuildingVisibility() }),
focusLogicController(KeyCode.unset, onTap = { mindustryX.features.func.focusLogicController() }),
placeRouterReplacement(KeyCode.shiftLeft),
overlayUI(KeyCode.z, onTap = onTap@{
Expand Down Expand Up @@ -50,4 +50,4 @@ enum class BindingExt(val default: KeybindValue = KeyCode.unset, val category: S
}
}
}
}
}
74 changes: 74 additions & 0 deletions src/mindustryX/features/LogicExt.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@
import mindustry.game.EventType.*;
import mindustry.gen.*;
import mindustry.net.Packets.*;
import mindustry.world.*;
import mindustry.world.blocks.environment.*;
import mindustryX.*;
import mindustryX.features.SettingsV2.*;

import static mindustry.Vars.net;
import static mindustryX.features.UIExt.i;

public class LogicExt{
public enum BlockLayer{
FLOOR, ORE, BLOCK
}

public static boolean worldCreator = false;
public static boolean terrainSchematic = false;
public static boolean floorLayerEnabled = true;
public static boolean oreLayerEnabled = true;
public static boolean blockLayerEnabled = true;
public static boolean invertMapClick = false;
/** Disable player control in InputHandler */
public static boolean noUpdatePlayerMovement = false;
Expand All @@ -26,6 +35,9 @@ public class LogicExt{
private static final CheckPref invertMapClick0 = new CheckPref("gameUI.invertMapClick");
public static final CheckPref worldCreator0 = new CheckPref("worldCreator");
public static final CheckPref terrainSchematic0 = new CheckPref("terrainSchematic");
public static final CheckPref floorLayerEnabled0 = new CheckPref("advanceTool.floorLayerEnabled", true);
public static final CheckPref oreLayerEnabled0 = new CheckPref("advanceTool.oreLayerEnabled", true);
public static final CheckPref blockLayerEnabled0 = new CheckPref("advanceTool.blockLayerEnabled", true);
public static final CheckPref reliableSync = new CheckPref("debug.reliableSync");
public static final SliderPref limitUpdate = new SliderPref("debug.limitUpdate", 0, 0, 100, 1, (it) -> {
if(it == 0) return i("关闭");
Expand All @@ -48,6 +60,9 @@ public static void init(){
limitUpdateTimer = (limitUpdateTimer + 1) % 10;
worldCreator = worldCreator0.get();
terrainSchematic = terrainSchematic0.get();
floorLayerEnabled = floorLayerEnabled0.get();
oreLayerEnabled = oreLayerEnabled0.get();
blockLayerEnabled = blockLayerEnabled0.get();
invertMapClick = invertMapClick0.get();
mockProtocol = ConnectPacket.clientVersion > 0 ? ConnectPacket.clientVersion : Version.build;
v146Mode = mockProtocol == 146;
Expand All @@ -57,4 +72,63 @@ public static void init(){
editOtherBlock &= !net.client();
});
}

public static boolean shouldIncludeFloorInTerrainSchematic(){
return shouldIncludeInTerrainSchematic(BlockLayer.FLOOR);
}

public static boolean shouldIncludeOreInTerrainSchematic(){
return shouldIncludeInTerrainSchematic(BlockLayer.ORE);
}

public static boolean shouldIncludeBlockInTerrainSchematic(){
return shouldIncludeInTerrainSchematic(BlockLayer.BLOCK);
}

public static boolean isFloorLayer(Block block){
return block instanceof Floor floor && !(floor instanceof OverlayFloor) && !floor.oreDefault && !floor.wallOre;
}

public static boolean isOreLayer(Block block){
return block instanceof Floor floor && (floor instanceof OverlayFloor || floor.oreDefault || floor.wallOre);
}

public static boolean isBlockLayer(Block block){
return block != null && !block.isAir() && !isFloorLayer(block) && !isOreLayer(block);
}

public static BlockLayer classifyBlockLayer(Block block){
if(isFloorLayer(block)) return BlockLayer.FLOOR;
if(isOreLayer(block)) return BlockLayer.ORE;
return BlockLayer.BLOCK;
}

public static boolean isFloorLayerEnabled(){
return floorLayerEnabled;
}

public static boolean isOreLayerEnabled(){
return oreLayerEnabled;
}

public static boolean isBlockLayerEnabled(){
return blockLayerEnabled;
}

public static boolean isLayerEnabled(BlockLayer layer){
return switch(layer){
case FLOOR -> isFloorLayerEnabled();
case ORE -> isOreLayerEnabled();
case BLOCK -> isBlockLayerEnabled();
};
}

public static boolean isLayerEnabled(Block block){
return block != null && !block.isAir() && isLayerEnabled(classifyBlockLayer(block));
}

public static boolean shouldIncludeInTerrainSchematic(BlockLayer layer){
return terrainSchematic && isLayerEnabled(layer);
}

}
41 changes: 40 additions & 1 deletion src/mindustryX/features/RenderExt.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,47 @@ public static void onGroupDraw(Drawc t){
}
}

public static boolean shouldDrawFloorLayer(){
return LogicExt.isFloorLayerEnabled();
}

public static boolean shouldDrawOreLayer(){
return LogicExt.isOreLayerEnabled();
}

public static boolean shouldDrawBuildingLayer(){
return LogicExt.isBlockLayerEnabled() && blockRenderLevel > 0;
}

public static boolean shouldDrawBuildingBase(){
return LogicExt.isBlockLayerEnabled() && blockRenderLevel > 1;
}

public static boolean shouldDraw(LogicExt.BlockLayer layer){
return switch(layer){
case FLOOR -> shouldDrawFloorLayer();
case ORE -> shouldDrawOreLayer();
case BLOCK -> shouldDrawBuildingLayer();
};
}

public static boolean shouldDraw(Block block){
return block != null && !block.isAir() && shouldDraw(LogicExt.classifyBlockLayer(block));
}

public static void cycleBuildingVisibility(){
if(!LogicExt.blockLayerEnabled0.get()){
LogicExt.blockLayerEnabled0.set(true);
if(blockRenderLevel0.get() <= 0){
blockRenderLevel0.set(1);
}
return;
}
blockRenderLevel0.cycle();
}

public static void onBlockDraw(Tile tile, Block block, @Nullable Building build){
if(blockRenderLevel < 2) return;
if(!shouldDrawBuildingBase()) return;
block.drawBase(tile);
if(displayAllMessage && build instanceof MessageBuild){
Draw.z(Layer.overlayUI - 0.1f);
Expand Down
6 changes: 6 additions & 0 deletions src/mindustryX/features/ui/toolTable/AdvanceToolTable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ class AdvanceToolTable : Table() {
}.checked { VarsX.allUnlocked.value }.tooltip(i("显示并允许建造所有物品")).wrapLabel(false)
button(i("地形蓝图"), Styles.flatToggleMenut) { LogicExt.terrainSchematic0.toggle() }
.checked { LogicExt.terrainSchematic }.wrapLabel(false)
button(i("地板"), Styles.flatToggleMenut) { LogicExt.floorLayerEnabled0.toggle() }
.checked { LogicExt.isFloorLayerEnabled() }.wrapLabel(false)
button(i("矿物"), Styles.flatToggleMenut) { LogicExt.oreLayerEnabled0.toggle() }
.checked { LogicExt.isOreLayerEnabled() }.wrapLabel(false)
button(i("建筑"), Styles.flatToggleMenut) { LogicExt.blockLayerEnabled0.toggle() }
.checked { LogicExt.isBlockLayerEnabled() }.wrapLabel(false)
button(i("瞬间完成"), Styles.cleart) {
Vars.player.unit()?.apply {
if (!canBuild()) {
Expand Down
2 changes: 1 addition & 1 deletion src/mindustryX/features/ui/toolTable/NewToolTable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object NewToolTable : Table() {
}
toggle(i("扫"), i("扫描模式"), { RenderExt.transportScan.value }) { RenderExt.transportScan.toggle() }

toggle(i("块"), i("建筑显示"), { RenderExt.blockRenderLevel > 0 }) { RenderExt.blockRenderLevel0.cycle() }
toggle(i("块"), i("建筑层级"), { RenderExt.shouldDrawBuildingLayer() }) { RenderExt.cycleBuildingVisibility() }
toggle(i("兵"), i("兵种显示"), { !RenderExt.unitHide.value }) { RenderExt.unitHide.toggle() }
toggle(i("弹"), i("子弹显示"), { !RenderExt.noBulletShow.value }) { RenderExt.noBulletShow.toggle() }
toggle(i("效"), i("特效显示"), { Vars.renderer.enableEffects }) { Settings.toggle("effects") }
Expand Down