diff --git a/public/js/map/overlays/PlayerOverlay.js b/public/js/map/overlays/PlayerOverlay.js index 4136734..eaf9c00 100644 --- a/public/js/map/overlays/PlayerOverlay.js +++ b/public/js/map/overlays/PlayerOverlay.js @@ -27,7 +27,7 @@ export default L.LayerGroup.extend({ }, createPopup: function(player){ - var html = "" + player.name + ""; + let html = "" + player.name + ""; html += "
"; for (let i=0; i + ${player.name} + ${player.name} + `, + className: '', // don't use leaflet default of a white block + iconSize: [48, 48], + iconAnchor: [24, 24], + popupAnchor: [0, -24] + }); + }, + isPlayerInCurrentLayer: function(player){ - var mapLayer = layerMgr.getCurrentLayer(); + const mapLayer = layerMgr.getCurrentLayer(); return ( player.pos.y >= (mapLayer.from*16) && @@ -73,7 +95,7 @@ export default L.LayerGroup.extend({ onMinetestUpdate: function(/*info*/){ players.forEach(player => { - var isInLayer = this.isPlayerInCurrentLayer(player); + const isInLayer = this.isPlayerInCurrentLayer(player); if (!isInLayer){ if (this.currentObjects[player.name]){ @@ -88,13 +110,14 @@ export default L.LayerGroup.extend({ if (this.currentObjects[player.name]){ //marker exists - let marker = this.currentObjects[player.name]; + const marker = this.currentObjects[player.name]; marker.setLatLng([player.pos.z, player.pos.x]); + marker.setIcon(this.getIcon(player)); marker.setPopupContent(this.createPopup(player)); } else { //marker does not exist - let marker = this.createMarker(player); + const marker = this.createMarker(player); marker.addTo(this); this.currentObjects[player.name] = marker; @@ -102,7 +125,7 @@ export default L.LayerGroup.extend({ }); Object.keys(this.currentObjects).forEach(existingName => { - var playerIsActive = players.find(function(p){ + const playerIsActive = players.find(function(p){ return p.name == existingName; }); @@ -124,7 +147,7 @@ export default L.LayerGroup.extend({ return; } - var marker = this.createMarker(player); + const marker = this.createMarker(player); marker.addTo(this); this.currentObjects[player.name] = marker; }); diff --git a/public/pics/sam_dir.png b/public/pics/sam_dir.png new file mode 100644 index 0000000..877eae2 Binary files /dev/null and b/public/pics/sam_dir.png differ diff --git a/public/pics/sam_dir_move.png b/public/pics/sam_dir_move.png new file mode 100644 index 0000000..adc355e Binary files /dev/null and b/public/pics/sam_dir_move.png differ diff --git a/web/minetest.go b/web/minetest.go index 5b9c556..32d91f8 100644 --- a/web/minetest.go +++ b/web/minetest.go @@ -50,6 +50,7 @@ type Player struct { Moderator bool `json:"moderator"` RTT float64 `json:"rtt"` ProtocolVersion float64 `json:"protocol_version"` + Yaw float64 `json:"yaw"` //TODO: stamina, skin, etc }