Skip to content
This repository was archived by the owner on Aug 31, 2026. It is now read-only.

Commit 7a16338

Browse files
committed
feat: the telescope sweeps a region and names the bodies in it
- a survey walks its region cell by cell and resumes after unload - a cell resolves into bodies, which is what the console can read - stopping and re-aiming are free; passive watches the home cell - survey time arrives with research; 22 tests in three tiers
1 parent 4cc136d commit 7a16338

9 files changed

Lines changed: 711 additions & 286 deletions

File tree

‎src/main/java/zmaster587/advancedRocketry/api/ARConfiguration.java‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ public class ARConfiguration {
297297
@ConfigProperty
298298
public int telescopeScanTicksPerSector;
299299
@ConfigProperty
300+
public int telescopeScanCellsPerStep;
301+
@ConfigProperty
302+
public int telescopePassiveRadiusSectors;
303+
@ConfigProperty
300304
public boolean allowNonArBiomesInTerraforming;
301305
@ConfigProperty
302306
public double oxygenVentPowerMultiplier;
@@ -525,10 +529,12 @@ public static void loadPreInit() {
525529
arConfig.planetsMustBeDiscovered = config.get(PLANET, "planetsMustBeDiscovered", false, "Planets must be discovered in the warp controller before being visible").getBoolean();
526530
arConfig.planetDiscoveryChance = config.get(PLANET, "planetDiscoveryChance", 5, "Chance of planet discovery in the warp controller, chance is 1/n", 1, Integer.MAX_VALUE).getInt();
527531
arConfig.telescopeScanRangeSectors = config.get(PLANET, "telescopeScanRangeSectors", 24, "How far, in galactic sectors, an observatory's region scan can be aimed. This is the instrument's horizon: beyond it the sky is not resolvable, which is what keeps an endless universe from being read off a telescope. A scan aimed farther is clamped to this.", 1, Integer.MAX_VALUE).getInt();
528-
arConfig.telescopeScanHalfWidthSectors = config.get(PLANET, "telescopeScanHalfWidthSectors", 1, "Half-width, in sectors, of the box one region scan covers. 0 means a single sector, 1 a 3x3x3 neighbourhood, and so on. Narrowed automatically when the resulting box would exceed telescopeScanMaxSectors.", 0, Integer.MAX_VALUE).getInt();
529-
arConfig.telescopeScanMaxSectors = config.get(PLANET, "telescopeScanMaxSectors", 64, "Hard ceiling on how many sectors one region scan may enumerate. The width above is narrowed until the box fits under this.", 1, Integer.MAX_VALUE).getInt();
530-
arConfig.telescopeScanBaseTicks = config.get(PLANET, "telescopeScanBaseTicks", 200, "Ticks a region scan takes before distance is counted - the cost of pointing the instrument at all.", 0, Integer.MAX_VALUE).getInt();
531-
arConfig.telescopeScanTicksPerSector = config.get(PLANET, "telescopeScanTicksPerSector", 100, "Extra ticks per sector of distance. This is what makes a far region a longer look than a near one.", 0, Integer.MAX_VALUE).getInt();
532+
arConfig.telescopeScanHalfWidthSectors = config.get(PLANET, "telescopeScanHalfWidthSectors", 2, "Half-width, in sectors, of the region one survey sweeps. 0 means a single sector, 1 a 3x3x3 neighbourhood, 2 a 5x5x5, and so on. Narrowed automatically when the resulting region would exceed telescopeScanMaxSectors.", 0, Integer.MAX_VALUE).getInt();
533+
arConfig.telescopeScanMaxSectors = config.get(PLANET, "telescopeScanMaxSectors", 1000, "Hard ceiling on how many sectors one survey may cover. The width above is narrowed until the region fits under this. A sweep may be long, but never unbounded.", 1, Integer.MAX_VALUE).getInt();
534+
arConfig.telescopeScanBaseTicks = config.get(PLANET, "telescopeScanBaseTicks", 200, "Ticks one STEP of a survey takes before distance is counted - the cost of holding the instrument on a patch of sky at all. Only applies with planetsMustBeDiscovered on; without research, an observation is instant.", 0, Integer.MAX_VALUE).getInt();
535+
arConfig.telescopeScanTicksPerSector = config.get(PLANET, "telescopeScanTicksPerSector", 100, "Extra ticks per sector of distance, per step. This is what makes a far region a longer survey than a near one.", 0, Integer.MAX_VALUE).getInt();
536+
arConfig.telescopeScanCellsPerStep = config.get(PLANET, "telescopeScanCellsPerStep", 5, "How many cells of the region one step of a survey resolves. This is the bound that stops a sweep from enumerating everything at once.", 1, Integer.MAX_VALUE).getInt();
537+
arConfig.telescopePassiveRadiusSectors = config.get(PLANET, "telescopePassiveRadiusSectors", 2, "How far, in sectors, the passive local radar reaches around the observatory's own cell. Passive is the mode that costs nothing and watches the neighbourhood; the directed survey is what looks far away.", 0, Integer.MAX_VALUE).getInt();
532538
DimensionManager.dimOffset = config.getInt("minDimension", PLANET, 2, -127, 8000, "Lowest dimension ID that can be used for planets.");
533539
arConfig.canPlayerRespawnInSpace = config.get(PLANET, "allowPlanetRespawn", false, "Allow bed respawn on planets with breathable air.").getBoolean();
534540
arConfig.forcePlayerRespawnInSpace = config.get(PLANET, "forcePlanetRespawn", false, "Allow bed respawn on planets even without breathable air. Requires 'allowPlanetRespawn=true'.").getBoolean();

‎src/main/java/zmaster587/advancedRocketry/command/test/TestProbeCommand.java‎

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,11 +2097,19 @@ private void handleTelescope(MinecraftServer server, ICommandSender sender, Stri
20972097
return;
20982098
}
20992099

2100+
if ("abort".equalsIgnoreCase(verb)) {
2101+
boolean stopped = scope.abortRegionScan();
2102+
send(sender, "{\"ok\":" + stopped + telescopeScanFields(scope, scope.getActiveScan(), world) + "}");
2103+
return;
2104+
}
2105+
2106+
if ("passive".equalsIgnoreCase(verb)) {
2107+
boolean started = scope.beginPassiveSweep();
2108+
send(sender, "{\"ok\":" + started + telescopeScanFields(scope, scope.getActiveScan(), world) + "}");
2109+
return;
2110+
}
2111+
21002112
if ("scan".equalsIgnoreCase(verb) && args.length >= 9) {
2101-
if (scope.getActiveScan() != null) {
2102-
send(sender, "{\"ok\":false,\"reason\":\"busy\"}");
2103-
return;
2104-
}
21052113
if (scope.scanOrigin() == null) {
21062114
send(sender, "{\"ok\":false,\"reason\":\"noOrigin\",\"dim\":"
21072115
+ world.provider.getDimension() + "}");
@@ -2142,17 +2150,24 @@ private String telescopeScanFields(zmaster587.advancedRocketry.tile.multiblock.T
21422150
// a GUI click changes and what the next scan will use. Distinct from the region a
21432151
// running scan is already looking at, below.
21442152
.append(",\"aim\":").append(scope.scanDirectionIndex())
2145-
.append(",\"aimDistance\":").append(scope.getScanDistance());
2153+
.append(",\"aimDistance\":").append(scope.getScanDistance())
2154+
.append(",\"passive\":").append(scope.isPassive());
21462155
if (scan != null) {
2156+
// The cell counts ship beside the region they are counted over, and the next deadline
2157+
// beside the clock it is measured against: a sweep that will not advance must be able to
2158+
// say which of the three is stuck.
21472159
out.append(",\"min\":\"").append(scan.min().cellKey())
21482160
.append("\",\"max\":\"").append(scan.max().cellKey())
2149-
.append("\",\"sectors\":").append(scan.sectorCount())
2161+
.append("\",\"cells\":").append(scan.totalCells())
2162+
.append(",\"cellsDone\":").append(scan.cellsDone())
2163+
.append(",\"cellsPerStep\":").append(scan.cellsPerStep())
21502164
.append(",\"distance\":").append(scan.distanceSectors())
21512165
.append(",\"start\":").append(scan.startTick())
2152-
.append(",\"deadline\":").append(scan.deadlineTick())
2153-
.append(",\"duration\":").append(scan.durationTicks())
2154-
.append(",\"progress\":").append(scan.progress(now))
2155-
.append(",\"complete\":").append(scan.isComplete(now));
2166+
.append(",\"stepDeadline\":").append(scan.stepDeadline())
2167+
.append(",\"ticksPerStep\":").append(scan.ticksPerStep())
2168+
.append(",\"estimatedTicks\":").append(scan.estimatedTicks())
2169+
.append(",\"progress\":").append(scan.progress())
2170+
.append(",\"stepDue\":").append(scan.stepDue(now));
21562171
}
21572172
return out.toString();
21582173
}
@@ -9063,7 +9078,12 @@ private void handleMachineTickUntil(MinecraftServer server, ICommandSender sende
90639078
"telescopeScanHalfWidthSectors",
90649079
"telescopeScanMaxSectors",
90659080
"telescopeScanBaseTicks",
9066-
"telescopeScanTicksPerSector"));
9081+
"telescopeScanTicksPerSector",
9082+
"telescopeScanCellsPerStep",
9083+
"telescopePassiveRadiusSectors",
9084+
// The research master switch. A survey is instant without it and paced by the
9085+
// time curve with it, so both halves of boundary B need it flippable at runtime.
9086+
"planetsMustBeDiscovered"));
90679087

90689088
private void handleConfig(ICommandSender sender, String[] args) {
90699089
if (args.length == 0) {

0 commit comments

Comments
 (0)