extends Node

@export var CursorBullet: PackedScene
@export var max_ammo = 30
var ammo = max_ammo

func activate(world, activator):
	var target: Vector2 = activator.get_target_pos()
	var bullet = CursorBullet.instantiate()
	world.add_child(bullet)
	bullet.position = activator.position
	bullet.look_at(target)
	if activator.get_collision_layer_bit(1): # player object
		bullet.set_collision_layer_bit(1, false)
		bullet.set_collision_layer_bit(2, true)
		ammo -= 1
	elif activator.get_collision_layer_bit(2): # enemy object
		bullet.set_collision_layer_bit(1, true)
		bullet.set_collision_layer_bit(2, false)
	else:
		assert(false, "who are you, activator?")

func discard(world, activator):
	pass
