Commit 81707283 authored by Romain Courteaud's avatar Romain Courteaud

erp5_drone_simulator: jslint

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