Files
PacketsPlease/incoming_pipe.gd
Andreas Stadelmeier 24f253c450 Add Notes
2024-11-22 00:13:43 +01:00

42 lines
1.3 KiB
GDScript

extends Node3D
var packet_queue = []
var packet_scene = preload("res://Packet.tscn")
var arp_packet_info = preload("res://info_card.tscn")
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
var packet_container_scene = preload("res://packet_container.tscn")
func send_packet(packet : Node3D):
var new_packet = packet_container_scene.instantiate()
new_packet.add_child(packet)
if $SpawnQueue.is_colliding():
var collisionPoint = to_local($SpawnQueue.get_collision_point())
new_packet.position = collisionPoint
new_packet.position.z -= 2
else:
new_packet.position = $PacketSpawn.position
new_packet.constant_force = $IncomingVelocity/Target.global_position - $IncomingVelocity.global_position
new_packet.gravity_scale = 0
new_packet.continuous_cd = true
packet_queue.append(new_packet)
add_child(new_packet)
#$incomingPacketSound.play()
func _on_attractor_body_exited(body: Node3D) -> void:
if body is RigidBody3D:
body.constant_force = Vector3(0,0,0)
body.gravity_scale = 1