Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paul Graydon
erp5
Commits
30405447
Commit
30405447
authored
Aug 18, 2023
by
Roque
Browse files
Options
Browse Files
Download
Plain Diff
Capture the flag app general fixes
See merge request
nexedi/erp5!1810
parents
26f6f688
0a6552e0
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
49 additions
and
34 deletions
+49
-34
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_fixedwingdrone_js.js
...m/web_page_module/drone_capture_flag_fixedwingdrone_js.js
+1
-1
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_fixedwingdrone_js.xml
.../web_page_module/drone_capture_flag_fixedwingdrone_js.xml
+2
-2
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.js
...mplateItem/web_page_module/drone_capture_flag_logic_js.js
+5
-4
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.xml
...plateItem/web_page_module/drone_capture_flag_logic_js.xml
+2
-2
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_API_page_html.html
...web_page_module/ojs_drone_capture_flag_API_page_html.html
+17
-4
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_API_page_html.xml
.../web_page_module/ojs_drone_capture_flag_API_page_html.xml
+2
-2
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.js
.../web_page_module/ojs_drone_capture_flag_script_page_js.js
+3
-2
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.xml
...web_page_module/ojs_drone_capture_flag_script_page_js.xml
+2
-2
bt5/erp5_officejs_drone_capture_flag_test/PathTemplateItem/web_page_module/test_capture_drone_flight_js.js
...plateItem/web_page_module/test_capture_drone_flight_js.js
+13
-13
bt5/erp5_officejs_drone_capture_flag_test/PathTemplateItem/web_page_module/test_capture_drone_flight_js.xml
...lateItem/web_page_module/test_capture_drone_flight_js.xml
+2
-2
No files found.
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_fixedwingdrone_js.js
View file @
30405447
...
...
@@ -409,7 +409,7 @@ var FixedWingDroneAPI = /** @class */ (function () {
return
_this
.
_mapManager
.
latLonDistance
([
a
.
x
,
a
.
y
],
[
b
.
x
,
b
.
y
]);
}
context
.
_gameManager
.
_droneList
.
forEach
(
function
(
other
)
{
if
(
other
.
can_play
&&
drone
.
id
!=
other
.
id
)
{
if
(
other
.
can_play
&&
drone
.
id
!=
=
other
.
id
)
{
other_position
=
other
.
getCurrentPosition
();
distance
=
calculateDistance
(
drone_position
,
other_position
,
context
);
if
(
distance
<=
VIEW_SCOPE
)
{
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_fixedwingdrone_js.xml
View file @
30405447
...
...
@@ -246,7 +246,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1010.
22181.14558.58982
</string>
</value>
<value>
<string>
1010.
35063.25322.10700
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>
169
1593350.04
</float>
<float>
169
2366624.83
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.js
View file @
30405447
...
...
@@ -564,9 +564,6 @@ var MapManager = /** @class */ (function () {
[
map_dict
.
max_lat
,
map_dict
.
min_lon
]),
map_size
=
Math
.
ceil
(
Math
.
max
(
max_width
,
max_height
)),
starting_point
=
map_size
/
2
*
-
0.75
;
console
.
log
(
"
max_width:
"
,
max_width
);
console
.
log
(
"
max_height:
"
,
max_height
);
console
.
log
(
"
map_size:
"
,
map_size
);
this
.
map_info
=
{
"
depth
"
:
map_size
,
"
height
"
:
map_dict
.
height
,
...
...
@@ -1324,12 +1321,16 @@ var GameManager = /** @class */ (function () {
return
false
;
}
function
spawnDrone
(
x
,
y
,
z
,
index
,
drone_info
,
api
,
team
)
{
var
default_drone_AI
=
api
.
getDroneAI
(),
code
,
base
,
code_eval
;
var
default_drone_AI
=
api
.
getDroneAI
(),
code
,
base
,
code_eval
,
trim
;
if
(
default_drone_AI
)
{
code
=
default_drone_AI
;
}
else
{
code
=
drone_info
.
script_content
;
}
trim
=
code
.
trim
();
if
(
!
trim
)
{
code
=
"
me.onStart = function () { forcedErrorEmptyScript };
"
;
}
code_eval
=
"
let drone = new DroneManager(ctx._scene,
"
+
index
+
'
, api, team);
'
+
"
let droneMe = function(NativeDate, me, Math, window, DroneManager,
"
+
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.xml
View file @
30405447
...
...
@@ -246,7 +246,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1010.2
2324.3760.4131
8
</string>
</value>
<value>
<string>
1010.2
3697.26501.4300
8
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>
16916
01869.17
</float>
<float>
16916
84378.73
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_API_page_html.html
View file @
30405447
...
...
@@ -265,7 +265,7 @@
<!-- loiter -->
<h4
class=
"item-name"
id=
"loiter"
><span>
loiter
</span><span>
: void
</span></h4>
<p
class=
"item-descr"
>
Set the drone to loiter mode, it will loiter around
last
target coordinates.
</p>
<p
class=
"item-descr"
>
Set the drone to loiter mode, it will loiter around
the
target coordinates.
</p>
<div>
<h5
class=
"item-param-1"
>
Param
</h5>
...
...
@@ -273,15 +273,28 @@
</div>
<div>
<p
class=
"item-param-1"
>
altitude: Float
</p>
<p
class=
"item-param-2"
>
altitude value
</p>
<p
class=
"item-param-1"
>
X: Float
</p>
<p
class=
"item-param-2"
>
X value - latitude (in degrees).
</p>
</div>
<div>
<p
class=
"item-param-1"
>
Y: Float
</p>
<p
class=
"item-param-2"
>
Y value - longitude (in degrees).
</p>
</div>
<div>
<p
class=
"item-param-1"
>
Z: Float
</p>
<p
class=
"item-param-2"
>
Z value - altitude (in meters).
</p>
</div>
<div>
<p
class=
"item-param-1"
>
radius: Float
</p>
<p
class=
"item-param-2"
>
radius value (in meters).
</p>
</div>
<div>
<h5
class=
"item-param-1"
>
Example
</h5>
</div>
<p
class=
"item-param-1"
>
me.loiter(
100
);
<br>
<p
class=
"item-param-1"
>
me.loiter(
lat, lon, altitude, radius
);
<br>
</p>
<div
class=
"line"
></div>
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_API_page_html.xml
View file @
30405447
...
...
@@ -244,7 +244,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1010.2
2088.20940.23517
</string>
</value>
<value>
<string>
1010.2
3624.18144.48810
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>
1691
587714.89
</float>
<float>
1691
679891.23
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.js
View file @
30405447
...
...
@@ -11,8 +11,9 @@
//but map_size is needed here for map randomization (location of objects)
//TODO refactor: or randomization is moved to map manager (seed as param)
//or randomization is done here but with geo-coordinates (not meters)
MAP_SIZE
=
902
,
min_lat
=
45.6475
,
MAP_SIZE
=
900
,
//square map
min_lat
=
45.6419
,
max_lat
=
45.65
,
min_lon
=
14.265
,
max_lon
=
14.2766
,
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.xml
View file @
30405447
...
...
@@ -246,7 +246,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1010.2
2334.20227.4084
0
</string>
</value>
<value>
<string>
1010.2
3654.50890.2036
0
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>
16916
02475.06
</float>
<float>
16916
81704.91
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drone_capture_flag_test/PathTemplateItem/web_page_module/test_capture_drone_flight_js.js
View file @
30405447
/*jslint indent: 2, maxlen: 100*/
/*global window, rJS, domsugar, document
, URLSearchParams, Blob
*/
(
function
(
window
,
rJS
,
domsugar
,
document
,
URLSearchParams
,
Blob
)
{
/*global window, rJS, domsugar, document*/
(
function
(
window
,
rJS
,
domsugar
,
document
)
{
"
use strict
"
;
var
SIMULATION_SPEED
=
10
,
...
...
@@ -23,7 +23,6 @@
MAX_CLIMB_RATE
=
8
,
MAX_SINK_RATE
=
3
,
NUMBER_OF_DRONES
=
1
,
FLAG_WEIGHT
=
5
,
// Non-inputs parameters
DEFAULT_SCRIPT_CONTENT
=
'
function assert(a, b, msg) {
\n
'
+
...
...
@@ -98,7 +97,7 @@
return
gadget
.
runGame
();
})
.
declareJob
(
'
runGame
'
,
function
runGame
(
options
)
{
.
declareJob
(
'
runGame
'
,
function
runGame
()
{
var
gadget
=
this
,
i
,
fragment
=
gadget
.
element
.
querySelector
(
'
.simulator_div
'
),
game_parameters_json
,
map_json
;
...
...
@@ -202,17 +201,18 @@
return
form_gadget
.
getContent
();
})
.
push
(
function
(
result
)
{
var
div
=
domsugar
(
'
div
'
,
{
text
:
"
CONSOLE LOG ENTRIES:
"
});
var
div
=
domsugar
(
'
div
'
,
{
text
:
"
CONSOLE LOG ENTRIES:
"
}),
lines
,
l
,
node
;
document
.
querySelector
(
'
.container
'
).
parentNode
.
appendChild
(
div
);
function
createLogNode
(
message
)
{
var
node
=
document
.
createElement
(
"
div
"
);
var
textNode
=
document
.
createTextNode
(
message
);
node
.
appendChild
(
textNode
);
return
node
;
var
log_node
=
document
.
createElement
(
"
div
"
),
textNode
=
document
.
createTextNode
(
message
);
log_
node
.
appendChild
(
textNode
);
return
log_
node
;
}
var
lines
=
result
.
console_log
.
split
(
'
\n
'
);
for
(
var
i
=
0
;
i
<
lines
.
length
;
i
++
)
{
var
node
=
createLogNode
(
lines
[
i
]);
lines
=
result
.
console_log
.
split
(
'
\n
'
);
for
(
l
=
0
;
l
<
lines
.
length
;
l
+=
1
)
{
node
=
createLogNode
(
lines
[
l
]);
document
.
querySelector
(
'
.test_log
'
).
appendChild
(
node
);
}
},
function
(
error
)
{
...
...
@@ -221,4 +221,4 @@
});
});
}(
window
,
rJS
,
domsugar
,
document
,
URLSearchParams
,
Blob
));
\ No newline at end of file
}(
window
,
rJS
,
domsugar
,
document
));
\ No newline at end of file
bt5/erp5_officejs_drone_capture_flag_test/PathTemplateItem/web_page_module/test_capture_drone_flight_js.xml
View file @
30405447
...
...
@@ -246,7 +246,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1010.
22211.26359.65484
</string>
</value>
<value>
<string>
1010.
33861.49321.40789
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>
169
1595104.7
4
</float>
<float>
169
2294109.0
4
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment