added keep shield ui onscreen option

This commit is contained in:
2026-02-10 19:56:01 +11:00
parent 1f91e0aef7
commit bb7e563e77
7 changed files with 77 additions and 9 deletions

View File

@@ -12,6 +12,7 @@ extends VBoxContainer
@export var self_damage: Button
@export var party_damage: Button
@export var status_damage: Button
@export var show_shield: Button
func _ready() -> void:
@@ -29,6 +30,7 @@ func _ready() -> void:
self_damage.button_pressed = Data.preferences.display_self_damage_indicators
party_damage.button_pressed = Data.preferences.display_party_damage_indicators
status_damage.button_pressed = Data.preferences.display_status_effect_damage_indicators
show_shield.button_pressed = Data.preferences.always_show_shield_ui
func save() -> void:
@@ -41,6 +43,7 @@ func save() -> void:
Data.preferences.display_self_damage_indicators = self_damage.button_pressed
Data.preferences.display_party_damage_indicators = party_damage.button_pressed
Data.preferences.display_status_effect_damage_indicators = status_damage.button_pressed
Data.preferences.always_show_shield_ui = show_shield.button_pressed
func _on_mouse_sens_spin_box_value_changed(value: float) -> void:

View File

@@ -4,7 +4,7 @@
[sub_resource type="ImageTexture" id="ImageTexture_03x6q"]
[node name="Gameplay" type="VBoxContainer" unique_id=9533751 node_paths=PackedStringArray("resolution_drop_down", "look_sens_slider", "look_sens_input", "toggle_sprint_checkbox", "invert_lookY", "invert_lookX", "fixed_minimap", "tower_damage", "self_damage", "party_damage", "status_damage")]
[node name="Gameplay" type="VBoxContainer" unique_id=9533751 node_paths=PackedStringArray("resolution_drop_down", "look_sens_slider", "look_sens_input", "toggle_sprint_checkbox", "invert_lookY", "invert_lookX", "fixed_minimap", "tower_damage", "self_damage", "party_damage", "status_damage", "show_shield")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
@@ -22,6 +22,7 @@ tower_damage = NodePath("FloatingDamageIndicators/CenterContainer/HBoxContainer/
self_damage = NodePath("FloatingDamageIndicators/CenterContainer/HBoxContainer/SelfDamage")
party_damage = NodePath("FloatingDamageIndicators/CenterContainer/HBoxContainer/PartyDamage")
status_damage = NodePath("FloatingDamageIndicators/CenterContainer/HBoxContainer/StatusDamage")
show_shield = NodePath("AlwaysShowShield/CenterContainer/CheckButton")
[node name="Resolution" type="HBoxContainer" parent="." unique_id=1996706644]
layout_mode = 2
@@ -186,6 +187,23 @@ toggle_mode = true
button_pressed = true
text = "OPTION_STATUS_DAMAGE"
[node name="AlwaysShowShield" type="HBoxContainer" parent="." unique_id=745573840]
layout_mode = 2
[node name="Label" type="Label" parent="AlwaysShowShield" unique_id=856331565]
layout_mode = 2
size_flags_horizontal = 3
text = "OPTION_ALWAYS_SHOW_SHIELD"
horizontal_alignment = 1
vertical_alignment = 1
[node name="CenterContainer" type="CenterContainer" parent="AlwaysShowShield" unique_id=726349358]
layout_mode = 2
size_flags_horizontal = 3
[node name="CheckButton" type="CheckButton" parent="AlwaysShowShield/CenterContainer" unique_id=263220323]
layout_mode = 2
[connection signal="item_selected" from="Resolution/HBoxContainer/OptionButton" to="." method="_on_option_button_item_selected"]
[connection signal="value_changed" from="MouseSens/HBoxContainer/SpinBox" to="." method="_on_mouse_sens_spin_box_value_changed"]
[connection signal="value_changed" from="MouseSens/HBoxContainer/HSlider" to="." method="_on_mouse_sens_h_slider_value_changed"]

View File

@@ -17,14 +17,23 @@ var cell_tweens: Array[Tween] = []
func _ready() -> void:
for x: int in cells.size():
cell_tweens.append(null)
fade_timer.start()
fade_ui()
func take_damage(damage: int) -> void:
func show_ui() -> void:
if fade_tween:
fade_tween.kill()
fade_tween = null
modulate = Color.WHITE
func fade_ui() -> void:
if !Data.preferences.always_show_shield_ui:
fade_timer.start()
func take_damage(damage: int) -> void:
show_ui()
var damage_to_deal_with: int = min(damage, current_cell_health)
var remaining_damage: int = damage - damage_to_deal_with
var current_cell: int = ceili(float(health) / CELL_HEALTH)
@@ -60,7 +69,6 @@ func take_damage(damage: int) -> void:
cell_tweens[current_cell - 1].tween_callback(change_cell_color.bind(current_cell - 1, cell_level))
cell_tweens[current_cell - 1].tween_interval(0.07)
cell_tweens[current_cell - 1].tween_callback(func() -> void: hit_glow.visible = false)
fade_timer.start()
func change_cell_color(cell: int, color: int) -> void: