Ticket #4068: map.js2016-6-21.patch
File map.js2016-6-21.patch, 1.3 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/maps/random/rmgen/map.js
279 279 return sumHeight / count; 280 280 }; 281 281 282 Map.prototype.get MapData = function()282 Map.prototype.getFullEntityList = function(rotateForMapExport = false) 283 283 { 284 var data = {};285 286 284 // Build entity array 287 285 var entities = []; 288 286 … … 297 295 for (var i = 0; i < this.objects.length; ++i) 298 296 { 299 297 // Change rotation from simple 2d to 3d befor giving to engine 300 this.objects[i].rotation.y = PI/2 - this.objects[i].rotation.y; 298 if (rotateForMapExport) 299 this.objects[i].rotation.y = PI/2 - this.objects[i].rotation.y; 301 300 entities.push(this.objects[i]); 302 301 } 303 data.entities = entities;304 302 305 log("Number of entities: "+entities.length); 303 return entities; 304 }; 305 306 Map.prototype.getMapData = function() 307 { 308 var data = {}; 306 309 310 data.entities = this.getFullEntityList(true); 311 312 log("Number of entities: "+ data.entities.length); 313 307 314 // Terrain 308 data.size = this.size; 315 var size = this.size; 316 data.size = size; 309 317 310 318 // Convert 2D heightmap array to flat array 311 319 // Flat because it's easier to handle by the engine