extends Node

@export var RocketProjectile: PackedScene
@export var max_ammo = 3
var ammo = max_ammo

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_bit(1): # player object
		rocket.set_collision_layer_bit(1, false)
		rocket.set_collision_layer_bit(2, true)
		ammo -= 1
	elif activator.get_collision_layer_bit(2): # enemy object
		rocket.set_collision_layer_bit(1, true)
		rocket.set_collision_layer_bit(2, false)
	else:
		assert(false, "who are you, activator?")
	

func discard(world, activator):
	pass
