Skip to content

Commit

Permalink
Merge pull request #1186 from Metritutus/fixes006
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
SpacialCircumstances authored Oct 6, 2024
2 parents 602355a + 81a07f7 commit 05be783
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
7 changes: 5 additions & 2 deletions client/src/views/game/components/carrier/WaypointRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ export default {
}
},
computed: {
userPlayer() {
return GameHelper.getUserPlayer(this.$store.state.game)
},
userPlayerOwnsCarrier: function () {
return GameHelper.getUserPlayer(this.$store.state.game) &&
GameHelper.getCarrierOwningPlayer(this.$store.state.game, this.carrier)._id === GameHelper.getUserPlayer(this.$store.state.game)._id
return this.userPlayer &&
GameHelper.getCarrierOwningPlayer(this.$store.state.game, this.carrier)._id === this.userPlayer._id
},
canEditWaypoints: function () {
return !GameHelper.isGameFinished(this.$store.state.game) && this.userPlayerOwnsCarrier && !this.carrier.isGift
Expand Down
7 changes: 5 additions & 2 deletions client/src/views/game/components/carrier/WaypointTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ export default {
}
},
computed: {
userPlayer() {
return GameHelper.getUserPlayer(this.$store.state.game)
},
userPlayerOwnsCarrier: function () {
return GameHelper.getUserPlayer(this.$store.state.game) &&
GameHelper.getCarrierOwningPlayer(this.$store.state.game, this.carrier)._id === GameHelper.getUserPlayer(this.$store.state.game)._id
return this.userPlayer &&
GameHelper.getCarrierOwningPlayer(this.$store.state.game, this.carrier)._id === this.userPlayer._id
},
canEditWaypoints: function () {
return !GameHelper.isGameFinished(this.$store.state.game) && this.userPlayerOwnsCarrier && !this.carrier.isGift
Expand Down
12 changes: 6 additions & 6 deletions client/src/views/game/components/galaxy/StarRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ export default {
}
},
computed: {
userPlayer() {
return gameHelper.getUserPlayer(this.$store.state.game);
},
hasEconomyCost () {
return this.star.upgradeCosts && this.star.upgradeCosts.economy
},
Expand All @@ -158,16 +161,13 @@ export default {
return this.$store.state.game.settings.player.developmentCost.science !== 'none'
},
canUpgradeEconomy () {
return this.allowUpgrades && this.star.upgradeCosts && this.star.upgradeCosts.economy && !this.isUpgradingEconomy && gameHelper.getUserPlayer(this.$store.state.game).credits >= this.star.upgradeCosts.economy
return this.allowUpgrades && this.star.upgradeCosts && this.star.upgradeCosts.economy && !this.isUpgradingEconomy && this.userPlayer?.credits >= this.star.upgradeCosts.economy
},
canUpgradeIndustry () {
return this.allowUpgrades && this.star.upgradeCosts && this.star.upgradeCosts.industry && !this.isUpgradingIndustry && gameHelper.getUserPlayer(this.$store.state.game).credits >= this.star.upgradeCosts.industry
return this.allowUpgrades && this.star.upgradeCosts && this.star.upgradeCosts.industry && !this.isUpgradingIndustry && this.userPlayer?.credits >= this.star.upgradeCosts.industry
},
canUpgradeScience () {
return this.allowUpgrades && this.star.upgradeCosts && this.star.upgradeCosts.science && !this.isUpgradingScience && gameHelper.getUserPlayer(this.$store.state.game).credits >= this.star.upgradeCosts.science
},
availableCredits () {
return gameHelper.getUserPlayer(this.$store.state.game).credits
return this.allowUpgrades && this.star.upgradeCosts && this.star.upgradeCosts.science && !this.isUpgradingScience && this.userPlayer?.credits >= this.star.upgradeCosts.science
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions client/src/views/game/components/player/StatisticRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ export default {
isUserPlayer () {
return this.userPlayer && this.userPlayer._id === this.player._id
},
getUserPlayer () {
return GameHelper.getUserPlayer(this.$store.state.game)
},
userIsInGame () {
return this.userPlayer != null
},
Expand Down Expand Up @@ -91,7 +88,7 @@ export default {
return GameHelper.isDarkModeExtra(this.$store.state.game);
},
hasPerspective() {
if (GameHelper.getUserPlayer(this.$store.state.game)) {
if (this.userPlayer) {
return false
}
Expand Down

0 comments on commit 05be783

Please sign in to comment.