Route the bull's hits through the typed DamageEvent pipeline
Hitbox now builds a DamageEvent (cause + hit position + shaped knock-up) and calls the bull's new receive_damage(), instead of two stringly Object.call()s. receive_damage adapts over the existing pip/knock-up logic so behaviour is identical -- the characterization test drives both the string and typed paths and asserts the same outcomes. Wire fx/damage/harness tests into run_tests.sh + CLAUDE.md. All hitbox guard tests green (stab, bear hitbox, ram, charge). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CmG3mQGVXZUPDVapmdbWZ1
This commit is contained in:
@@ -87,6 +87,24 @@ func _run() -> void:
|
||||
bull.call(&"apply_knock_up", 8.0)
|
||||
_ok(is_equal_approx(float((bull.get(&"velocity") as Vector3).y), 8.0), "a larger knock_up raises it further")
|
||||
|
||||
# The typed pipeline (Hitbox → DamageEvent → receive_damage) must produce identical outcomes to
|
||||
# the string path it now wraps.
|
||||
_last_hp = -1
|
||||
bull.set(&"_hp", 3)
|
||||
bull.set(&"_dead", false)
|
||||
bull.set(&"_hit_iframes", 0.0)
|
||||
bull.set(&"velocity", Vector3.ZERO)
|
||||
bull.call(&"receive_damage", DamageEvent.make(DamageEvent.Cause.MAULED, Vector3.ZERO))
|
||||
_ok(int(bull.get(&"_hp")) == 2, "receive_damage removes a pip like take_sword_hit")
|
||||
_ok(_last_hp == 2, "receive_damage emits health_changed with the new pip count")
|
||||
|
||||
bull.set(&"_hit_iframes", 0.0)
|
||||
bull.set(&"velocity", Vector3.ZERO)
|
||||
var popping := DamageEvent.make(DamageEvent.Cause.SLAMMED, Vector3.ZERO)
|
||||
popping.knock_up = 6.0
|
||||
bull.call(&"receive_damage", popping)
|
||||
_ok(is_equal_approx(float((bull.get(&"velocity") as Vector3).y), 6.0), "receive_damage applies the event's knock_up")
|
||||
|
||||
_finish()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user