Complete the DamageEvent migration: one deal() entry point for every attacker
The bull's Hitbox already routed through DamageEvent, but the spear, the bear's maul, and the matador's reach-gore still did raw Object.call(&"take_sword_hit", ...) — the exact scattered string paths DamageEvent was meant to retire. Add a single static DamageEvent.deal(target, cause, at, source, knock_up) that builds the typed event and hands it to receive_damage(), falling back to the legacy string call for any not-yet-migrated victim, and route all four attackers (Hitbox included) through it. The damage_pipeline characterization test proves the bull's outcomes are unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pq1VX2o1ZfiNRdCjD294wf
This commit is contained in:
@@ -80,17 +80,8 @@ func _apply_hit(body: Node3D) -> void:
|
||||
return
|
||||
_hit_this_swing[body] = true
|
||||
_did_hit = true
|
||||
if body.has_method(&"receive_damage"):
|
||||
var event := DamageEvent.make(DamageEvent.cause_from(damage_cause), body.global_position, self)
|
||||
if knock_up > 0.0:
|
||||
event.knock_up = _knock_up_for(body)
|
||||
body.call(&"receive_damage", event)
|
||||
else:
|
||||
body.call(&"take_sword_hit", damage_cause)
|
||||
if knock_up > 0.0:
|
||||
var v := _knock_up_for(body)
|
||||
if v > 0.0:
|
||||
body.call(&"apply_knock_up", v)
|
||||
var ku := _knock_up_for(body) if knock_up > 0.0 else 0.0
|
||||
DamageEvent.deal(body, DamageEvent.cause_from(damage_cause), body.global_position, self, ku)
|
||||
|
||||
|
||||
# Scale the pop by how far the body is from this hitbox's origin (planar). See the export docs.
|
||||
|
||||
Reference in New Issue
Block a user