Bull roll ability, console screen, tests

This commit is contained in:
2026-07-28 23:10:38 +03:00
parent a0b248748c
commit ebb6ec6335
16 changed files with 1494 additions and 283 deletions
+69 -9
View File
@@ -7,7 +7,12 @@ signal any_changed(key: String, value: Variant)
const SAVE_PATH := "user://debug_params.cfg"
# _params holds the full metadata (min/max/step/default/section/type) and is the
# authority the debug menu reads. _values is a flat key→value mirror so the hot
# f()/b() reads — called dozens of times per matador per physics frame — cost a
# single hash lookup instead of a nested dict access. Every write updates both.
var _params: Dictionary = {}
var _values: Dictionary = {}
func _ready() -> void:
@@ -112,12 +117,19 @@ func _register_all() -> void:
_reg_f("Matador", "mat_commit_dist", 2.5, 0.5, 6.0, 0.1)
_reg_f("Matador", "mat_step_speed", 3.5, 2.0, 20.0)
_reg_f("Matador", "mat_step_duration", 0.35, 0.1, 1.0, 0.05)
_reg_f("Matador", "mat_dodge_cooldown", 5.0, 0.5, 12.0, 0.25)
_reg_f("Matador", "mat_dodge_chance", 0.25, 0.0, 1.0, 0.05)
# How strongly the sidestep biases toward the bull so the blade sweeps through
# its path during the pass (0 = pure lateral dodge, 1 = straight at the bull).
_reg_f("Matador", "mat_pass_lunge", 0.35, 0.0, 1.0, 0.05)
_reg_f("Matador", "mat_dodge_cooldown", 2.5, 0.5, 12.0, 0.25)
_reg_f("Matador", "mat_dodge_chance", 0.55, 0.0, 1.0, 0.05)
_reg_f("Matador", "mat_attack_range", 8.0, 2.0, 20.0)
_reg_f("Matador", "mat_attack_speed", 5.5, 1.0, 12.0)
_reg_f("Matador", "mat_attack_duration", 1.8, 0.5, 5.0, 0.1)
_reg_f("Matador", "mat_attack_min_dist", 2.5, 0.5, 6.0, 0.1)
_reg_f("Matador", "mat_attack_min_dist", 3.0, 0.5, 6.0, 0.1)
# Forward drive during the opening of a melee swing — turns the stationary stab
# into an estocada lunge so the blade covers ground toward the bull.
_reg_f("Matador", "mat_lunge_speed", 9.0, 0.0, 20.0)
_reg_f("Matador", "mat_lunge_time", 0.18, 0.0, 0.6, 0.01)
_reg_f("Matador", "mat_roll_chance", 0.35, 0.0, 1.0, 0.05)
_reg_f("Matador", "mat_roll_duration", 0.45, 0.1, 1.5, 0.05)
# Playback rate of the Draw_weapon clip used for both drawing and sheathing —
@@ -174,8 +186,35 @@ func _register_all() -> void:
_reg_f("Abilities", "slam_strength", 14.0, 1.0, 30.0)
_reg_f("Abilities", "dash_cooldown", 2.0, 0.5, 10.0, 0.1)
_reg_f("Abilities", "dash_speed", 66.0, 5.0, 200.0)
# ── Debug ─────────────────────────────────────────────────────────────────
_reg_b("Debug", "show_collisions", false)
# ── Roll (boulder charge) ─────────────────────────────────────────────────
# A held-momentum roll: inherits your current charge, ramps toward roll_max_speed,
# and RICOCHETS off walls with a speed boost (bank shots build ludicrous speed).
_reg_f("Roll", "roll_cooldown", 3.0, 0.5, 15.0, 0.1)
_reg_f("Roll", "roll_duration", 2.5, 0.5, 6.0, 0.1)
_reg_f("Roll", "roll_min_speed", 30.0, 5.0, 120.0) # launch floor (combines charge)
_reg_f("Roll", "roll_max_speed", 95.0, 10.0, 200.0) # natural top from acceleration
_reg_f("Roll", "roll_accel", 55.0, 0.0, 300.0)
# Per-second speed retained above roll_max_speed — low friction so wall-boosted
# momentum bleeds off slowly rather than snapping back to the cruise speed.
_reg_f("Roll", "roll_momentum", 0.9, 0.1, 0.99, 0.01)
_reg_f("Roll", "roll_turn", 3.5, 0.2, 20.0) # steer rate (sluggish = momentum feel)
_reg_f("Roll", "roll_wall_boost", 1.25, 1.0, 2.0, 0.05) # speed × on each ricochet
_reg_f("Roll", "roll_wall_cap", 150.0, 10.0, 300.0) # ceiling reachable via boosts
_reg_f("Roll", "roll_hit_radius", 2.4, 0.5, 6.0, 0.1)
_reg_f("Roll", "roll_hit_strength", 22.0, 1.0, 40.0)
_reg_f("Roll", "roll_hit_up", 4.5, 0.0, 15.0)
# ── Debug overlays (see debug_draw.gd) ───────────────────────────────────
_reg_b("Debug", "show_collisions", false)
_reg_b("Debug", "show_hitboxes", false)
_reg_b("Debug", "show_bones", false)
_reg_b("Debug", "show_raycasts", false)
_reg_b("Debug", "show_tail", false)
_reg_b("Debug", "show_stats", false)
_reg_b("Debug", "show_states", false)
_reg_b("Debug", "show_animation_name", false)
_reg_b("Debug", "show_wireframe", false)
_reg_b("Debug", "show_grid", false)
_reg_b("Debug", "show_axes", false)
func _reg_f(section: String, key: String, default: float,
@@ -189,6 +228,7 @@ func _reg_f(section: String, key: String, default: float,
"max": max_val,
"step": step,
}
_values[key] = default
func _reg_b(section: String, key: String, default: bool) -> void:
@@ -198,26 +238,28 @@ func _reg_b(section: String, key: String, default: bool) -> void:
"section": section,
"type": TYPE_BOOL,
}
_values[key] = default
## Read a float param. Panics on unknown key — intentional: typos should be loud.
func f(key: String) -> float:
return _params[key]["value"] as float
return _values[key] as float
## Read a bool param.
func b(key: String) -> bool:
return _params[key]["value"] as bool
return _values[key] as bool
func set_value(key: String, value: Variant) -> void:
if not _params.has(key):
return
_params[key]["value"] = value
_values[key] = value
any_changed.emit(key, value)
## Returns the full metadata dict — used by DebugMenu to build UI.
## Returns the full metadata dict — used by Console to build UI.
func get_all() -> Dictionary:
return _params
@@ -243,9 +285,27 @@ func load_saved() -> void:
if p["type"] == TYPE_FLOAT:
val = clampf(val as float, p["min"] as float, p["max"] as float)
_params[key]["value"] = val
_values[key] = val
func reset_all() -> void:
for key: String in _params:
_params[key]["value"] = _params[key]["default"]
var default: Variant = _params[key]["default"]
_params[key]["value"] = default
_values[key] = default
any_changed.emit("__all__", null)
## Reset a single param to its default. No-op on unknown key.
func reset(key: String) -> void:
if not _params.has(key):
return
var default: Variant = _params[key]["default"]
_params[key]["value"] = default
_values[key] = default
any_changed.emit(key, default)
## True when the param currently differs from its registered default.
func is_modified(key: String) -> bool:
return _params.has(key) and _params[key]["value"] != _params[key]["default"]