extends Node


# Declare member variables here. Examples:
# var a = 2
# var b = "text"


# Called when the node enters the scene tree for the first time.
var root
var skel
var garments = ["female-panties1", "female-bra1"]
var basedir = "res://scenes/clothes/"
var material = preload("res://scenes/clothes/cloth.material")
func _init():
	root = get_parent()
	assert(root.has_meta("skeleton"))
	root.add_to_group("sacrifice")
	call_deferred("setup_markers")
	characters.call_deferred("setup_garments", root, garments, [], material)
		
func setup_markers():
	var cmdq = []
	if root.has_meta("cmdqueue"):
		cmdq = root.get_meta("cmdqueue")
	cmdq.push_back(["hide_marker", "head/marker_talk"])
	cmdq.push_back(["hide_marker", "head/marker_hips_action"])
#	cmdq.push_back(["register_marker", self, "hips/marker_dagger_sacrifice",
#		{
#			"method": "dagger_sacrifice"
#		}
#	])
#	cmdq.push_back(["hide_marker", "hips/marker_dagger_sacrifice"])
	cmdq.push_back(["anim_state", "sacrifice"])
	root.set_meta("cmdqueue", cmdq)
func _process(delta):
	if !skel:
		skel = root.get_meta("skeleton")
#	var sacrifice_marker = skel.get_node("hips/marker_dagger_sacrifice")
#	if sacrifice_marker.visible && !inventory.items.s_dagger:
#		sacrifice_marker.hide()
#	elif !sacrifice_marker.visible && inventory.items.s_dagger:
#		sacrifice_marker.show()

#func dagger_sacrifice(data):
#	print("dagger sacrifice")
#	var cmdq = []
#	var other = get_viewport().get_camera().get_meta("player")
#	if other.has_meta("cmdqueue"):
#		cmdq = other.get_meta("cmdqueue")
#	cmdq.push_back(["anim_param", "blade_right/blend_amount", 1.0])
#	cmdq.push_back(["equip", "wrist_r/weapon_right", "s_dagger"])
#	other.set_meta("cmdqueue", cmdq)
#	group_manager.submit_player_npc_event_arot(root, "sacrificed-a", root, "sacrificed", root)
