Scriptname KA_RevKonahBustKey extends ObjectReference  

armor property ArmorDragonPriestMaskUltraHelmet auto
objectReference property myBustActivator auto
objectReference property INVwall auto
message property defaultLackTheItemMSG auto

string property openAnim = "open" auto
{animation to play when opening}
string property closeAnim = "close" auto
{animation to play when closing}
string property openEvent = "opening" auto
{open event name - waits for this event before considering itself "open"}
string property closeEvent = "closing" auto
{close event name - waits for this event before considering itself "closed"}

bool placed = FALSE

Auto STATE waiting
EVENT onActivate(objectReference actronaut)
	if placed == FALSE
		if actronaut.getItemCount(ArmorDragonPriestMaskUltraHelmet) >= 1
			gotoState ("busy")
;			blockActivation()
			actronaut.removeItem(ArmorDragonPriestMaskUltraHelmet, 1)
			placed = TRUE
			myBustActivator.playAnimationandWait("on","TransOn")			
			Utility.Wait(1.0)
			INVwall.Disable()
;			getLinkedRef().playAnimationAndWait("open","opening")
			getLinkedRef().activate(self)
;			blockActivation(FALSE)
			gotoState ("waiting")
		else
			defaultLackTheItemMSG.show()
		endif
	elseif placed == TRUE
		gotoState ("busy")
;		blockActivation()
		actronaut.addItem(ArmorDragonPriestMaskUltraHelmet, 1)
		placed = FALSE
		myBustActivator.playAnimationAndWait("off","TransOff")
;		getLinkedRef().playAnimationAndWait("close","closing")
		getLinkedRef().activate(self)
		INVwall.Enable()	
;		blockActivation(FALSE)
		gotoState ("waiting")
	endif	
endEVENT
endSTATE

STATE busy
	EVENT onActivate (objectReference triggerRef)
			;do nothing
	endEVENT
endSTATE