2025-01-26 09:59:59 +00:00
|
|
|
extends Node3D
|
|
|
|
|
|
|
|
|
2025-01-26 13:39:11 +00:00
|
|
|
var owner_placeholder: CharacterBody3D = null
|
2025-01-26 09:59:59 +00:00
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready() -> void:
|
2025-01-26 13:39:11 +00:00
|
|
|
$Body/Armature/Skeleton3D.physical_bones_start_simulation()
|
|
|
|
owner_placeholder = _get_owner()
|
2025-01-26 09:59:59 +00:00
|
|
|
pass # Replace with function body.
|
|
|
|
|
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
func _process(delta: float) -> void:
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
func _on_head_collision_body_part_hit(dam: Variant) -> void:
|
2025-01-26 13:39:11 +00:00
|
|
|
#if owner_placeholder.has_method("take_damage"):
|
|
|
|
if owner_placeholder:
|
|
|
|
owner_placeholder.take_damage(dam)
|
2025-01-26 09:59:59 +00:00
|
|
|
pass # Replace with function body.
|
2025-01-26 13:39:11 +00:00
|
|
|
|
2025-02-01 17:03:00 +00:00
|
|
|
func _hit_detected(dam: Variant) -> void:
|
|
|
|
print("hit detected")
|
|
|
|
if owner_placeholder:
|
|
|
|
owner_placeholder.take_damage(dam)
|
|
|
|
|
2025-01-26 13:39:11 +00:00
|
|
|
func _get_owner() -> CharacterBody3D:
|
|
|
|
var owner_placeholder := find_parent("PlayerPlaceholder*")
|
|
|
|
return owner_placeholder
|
|
|
|
|
|
|
|
func die():
|
|
|
|
for child in $Body/Armature/Skeleton3D/PhysicalBoneSimulator3D.get_children():
|
|
|
|
if child is PhysicalBone3D:
|
|
|
|
child.collision_layer = 1
|
|
|
|
child.collision_mask = 1
|
|
|
|
$Body/Armature/Skeleton3D.physical_bones_stop_simulation()
|
|
|
|
$Body/Armature/Skeleton3D/PhysicalBoneSimulator3D.physical_bones_start_simulation()
|
|
|
|
|
|
|
|
func make_invisible():
|
|
|
|
$Body/Armature/Skeleton3D/Alpha_Joints.set_layer_mask_value(1, false)
|
|
|
|
$Body/Armature/Skeleton3D/Alpha_Surface.set_layer_mask_value(1, false)
|
|
|
|
$Body/Armature/Skeleton3D/Alpha_Joints.set_layer_mask_value(2, true)
|
|
|
|
$Body/Armature/Skeleton3D/Alpha_Surface.set_layer_mask_value(2, true)
|