Skip to content

Commit 891a0cc

Browse files
Merge pull request #1420 from solaris-games/dev
Update 251.3 fixes
2 parents fece4aa + ca4711e commit 891a0cc

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

client/src/eventBusEventNames/mapCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default class MapCommandEventBusEventNames {
1515
public static readonly MapCommandPanToLocation: MapCommandEventBusEventName<{ location: Location }> = toEventName('panToLocation');
1616
public static readonly MapCommandPanToPlayer: MapCommandEventBusEventName<{ player: Player }> = toEventName('panToPlayer');
1717
public static readonly MapCommandClearHighlightedLocations: MapCommandEventBusEventName<{}> = toEventName('clearHighlightedLocations');
18-
public static readonly MapCommandHighlightLocation: MapCommandEventBusEventName<{ object: MapObject<string>, opacity: number }> = toEventName('highlightLocation');
18+
public static readonly MapCommandHighlightLocation: MapCommandEventBusEventName<{ location: Location }> = toEventName('highlightLocation');
1919
public static readonly MapCommandClickStar: MapCommandEventBusEventName<{ starId: string }> = toEventName('clickStar');
2020
public static readonly MapCommandClickCarrier: MapCommandEventBusEventName<{ carrierId: string }> = toEventName('clickCarrier');
2121
public static readonly MapCommandRemoveLastRulerPoint: MapCommandEventBusEventName<{}> = toEventName('removeLastRulerPoint');

client/src/game/map.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export class Map {
252252
const panToUser = () => this.panToUser(this.game!);
253253
const panToPlayer = ({ player }: { player: Player }) => this.panToPlayer(this.game!, player);
254254
const clearHighlightedLocations = () => this.clearCarrierHighlights();
255-
const highlightLocation = ({ object, opacity }: { object: MapObject<string>, opacity: number }) => this.highlightLocation(object, opacity);
255+
const highlightLocation = ({ location }: { location: Location }) => this.highlightLocation(location);
256256
const clickStar = ({ starId }: { starId: string }) => this.clickStar(starId);
257257
const clickCarrier = ({ carrierId }: { carrierId: string }) => this.clickCarrier(carrierId);
258258
const removeLastRulerWaypoint = () => this.removeLastRulerPoint();
@@ -1000,7 +1000,7 @@ export class Map {
10001000
if (this.background) this.background.refreshZoom(zoomPercent)
10011001
}
10021002

1003-
highlightLocation (location, opacity = 1) {
1003+
highlightLocation (location: Location, opacity = 1) {
10041004
let graphics = new PIXI.Graphics()
10051005
let radius = 12
10061006

client/src/views/game/components/carrier/CarrierWaypoints.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ import CarrierApiService from '../../../../services/api/carrier'
8585
import AudioService from '../../../../game/audio'
8686
import OrbitalMechanicsETAWarningVue from '../shared/OrbitalMechanicsETAWarning.vue'
8787
import {eventBusInjectionKey} from "../../../../eventBus";
88+
import MapEventBusEventNames from "@/eventBusEventNames/map";
8889
8990
export default {
9091
components: {
@@ -127,10 +128,10 @@ export default {
127128
GameContainer.setMode('waypoints', this.carrier)
128129
129130
this.waypointCreatedHandler = this.onWaypointCreated.bind(this);
130-
this.eventBus.on('onWaypointCreated', this.waypointCreatedHandler);
131+
this.eventBus.on(MapEventBusEventNames.MapOnWaypointCreated, this.waypointCreatedHandler);
131132
132133
this.waypointOutOfRangeHandler = this.onWaypointOutOfRange.bind(this);
133-
this.eventBus.on('onWaypointOutOfRange', this.waypointOutOfRangeHandler);
134+
this.eventBus.on(MapEventBusEventNames.MapOnWaypointOutOfRange, this.waypointOutOfRangeHandler);
134135
135136
this.oldWaypoints = this.carrier.waypoints.slice(0);
136137
this.oldWaypointsLooped = this.carrier.waypointsLooped;
@@ -200,17 +201,17 @@ export default {
200201
this.recalculateTotalEta()
201202
this.recalculateLooped()
202203
},
203-
onWaypointCreated (e) {
204+
onWaypointCreated ({ waypoint }) {
204205
// Overwrite the default action and default action ships
205-
e.action = this.$store.state.settings.carrier.defaultAction
206-
e.actionShips = this.$store.state.settings.carrier.defaultAmount
206+
waypoint.action = this.$store.state.settings.carrier.defaultAction
207+
waypoint.actionShips = this.$store.state.settings.carrier.defaultAmount
207208
208209
AudioService.type()
209210
210211
this.recalculateTotalEta()
211212
this.recalculateLooped()
212213
},
213-
onWaypointOutOfRange (e) {
214+
onWaypointOutOfRange ({ waypoint }) {
214215
this.$toast.error(`This waypoint is out of hyperspace range.`)
215216
},
216217
recalculateTotalEta () {

server/services/trade.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,14 @@ export default class TradeService extends EventEmitter {
457457
return tradeTechs;
458458
}
459459

460+
_canPlayersTradeInRange(game: Game, fromPlayer: Player, toPlayer: Player) {
461+
if (game.settings.player.tradeScanning === 'scanned') {
462+
return this.playerService.isInScanningRangeOfPlayer(game, fromPlayer, toPlayer);
463+
}
464+
465+
return true;
466+
}
467+
460468
_tradeScanningCheck(game: Game, fromPlayer: Player, toPlayer: Player) {
461469
if (game.settings.player.tradeScanning === 'scanned') {
462470
let isInRange = this.playerService.isInScanningRangeOfPlayer(game, fromPlayer, toPlayer);
@@ -525,6 +533,10 @@ export default class TradeService extends EventEmitter {
525533
return;
526534
}
527535

536+
if (!this._canPlayersTradeInRange(game, fromPlayer, toPlayer)) {
537+
return;
538+
}
539+
528540
let tradeChance = TRADE_CHANCE_BASE + (TRADE_CHANCE_STEP * reputation.score);
529541
let tradeRoll = this.randomService.getRandomNumber(99);
530542
let canPerformTrade = tradeRoll <= tradeChance || true;

0 commit comments

Comments
 (0)