Optionally add player health bars to map markers.
This commit is contained in:
parent
08014fb9a5
commit
818182bf2a
5 changed files with 26 additions and 1 deletions
|
|
@ -22,6 +22,12 @@ componentconstructors['playermarkers'] = function(dynmap, configuration) {
|
|||
playerImage.remove();
|
||||
});
|
||||
}
|
||||
if (configuration.showplayerhealth) {
|
||||
player.healthBar = $('<div/>')
|
||||
.addClass('playerHealth')
|
||||
.css('width', (player.health/2*9) + 'px')
|
||||
.appendTo(div);
|
||||
}
|
||||
});
|
||||
});
|
||||
$(dynmap).bind('playerremoved', function(event, player) {
|
||||
|
|
@ -33,5 +39,8 @@ componentconstructors['playermarkers'] = function(dynmap, configuration) {
|
|||
var markerPosition = dynmap.map.getProjection().fromWorldToLatLng(player.location.x, player.location.y, player.location.z);
|
||||
player.marker.toggle(dynmap.world === player.location.world);
|
||||
player.marker.setPosition(markerPosition);
|
||||
// Update health
|
||||
if (configuration.showplayerhealth)
|
||||
player.healthBar.css('width', (player.health/2*9) + 'px');
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue