If node has no variable then look for variable from another node. Possible?

Godot Version

4.5

Question

Some of my player_weapons have Area3D as parent and some as child, they both have damage variable. Is it possible to code something like this

func _on_area_3d_area_entered(area: Area3D) → void:
if area.is_in_group(“player_weapon”):
apply_damage(area.damage)

or if area.is_in_group(“player_weapon”):
apply_damage(area.get_parent().damage)

You may need to use different groups or metadata; it’s probably best to make your weapons consistent though.

Thanks, I just re-made it consistent.