mirror of
https://forge.apps.education.fr/blender-edutech/ropy.git
synced 2024-01-27 08:23:20 +01:00
Bugfix : inspection du code par astroid, affichage du feuillage et affichage des forages
This commit is contained in:
parent
9fca493f2b
commit
14221c863c
Binary file not shown.
BIN
ropy-34.blend
BIN
ropy-34.blend
Binary file not shown.
30
rp.py
30
rp.py
@ -10,9 +10,7 @@ import threading # Multithreading
|
|||||||
import subprocess # Multiprocessus
|
import subprocess # Multiprocessus
|
||||||
import xml.etree.ElementTree as ET # Creating/parsing XML file
|
import xml.etree.ElementTree as ET # Creating/parsing XML file
|
||||||
import runpy # Exécution de script Python légère (sans import)
|
import runpy # Exécution de script Python légère (sans import)
|
||||||
# from pylint import epylint as lint # Mesure de la qualité d'un code Python
|
import astroid # Inspection de script Python (Pylint)
|
||||||
# from pylint import run_pylint # Mesure de la qualité d'un code Python
|
|
||||||
# from pylint.lint import Run as pylint_run
|
|
||||||
|
|
||||||
import rp_map1 as rp_map # Map definition
|
import rp_map1 as rp_map # Map definition
|
||||||
import rp_doc # Documentation
|
import rp_doc # Documentation
|
||||||
@ -235,7 +233,6 @@ def python_validation(file):
|
|||||||
stout_lines = stout[0].split("\n")
|
stout_lines = stout[0].split("\n")
|
||||||
for stout_line in stout_lines:
|
for stout_line in stout_lines:
|
||||||
print ("Pylint :", stout_line) # Affichage console
|
print ("Pylint :", stout_line) # Affichage console
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Absence d'erreur
|
# Absence d'erreur
|
||||||
@ -244,6 +241,30 @@ def python_validation(file):
|
|||||||
scene.objects['Cmd-text'].setVisible(False,False)
|
scene.objects['Cmd-text'].setVisible(False,False)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
##
|
||||||
|
# Inspection du code Python : détection des appels
|
||||||
|
#
|
||||||
|
# Call(func=<Name.rp_marquer l.1 at 0x7f0d137ebaf0>,
|
||||||
|
# args=[],
|
||||||
|
# keywords=[])
|
||||||
|
##
|
||||||
|
|
||||||
|
def python_inspect(file):
|
||||||
|
functions=[]
|
||||||
|
file_buff = open(file, 'r')
|
||||||
|
file_txt = file_buff.read()
|
||||||
|
file_lines= file_txt.split("\n")
|
||||||
|
for i in range (len(file_lines)):
|
||||||
|
try:
|
||||||
|
node = astroid.extract_node(file_lines[i])
|
||||||
|
# print (node)
|
||||||
|
if str(node).find ("Call(func=<Name.") > -1:
|
||||||
|
functions.append(str(node)[16:str(node).find ("l.1")-1])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
file_buff.close()
|
||||||
|
return functions
|
||||||
|
|
||||||
##
|
##
|
||||||
# Exécuter le script
|
# Exécuter le script
|
||||||
##
|
##
|
||||||
@ -286,6 +307,7 @@ def terrain_run ():
|
|||||||
scene.objects['Rover']['stop'] = False
|
scene.objects['Rover']['stop'] = False
|
||||||
scene.objects['Points-Twins-text']['Text'] = "Connection fermée."
|
scene.objects['Points-Twins-text']['Text'] = "Connection fermée."
|
||||||
if python_validation(scene.objects['Commands']['script']):
|
if python_validation(scene.objects['Commands']['script']):
|
||||||
|
scene.objects['Commands']['functions'] = python_inspect(scene.objects['Commands']['script'])
|
||||||
runpy.run_path(scene.objects['Commands']['script'], run_name='start') # Execution du script utilisateur
|
runpy.run_path(scene.objects['Commands']['script'], run_name='start') # Execution du script utilisateur
|
||||||
|
|
||||||
# Arrêt de la pause
|
# Arrêt de la pause
|
||||||
|
@ -425,6 +425,7 @@ def quality_apply(quality, start_flag=False):
|
|||||||
eevee.use_volumetric_shadows = False
|
eevee.use_volumetric_shadows = False
|
||||||
eevee.shadow_cascade_size='64'
|
eevee.shadow_cascade_size='64'
|
||||||
eevee.shadow_cube_size='64'
|
eevee.shadow_cube_size='64'
|
||||||
|
bpy.data.particles["Feuillage"].count = 100
|
||||||
# scene.objects['terrain-scatter.001'].setVisible(False,True)
|
# scene.objects['terrain-scatter.001'].setVisible(False,True)
|
||||||
# scene.objects['terrain-scatter.002'].setVisible(False,True)
|
# scene.objects['terrain-scatter.002'].setVisible(False,True)
|
||||||
|
|
||||||
@ -441,6 +442,7 @@ def quality_apply(quality, start_flag=False):
|
|||||||
eevee.use_volumetric_shadows = False
|
eevee.use_volumetric_shadows = False
|
||||||
eevee.shadow_cascade_size='1024'
|
eevee.shadow_cascade_size='1024'
|
||||||
eevee.shadow_cube_size='512'
|
eevee.shadow_cube_size='512'
|
||||||
|
bpy.data.particles["Feuillage"].count = 100
|
||||||
# scene.objects['terrain-scatter.001'].setVisible(False,True)
|
# scene.objects['terrain-scatter.001'].setVisible(False,True)
|
||||||
# scene.objects['terrain-scatter.002'].setVisible(False,True)
|
# scene.objects['terrain-scatter.002'].setVisible(False,True)
|
||||||
|
|
||||||
@ -457,6 +459,7 @@ def quality_apply(quality, start_flag=False):
|
|||||||
eevee.use_volumetric_shadows = False
|
eevee.use_volumetric_shadows = False
|
||||||
eevee.shadow_cascade_size='1024'
|
eevee.shadow_cascade_size='1024'
|
||||||
eevee.shadow_cube_size='512'
|
eevee.shadow_cube_size='512'
|
||||||
|
bpy.data.particles["Feuillage"].count = 100
|
||||||
# scene.objects['terrain-scatter.001'].setVisible(True,True)
|
# scene.objects['terrain-scatter.001'].setVisible(True,True)
|
||||||
# scene.objects['terrain-scatter.002'].setVisible(True,True)
|
# scene.objects['terrain-scatter.002'].setVisible(True,True)
|
||||||
|
|
||||||
@ -473,6 +476,7 @@ def quality_apply(quality, start_flag=False):
|
|||||||
eevee.use_volumetric_shadows = False
|
eevee.use_volumetric_shadows = False
|
||||||
eevee.shadow_cascade_size='1024'
|
eevee.shadow_cascade_size='1024'
|
||||||
eevee.shadow_cube_size='512'
|
eevee.shadow_cube_size='512'
|
||||||
|
bpy.data.particles["Feuillage"].count = 500
|
||||||
# scene.objects['terrain-scatter.001'].setVisible(True,True)
|
# scene.objects['terrain-scatter.001'].setVisible(True,True)
|
||||||
# scene.objects['terrain-scatter.002'].setVisible(True,True)
|
# scene.objects['terrain-scatter.002'].setVisible(True,True)
|
||||||
|
|
||||||
@ -489,5 +493,6 @@ def quality_apply(quality, start_flag=False):
|
|||||||
eevee.use_volumetric_shadows = True
|
eevee.use_volumetric_shadows = True
|
||||||
eevee.shadow_cascade_size='4096'
|
eevee.shadow_cascade_size='4096'
|
||||||
eevee.shadow_cube_size='4096'
|
eevee.shadow_cube_size='4096'
|
||||||
|
bpy.data.particles["Feuillage"].count = 1000
|
||||||
# scene.objects['terrain-scatter.001'].setVisible(True,True)
|
# scene.objects['terrain-scatter.001'].setVisible(True,True)
|
||||||
# scene.objects['terrain-scatter.002'].setVisible(True,True)
|
# scene.objects['terrain-scatter.002'].setVisible(True,True)
|
||||||
|
32
rp_cmd.py
32
rp_cmd.py
@ -1,5 +1,4 @@
|
|||||||
import time
|
import time
|
||||||
import inspect
|
|
||||||
from rp_lib import * # Bibliothèque Ropy
|
from rp_lib import * # Bibliothèque Ropy
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -26,19 +25,34 @@ from rp_lib import * # Bibliothèque Ropy
|
|||||||
# Commandes
|
# Commandes
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
def mrp_avancer():
|
||||||
|
pass
|
||||||
|
|
||||||
def commandes():
|
def commandes():
|
||||||
|
|
||||||
# print ("inspect :", inspect.isfunction(mrp_avancer()))
|
print ('Go go go ...')
|
||||||
|
|
||||||
|
# mrp_avancer()
|
||||||
|
# mrp_avancer()
|
||||||
|
# mrp_avancer()
|
||||||
|
|
||||||
print ('okok')
|
|
||||||
rp_gauche()
|
rp_gauche()
|
||||||
rp_avancer()
|
while rp_detect()==False:
|
||||||
rp_avancer()
|
|
||||||
rp_droite()
|
|
||||||
for i in range (3):
|
|
||||||
rp_avancer()
|
rp_avancer()
|
||||||
rp_marquer()
|
rp_droite()
|
||||||
|
while rp_detect()==False:
|
||||||
|
rp_avancer()
|
||||||
|
|
||||||
|
# rp_avancer()
|
||||||
|
# rp_droite()
|
||||||
|
# for i in range (4):
|
||||||
|
# rp_avancer()
|
||||||
|
# rp_marquer()
|
||||||
|
# rp_droite()
|
||||||
|
# for i in range (3):
|
||||||
|
# rp_avancer()
|
||||||
|
# rp_marquer()
|
||||||
|
|
||||||
rp_fin() # A garder
|
rp_fin() # A garder
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
<data>
|
<data>
|
||||||
<config>
|
<config>
|
||||||
<speed>2.0</speed>
|
<speed>4.0</speed>
|
||||||
<sound>False</sound>
|
<sound>False</sound>
|
||||||
<cam>
|
<cam>
|
||||||
<worldPosition.x>4.116782188415527</worldPosition.x>
|
<worldPosition.x>-3.7522060871124268</worldPosition.x>
|
||||||
<worldPosition.y>-39.253841400146484</worldPosition.y>
|
<worldPosition.y>-18.188343048095703</worldPosition.y>
|
||||||
<worldPosition.z>29.45159339904785</worldPosition.z>
|
<worldPosition.z>15.865280151367188</worldPosition.z>
|
||||||
</cam>
|
</cam>
|
||||||
<screen>
|
<screen>
|
||||||
<width>1599</width>
|
<width>1639</width>
|
||||||
<height>900</height>
|
<height>922</height>
|
||||||
<quality>4</quality>
|
<quality>4</quality>
|
||||||
</screen>
|
</screen>
|
||||||
</config>
|
</config>
|
||||||
@ -18,9 +18,9 @@
|
|||||||
<level>6</level>
|
<level>6</level>
|
||||||
</mission>
|
</mission>
|
||||||
<upgrade>
|
<upgrade>
|
||||||
<battery>False</battery>
|
<battery>True</battery>
|
||||||
<beacon>False</beacon>
|
<beacon>True</beacon>
|
||||||
<paint>False</paint>
|
<paint>True</paint>
|
||||||
<speed>True</speed>
|
<speed>True</speed>
|
||||||
</upgrade>
|
</upgrade>
|
||||||
</data>
|
</data>
|
13
rp_lib.py
13
rp_lib.py
@ -281,9 +281,14 @@ def rp_avancer (twins=True):
|
|||||||
scene.objects['Rv-Wheel-left-front'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
scene.objects['Rv-Wheel-left-front'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||||
scene.objects['Rv-Wheel-left-mid'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
scene.objects['Rv-Wheel-left-mid'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||||
scene.objects['Rv-Wheel-left-rear'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
scene.objects['Rv-Wheel-left-rear'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||||
while scene.objects['Rv-Wheel-right-front'].isPlayingAction(): # Forçage du redraw
|
|
||||||
# scene.objects['Camera'].applyMovement((0, 0, 0), True)
|
# Forçage du redraw
|
||||||
scene.objects['Sun'].applyMovement((0, 0, 0), True)
|
while scene.objects['Rv-Wheel-right-front'].isPlayingAction():
|
||||||
|
rp_sleep(0.1)
|
||||||
|
# rp_tempo (0.1)
|
||||||
|
# # pass
|
||||||
|
# # scene.objects['Camera'].applyMovement((0, 0, 0), True)
|
||||||
|
# scene.objects['Sun'].applyMovement((0, 0, 0), True)
|
||||||
rp_tempo (0.1)
|
rp_tempo (0.1)
|
||||||
|
|
||||||
# Contrôle objectif
|
# Contrôle objectif
|
||||||
@ -829,7 +834,7 @@ def rover_colision_montain (back):
|
|||||||
scene.objects['Rv-Wheel-left-rear'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
scene.objects['Rv-Wheel-left-rear'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||||
|
|
||||||
# Forçage du redraw
|
# Forçage du redraw
|
||||||
while scene.objects['Rv-Wheel-right-front'].isPlayingAction(): # Forçage du redraw
|
while scene.objects['Rv-Wheel-right-front'].isPlayingAction():
|
||||||
scene.objects['Sun'].applyMovement((0, 0, 0), True)
|
scene.objects['Sun'].applyMovement((0, 0, 0), True)
|
||||||
rp_tempo (0.1)
|
rp_tempo (0.1)
|
||||||
return True
|
return True
|
||||||
|
42
rp_map1.py
42
rp_map1.py
@ -1,9 +1,9 @@
|
|||||||
import bge # Bibliothèque Blender Game Engine (UPBGE)
|
import bge # Bibliothèque Blender Game Engine (UPBGE)
|
||||||
import bpy # Blender
|
import bpy # Blender
|
||||||
import random
|
import random
|
||||||
import inspect
|
|
||||||
from rp_lib import * # Bibliothèque Ropy
|
from rp_lib import * # Bibliothèque Ropy
|
||||||
import os
|
import os
|
||||||
|
import runpy # Exécution de script Python légère (sans import)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# rp_map1.py
|
# rp_map1.py
|
||||||
@ -153,18 +153,15 @@ def map_init():
|
|||||||
filename=object_name)
|
filename=object_name)
|
||||||
|
|
||||||
scene.objects['Terrain']['size'] = [-15,-11,15,10] # Map size
|
scene.objects['Terrain']['size'] = [-15,-11,15,10] # Map size
|
||||||
|
scene.objects['Terrain-plane'].setVisible(False,True) # Plan de conception (Blender)
|
||||||
scene.objects['Terrain']['map_tile_station']= [[-9,2],[-9,3]]
|
scene.objects['Terrain']['map_tile_station']= [[-9,2],[-9,3]]
|
||||||
|
|
||||||
# Détection des emplacements des colisions de montagne
|
# Montagne
|
||||||
# scene.objects['Terrain']['map_tile_montain']= []
|
|
||||||
# for obj_i in scene.objects:
|
|
||||||
# if "terrain_sideCliff" in obj_i.name or "terrain_sideCorner" in obj_i.name or "terrain_sideCornerInner" in obj_i.name:
|
|
||||||
# scene.objects['Terrain']['map_tile_montain'].append([round(obj_i.worldPosition.x), round(obj_i.worldPosition.y)])
|
|
||||||
scene.objects['Terrain']['map_tile_montain'] = [[-9, -1], [1, -9], [-14, -8], [-12, -10], [-11, -10], [-10, -10], [-9, -10], [-11, 1], [-14, 3], [-14, 4], [-14, -7], [-12, 1], [2, -7], [-12, 10],
|
scene.objects['Terrain']['map_tile_montain'] = [[-9, -1], [1, -9], [-14, -8], [-12, -10], [-11, -10], [-10, -10], [-9, -10], [-11, 1], [-14, 3], [-14, 4], [-14, -7], [-12, 1], [2, -7], [-12, 10],
|
||||||
[-11,10], [-10, 10], [-9, 10], [-8, 10], [-4, 7], [-2, 6], [4, 10], [5, 10], [1, 8], [2, -6], [6, 10], [7, 10], [8, 10], [9, 10], [10, 10], [11, 10],
|
[-11,10], [-10, 10], [-9, 10], [-8, 10], [-4, 7], [-2, 6], [4, 10], [5, 10], [1, 8], [2, -6], [6, 10], [7, 10], [8, 10], [9, 10], [10, 10], [11, 10],
|
||||||
[14,7], [-14, -1], [13, 8], [-14, 0], [-14, -2], [8, -1], [-15, -7], [-15, -8], [-15, -9], [-15, -6], [-8, -10], [-7, -10], [10, -1], [15, 5], [11, -1],
|
[14,7], [-14, -1], [13, 8], [-14, 0], [-14, -2], [8, -1], [-15, -7], [-15, -8], [-15, -9], [-15, -6], [-8, -10], [-7, -10], [10, -1], [15, 5], [11, -1],
|
||||||
[14, 9], [15, 10], [12, -1], [4, -9], [5, -9], [6, -9], [3, -10], [7, -10], [-14, -11], [-6, -11], [3, -11], [7, -11], [0, -11], [0, 1], [-1, 0], [13, 7],
|
[14, 9], [15, 10], [12, -1], [4, -9], [5, -9], [6, -9], [3, -10], [7, -10], [-14, -11], [-6, -11], [3, -11], [7, -11], [0, -11], [13, 7],
|
||||||
[13, 6], [13, 5], [1, 1], [0, -1], [14, 10], [13, 9], [14, 8], [14, 6], [12, 10], [15, 9], [15, 3], [9, -1], [7, -1], [15, 8], [15, 7], [6, -1], [2, -5],
|
[13, 6], [13, 5], [14, 10], [13, 9], [14, 8], [14, 6], [12, 10], [15, 9], [15, 3], [9, -1], [7, -1], [15, 8], [15, 7], [6, -1], [2, -5],
|
||||||
[2, -4], [2, -3], [2, -2], [5, -1], [4, -1], [3, -1], [3, 10], [-1, 6], [0, -10], [-13, -9], [1, -8], [-12, -3], [-9, -2], [-12, -5], [-13, -6], [-13, 5],
|
[2, -4], [2, -3], [2, -2], [5, -1], [4, -1], [3, -1], [3, 10], [-1, 6], [0, -10], [-13, -9], [1, -8], [-12, -3], [-9, -2], [-12, -5], [-13, -6], [-13, 5],
|
||||||
[-13, 6], [-14, 8], [-13, 2], [-10, -3], [-13, 9], [-7, 9], [-14, 7], [-6, 8], [-5, 7], [-3, 6], [0, 6], [1, 7], [2, 9], [-10, 1], [-9, 0], [-15, 2],
|
[-13, 6], [-14, 8], [-13, 2], [-10, -3], [-13, 9], [-7, 9], [-14, 7], [-6, 8], [-5, 7], [-3, 6], [0, 6], [1, 7], [2, 9], [-10, 1], [-9, 0], [-15, 2],
|
||||||
[-14,1], [-14, -10], [-14, -5], [-13, -4], [-13, -3], [2, -1], [13, 4], [14, 3], [15, 6], [13, -1], [14, -2], [-6, -10], [15, -3], [14, 5], [3, -9],
|
[-14,1], [-14, -10], [-14, -5], [-13, -4], [-13, -3], [2, -1], [13, 4], [14, 3], [15, 6], [13, -1], [14, -2], [-6, -10], [15, -3], [14, 5], [3, -9],
|
||||||
@ -174,6 +171,18 @@ def map_init():
|
|||||||
[2,10], [2, 10], [13, 10], [13, 10], [13, -2], [13, -2], [-15, -10], [-15, -10], [1, -10], [1, -10], [-15, 1], [-15, 1], [-15, -5], [-15, -5], [-14, -4],
|
[2,10], [2, 10], [13, 10], [13, 10], [13, -2], [13, -2], [-15, -10], [-15, -10], [1, -10], [1, -10], [-15, 1], [-15, 1], [-15, -5], [-15, -5], [-14, -4],
|
||||||
[-14, -4], [-14, -3], [-14, -3], [-15, 8], [-15, 8], [14, 4], [14, 4], [-15, 7], [-15, 7], [2, -8], [2, -8]]
|
[-14, -4], [-14, -3], [-14, -3], [-15, 8], [-15, 8], [14, 4], [14, 4], [-15, 7], [-15, 7], [2, -8], [2, -8]]
|
||||||
|
|
||||||
|
# Visualisation des cases montagne
|
||||||
|
# for i in range (len (scene.objects['Terrain']['map_tile_montain'])):
|
||||||
|
# beacon_montain= scene.addObject("Beacon", scene.objects['Terrain'])
|
||||||
|
# beacon_montain.worldPosition=[scene.objects['Terrain']['map_tile_montain'][i][0],scene.objects['Terrain']['map_tile_montain'][i][1],0.2]
|
||||||
|
# beacon_montain.setVisible(True,True)
|
||||||
|
|
||||||
|
# Détection des emplacements des colisions de montagne
|
||||||
|
# scene.objects['Terrain']['map_tile_montain']= []
|
||||||
|
# for obj_i in scene.objects:
|
||||||
|
# if "terrain_sideCliff" in obj_i.name or "terrain_sideCorner" in obj_i.name or "terrain_sideCornerInner" in obj_i.name:
|
||||||
|
# scene.objects['Terrain']['map_tile_montain'].append([round(obj_i.worldPosition.x), round(obj_i.worldPosition.y)])
|
||||||
|
|
||||||
# Couleurs
|
# Couleurs
|
||||||
rp_couleur_init()
|
rp_couleur_init()
|
||||||
|
|
||||||
@ -351,10 +360,14 @@ def objectif_control(x,y):
|
|||||||
# Mission 2 (fonction)
|
# Mission 2 (fonction)
|
||||||
if scene.objects['Points']['mission']==2:
|
if scene.objects['Points']['mission']==2:
|
||||||
if [x,y] in scene.objects['Terrain']['map_aim']: # Aim
|
if [x,y] in scene.objects['Terrain']['map_aim']: # Aim
|
||||||
|
# print ("Objectif : ok")
|
||||||
if len(scene.objects['Terrain']['map_tile_beacon'])>=6: # 6 balises posées mini
|
if len(scene.objects['Terrain']['map_tile_beacon'])>=6: # 6 balises posées mini
|
||||||
|
# print ("6 balises posées : ok")
|
||||||
if scene.objects['Points']['nbligne'] <=40: # 40 lignes de code maxi
|
if scene.objects['Points']['nbligne'] <=40: # 40 lignes de code maxi
|
||||||
txt=["def mrp_avancer():", "def mrp_avancer() :", "def mrp_avancer ():", "def mrp_avancer () :"] # Présence de "def mrp_avancer():"
|
# print ("40 lignes de code maxi : ok")
|
||||||
if rp_cmd_txtcount(txt, 1):
|
# print (scene.objects['Commands']['functions'])
|
||||||
|
if scene.objects['Commands']['functions'].count("mrp_avancer")>=3: # Au moins 3 appels de "mrp_avancer()"
|
||||||
|
# print ("Fonction mrp_avancer : ok")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Mission 3 (structure alternative)
|
# Mission 3 (structure alternative)
|
||||||
@ -370,8 +383,7 @@ def objectif_control(x,y):
|
|||||||
if rp_cmd_txtcount(txt, 2):
|
if rp_cmd_txtcount(txt, 2):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
txt=["def mrp_avancer_nbpas"] # Présence de "def mrp_avancer_nbpas"
|
if scene.objects['Commands']['functions'].count("mrp_avancer_nbpas")>=2: # Au moins 2 appels de "mrp_avancer_nbpas()"
|
||||||
if rp_cmd_txtcount(txt, 1):
|
|
||||||
txt=["for" ] # Présence de "for i in range" 1x
|
txt=["for" ] # Présence de "for i in range" 1x
|
||||||
if rp_cmd_txtcount(txt, 1):
|
if rp_cmd_txtcount(txt, 1):
|
||||||
txt=["in range" ]
|
txt=["in range" ]
|
||||||
@ -386,8 +398,7 @@ def objectif_control(x,y):
|
|||||||
if rp_cmd_txtcount(txt, 2):
|
if rp_cmd_txtcount(txt, 2):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
txt=["def mrp_avancer_mur():", "def mrp_avancer_mur() :", "def mrp_avancer_mur ():", "def mrp_avancer_mur () :"] # Présence de "def mrp_avancer_mur():"
|
if scene.objects['Commands']['functions'].count("mrp_avancer_mur")>=2: # Au moins 2 appels de "mrp_avancer_mur()"
|
||||||
if rp_cmd_txtcount(txt, 1):
|
|
||||||
txt=["while" ] # Présence de "while" 1x
|
txt=["while" ] # Présence de "while" 1x
|
||||||
if rp_cmd_txtcount(txt, 1):
|
if rp_cmd_txtcount(txt, 1):
|
||||||
return True
|
return True
|
||||||
@ -396,13 +407,12 @@ def objectif_control(x,y):
|
|||||||
if scene.objects['Points']['mission']==6:
|
if scene.objects['Points']['mission']==6:
|
||||||
if [x,y] in scene.objects['Terrain']['map_aim']: # Cibles
|
if [x,y] in scene.objects['Terrain']['map_aim']: # Cibles
|
||||||
if [x,y] not in scene.objects['Terrain']['map_aim_hit']: # Cibles atteintes
|
if [x,y] not in scene.objects['Terrain']['map_aim_hit']: # Cibles atteintes
|
||||||
|
|
||||||
rover_drill(x,y)
|
rover_drill(x,y)
|
||||||
|
|
||||||
scene.objects['Terrain']['map_aim_hit'].append([x,y])
|
scene.objects['Terrain']['map_aim_hit'].append([x,y])
|
||||||
if len (scene.objects['Terrain']['map_aim_hit'])==10 : # Toutes les cibles atteintes
|
if len (scene.objects['Terrain']['map_aim_hit'])==10 : # Toutes les cibles atteintes
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
# Objectif pas atteint
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ from pylint import run_pylint
|
|||||||
# print (sys.argv[0])
|
# print (sys.argv[0])
|
||||||
# print (sys.argv[1])
|
# print (sys.argv[1])
|
||||||
# run_pylint(argv=["--version"])
|
# run_pylint(argv=["--version"])
|
||||||
|
|
||||||
|
# Détection des erreurs
|
||||||
run_pylint(argv=["--errors-only", sys.argv[1]])
|
run_pylint(argv=["--errors-only", sys.argv[1]])
|
||||||
# run_pylint(argv=["--disable=line-too-long", sys.argv[1]])
|
# run_pylint(argv=["--disable=line-too-long", sys.argv[1]])
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user