2024-08-31 14:58:41 +02:00
|
|
|
## FreeFTF
|
|
|
|
## Copyright (C) 2024 Interstellar Development
|
2024-08-04 13:42:00 +02:00
|
|
|
##
|
2024-08-31 14:58:41 +02:00
|
|
|
## This program is free software: you can redistribute it and/or modify
|
|
|
|
## it under the terms of the GNU General Public License as published by
|
|
|
|
## the Free Software Foundation, either version 3 of the License, or
|
|
|
|
## (at your option) any later version.
|
2024-08-04 13:42:00 +02:00
|
|
|
##
|
2024-08-31 14:58:41 +02:00
|
|
|
## This program is distributed in the hope that it will be useful,
|
|
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
## GNU General Public License for more details.
|
2024-08-04 13:42:00 +02:00
|
|
|
##
|
2024-08-31 14:58:41 +02:00
|
|
|
## You should have received a copy of the GNU General Public License
|
|
|
|
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2024-08-04 13:42:00 +02:00
|
|
|
|
2024-08-04 13:41:19 +02:00
|
|
|
extends StaticBody3D
|
|
|
|
|
|
|
|
var trapped_body
|
|
|
|
var occupied = false
|
|
|
|
var living = true
|
|
|
|
|
2024-08-08 21:49:24 +02:00
|
|
|
func _process(_delta):
|
2024-08-06 23:28:40 +02:00
|
|
|
if occupied and trapped_body.hp == 0 and living:
|
|
|
|
Game.died()
|
2024-08-04 13:41:19 +02:00
|
|
|
living = false
|
2024-08-06 11:13:52 +02:00
|
|
|
$dead.show()
|
2024-08-13 22:12:37 +02:00
|
|
|
$Sprite3D.hide()
|
|
|
|
elif occupied:
|
|
|
|
trapped_body.position = global_position
|
|
|
|
$Sprite3D.show()
|
2024-08-31 14:58:41 +02:00
|
|
|
else:
|
|
|
|
$Sprite3D.hide()
|
2024-08-04 13:41:19 +02:00
|
|
|
|
|
|
|
func _on_area_3d_body_entered(body):
|
2024-08-05 22:35:50 +02:00
|
|
|
if body is CharacterBody3D:
|
|
|
|
if body.beast and body.got_person and !occupied:
|
|
|
|
trapped_body = body.caught_body
|
|
|
|
occupied = true
|
|
|
|
living = true
|
|
|
|
body.lost_one()
|
|
|
|
trapped_body.frozen()
|
2024-08-06 23:28:40 +02:00
|
|
|
Game.freeze()
|
2024-08-05 22:35:50 +02:00
|
|
|
elif !body.beast and occupied and living and body != trapped_body:
|
|
|
|
trapped_body.unfreeze()
|
2024-08-06 23:28:40 +02:00
|
|
|
Game.unfreeze()
|
2024-08-05 22:35:50 +02:00
|
|
|
occupied = false
|
2024-08-06 11:13:52 +02:00
|
|
|
trapped_body.position = $spawn.global_position
|
2024-08-05 22:35:50 +02:00
|
|
|
trapped_body = null
|
2024-08-04 13:41:19 +02:00
|
|
|
|
|
|
|
func _on_timer_timeout():
|
|
|
|
if occupied and living:
|
2024-08-24 14:44:33 +02:00
|
|
|
trapped_body.hp -= 1
|