extends Spatial

func _ready():
	var e = $Area.connect("body_entered", self, "weapon_pick")
	assert(e == OK)

func weapon_pick(body):
	if !body.is_in_group("npc"):
		return
	assert(body.has_meta("weapon"))
	assert(body.has_meta("action"))
#	print("weapon  picked")
	if !body.has_meta("action"):
		return
	if body.get_meta("weapon") == false:
		var action = body.get_meta("action")
		if action == "find_weapon":
			body.set_meta("weapon", true)
#			body.set_meta("action", "")
#			body.remove_meta("path")
#			body.remove_meta("path_valid")
#			body.remove_meta("target_loc")
#			body.remove_meta("target_group")
			queue_free()
#	if body.get_meta("weapon") == true:
#		var action = body.get_meta("action")
#		if action == "find_weapon":
#			body.set_meta("action", "")
#			body.remove_meta("path")
#			body.remove_meta("path_valid")
#			body.remove_meta("target_loc")
#			body.remove_meta("target_group")
		
			
