Skip to content

Commit 7d665cd

Browse files
committed
fix: hiding blips also hiding players
Before, when hiding all blips the player blips would also be hidden. They should now be shown when other blips are hidden. When a player enters a vehicle, their blip changes to the appropriate icon and the vehicle name is displayed.
1 parent a318344 commit 7d665cd

File tree

5 files changed

+53
-16
lines changed

5 files changed

+53
-16
lines changed

js/map.min.js

+8-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/socket.min.js

+12-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/src/controls.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var _invervalId; //
1+
var _invervalId;
22
var _isLive = false;
33
var _blips = [];
44
var _blipCount = 0;

js/src/map.js

+10
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,16 @@ function clearAllMarkers() {
255255
}
256256
}
257257
_MAP_markerStore.length = 0;
258+
// Re-do player markers
259+
for(var id in localCache){
260+
var plr = localCache[id].player;
261+
//console.log("redoing marker for ");
262+
//console.log(plr);
263+
var obj = new MarkerObject(plr.name, new Coordinates(plr.x, plr.y, plr.z), MarkerTypes.normal, "A player", "", "");
264+
createMarker(false, false, obj, plr.name);
265+
266+
localCache[plr.id].marker = _MAP_markerStore.length - 1;
267+
}
258268
}
259269

260270
function clearMarker(id) {

js/src/socket.js

+22-1
Original file line numberDiff line numberDiff line change
@@ -173,19 +173,40 @@ function doPlayerUpdate(players){
173173
}else{
174174
console.log("updated local cache for " + plr.name);
175175
//console.log(JSON.stringify(plr));
176+
if (localCache[plr.id].marker != null && plr.vehicle && plr.vehicle != localCache[plr.id].player.vehicle){
177+
// They've changed vehicle
178+
var t = MarkerTypes[plr.vehicle];
179+
_MAP_markerStore[localCache[plr.id].marker].setIcon({
180+
url: _MAP_iconURL + t.icon,
181+
size: t.size,
182+
origin: t.origin,
183+
anchor: t.anchor,
184+
scaledSize: t.scaledSize
185+
});
186+
}
187+
176188
localCache[plr.id].player = plr;
177189

178190
if (localCache[plr.id].marker != null || localCache[plr.id].marker != undefined){
179191
//update postion
180192
_MAP_markerStore[localCache[plr.id].marker].setPosition( convertToMapGMAP(plr.x, plr.y) );
181193

182194
//update popup
183-
var html = '<div class="row info-body-row"><strong>Position:</strong>&nbsp;X {' + plr.x.toFixed(4) + "} Y {" + plr.y.toFixed(4) + "} Z {" + plr.z.toFixed(4) + "}</div>";
195+
var html = '<div class="row info-body-row"><strong>Position:</strong>&nbsp;X {' + plr.x.toFixed(4) + "} Y {" + plr.y.toFixed(4) + "} Z {" + plr.z.toFixed(4) + "}</div>"
196+
197+
if (plr.vehicle && plr.vehicle != "normal")
198+
html += '<div class="row info-body-row"><strong>Vehicle:</strong>&nbsp;' + plr.vehicle_name + '</div>';
199+
184200
var infoContent = '<div class="info-window"><div class="info-header-box"><div class="info-icon"></div><div class="info-header">' + plr.name + '</div></div><div class="clear"></div><div id=info-body>' + html + "</div></div>";
185201
var infoBox = new google.maps.InfoWindow({
186202
content: infoContent
187203
});
188204
_MAP_markerStore[localCache[plr.id].marker].popup.setContent(infoContent);
205+
}else{
206+
var obj = new MarkerObject(plr.name, new Coordinates(plr.x, plr.y, plr.z), MarkerTypes.normal, "A player", "", "");
207+
createMarker(false, false, obj, plr.name);
208+
209+
localCache[plr.id].marker = _MAP_markerStore.length - 1;
189210
}
190211
}
191212

0 commit comments

Comments
 (0)