Commit 85987855 authored by Roque's avatar Roque

erp5_drone_simulator: check drone altitude

parent 4ce4bb17
......@@ -581,6 +581,14 @@ var GameManager = /** @class */ (function () {
this._flight_log[drone._id].push(error.stack);
};
GameManager.prototype._checkDroneRules = function (drone) {
//TODO move this to API methods
if (drone.getCurrentPosition()) {
return drone.getCurrentPosition().z > 1;
}
return false;
};
GameManager.prototype._update = function (delta_time) {
var _this = this,
queue = new RSVP.Queue(),
......@@ -600,7 +608,11 @@ var GameManager = /** @class */ (function () {
this._droneList.forEach(function (drone) {
queue.push(function () {
drone._tick += 1;
return drone.internal_update(delta_time);
if (_this._checkDroneRules(drone)) {
return drone.internal_update(delta_time);
}
//TODO error must be defined by the api?
drone._internal_crash('Drone touched the floor');
});
});
......
......@@ -244,7 +244,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1004.25222.46703.18858</string> </value>
<value> <string>1004.26851.10414.26504</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>1668701293.79</float>
<float>1668798987.44</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