feat: add test_level_builder script for debugging level generation
This commit is contained in:
@@ -7,6 +7,7 @@ class_name TestLevelBuilder
|
|||||||
var _speed_label: Label
|
var _speed_label: Label
|
||||||
var _state_label: Label
|
var _state_label: Label
|
||||||
var _chain_label: Label
|
var _chain_label: Label
|
||||||
|
var _weapon_label: Label
|
||||||
var _player: CharacterBody3D
|
var _player: CharacterBody3D
|
||||||
|
|
||||||
|
|
||||||
@@ -458,6 +459,35 @@ func _build_hud() -> void:
|
|||||||
help.add_theme_color_override("font_color", Color(0.8, 0.8, 0.8, 0.7))
|
help.add_theme_color_override("font_color", Color(0.8, 0.8, 0.8, 0.7))
|
||||||
help_panel.add_child(help)
|
help_panel.add_child(help)
|
||||||
|
|
||||||
|
# ── Weapon & Ammo Panel ───────────────────────────────────────────────
|
||||||
|
var wp_panel := PanelContainer.new()
|
||||||
|
wp_panel.name = "WeaponPanel"
|
||||||
|
wp_panel.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
|
||||||
|
wp_panel.offset_left = -250
|
||||||
|
wp_panel.offset_top = -100
|
||||||
|
wp_panel.offset_right = -20
|
||||||
|
wp_panel.offset_bottom = -20
|
||||||
|
var wp_style := StyleBoxFlat.new()
|
||||||
|
wp_style.bg_color = Color(0, 0, 0, 0.6)
|
||||||
|
wp_style.corner_radius_top_left = 8
|
||||||
|
wp_style.corner_radius_top_right = 8
|
||||||
|
wp_style.corner_radius_bottom_left = 8
|
||||||
|
wp_style.corner_radius_bottom_right = 8
|
||||||
|
wp_style.content_margin_left = 16
|
||||||
|
wp_style.content_margin_top = 12
|
||||||
|
wp_style.content_margin_right = 16
|
||||||
|
wp_style.content_margin_bottom = 12
|
||||||
|
wp_panel.add_theme_stylebox_override("panel", wp_style)
|
||||||
|
canvas.add_child(wp_panel)
|
||||||
|
|
||||||
|
_weapon_label = Label.new()
|
||||||
|
_weapon_label.name = "WeaponLabel"
|
||||||
|
_weapon_label.text = "Unarmed\n0 / 0"
|
||||||
|
_weapon_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
||||||
|
_weapon_label.vertical_alignment = VERTICAL_ALIGNMENT_BOTTOM
|
||||||
|
_weapon_label.add_theme_font_size_override("font_size", 24)
|
||||||
|
wp_panel.add_child(_weapon_label)
|
||||||
|
|
||||||
|
|
||||||
# ── Utility: Key Name ─────────────────────────────────────────────────────────
|
# ── Utility: Key Name ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -497,3 +527,30 @@ func _process(_delta: float) -> void:
|
|||||||
var sm = _player.get_node_or_null("MovementStateMachine")
|
var sm = _player.get_node_or_null("MovementStateMachine")
|
||||||
if sm:
|
if sm:
|
||||||
_chain_label.text = "Chain: %d (+%d%%)" % [sm.chain_count, int(sm.current_chain_bonus * 100)]
|
_chain_label.text = "Chain: %d (+%d%%)" % [sm.chain_count, int(sm.current_chain_bonus * 100)]
|
||||||
|
|
||||||
|
if _weapon_label:
|
||||||
|
var wman = _player.get_node_or_null("HeadPivot/Camera3D/WeaponManager")
|
||||||
|
if wman and wman.weapons.has(wman.active_slot):
|
||||||
|
var active_weapon = wman.weapons[wman.active_slot]
|
||||||
|
var w_name = "Weapon"
|
||||||
|
var cur_ammo = 0
|
||||||
|
var max_ammo = 0
|
||||||
|
|
||||||
|
if "weapon_name" in active_weapon:
|
||||||
|
w_name = active_weapon.weapon_name
|
||||||
|
elif active_weapon is DoubleBarrelShotgun:
|
||||||
|
w_name = "Double Barrel Shotgun"
|
||||||
|
|
||||||
|
if "current_ammo" in active_weapon:
|
||||||
|
cur_ammo = active_weapon.current_ammo
|
||||||
|
max_ammo = active_weapon.max_ammo
|
||||||
|
elif "shells" in active_weapon:
|
||||||
|
cur_ammo = active_weapon.shells
|
||||||
|
max_ammo = 2
|
||||||
|
|
||||||
|
if "reloading" in active_weapon and active_weapon.reloading:
|
||||||
|
_weapon_label.text = "%s\nReloading..." % w_name
|
||||||
|
else:
|
||||||
|
_weapon_label.text = "%s\n%d / %d" % [w_name, cur_ammo, max_ammo]
|
||||||
|
else:
|
||||||
|
_weapon_label.text = "Unarmed\n0 / 0"
|
||||||
|
|||||||
Reference in New Issue
Block a user