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
public final void explode(TNTPrimed tntPrimed, boolean inBuildRegion) {
public final void explode(TNTPrimed tntPrimed, boolean inBuildRegion, boolean inTestblockRegion) {
if (!recording && shouldStartRecording(StartType.EXPLODE)) {
startRecording();
}
if (recording) {
Record.TNTRecord tntRecord = getRecord(tntPrimed);
if (inBuildRegion) tntRecord.setInBuildArea(true);
if (inTestblockRegion) tntRecord.setInTestblockArea(true);
tntRecord.explode(tntPrimed);
}
lastExplosion = 0;

Datei anzeigen

@ -65,7 +65,7 @@ public class Recorder implements Listener {
}
@Override
public void explode(TNTPrimed tntPrimed, boolean b) {
public void explode(TNTPrimed tntPrimed, boolean inBuildArea, boolean inTestblockRegion) {
}
@Override
@ -155,7 +155,8 @@ public class Recorder implements Listener {
TraceRecorder traceRecorder = get((TNTPrimed) entity);
Region region = tntTraceRecorderMap.get((TNTPrimed) entity);
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);
tick();
}

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -31,6 +31,7 @@ public class ShowModeParameter {
private boolean ticks = false;
private boolean count = false;
private boolean buildDestroyOnly = false;
private boolean testblockDestroyOnly = false;
private boolean ticksSinceStart = false;
private boolean microMotion = false;
@ -66,6 +67,10 @@ public class ShowModeParameter {
this.buildDestroyOnly = true;
}
public void enableTestblockDestroyOnly() {
this.testblockDestroyOnly = true;
}
public void enableTicksSinceStart() {
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"),
COUNT(ShowModeParameter::enableCount, Arrays.asList("-count", "-c"), "TICKS", "TICKS_SINCE_START"),
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"),
MICROMOTION(ShowModeParameter::enableMicroMotion, Arrays.asList("-micromotion", "-micro", "-m")),
;