SteamWar/BauSystem2.0
Archiviert
12
0

Add -testblockdestroy and -testblockdestroyonly as Trace Show options
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-09-18 17:18:27 +02:00
Ursprung 7cd8d40e11
Commit 952d2f03dc
8 geänderte Dateien mit 22 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -93,13 +93,14 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
} }
@Override @Override
public final void explode(TNTPrimed tntPrimed, boolean inBuildRegion) { public final void explode(TNTPrimed tntPrimed, boolean inBuildRegion, boolean inTestblockRegion) {
if (!recording && shouldStartRecording(StartType.EXPLODE)) { if (!recording && shouldStartRecording(StartType.EXPLODE)) {
startRecording(); startRecording();
} }
if (recording) { if (recording) {
Record.TNTRecord tntRecord = getRecord(tntPrimed); Record.TNTRecord tntRecord = getRecord(tntPrimed);
if (inBuildRegion) tntRecord.setInBuildArea(true); if (inBuildRegion) tntRecord.setInBuildArea(true);
if (inTestblockRegion) tntRecord.setInTestblockArea(true);
tntRecord.explode(tntPrimed); tntRecord.explode(tntPrimed);
} }
lastExplosion = 0; lastExplosion = 0;

Datei anzeigen

@ -65,7 +65,7 @@ public class Recorder implements Listener {
} }
@Override @Override
public void explode(TNTPrimed tntPrimed, boolean b) { public void explode(TNTPrimed tntPrimed, boolean inBuildArea, boolean inTestblockRegion) {
} }
@Override @Override
@ -155,7 +155,8 @@ public class Recorder implements Listener {
TraceRecorder traceRecorder = get((TNTPrimed) entity); TraceRecorder traceRecorder = get((TNTPrimed) entity);
Region region = tntTraceRecorderMap.get((TNTPrimed) entity); Region region = tntTraceRecorderMap.get((TNTPrimed) entity);
boolean inBuildRegion = event.blockList().stream().anyMatch(block -> region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)); boolean inBuildRegion = event.blockList().stream().anyMatch(block -> region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION));
traceRecorder.explode((TNTPrimed) entity, inBuildRegion); boolean inTestblockRegion = event.blockList().stream().anyMatch(block -> region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION));
traceRecorder.explode((TNTPrimed) entity, inBuildRegion, inTestblockRegion);
tntTraceRecorderMap.remove(entity); tntTraceRecorderMap.remove(entity);
tick(); tick();
} }

Datei anzeigen

@ -65,9 +65,10 @@ public class SimpleTraceRecorder implements TraceRecorder, ActiveTracer {
} }
@Override @Override
public void explode(TNTPrimed tntPrimed, boolean inBuildRegion) { public void explode(TNTPrimed tntPrimed, boolean inBuildRegion, boolean inTestblockRegion) {
Record.TNTRecord tntRecord = getRecord(tntPrimed); Record.TNTRecord tntRecord = getRecord(tntPrimed);
if (inBuildRegion) tntRecord.setInBuildArea(true); if (inBuildRegion) tntRecord.setInBuildArea(true);
if (inTestblockRegion) tntRecord.setInTestblockArea(true);
tntRecord.explode(tntPrimed); tntRecord.explode(tntPrimed);
recordMap.remove(tntPrimed); recordMap.remove(tntPrimed);
} }

Datei anzeigen

@ -34,7 +34,7 @@ public interface TraceRecorder {
} }
void spawn(TNTPrimed tntPrimed); void spawn(TNTPrimed tntPrimed);
void tick(TNTPrimed tntPrimed); void tick(TNTPrimed tntPrimed);
void explode(TNTPrimed tntPrimed, boolean inBuildRegion); void explode(TNTPrimed tntPrimed, boolean inBuildRegion, boolean inTestblockRegion);
default void tick() { default void tick() {
} }

Datei anzeigen

@ -84,6 +84,10 @@ public class EntityShowMode implements ShowMode<TNTPosition> {
return; return;
} }
if (showModeParameter.isTestblockDestroyOnly() && !position.getRecord().isInTestblockArea()) {
return;
}
if (showModeParameter.isMicroMotion() && !position.getRecord().isHasMicroMotion()) { if (showModeParameter.isMicroMotion() && !position.getRecord().isHasMicroMotion()) {
return; return;
} }

Datei anzeigen

@ -93,6 +93,10 @@ public class Record {
@Setter @Setter
private boolean inBuildArea = false; private boolean inBuildArea = false;
@Getter
@Setter
private boolean inTestblockArea = false;
@Getter @Getter
private boolean hasMicroMotion = false; private boolean hasMicroMotion = false;

Datei anzeigen

@ -31,6 +31,7 @@ public class ShowModeParameter {
private boolean ticks = false; private boolean ticks = false;
private boolean count = false; private boolean count = false;
private boolean buildDestroyOnly = false; private boolean buildDestroyOnly = false;
private boolean testblockDestroyOnly = false;
private boolean ticksSinceStart = false; private boolean ticksSinceStart = false;
private boolean microMotion = false; private boolean microMotion = false;
@ -66,6 +67,10 @@ public class ShowModeParameter {
this.buildDestroyOnly = true; this.buildDestroyOnly = true;
} }
public void enableTestblockDestroyOnly() {
this.testblockDestroyOnly = true;
}
public void enableTicksSinceStart() { public void enableTicksSinceStart() {
this.ticksSinceStart = true; this.ticksSinceStart = true;
} }

Datei anzeigen

@ -41,6 +41,7 @@ public enum ShowModeParameterType {
TICKS(ShowModeParameter::enableTicks, Arrays.asList("-ticks", "-t"), "EXPLODE", "SOURCE", "COUNT", "TICKS_SINCE_START"), TICKS(ShowModeParameter::enableTicks, Arrays.asList("-ticks", "-t"), "EXPLODE", "SOURCE", "COUNT", "TICKS_SINCE_START"),
COUNT(ShowModeParameter::enableCount, Arrays.asList("-count", "-c"), "TICKS", "TICKS_SINCE_START"), COUNT(ShowModeParameter::enableCount, Arrays.asList("-count", "-c"), "TICKS", "TICKS_SINCE_START"),
BUILD_DESTROY_ONLY(ShowModeParameter::enableBuildDestroyOnly, Arrays.asList("-builddestroy", "-builddestoryonly"), "WATER"), BUILD_DESTROY_ONLY(ShowModeParameter::enableBuildDestroyOnly, Arrays.asList("-builddestroy", "-builddestoryonly"), "WATER"),
TESTBLOCK_DESTROY_ONLY(ShowModeParameter::enableTestblockDestroyOnly, Arrays.asList("-testblockdestroy", "-testblockdestroyonly"), "WATER"),
TICKS_SINCE_START(ShowModeParameter::enableTicksSinceStart, Arrays.asList("-tickssincestart", "-tss"), "TICKS", "COUNT"), TICKS_SINCE_START(ShowModeParameter::enableTicksSinceStart, Arrays.asList("-tickssincestart", "-tss"), "TICKS", "COUNT"),
MICROMOTION(ShowModeParameter::enableMicroMotion, Arrays.asList("-micromotion", "-micro", "-m")), MICROMOTION(ShowModeParameter::enableMicroMotion, Arrays.asList("-micromotion", "-micro", "-m")),
; ;