'use strict'; var PlayerIcon = L.icon({ iconUrl: 'pics/sam.png', iconSize: [16, 32], iconAnchor: [8, 16], popupAnchor: [0, -16] }); var PlayerOverlay = L.LayerGroup.extend({ initialize: function(wsChannel, layerMgr) { L.LayerGroup.prototype.initialize.call(this); this.layerMgr = layerMgr; this.wsChannel = wsChannel; this.currentObjects = {}; // name => marker this.players = []; this.reDraw = this.reDraw.bind(this); this.onMinetestUpdate = this.onMinetestUpdate.bind(this); //update players all the time this.wsChannel.addListener("minetest-info", function(info){ this.players = info.players || []; }.bind(this)); }, createMarker: function(player){ var marker = L.marker([player.pos.z, player.pos.x], {icon: PlayerIcon}); var html = "" + player.name + ""; html += "
"; for (var i=0; i