extends Node

@export var RocketProjectile: PackedScene

func activate(world, activator):
	var rocket = RocketProjectile.instantiate()
	var target = activator.get_target_pos()
	rocket.position = activator.position
	rocket.look_at(target)
	if activator.get_collision_layer_value(1): # player object
		rocket.get_node("Area2D").set_collision_layer_value(1, false)
		rocket.get_node("Area2D").set_collision_layer_value(2, true)
	elif activator.get_collision_layer_value(2): # enemy object
		rocket.get_node("Area2D").set_collision_layer_value(1, true)
		rocket.get_node("Area2D").set_collision_layer_value(2, false)
	else:
		assert(false, "who are you, activator?")
	world.add_child(rocket)

func discard(world, activator):
	pass
