board-game-engine-react 0.0.17 → 0.0.18
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.
|
@@ -5651,6 +5651,11 @@ function Space({
|
|
|
5651
5651
|
}))), !entities.length && space.attributes.name));
|
|
5652
5652
|
}
|
|
5653
5653
|
|
|
5654
|
+
function sameEntity(a, b) {
|
|
5655
|
+
const idA = a.entityId ?? a.attributes?.entityId;
|
|
5656
|
+
const idB = b.entityId ?? b.attributes?.entityId;
|
|
5657
|
+
return idA != null && idB != null && idA === idB;
|
|
5658
|
+
}
|
|
5654
5659
|
function Entity({
|
|
5655
5660
|
entity
|
|
5656
5661
|
}) {
|
|
@@ -5658,7 +5663,7 @@ function Entity({
|
|
|
5658
5663
|
clickTarget,
|
|
5659
5664
|
allClickable
|
|
5660
5665
|
} = useGame();
|
|
5661
|
-
const isClickable = allClickable.
|
|
5666
|
+
const isClickable = [...allClickable].some(c => sameEntity(c, entity));
|
|
5662
5667
|
const attributes = entity.attributes;
|
|
5663
5668
|
const entityType = attributes.entityType ?? attributes.type;
|
|
5664
5669
|
switch (entityType) {
|
|
@@ -5680,7 +5685,7 @@ function Entity({
|
|
|
5680
5685
|
clickTarget(entity);
|
|
5681
5686
|
}
|
|
5682
5687
|
},
|
|
5683
|
-
className: ['entity', attributes.player && `player-${attributes.player}`,
|
|
5688
|
+
className: ['entity', attributes.player && `player-${attributes.player}`, isClickable && 'entity--clickable'].filter(Boolean).join(' ')
|
|
5684
5689
|
}, entity.rule.displayProperties?.map((property, i) => /*#__PURE__*/React.createElement("div", {
|
|
5685
5690
|
key: i
|
|
5686
5691
|
}, property, ": ", entity.attributes[property]?.toString())));
|
|
@@ -5747,6 +5752,7 @@ function Game({
|
|
|
5747
5752
|
loading,
|
|
5748
5753
|
isSpectator
|
|
5749
5754
|
}) {
|
|
5755
|
+
console.log('gameConnection?.getState?.()', gameConnection?.getState?.());
|
|
5750
5756
|
const G = gameConnection?.getState?.().state.G;
|
|
5751
5757
|
return G ? /*#__PURE__*/React.createElement(GameProvider, {
|
|
5752
5758
|
gameConnection: gameConnection,
|