Only fetch Pl3xmap players when player markers are enabled
This commit is contained in:
parent
d1d31b64bc
commit
c71e8289dd
@ -37,7 +37,7 @@ export default class Pl3xmapMapProvider extends MapProvider {
|
||||
private updateTimeout: null | ReturnType<typeof setTimeout> = null;
|
||||
private updateTimestamp: Date = new Date();
|
||||
private updateInterval: number = 3000;
|
||||
private worldSettings: Map<string, {
|
||||
private worldComponents: Map<string, {
|
||||
components: LiveAtlasPartialComponentConfig,
|
||||
}> = new Map();
|
||||
|
||||
@ -95,9 +95,11 @@ export default class Pl3xmapMapProvider extends MapProvider {
|
||||
showHealth: !!worldResponse.player_tracker?.nameplates?.show_health,
|
||||
smallFaces: true,
|
||||
}
|
||||
} else {
|
||||
worldConfig.components.playerMarkers = undefined;
|
||||
}
|
||||
|
||||
this.worldSettings.set(world.name, worldConfig);
|
||||
this.worldComponents.set(world.name, worldConfig);
|
||||
|
||||
if(!worldResponse) {
|
||||
console.warn(`World ${world.name} has no matching world config. Ignoring.`);
|
||||
@ -389,7 +391,7 @@ export default class Pl3xmapMapProvider extends MapProvider {
|
||||
|
||||
async populateWorld(world: LiveAtlasWorldDefinition) {
|
||||
const markerSets = await this.getMarkerSets(world),
|
||||
worldConfig = this.worldSettings.get(world.name);
|
||||
worldConfig = this.worldComponents.get(world.name);
|
||||
|
||||
this.store.commit(MutationTypes.SET_MARKER_SETS, markerSets);
|
||||
this.store.commit(MutationTypes.SET_COMPONENTS, worldConfig!.components);
|
||||
@ -456,11 +458,13 @@ export default class Pl3xmapMapProvider extends MapProvider {
|
||||
|
||||
private async update() {
|
||||
try {
|
||||
if(this.store.state.components.playerMarkers) {
|
||||
const players = await this.getPlayers();
|
||||
|
||||
this.updateTimestamp = new Date();
|
||||
|
||||
await this.store.dispatch(ActionTypes.SET_PLAYERS, players);
|
||||
}
|
||||
} finally {
|
||||
if(this.updatesEnabled) {
|
||||
if(this.updateTimeout) {
|
||||
|
Loading…
Reference in New Issue
Block a user