flow controls in freeroam

This commit is contained in:
Persephone Bubblegum-Holiday 2025-08-04 20:58:39 -07:00
parent 1efee5b65e
commit 143d95a297
6 changed files with 85 additions and 29 deletions

View file

@ -4,13 +4,15 @@
[node name="FlowControl" type="Control"]
layout_mode = 3
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 40.0
grow_horizontal = 2
script = ExtResource("1_fg0vw")
[node name="Panel" type="Panel" parent="."]
layout_mode = 1
anchors_preset = -1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2

View file

@ -4,44 +4,56 @@
[node name="FlowControl" type="Control"]
layout_mode = 3
anchors_preset = 0
offset_right = 512.0
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 40.0
grow_horizontal = 2
script = ExtResource("1_6sy3t")
[node name="Panel" type="Panel" parent="."]
layout_mode = 0
offset_right = 512.0
offset_bottom = 40.0
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Label" type="Label" parent="Panel"]
layout_mode = 0
layout_mode = 1
anchors_preset = -1
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = 4.0
offset_top = 4.0
offset_right = 244.0
offset_bottom = 36.0
offset_bottom = -4.0
text = "Movement"
vertical_alignment = 1
clip_text = true
text_overrun_behavior = 3
[node name="InStepper" type="SpinBox" parent="Panel"]
layout_mode = 0
offset_left = 248.0
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_right = 0.75
anchor_bottom = 1.0
offset_top = 4.0
offset_right = 376.0
offset_bottom = 36.0
offset_right = -4.0
offset_bottom = -4.0
max_value = 10000.0
step = 0.1
value = 1.0
prefix = "In:"
[node name="OutStepper" type="SpinBox" parent="Panel"]
layout_mode = 0
offset_left = 380.0
layout_mode = 1
anchors_preset = -1
anchor_left = 0.75
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = 4.0
offset_right = 508.0
offset_bottom = 36.0
offset_right = -4.0
offset_bottom = -4.0
max_value = 10000.0
step = 0.1
value = 1.0

View file

@ -594,7 +594,10 @@ offset_right = 516.0
offset_bottom = 388.0
[node name="FlowHandle" type="Control" parent="FlyoutPanel/FlowControls/InvisibleMask"]
anchors_preset = 0
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
grow_horizontal = 2
[node name="VScrollBar" type="VScrollBar" parent="FlyoutPanel/FlowControls"]
layout_mode = 0

View file

@ -121,7 +121,6 @@ horizontal_alignment = 2
vertical_alignment = 1
[node name="FlowControlsScreen" type="Control" parent="."]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -182,7 +181,10 @@ grow_horizontal = 2
grow_vertical = 2
[node name="FlowHandle" type="Control" parent="FlowControlsScreen/DialogPanel/InvisibleMask"]
anchors_preset = 0
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
grow_horizontal = 2
[node name="VScrollBar" type="VScrollBar" parent="FlowControlsScreen/DialogPanel"]
layout_mode = 1
@ -198,6 +200,7 @@ max_value = 0.0
step = 1.0
[node name="CosmeticsScreen" type="Control" parent="."]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -283,4 +286,6 @@ step = 1.0
[connection signal="pressed" from="Buttons/ExitMenuButton" to="." method="_on_exit_menu_button_pressed"]
[connection signal="pressed" from="Buttons/ExitButton" to="." method="_on_exit_button_pressed"]
[connection signal="pressed" from="FlowControlsScreen/InputEater" to="." method="_on_input_eater_pressed"]
[connection signal="value_changed" from="FlowControlsScreen/DialogPanel/VScrollBar" to="." method="_on_flow_v_scroll_bar_value_changed"]
[connection signal="pressed" from="CosmeticsScreen/InputEater" to="." method="_on_input_eater_pressed"]
[connection signal="value_changed" from="CosmeticsScreen/DialogPanel/VScrollBar" to="." method="_on_cosmetics_v_scroll_bar_value_changed"]

View file

