2024-07-23 00:25:52 +02:00
|
|
|
extends RigidBody3D
|
2017-08-30 01:53:01 +02:00
|
|
|
|
|
|
|
var life_span = 0
|
|
|
|
|
2017-09-13 16:59:33 +02:00
|
|
|
func _ready():
|
|
|
|
set_contact_monitor(true)
|
|
|
|
set_max_contacts_reported(5)
|
|
|
|
set_fixed_process(true)
|
2024-07-23 00:25:52 +02:00
|
|
|
connect("body_enter", Callable(self, "on_hit"))
|
2017-09-13 16:59:33 +02:00
|
|
|
|
2017-08-30 01:53:01 +02:00
|
|
|
func _fixed_process(delta):
|
|
|
|
life_span += delta
|
2017-09-13 16:59:33 +02:00
|
|
|
if life_span > 5:
|
|
|
|
print("removed shot")
|
|
|
|
remove_and_skip()
|
|
|
|
|
|
|
|
func on_hit(other):
|
|
|
|
# cannot remove node right here as this would break exec
|
2022-10-15 19:37:05 +02:00
|
|
|
life_span = 5
|