Hithurtboxes

This commit is contained in:
Twirpytherobot
2025-11-21 23:53:28 +00:00
parent 2ec7d56511
commit 10cc8720b7
16 changed files with 416 additions and 100 deletions
+27
View File
@@ -0,0 +1,27 @@
extends Area3D
class_name HurtBox
## A component that receives damage from HitBoxes
## Attach to any entity that can be damaged (players, enemies, destructibles)
## NOTE: This is a passive detection zone - HitBox handles the collision detection
## The entity that owns this hurtbox (should be a BaseUnit or similar)
@export var owner_entity: Node = null
func _ready():
# Auto-find owner if not set (traverse up to find BaseUnit)
if owner_entity == null:
var parent = get_parent()
while parent:
if parent is BaseUnit:
owner_entity = parent
break
parent = parent.get_parent()
# Configure collision - hurtboxes are on layer 5, detect nothing (passive)
collision_layer = 16 # Layer 5 (hurtbox)
collision_mask = 0 # Don't detect anything - hitboxes detect us
# Ensure we can be detected but don't detect others
monitorable = true
monitoring = false