forked from interstellar_development/freeftf
a92202b536
The freezer is now implemented, just as it worked in the original. There are also a few fixes here and there in preparation for Milestonr 4.
30 lines
690 B
GDScript
30 lines
690 B
GDScript
extends StaticBody3D
|
|
|
|
var trapped_body
|
|
var occupied = false
|
|
var living = true
|
|
|
|
func _process(delta):
|
|
if occupied:
|
|
trapped_body.position = position
|
|
if occupied and trapped_body.hp == 0:
|
|
living = false
|
|
|
|
func _on_area_3d_body_entered(body):
|
|
if body is StaticBody3D:
|
|
pass
|
|
elif body.beast and body.got_person and !occupied:
|
|
trapped_body = body.caught_body
|
|
occupied = true
|
|
living = true
|
|
body.lost_one()
|
|
trapped_body.frozen()
|
|
elif !body.beast and occupied and living and body != trapped_body:
|
|
trapped_body.unfreeze()
|
|
trapped_body._on_time_in_bag_timeout()
|
|
occupied = false
|
|
trapped_body = null
|
|
|
|
func _on_timer_timeout():
|
|
if occupied and living:
|
|
trapped_body.hp -= 2
|