Commit 81707283 authored by Romain Courteaud's avatar Romain Courteaud

erp5_drone_simulator: jslint

parent fecbc426
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
/*jslint nomen: true, indent: 2, maxlen: 80, white: true */ /*jslint nomen: true, indent: 2, maxlen: 80, white: true */
/************************** DRONE A AILE FIXE API ****************************/ /************************** DRONE A AILE FIXE API ****************************/
var DroneAaileFixeAPI = /** @class */ (function () {
"use strict";
var TAKEOFF_RADIUS = 60, // var TAKEOFF_RADIUS = 60,
LOITER_LIMIT = 30, var LOITER_LIMIT = 30,
LOITER_RADIUS_FACTOR = 0.60, LOITER_RADIUS_FACTOR = 0.60,
LOITER_SPEED_FACTOR = 1.5; LOITER_SPEED_FACTOR = 1.5;
var DroneAaileFixeAPI = /** @class */ (function () {
"use strict";
//** CONSTRUCTOR //** CONSTRUCTOR
function DroneAaileFixeAPI(gameManager, drone_info, flight_parameters, id) { function DroneAaileFixeAPI(gameManager, drone_info, flight_parameters, id) {
this._gameManager = gameManager; this._gameManager = gameManager;
...@@ -29,6 +29,7 @@ var DroneAaileFixeAPI = /** @class */ (function () { ...@@ -29,6 +29,7 @@ var DroneAaileFixeAPI = /** @class */ (function () {
** Function called on start phase of the drone, just before onStart AI script ** Function called on start phase of the drone, just before onStart AI script
*/ */
DroneAaileFixeAPI.prototype.internal_start = function () { DroneAaileFixeAPI.prototype.internal_start = function () {
return;
}; };
/* /*
** Function called on every drone update, right after onUpdate AI script ** Function called on every drone update, right after onUpdate AI script
......
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1004.25224.30173.1314</string> </value> <value> <string>1004.32328.6567.2218</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1668701317.95</float> <float>1669127569.3</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global BABYLON, RSVP, console, DroneAaileFixeAPI, DroneLogAPI*/ /*global BABYLON, RSVP, console, DroneAaileFixeAPI, DroneLogAPI, document*/
/*jslint nomen: true, indent: 2, maxlen: 80, white: true, evil: false */ /*jslint nomen: true, indent: 2, maxlen: 80, white: true, todo: true,
unparam: true */
/******************************* DRONE MANAGER ********************************/
var GAMEPARAMETERS = {}; var GAMEPARAMETERS = {};
/******************************* DRONE MANAGER ********************************/
var DroneManager = /** @class */ (function () { var DroneManager = /** @class */ (function () {
"use strict"; "use strict";
//** CONSTRUCTOR //** CONSTRUCTOR
function DroneManager(scene, id, API) { function DroneManager(scene, id, API) {
this._mesh = null; this._mesh = null;
...@@ -224,8 +224,7 @@ var DroneManager = /** @class */ (function () { ...@@ -224,8 +224,7 @@ var DroneManager = /** @class */ (function () {
if (!this._canCommunicate) { if (!this._canCommunicate) {
return; return;
} }
if (id >= 0) { } if (id < 0) {
else {
id = -1; id = -1;
} }
if (_this.infosMesh) { if (_this.infosMesh) {
...@@ -322,20 +321,21 @@ var DroneManager = /** @class */ (function () { ...@@ -322,20 +321,21 @@ var DroneManager = /** @class */ (function () {
/** /**
* Function called on game start * Function called on game start
*/ */
DroneManager.prototype.onStart = function () { }; DroneManager.prototype.onStart = function () { return;};
/** /**
* Function called on game update * Function called on game update
* @param timestamp The tic value
*/ */
DroneManager.prototype.onUpdate = function (timestamp) { }; DroneManager.prototype.onUpdate = function () { return;};
/** /**
* Function called when drone crashes * Function called when drone crashes
*/ */
DroneManager.prototype.onTouched = function () { }; DroneManager.prototype.onTouched = function () { return;};
/** /**
* Function called when a message is received * Function called when a message is received
* @param msg The message * @param msg The message
*/ */
DroneManager.prototype.onGetMsg = function (msg) { }; DroneManager.prototype.onGetMsg = function () { return;};
return DroneManager; return DroneManager;
}()); }());
...@@ -592,7 +592,7 @@ var GameManager = /** @class */ (function () { ...@@ -592,7 +592,7 @@ var GameManager = /** @class */ (function () {
GameManager.prototype._update = function (delta_time) { GameManager.prototype._update = function (delta_time) {
var _this = this, var _this = this,
queue = new RSVP.Queue(), queue = new RSVP.Queue(),
i, drone_position; i;
this._updateTimeAndLog(delta_time); this._updateTimeAndLog(delta_time);
// trigger all deferred calls if it is time // trigger all deferred calls if it is time
...@@ -652,7 +652,7 @@ var GameManager = /** @class */ (function () { ...@@ -652,7 +652,7 @@ var GameManager = /** @class */ (function () {
} }
if (GAMEPARAMETERS.draw_flight_path) { if (GAMEPARAMETERS.draw_flight_path) {
//draw drone position every some seconds //draw drone position every some seconds
if (seconds - this._last_position_drawn[drone] > 3) { if (seconds - this._last_position_drawn[drone] > 0.2) {
this._last_position_drawn[drone] = seconds; this._last_position_drawn[drone] = seconds;
position_obj = BABYLON.MeshBuilder.CreateBox("obs_" + seconds, position_obj = BABYLON.MeshBuilder.CreateBox("obs_" + seconds,
{ size: 1 }, { size: 1 },
...@@ -670,7 +670,7 @@ var GameManager = /** @class */ (function () { ...@@ -670,7 +670,7 @@ var GameManager = /** @class */ (function () {
material.diffuseColor = color; material.diffuseColor = color;
position_obj.material = material; position_obj.material = material;
if (GAMEPARAMETERS.temp_flight_path) { if (GAMEPARAMETERS.temp_flight_path) {
if (this._trace_objects_per_drone[drone].length === 20) { if (this._trace_objects_per_drone[drone].length === 10) {
this._trace_objects_per_drone[drone][0].dispose(); this._trace_objects_per_drone[drone][0].dispose();
this._trace_objects_per_drone[drone].splice(0, 1); this._trace_objects_per_drone[drone].splice(0, 1);
} }
...@@ -914,12 +914,14 @@ var GameManager = /** @class */ (function () { ...@@ -914,12 +914,14 @@ var GameManager = /** @class */ (function () {
code_eval += code + "}; droneMe(Date, drone, Math, {});"; code_eval += code + "}; droneMe(Date, drone, Math, {});";
base += "};ctx._droneList.push(drone)"; base += "};ctx._droneList.push(drone)";
code_eval += "ctx._droneList.push(drone)"; code_eval += "ctx._droneList.push(drone)";
/*jslint evil: true*/
try { try {
eval(code_eval); eval(code_eval);
} }
catch (error) { catch (error) {
eval(base); eval(base);
} }
/*jslint evil: false*/
} }
function randomSpherePoint(x0, y0, z0, rx0, ry0, rz0) { function randomSpherePoint(x0, y0, z0, rx0, ry0, rz0) {
var u = Math.random(), v = Math.random(), var u = Math.random(), v = Math.random(),
......
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1004.26851.10414.26504</string> </value> <value> <string>1004.32347.13889.60603</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1668798987.44</float> <float>1669128788.73</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment