Scriptname _00E_FailsaveTorchScript extends ObjectReference  
{Reequips Calia's torch and fixes the game for cheaters. 
Added the latter because people tend to not unlock the door with the respective key but with console commands.
Therefore the quest wouldn't progress properly (missed vision etc).}

Event OnTriggerEnter(ObjectReference akActionRef)

	If (akActionRef == _00E_MC_CaliaREF && _00E_MC_CaliaREF.IsEquipped(Torch01) == false)
		MQ11a.CaliaEquipTorch(True)
	EndIf
	
	If (akActionRef == PlayerREF && PlayerRef.GetItemCount(MQ11a_SC13_DissectingRoomKey) == 0)
		int iIndex = _00E_MQ11a_CheaterKeyMessage.Show()
		If iIndex == 0
			CheaterDoorREF.Activate(PlayerREF)
		Else
			PlayerREF.MoveTo(CheaterKeyMarkerREF)
		EndIf
		Game.DisablePlayerControls()
		RegisterForSingleUpdate(2)
	EndIf
	
EndEvent

Event OnUpdate()
	LockCheaterDoorREF.Lock()
	Game.EnablePlayerControls()
EndEvent

ObjectReference Property CheaterDoorREF Auto
ObjectReference Property LockCheaterDoorREF Auto
ObjectReference Property CheaterKeyMarkerREF Auto
Key Property MQ11a_SC13_DissectingRoomKey Auto
Message Property _00E_MQ11a_CheaterKeyMessage Auto
_00E_MQ11a_Functions Property MQ11a Auto
Actor Property PlayerREF Auto
Actor Property _00E_MC_CaliaREF Auto
Light Property Torch01 Auto