27 lines
587 B
GDScript
27 lines
587 B
GDScript
class_name FusePickup
|
|
extends Node3D
|
|
|
|
|
|
@export var power_box: PowerBox
|
|
|
|
var world: World
|
|
|
|
@onready var pickup_interaction: PickupInteraction = $PickupInteraction
|
|
@onready var world_proxy: WorldProxy = $WorldProxy
|
|
|
|
|
|
func _ready() -> void:
|
|
world = await world_proxy.wait_for_world()
|
|
|
|
if InstancePersister.new(self, world).get_property(&"is_collected", false):
|
|
queue_free()
|
|
return
|
|
|
|
pickup_interaction.picked_up.connect(_on_picked_up)
|
|
|
|
|
|
func _on_picked_up() -> void:
|
|
power_box.on_fuse_picked_up()
|
|
InstancePersister.new(self, world).set_property(&"is_collected", true)
|
|
queue_free()
|