|
@ -21,10 +21,9 @@ enum CellStates { |
|
|
|
|
|
|
|
|
@onready var generation_ui: MarginContainer = $UI/WorldGeneration |
|
|
@onready var generation_ui: MarginContainer = $UI/WorldGeneration |
|
|
@onready var generation_seed: LineEdit = $UI/WorldGeneration/VBoxContainer/Seed/Input |
|
|
@onready var generation_seed: LineEdit = $UI/WorldGeneration/VBoxContainer/Seed/Input |
|
|
|
|
|
@onready var generation_speed: HSlider = $UI/WorldGeneration/VBoxContainer/GenerationSpeed/Input |
|
|
@onready var generation_world_size_x: LineEdit = $UI/WorldGeneration/VBoxContainer/WorldSize/Input_x |
|
|
@onready var generation_world_size_x: LineEdit = $UI/WorldGeneration/VBoxContainer/WorldSize/Input_x |
|
|
@onready var generation_world_size_y: LineEdit = $UI/WorldGeneration/VBoxContainer/WorldSize/Input_y |
|
|
@onready var generation_world_size_y: LineEdit = $UI/WorldGeneration/VBoxContainer/WorldSize/Input_y |
|
|
@onready var generation_cell_size_x: LineEdit = $UI/WorldGeneration/VBoxContainer/CellSize/Input_x |
|
|
|
|
|
@onready var generation_cell_size_y: LineEdit = $UI/WorldGeneration/VBoxContainer/CellSize/Input_y |
|
|
|
|
|
@onready var start_paused_button: CheckBox = $UI/WorldGeneration/VBoxContainer/FinalRow/StartPausedButton |
|
|
@onready var start_paused_button: CheckBox = $UI/WorldGeneration/VBoxContainer/FinalRow/StartPausedButton |
|
|
|
|
|
|
|
|
@onready var messages_label: Label = $UI/Messages/Label |
|
|
@onready var messages_label: Label = $UI/Messages/Label |
|
@ -58,6 +57,8 @@ var previous_generation_count: int = 10 # Number of generations to check for evo |
|
|
# 4 Collisions out of 10 previous_generation_count seems reasonable although it may not be quite enough |
|
|
# 4 Collisions out of 10 previous_generation_count seems reasonable although it may not be quite enough |
|
|
var collision_count_limit: int = 4 |
|
|
var collision_count_limit: int = 4 |
|
|
|
|
|
|
|
|
|
|
|
var timer_speeds: Array = [0.1, 0.08, 0.05, 0.03, 0.01] # The speeds for the generation_timer for selection from the UI |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void: |
|
|
func _ready() -> void: |
|
|
update_generation_ui() |
|
|
update_generation_ui() |
|
@ -96,8 +97,6 @@ func update_generation_ui() -> void: |
|
|
generation_seed.text = str(randi()) |
|
|
generation_seed.text = str(randi()) |
|
|
generation_world_size_x.text = str(world_size.x) |
|
|
generation_world_size_x.text = str(world_size.x) |
|
|
generation_world_size_y.text = str(world_size.y) |
|
|
generation_world_size_y.text = str(world_size.y) |
|
|
generation_cell_size_x.text = str(cell_size.x) |
|
|
|
|
|
generation_cell_size_y.text = str(cell_size.y) |
|
|
|
|
|
start_paused_button.button_pressed = false |
|
|
start_paused_button.button_pressed = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -282,6 +281,11 @@ func _on_generation_timer_timeout() -> void: |
|
|
|
|
|
|
|
|
generation_timer.start() |
|
|
generation_timer.start() |
|
|
|
|
|
|
|
|
|
|
|
func _on_generation_speed_drag_ended(value_changed: bool) -> void: |
|
|
|
|
|
var speed = generation_speed.value - 1 |
|
|
|
|
|
if value_changed: |
|
|
|
|
|
generation_timer.wait_time = timer_speeds[speed] |
|
|
|
|
|
|
|
|
func _on_quit_button_pressed() -> void: |
|
|
func _on_quit_button_pressed() -> void: |
|
|
get_tree().quit() |
|
|
get_tree().quit() |
|
|
|
|
|
|
|
@ -291,7 +295,6 @@ func _on_run_button_pressed() -> void: |
|
|
else: |
|
|
else: |
|
|
world_seed = randi() |
|
|
world_seed = randi() |
|
|
world_size = Vector2(int(generation_world_size_x.text), int(generation_world_size_y.text)) |
|
|
world_size = Vector2(int(generation_world_size_x.text), int(generation_world_size_y.text)) |
|
|
cell_size = Vector2(int(generation_cell_size_x.text), int(generation_cell_size_y.text)) |
|
|
|
|
|
|
|
|
|
|
|
debug_ui.visible = true |
|
|
debug_ui.visible = true |
|
|
generation_ui.visible = false |
|
|
generation_ui.visible = false |
|
|