Respect pl3xmap show-armor setting
This commit is contained in:
parent
c71e8289dd
commit
bfc0a381a8
@ -52,6 +52,7 @@ export default defineComponent({
|
|||||||
showSkinFace: componentSettings.value!.showSkinFaces,
|
showSkinFace: componentSettings.value!.showSkinFaces,
|
||||||
showBody: componentSettings.value!.showBodies,
|
showBody: componentSettings.value!.showBodies,
|
||||||
showHealth: componentSettings.value!.showHealth,
|
showHealth: componentSettings.value!.showHealth,
|
||||||
|
showArmor: componentSettings.value!.showArmor,
|
||||||
pane: 'players',
|
pane: 'players',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
1
src/index.d.ts
vendored
1
src/index.d.ts
vendored
@ -323,6 +323,7 @@ interface LiveAtlasPlayerMarkerConfig {
|
|||||||
showBodies: boolean;
|
showBodies: boolean;
|
||||||
showSkinFaces: boolean;
|
showSkinFaces: boolean;
|
||||||
showHealth: boolean;
|
showHealth: boolean;
|
||||||
|
showArmor: boolean;
|
||||||
smallFaces: boolean;
|
smallFaces: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ export interface PlayerIconOptions extends BaseIconOptions {
|
|||||||
showSkinFace: boolean,
|
showSkinFace: boolean,
|
||||||
showBody: boolean,
|
showBody: boolean,
|
||||||
showHealth: boolean,
|
showHealth: boolean,
|
||||||
|
showArmor: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PlayerIcon extends Layer implements Icon<PlayerIconOptions> {
|
export class PlayerIcon extends Layer implements Icon<PlayerIconOptions> {
|
||||||
@ -120,24 +121,25 @@ export class PlayerIcon extends Layer implements Icon<PlayerIconOptions> {
|
|||||||
if (this.options.showHealth) {
|
if (this.options.showHealth) {
|
||||||
this._playerHealth = document.createElement('div');
|
this._playerHealth = document.createElement('div');
|
||||||
this._playerHealth.className = 'player__health';
|
this._playerHealth.className = 'player__health';
|
||||||
|
this._playerHealth.hidden = true;
|
||||||
this._playerArmor = document.createElement('div');
|
|
||||||
this._playerArmor.className = 'player__armor';
|
|
||||||
|
|
||||||
this._playerHealthBar = document.createElement('div');
|
this._playerHealthBar = document.createElement('div');
|
||||||
this._playerHealthBar.className = 'player__health-bar';
|
this._playerHealthBar.className = 'player__health-bar';
|
||||||
|
|
||||||
|
this._playerHealth.appendChild(this._playerHealthBar);
|
||||||
|
this._playerInfo.appendChild(this._playerHealth);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.options.showArmor) {
|
||||||
|
this._playerArmor = document.createElement('div');
|
||||||
|
this._playerArmor.className = 'player__armor';
|
||||||
|
this._playerArmor.hidden = true;
|
||||||
|
|
||||||
this._playerArmorBar = document.createElement('div');
|
this._playerArmorBar = document.createElement('div');
|
||||||
this._playerArmorBar.className = 'player__armor-bar';
|
this._playerArmorBar.className = 'player__armor-bar';
|
||||||
|
|
||||||
this._playerHealth.appendChild(this._playerHealthBar);
|
|
||||||
this._playerArmor.appendChild(this._playerArmorBar);
|
this._playerArmor.appendChild(this._playerArmorBar);
|
||||||
this._playerInfo.appendChild(this._playerHealth);
|
|
||||||
this._playerInfo.appendChild(this._playerArmor);
|
this._playerInfo.appendChild(this._playerArmor);
|
||||||
|
|
||||||
this._playerHealth.hidden = this._playerArmor.hidden = true;
|
|
||||||
} else {
|
|
||||||
this._playerName.classList.add('playerNameNoHealth');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._container.style.marginTop = `-${offset}px`;
|
this._container.style.marginTop = `-${offset}px`;
|
||||||
@ -161,13 +163,19 @@ export class PlayerIcon extends Layer implements Icon<PlayerIconOptions> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(this.options.showHealth) {
|
if(this.options.showHealth) {
|
||||||
if (this._player.health !== undefined && this._player.armor !== undefined) {
|
if (this._player.health !== undefined) {
|
||||||
this._playerHealth!.hidden = false;
|
this._playerHealth!.hidden = false;
|
||||||
this._playerArmor!.hidden = false;
|
|
||||||
this._playerHealthBar!.style.width = Math.ceil(this._player.health * 2.5) + 'px';
|
this._playerHealthBar!.style.width = Math.ceil(this._player.health * 2.5) + 'px';
|
||||||
this._playerArmorBar!.style.width = Math.ceil(this._player.armor * 2.5) + 'px';
|
|
||||||
} else {
|
} else {
|
||||||
this._playerHealth!.hidden = true;
|
this._playerHealth!.hidden = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.options.showArmor) {
|
||||||
|
if(this._player.armor !== undefined) {
|
||||||
|
this._playerArmor!.hidden = false;
|
||||||
|
this._playerArmorBar!.style.width = Math.ceil(this._player.armor * 2.5) + 'px';
|
||||||
|
} else {
|
||||||
this._playerArmor!.hidden = true;
|
this._playerArmor!.hidden = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ export interface PlayerMarkerOptions extends MarkerOptions {
|
|||||||
showSkinFace: boolean,
|
showSkinFace: boolean,
|
||||||
showBody: boolean,
|
showBody: boolean,
|
||||||
showHealth: boolean,
|
showHealth: boolean,
|
||||||
|
showArmor: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PlayerMarker extends Marker {
|
export class PlayerMarker extends Marker {
|
||||||
@ -43,6 +44,7 @@ export class PlayerMarker extends Marker {
|
|||||||
showSkinFace: options.showSkinFace,
|
showSkinFace: options.showSkinFace,
|
||||||
showBody: options.showBody,
|
showBody: options.showBody,
|
||||||
showHealth: options.showHealth,
|
showHealth: options.showHealth,
|
||||||
|
showArmor: options.showArmor,
|
||||||
});
|
});
|
||||||
|
|
||||||
Util.setOptions(this, options);
|
Util.setOptions(this, options);
|
||||||
|
@ -93,6 +93,7 @@ export default class Pl3xmapMapProvider extends MapProvider {
|
|||||||
showBodies: false,
|
showBodies: false,
|
||||||
showSkinFaces: true,
|
showSkinFaces: true,
|
||||||
showHealth: !!worldResponse.player_tracker?.nameplates?.show_health,
|
showHealth: !!worldResponse.player_tracker?.nameplates?.show_health,
|
||||||
|
showArmor: !!worldResponse.player_tracker?.nameplates?.show_armor,
|
||||||
smallFaces: true,
|
smallFaces: true,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -153,6 +153,7 @@ export function buildComponents(response: any): LiveAtlasComponentConfig {
|
|||||||
showBodies: component.showplayerbody || false,
|
showBodies: component.showplayerbody || false,
|
||||||
showSkinFaces: component.showplayerfaces || false,
|
showSkinFaces: component.showplayerfaces || false,
|
||||||
showHealth: component.showplayerhealth || false,
|
showHealth: component.showplayerhealth || false,
|
||||||
|
showArmor: component.showplayerhealth || false,
|
||||||
smallFaces: component.smallplayerfaces || false,
|
smallFaces: component.smallplayerfaces || false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user