Scriptname _00E_PlayerFunctions extends Actor  

_00E_EnderalControls Property ControlRepository  Auto  

Float fDefaultHeadTrackTimerOldValue = 0.0
Float fStayHeadTrackTimerOldValue = 0.0

int function _GetScriptVersion() Global
	return 1
endFunction

Event OnInit()
	fDefaultHeadTrackTimerOldValue = Game.GetGameSettingFloat("fAIHoldDefaultHeadTrackTimer")
	fStayHeadTrackTimerOldValue = Game.GetGameSettingFloat("fAIStayonScriptHeadtrack")
	if ControlRepository == None
		ControlRepository = Game.GetForm(0x493C2) as _00E_EnderalControls
	endif
EndEvent

Event OnPlayerLoadGame()
	if ControlRepository == None
		ControlRepository = Game.GetForm(0x493C2) as _00E_EnderalControls
	endif
EndEvent

_00E_SkillControl function GetSkillControl() Global
	return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.SkillControl
endfunction

_00E_SympathyControl function GetSympathyControl() Global
	return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.SympathyControl
endfunction

_00E_SoundControl function GetSoundControl() Global
	return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.SoundControl
endfunction

_00E_VisionControl function GetVisionControl() Global
	return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.VisionControl
endfunction

_00E_FadeToBlackControl function GetFadeToBlackControl() Global
	return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.FadeToBlackControl
endfunction

_00E_TeleportControl function GetTeleportControl() Global
	return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.TeleportControl
endfunction

_00E_SafeItemRemove function GetSafeItemRemove() Global
	return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.SafeItemRemove
endfunction

_00E_BrawlControl function GetBrawlControl() Global
	return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.BrawlControl
endfunction

_00E_MiningControl function GetMiningControl() Global
	return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.MiningControl
endfunction

_00E_DigControl function GetDigControl() Global
	return (Game.GetForm(0x14) as _00E_PlayerFunctions).ControlRepository.DigControl
endfunction


;=====================================================================================
; Stop/restart random headtracking
;=====================================================================================

Function StopRandomHeadTracking()
    ; Raise "change headtrack target" timers a lot so the NPCs would stare at what the scene tells them, without randomly switching to the player or other NPCs
	Game.SetGameSettingFloat("fAIHoldDefaultHeadTrackTimer", 1000.0)
	Game.SetGameSettingFloat("fAIStayonScriptHeadtrack", 1000.0)
EndFunction

Function ResumeRandomHeadTracking()
	Game.SetGameSettingFloat("fAIHoldDefaultHeadTrackTimer", fDefaultHeadTrackTimerOldValue)
	Game.SetGameSettingFloat("fAIStayonScriptHeadtrack", fStayHeadTrackTimerOldValue)
EndFunction