File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,6 +47,13 @@ const vehicleIcon = L.icon({
4747 popupAnchor: [0 , - 20 ],
4848});
4949
50+ const droneIcon = L .icon ({
51+ iconUrl: " img/drone-icon.png" ,
52+ iconSize: [50 , 50 ],
53+ iconAnchor: [12 , 24 ],
54+ popupAnchor: [0 , - 20 ],
55+ });
56+
5057const traderIcon = L .icon ({
5158 iconUrl: " img/shopping-cart.png" ,
5259 iconSize: [25 , 25 ],
@@ -401,6 +408,39 @@ export default {
401408 vehiclesLayer .addLayer (marker);
402409 }
403410 },
411+ getDrones () {
412+ return fetch (` /api/getdrones` )
413+ .then (function (response ) {
414+ return response .json ();
415+ })
416+ .then (function (data ) {
417+ return data;
418+ });
419+ },
420+ async drawDrones () {
421+ if (! this .hasPermission (" ClaimCreator.getdrones" )) {
422+ return ;
423+ }
424+
425+ const currentDrones = await this .getDrones ();
426+ let dronesLayer = this .layers [" Drones" ];
427+ if (! dronesLayer) {
428+ this .layers [" Drones" ] = new L.LayerGroup ();
429+ dronesLayer = this .layers [" Drones" ];
430+ }
431+
432+ dronesLayer .clearLayers ();
433+ for (const drone of currentDrones .Drones ) {
434+ const marker = L .marker ([drone .posX , drone .posZ ], {
435+ icon: droneIcon,
436+ }).bindPopup (
437+ ` Drone: ${ drone .name } <br> Position: ${ drone .posX } ${
438+ drone .posY
439+ } ${ drone .posZ } `
440+ );
441+ dronesLayer .addLayer (marker);
442+ }
443+ },
404444 getHomes () {
405445 return fetch (` /api/getplayerhomes` )
406446 .then (function (response ) {
You can’t perform that action at this time.
0 commit comments