screeps-connectivity 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - f29f9a8: Fix world bounds calculation for single-quadrant maps (e.g. E/S-only servers) — previously the client assumed a symmetric world and mapped e.g. E0S0–E11S11 to W6N6–E5S5.
8
+
3
9
  ## 0.8.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screeps-connectivity",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "repository": {
@@ -102,16 +102,30 @@ export class ServerStore extends TypedStore<ServerStoreEvents> {
102
102
  const stats = probe.stats ?? {}
103
103
  const found = (['W0N0', 'E0N0', 'W0S0', 'E0S0'] as const).filter(r => r in stats)
104
104
  this.logger.log(`worldInfo corner probe — found: [${found.length ? found.join(', ') : 'none'}]`)
105
- if ('E0N0' in stats || 'E0S0' in stats) {
106
- // E quadrant exists: width spans both W and E sides, split evenly
105
+ const hasEast = 'E0N0' in stats || 'E0S0' in stats
106
+ const hasWest = 'W0N0' in stats || 'W0S0' in stats
107
+ const hasSouth = 'W0S0' in stats || 'E0S0' in stats
108
+ const hasNorth = 'W0N0' in stats || 'E0N0' in stats
109
+ if (hasEast && hasWest) {
110
+ // Both E and W quadrants exist: split width evenly around E0/W0
107
111
  minX = -Math.ceil(width / 2)
108
112
  maxX = Math.floor(width / 2) - 1
113
+ } else if (hasEast) {
114
+ // Only E quadrant: all rooms are east of E0
115
+ minX = 0
116
+ maxX = width - 1
109
117
  }
110
- if ('W0S0' in stats || 'E0S0' in stats) {
111
- // S quadrant exists: height spans both N and S sides, split evenly
118
+ // else: W-only keeps default (minX=-width, maxX=-1)
119
+ if (hasSouth && hasNorth) {
120
+ // Both S and N quadrants exist: split height evenly around S0/N0
112
121
  minY = -Math.ceil(height / 2)
113
122
  maxY = Math.floor(height / 2) - 1
123
+ } else if (hasSouth) {
124
+ // Only S quadrant: all rooms are south of S0
125
+ minY = 0
126
+ maxY = height - 1
114
127
  }
128
+ // else: N-only keeps default (minY=-height, maxY=-1)
115
129
  } catch (e) {
116
130
  this.logger.log('worldInfo corner probe failed — keeping W/N defaults:', e)
117
131
  }