Use range() to ensure compatibility with previous (and future ?) GDScript versions (again, this time in all scripts found)
This commit is contained in:
@@ -44,7 +44,7 @@ func _init_gardens_layout() -> void:
|
||||
garden_layout.color = int(index / 4.0) % GARDEN_TEXTURES_NB
|
||||
|
||||
# Add the flowers to the garden
|
||||
for flower_i: int in 5:
|
||||
for flower_i: int in range(5):
|
||||
var flower: GardenLayout.Flower = GardenLayout.Flower.new(garden_layout.color, flower_i, Vector2i(980 + flower_i * 100, 900))
|
||||
garden_layout.flowers.append(flower)
|
||||
garden_layout.flowers = garden_layout.flowers
|
||||
@@ -64,14 +64,14 @@ func set_up_click_detection() -> void:
|
||||
for garden_control_ind: int in range(garden_parent.get_child_count()):
|
||||
var garden_control: Garden = garden_parent.get_child(garden_control_ind)
|
||||
|
||||
for flower_ind: int in garden_control.flower_controls.size():
|
||||
for flower_ind: int in range(garden_control.flower_controls.size()):
|
||||
var flower_control: Control = garden_control.flower_controls[flower_ind]
|
||||
flower_control.gui_input.connect(_on_flower_gui_input.bind(garden_control_ind, flower_ind, flower_control))
|
||||
|
||||
garden_control.flowers_sizes[flower_ind] = Garden.FlowerSizes.LARGE
|
||||
garden_control.update_flowers()
|
||||
|
||||
for lesson_button_ind: int in garden_control.lesson_button_controls.size():
|
||||
for lesson_button_ind: int in range(garden_control.lesson_button_controls.size()):
|
||||
var lesson_button_control: Control = garden_control.lesson_button_controls[lesson_button_ind]
|
||||
lesson_button_control.gui_input.connect(_on_lesson_button_gui_input.bind(garden_control_ind, lesson_button_ind, lesson_button_control))
|
||||
|
||||
@@ -118,36 +118,11 @@ func _input(event: InputEvent) -> void:
|
||||
dragging_element = null
|
||||
|
||||
|
||||
#func _unhandled_input(event: InputEvent) -> void:
|
||||
#if event.is_action_pressed("left_click"):
|
||||
## Get the closest point to the mouse
|
||||
#var closest_point: = curve.get_closest_point(locked_line.get_local_mouse_position())
|
||||
#
|
||||
## If the user clicked on a line, do the drag event
|
||||
#if closest_point.distance_to(locked_line.get_local_mouse_position()) < locked_line.width:
|
||||
#dragging_element = get_previous_point_on_curve(closest_point)
|
||||
#var a: = get_garden_and_sub_ind_from_ind(dragging_element as int)
|
||||
#drag_data = {
|
||||
#type = "path_middle",
|
||||
#garden_ind = a[0],
|
||||
#sub_ind = a[1],
|
||||
#}
|
||||
|
||||
|
||||
#func get_previous_point_on_curve(point: Vector2) -> int:
|
||||
#var offset: = curve.get_closest_offset(point)
|
||||
#for index: int in curve.point_count:
|
||||
#var point_offset: = curve.get_closest_offset(curve.get_point_position(index))
|
||||
#if point_offset > offset:
|
||||
#return index - 1
|
||||
#return curve.point_count
|
||||
|
||||
|
||||
func get_garden_and_sub_ind_from_ind(ind: int) -> Array[int]:
|
||||
var count: int = 0
|
||||
for garden_control_ind: int in range(garden_parent.get_child_count()):
|
||||
var garden_control: Garden = garden_parent.get_child(garden_control_ind)
|
||||
for lesson_button_ind: int in garden_control.lesson_button_controls.size():
|
||||
for lesson_button_ind: int in range(garden_control.lesson_button_controls.size()):
|
||||
if count == ind:
|
||||
return [garden_control_ind, lesson_button_ind]
|
||||
count += 1
|
||||
|
||||
@@ -95,7 +95,7 @@ func set_graphemes_edit(p_gp_ids: Array[int]) -> void:
|
||||
for child: Node in graphemes_edit_container.get_children():
|
||||
graphemes_edit_container.remove_child(child)
|
||||
child.queue_free()
|
||||
for ind_gp_id: int in p_gp_ids.size():
|
||||
for ind_gp_id: int in range(p_gp_ids.size()):
|
||||
var gp_id: int = p_gp_ids[ind_gp_id]
|
||||
add_gp_list_button(gp_id, ind_gp_id)
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ func _tracing_process() -> void:
|
||||
if offset > guide.progress:
|
||||
remove_up_to = index
|
||||
break
|
||||
for _index: int in min(remove_up_to, curve_points.size() - 2):
|
||||
for _index: int in range(mini(remove_up_to, curve_points.size() - 2)):
|
||||
curve_points.remove_at(0)
|
||||
remaining_curve.remove_point(0)
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ func _on_step_completed(step: Step) -> void:
|
||||
"devices":
|
||||
# Adds students steps for teachers
|
||||
_remove_future_steps()
|
||||
for device: int in register_data.devices_count:
|
||||
for device: int in range(register_data.devices_count):
|
||||
var students_step_scene: Node = students_step.instantiate()
|
||||
if students_step_scene is StudentsCountStep:
|
||||
(students_step_scene as StudentsCountStep).question = tr((students_step_scene as StudentsCountStep).question).format({"number": (device + 1)})
|
||||
|
||||
@@ -64,7 +64,7 @@ func compare_versions(version_a: String, version_b: String) -> int:
|
||||
var va: PackedStringArray = version_a.split(".")
|
||||
var vb: PackedStringArray = version_b.split(".")
|
||||
|
||||
for index: int in 3:
|
||||
for index: int in range(3):
|
||||
var ai: int = int(va[index]) if index < va.size() else 0
|
||||
var bi: int = int(vb[index]) if index < vb.size() else 0
|
||||
if ai < bi:
|
||||
|
||||
Reference in New Issue
Block a user