powergrid-viewer 1.11.6 → 1.11.7
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "powergrid-viewer",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/boardgamers/powergrid.git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"vue": "^2.6.11",
|
|
19
19
|
"vue-class-component": "^7.2.3",
|
|
20
20
|
"vue-property-decorator": "^8.4.2",
|
|
21
|
-
"powergrid-engine": "1.15.
|
|
21
|
+
"powergrid-engine": "1.15.7"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/assert": "^1.4.7",
|
package/src/components/Game.vue
CHANGED
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
:connections="G.map.connections"
|
|
56
56
|
:polygons="G.map.polygons"
|
|
57
57
|
:buildableCities="getBuildableCities()"
|
|
58
|
+
:blockedCities="G.blockedCities"
|
|
58
59
|
:pickableRegions="getPickableRegions()"
|
|
59
60
|
:devBackdrop="G.map.devBackdrop"
|
|
60
61
|
:mapRotation="G.map.mapRotation || 0"
|
|
@@ -92,7 +92,10 @@
|
|
|
92
92
|
number + 8/14/20 house slots), drawn AFTER the links so the gray lines
|
|
93
93
|
sit behind. Gated on connectionCost; other maps keep circular nodes. -->
|
|
94
94
|
<template v-for="city in cities">
|
|
95
|
-
<g
|
|
95
|
+
<g
|
|
96
|
+
v-if="city.connectionCost != null && city.slotCosts && city.slotCosts.length >= 2"
|
|
97
|
+
:key="city.name + '_tile'"
|
|
98
|
+
>
|
|
96
99
|
<rect
|
|
97
100
|
:class="[{ canClick: canBuild(city) || canPickRegion(city) }]"
|
|
98
101
|
:x="city.x - 23"
|
|
@@ -144,6 +147,48 @@
|
|
|
144
147
|
</g>
|
|
145
148
|
</template>
|
|
146
149
|
|
|
150
|
+
<!-- Manhattan single-house spaces: one house per space at its printed price.
|
|
151
|
+
Small, semi-transparent tile (no entry-cost circle — connection is a flat
|
|
152
|
+
5 everywhere, stated in the rules) so the price reads cleanly and tiles
|
|
153
|
+
never hide the board beneath when they overlap. -->
|
|
154
|
+
<template v-for="city in cities">
|
|
155
|
+
<g
|
|
156
|
+
v-if="city.connectionCost != null && city.slotCosts && city.slotCosts.length === 1"
|
|
157
|
+
:key="city.name + '_mtile'"
|
|
158
|
+
>
|
|
159
|
+
<rect
|
|
160
|
+
:class="[{ canClick: canBuild(city) }]"
|
|
161
|
+
:x="city.x - 13"
|
|
162
|
+
:y="city.y - 13"
|
|
163
|
+
width="26"
|
|
164
|
+
height="26"
|
|
165
|
+
rx="5"
|
|
166
|
+
:fill="isBlocked(city) ? '#555555' : 'white'"
|
|
167
|
+
:fill-opacity="isBlocked(city) ? 0.88 : 0.82"
|
|
168
|
+
stroke="black"
|
|
169
|
+
stroke-width="1.5"
|
|
170
|
+
@click="canBuild(city) && build(city)"
|
|
171
|
+
>
|
|
172
|
+
<title>
|
|
173
|
+
{{ city.name }}<template v-if="isBlocked(city)"> — blocked for this player count (transit
|
|
174
|
+
only)</template ><template v-else> — build for {{ city.slotCosts[0] }} (+ flat 5 per transited
|
|
175
|
+
space)</template>
|
|
176
|
+
</title>
|
|
177
|
+
</rect>
|
|
178
|
+
<text
|
|
179
|
+
:x="city.x"
|
|
180
|
+
:y="city.y"
|
|
181
|
+
font-size="17"
|
|
182
|
+
font-weight="bold"
|
|
183
|
+
text-anchor="middle"
|
|
184
|
+
dominant-baseline="central"
|
|
185
|
+
:fill="isBlocked(city) ? '#dddddd' : 'black'"
|
|
186
|
+
>
|
|
187
|
+
{{ city.slotCosts[0] }}
|
|
188
|
+
</text>
|
|
189
|
+
</g>
|
|
190
|
+
</template>
|
|
191
|
+
|
|
147
192
|
<template v-for="city in cities">
|
|
148
193
|
<circle
|
|
149
194
|
v-if="city.connectionCost == null"
|
|
@@ -205,12 +250,16 @@
|
|
|
205
250
|
:owner="house.owner"
|
|
206
251
|
:ownerName="house.ownerName"
|
|
207
252
|
:color="house.color"
|
|
253
|
+
:scale="house.scale"
|
|
208
254
|
/>
|
|
209
255
|
</template>
|
|
210
256
|
|
|
211
257
|
<!-- Bremen entry-cost number, on top so it stays readable over houses -->
|
|
212
258
|
<template v-for="city in cities">
|
|
213
|
-
<g
|
|
259
|
+
<g
|
|
260
|
+
v-if="city.connectionCost != null && city.slotCosts && city.slotCosts.length >= 2"
|
|
261
|
+
:key="city.name + '_cc'"
|
|
262
|
+
>
|
|
214
263
|
<circle
|
|
215
264
|
:cx="city.x"
|
|
216
265
|
:cy="city.y + 15"
|
|
@@ -348,7 +397,7 @@ import { City, Connection, Polygon } from 'powergrid-engine/src/maps';
|
|
|
348
397
|
|
|
349
398
|
@Component({
|
|
350
399
|
components: {
|
|
351
|
-
House
|
|
400
|
+
House,
|
|
352
401
|
},
|
|
353
402
|
})
|
|
354
403
|
export default class Map extends Vue {
|
|
@@ -357,6 +406,8 @@ export default class Map extends Vue {
|
|
|
357
406
|
@Prop() connections?: Connection[];
|
|
358
407
|
@Prop() playerColors?: string[];
|
|
359
408
|
@Prop() buildableCities?: string[];
|
|
409
|
+
// Manhattan: spaces blocked for this player count — transitable but never buildable.
|
|
410
|
+
@Prop() blockedCities?: string[];
|
|
360
411
|
// chooseRegions draft: region names the current player may pick this turn.
|
|
361
412
|
@Prop() pickableRegions?: string[];
|
|
362
413
|
@Prop() devBackdrop?: { src: string; width: number; height: number; opacity?: number };
|
|
@@ -372,9 +423,20 @@ export default class Map extends Vue {
|
|
|
372
423
|
player.cities.forEach((cityPiece) => {
|
|
373
424
|
const city = gameState.map.cities.find((city) => city.name == cityPiece.name)!;
|
|
374
425
|
let offsetX, offsetY;
|
|
426
|
+
let pieceScale: number | undefined;
|
|
375
427
|
const isNodeWeighted = city.connectionCost != null;
|
|
428
|
+
// Manhattan = a node-weighted map with exactly one house per space.
|
|
429
|
+
const isManhattan = isNodeWeighted && city.slotCosts?.length === 1;
|
|
376
430
|
const is1520 = city.slotCosts?.length === 2 && city.slotCosts[0] === 15;
|
|
377
|
-
if (
|
|
431
|
+
if (isManhattan) {
|
|
432
|
+
// One house per space, enlarged and centered so the house silhouette
|
|
433
|
+
// slightly overflows the (smaller) price tile and covers it — no white
|
|
434
|
+
// corners showing. The House shape's bbox center is ~(199, 230) in its
|
|
435
|
+
// own units, so at scale S it centers on the space when offset -199S/-230S.
|
|
436
|
+
pieceScale = 0.085;
|
|
437
|
+
offsetX = -199 * pieceScale;
|
|
438
|
+
offsetY = -230 * pieceScale;
|
|
439
|
+
} else if (isNodeWeighted) {
|
|
378
440
|
// Bremen tiles: 8 top, 14 left, 20 right — matches the board layout.
|
|
379
441
|
// The House piece is anchored top-left (~14×16 after its scale), so
|
|
380
442
|
// offset by half its size to center it on the slot.
|
|
@@ -407,6 +469,7 @@ export default class Map extends Vue {
|
|
|
407
469
|
y: city.y + offsetY,
|
|
408
470
|
color: this.playerColors![pi],
|
|
409
471
|
owner: pi,
|
|
472
|
+
scale: pieceScale,
|
|
410
473
|
});
|
|
411
474
|
});
|
|
412
475
|
});
|
|
@@ -443,6 +506,10 @@ export default class Map extends Vue {
|
|
|
443
506
|
return !!this.buildableCities!.find((cityName) => cityName == city.name);
|
|
444
507
|
}
|
|
445
508
|
|
|
509
|
+
isBlocked(city: City) {
|
|
510
|
+
return !!this.blockedCities && this.blockedCities.includes(city.name);
|
|
511
|
+
}
|
|
512
|
+
|
|
446
513
|
build(city: City) {
|
|
447
514
|
this.$emit('build', city);
|
|
448
515
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<g :id="elId" :class="['piece']" :transform="`translate(${currentX}, ${currentY}) scale(
|
|
2
|
+
<g :id="elId" :class="['piece']" :transform="`translate(${currentX}, ${currentY}) scale(${scale})`">
|
|
3
3
|
<!-- <path d="M15 0 L30 10 L30 30 L0 30 L0 10Z" :fill="color" stroke="black" /> -->
|
|
4
4
|
<path
|
|
5
5
|
d="M187.698 263.636V456.017L3 341.204V169.522L80.8579 108.141L187.698 263.636Z"
|
|
@@ -42,6 +42,9 @@ export default class House extends Mixins(Piece) {
|
|
|
42
42
|
@Prop()
|
|
43
43
|
color?: string;
|
|
44
44
|
|
|
45
|
+
@Prop({ default: 0.035 })
|
|
46
|
+
scale!: number;
|
|
47
|
+
|
|
45
48
|
@Prop()
|
|
46
49
|
owner?: number;
|
|
47
50
|
|
package/src/types/ui-data.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface Piece {
|
|
|
21
21
|
color?: string;
|
|
22
22
|
powerPlant?: PowerPlant;
|
|
23
23
|
transparent?: boolean;
|
|
24
|
+
// Per-piece render scale override (House defaults to 0.035; Manhattan enlarges).
|
|
25
|
+
scale?: number;
|
|
24
26
|
side?: 'north' | 'south';
|
|
25
27
|
// South Africa: this coal cube sits in the storage pool below the market.
|
|
26
28
|
// Clicking emits buyResource with fromStorage:true (flat $8 buy).
|