diff --git a/mapserver_mod/mapserver/init.lua b/mapserver_mod/mapserver/init.lua index 07863a8..c5da6aa 100644 --- a/mapserver_mod/mapserver/init.lua +++ b/mapserver_mod/mapserver/init.lua @@ -1,6 +1,6 @@ mapserver = { - enable_crafting = minetest.settings:get("mapserver.enable_crafting") + enable_crafting = minetest.settings:get("mapserver.enable_crafting"), bridge = {} } @@ -27,7 +27,7 @@ if http then print("[Mapserver] starting mapserver-bridge with endpoint: " .. mapserver_url) dofile(MP .. "/bridge/init.lua") - + mapserver.bridge_init(http, mapserver_url, mapserver_key) else diff --git a/server/static/js/overlays/MinecartOverlay.js b/server/static/js/overlays/MinecartOverlay.js index 3128c1d..1ef8ad0 100644 --- a/server/static/js/overlays/MinecartOverlay.js +++ b/server/static/js/overlays/MinecartOverlay.js @@ -10,7 +10,7 @@ var MinecartOverlay = L.LayerGroup.extend({ this.wsChannel = wsChannel; this.currentObjects = {}; // name => marker - this.trains = []; + this.minecarts = []; this.reDraw = this.reDraw.bind(this); this.onMinetestUpdate = this.onMinetestUpdate.bind(this); @@ -33,6 +33,7 @@ var MinecartOverlay = L.LayerGroup.extend({ var marker = L.marker([cart.pos.z, cart.pos.x], {icon: Icon}); var html = "Minecart
"; + html += "Id: " + cart.id + "
"; marker.bindPopup(html); @@ -53,37 +54,36 @@ var MinecartOverlay = L.LayerGroup.extend({ var isInLayer = self.isCartInCurrentLayer(cart); if (!isInLayer){ - if (self.currentObjects[train.id]){ - //train is displayed and not on the layer anymore + if (self.currentObjects[cart.id]){ + //cart is displayed and not on the layer anymore //Remove the marker and reference - self.currentObjects[train.id].remove(); - delete self.currentObjects[train.id]; + self.currentObjects[cart.id].remove(); + delete self.currentObjects[cart.id]; } return; } - if (self.currentObjects[train.id]){ + if (self.currentObjects[cart.id]){ //marker exists - self.currentObjects[train.id].setLatLng([train.pos.z, train.pos.x]); + self.currentObjects[cart.id].setLatLng([cart.pos.z, cart.pos.x]); //setPopupContent } else { //marker does not exist - var marker = self.createMarker(train); + var marker = self.createMarker(cart); marker.addTo(self); - self.currentObjects[train.id] = marker; + self.currentObjects[cart.id] = marker; } }); Object.keys(self.currentObjects).forEach(function(existingId){ - var trainIsActive = self.trains.find(function(t){ + var cartIsActive = self.minecarts.find(function(t){ return t.id == existingId; }); - if (!trainIsActive){ - //train + if (!cartIsActive){ self.currentObjects[existingId].remove(); delete self.currentObjects[existingId]; } @@ -97,15 +97,15 @@ var MinecartOverlay = L.LayerGroup.extend({ var mapLayer = this.layerMgr.getCurrentLayer(); - this.trains.forEach(function(train){ - if (!self.isTrainInCurrentLayer(train)){ + this.minecarts.forEach(function(cart){ + if (!self.isCartInCurrentLayer(cart)){ //not in current layer return; } - var marker = self.createMarker(train); + var marker = self.createMarker(cart); marker.addTo(self); - self.currentObjects[train.id] = marker; + self.currentObjects[cart.id] = marker; }); }, diff --git a/server/web/minetest.go b/server/web/minetest.go index 90877f2..b0dbed3 100644 --- a/server/web/minetest.go +++ b/server/web/minetest.go @@ -34,6 +34,7 @@ type Train struct { type Minecart struct { Pos GenericPos `json:"pos"` Speed GenericPos `json:"speed"` + Id float64 `json:"id"` } type Player struct {