@ -83,6 +83,7 @@ func reload_stage() -> void:
flow_control.vis_name = bot + " " + movement
flow_control.in_value = in_flow
flow_control.out_value = out_flow
flow_control.anchor_right = 1.0
$FlyoutPanel/FlowControls/InvisibleMask/FlowHandle.add_child(flow_control)
flows_offset += 44
flow_count += 1

View file

@ -1,52 +1,85 @@
extends Control
var in_flows = []
var out_flows = []
var loaded_show = []
func _ready() -> void:
var stage = FreeRoamMaps.MapIndex[get_node("../").current_map]["stage"]
var cosmetics_offset = 0
var cosmetics_count = 0
for cosmetic_subtable in FreeRoamMaps.MapIndex[get_node("../").current_map]["stage"]["cosmetics"]:
for cosmetic_subtable in stage["cosmetics"]:
for cosmetic in cosmetic_subtable:
var cosmetic_adjustment = load("res://Scenes/GUI/Controls/CosmeticAdjustment.tscn").instantiate()
cosmetic_adjustment.vis_name = cosmetic
cosmetic_adjustment.options = cosmetic_subtable[cosmetic]
cosmetic_adjustment.scene_handle = "../../../../../../../"
cosmetic_adjustment.drop_index = FreeRoamMaps.MapIndex[get_node("../").current_map]["stage"]["cosmetic_defaults"][cosmetics_count]
cosmetic_adjustment.drop_index = stage["cosmetic_defaults"][cosmetics_count]
cosmetic_adjustment.position.y = cosmetics_offset
cosmetic_adjustment.anchor_right = 1.0
cosmetics_offset += 44
cosmetics_count += 1
$CosmeticsScreen/DialogPanel/InvisibleMask/CosmeticsHandle.add_child(cosmetic_adjustment)
$CosmeticsScreen/DialogPanel/VScrollBar.max_value = cosmetics_count - 1
var rows_offset = 0
var flows_offset = 0
var flow_count = 0
for bit_number in stage["bit_mapping"]:
var bot = stage["bit_mapping"][bit_number]["bot"]
var movement = stage["bit_mapping"][bit_number]["movement"]
var in_flow = stage["bit_mapping"][bit_number]["flow_in"]
var out_flow = stage["bit_mapping"][bit_number]["flow_out"]
in_flows.push_back(in_flow)
out_flows.push_back(out_flow)
if (in_flow is not String):
var flow_control = load("res://Scenes/GUI/Controls/FlowControl.tscn").instantiate()
flow_control.position.y = flows_offset
flow_control.name = str(bit_number) + bot + movement + get_node("../").current_map
flow_control.vis_name = bot + " " + movement
flow_control.in_value = in_flow
flow_control.out_value = out_flow
flow_control.anchor_right = 1.0
$FlowControlsScreen/DialogPanel/InvisibleMask/FlowHandle.add_child(flow_control)
flows_offset += 44
flow_count += 1
$FlowControlsScreen/DialogPanel/VScrollBar.max_value = flow_count - 1
func _on_exit_button_pressed() -> void:
get_tree().quit()
func _on_exit_menu_button_pressed() -> void:
get_tree().change_scene_to_file("res://Scenes/GUI/MainMenu.tscn")
func _on_flow_controls_button_pressed() -> void:
$BG.visible = false
$FlowControlsScreen.visible = true
func _on_cosmetics_button_pressed() -> void:
$BG.visible = false
$CosmeticsScreen.visible = true
func _on_load_show_button_pressed() -> void:
$BG.visible = false
func _on_return_button_pressed() -> void:
get_node("../").interact = true
get_node("../").capture_mouse()
visible = false
func _on_input_eater_pressed() -> void:
$BG.visible = true
$CosmeticsScreen.visible = false
$FlowControlsScreen.visible = false
func _on_cosmetics_v_scroll_bar_value_changed(value: float) -> void:
$CosmeticsScreen/DialogPanel/InvisibleMask/CosmeticsHandle.position.y = value * -44
func _on_flow_v_scroll_bar_value_changed(value: float) -> void:
$FlowControlsScreen/DialogPanel/InvisibleMask/FlowHandle.position.y = value * -44