19 lines
783 B
GDScript
19 lines
783 B
GDScript
extends StaticBody3D
|
|
|
|
@onready var debris_generator: Node3D = get_tree().get_first_node_in_group("generator")
|
|
|
|
@export var stability = 2
|
|
|
|
func _process(_delta: float) -> void:
|
|
match stability:
|
|
1:
|
|
##Assumes decal is always 3rd child and checks if object has a decal
|
|
if self.get_children().size() > 2 and self.get_child(2) is Decal:
|
|
$Decal.visible = true
|
|
0:
|
|
if self.get_child(0).mesh is ArrayMesh:
|
|
debris_generator.generate_debris(self.global_position, self.get_child(0).get_aabb().size * self.scale, self.get_child(0).get_surface_override_material(0), "one_shot")
|
|
elif self.get_child(0).mesh is BoxMesh:
|
|
debris_generator.generate_debris(self.global_position, self.get_child(0).get_aabb().size, self.get_child(0).mesh.material, "one_shot")
|
|
queue_free()
|