class ChestPressController extends ScriptableDeviceComponent
{

	public const override function GetPS() : ChestPressControllerPS
	{
		return ( ( ChestPressControllerPS )( GetBasePS() ) );
	}

}

class ChestPressControllerPS extends ScriptableDeviceComponentPS
{
	default m_deviceName = "LocKey#601";
	default m_tweakDBRecord = T"Devices.ChestPress";
	default m_tweakDBDescriptionRecord = T"device_descriptions.ChestPress";
	protected instanceeditable inlined var m_chestPressSkillChecks : EngDemoContainer;
	private instanceeditable var m_factOnQHack : CName;
	private var m_wasWeighHacked : Bool;

	protected override function GameAttached() {}

	protected override function GetSkillCheckContainerForSetup() : BaseSkillCheckContainer
	{
		return m_chestPressSkillChecks;
	}

	public function PushPersistentData() {}

	public function GetFactOnQHack() : CName
	{
		return m_factOnQHack;
	}

	protected function ActionChestPressWeightHack() : ChestPressWeightHack
	{
		var action : ChestPressWeightHack;
		action = new ChestPressWeightHack;
		action.clearanceLevel = DefaultActionsParametersHolder.GetInteractiveClearance();
		action.SetUp( this );
		action.SetProperties();
		action.AddDeviceName( m_deviceName );
		action.CreateInteraction();
		return action;
	}

	protected function ActionE3Hack_QuestPlayAnimationWeightLift() : E3Hack_QuestPlayAnimationWeightLift
	{
		var action : E3Hack_QuestPlayAnimationWeightLift;
		action = new E3Hack_QuestPlayAnimationWeightLift;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties();
		action.AddDeviceName( m_deviceName );
		return action;
	}

	protected function ActionE3Hack_QuestPlayAnimationKillNPC() : E3Hack_QuestPlayAnimationKillNPC
	{
		var action : E3Hack_QuestPlayAnimationKillNPC;
		action = new E3Hack_QuestPlayAnimationKillNPC;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties();
		action.AddDeviceName( m_deviceName );
		return action;
	}

	protected const override function CanCreateAnyQuickHackActions() : Bool
	{
		return true;
	}

	protected override function GetQuickHackActions( out actions : array< DeviceAction >, const context : ref< GetActionsContext > )
	{
		var currentAction : ScriptableDeviceAction;
		currentAction = ActionChestPressWeightHack();
		currentAction.SetObjectActionID( T"DeviceAction.OverloadClassHack" );
		currentAction.SetInactiveWithReason( !( m_wasWeighHacked ), "LocKey#7004" );
		actions.PushBack( currentAction );
		FinalizeGetQuickHackActions( actions, context );
	}

	public override function GetQuestActionByName( actionName : CName ) : DeviceAction
	{
		var action : DeviceAction;
		action = super.GetQuestActionByName( actionName );
		if( action == NULL )
		{
			switch( actionName )
			{
				case 'E3Hack_QuestPlayAnimationWeightLift':
					action = ActionE3Hack_QuestPlayAnimationWeightLift();
				break;
				case 'E3Hack_QuestPlayAnimationKillNPC':
					action = ActionE3Hack_QuestPlayAnimationKillNPC();
				break;
			}
		}
		return action;
	}

	protected override function GetQuestActions( out outActions : array< DeviceAction >, const context : ref< GetActionsContext > )
	{
		super.GetQuestActions( outActions, context );
		outActions.PushBack( ActionE3Hack_QuestPlayAnimationWeightLift() );
		outActions.PushBack( ActionE3Hack_QuestPlayAnimationKillNPC() );
	}

	private function OnChestPressWeightHack( evt : ChestPressWeightHack ) : EntityNotificationType
	{
		m_wasWeighHacked = true;
		UseNotifier( evt );
		return EntityNotificationType.SendThisEventToEntity;
	}

	private constexpr function OnE3Hack_QuestPlayAnimationWeightLift( evt : E3Hack_QuestPlayAnimationWeightLift ) : EntityNotificationType
	{
		return EntityNotificationType.SendThisEventToEntity;
	}

	private constexpr function OnE3Hack_QuestPlayAnimationKillNPC( evt : E3Hack_QuestPlayAnimationKillNPC ) : EntityNotificationType
	{
		return EntityNotificationType.SendThisEventToEntity;
	}

}

class ChestPressWeightHack extends ActionBool
{

	public function SetProperties()
	{
		actionName = 'ChestPressWeightHack';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Bool( actionName, true, 'LocKey#600', 'LocKey#600' );
	}

	public const override function GetInteractionIcon() : weak< ChoiceCaptionIconPart_Record >
	{
		return TweakDBInterface.GetChoiceCaptionIconPartRecord( T"ChoiceCaptionParts.DistractIcon" );
	}

	public constexpr static function IsAvailable( device : ScriptableDeviceComponentPS ) : Bool
	{
		return true;
	}

	public constexpr static function IsClearanceValid( clearance : Clearance ) : Bool
	{
		return true;
	}

	public constexpr static function IsContextValid( const context : ref< GetActionsContext > ) : Bool
	{
		return true;
	}

}

class E3Hack_QuestPlayAnimationWeightLift extends ActionBool
{

	public function SetProperties()
	{
		actionName = 'E3Hack_QuestPlayAnimationWeightLift';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Bool( actionName, true, 'E3Hack_QuestPlayAnimationWeightLift', 'E3Hack_QuestPlayAnimationWeightLift' );
	}

	public constexpr static function IsAvailable( device : ScriptableDeviceComponentPS ) : Bool
	{
		return true;
	}

	public constexpr static function IsClearanceValid( clearance : Clearance ) : Bool
	{
		return true;
	}

	public constexpr static function IsContextValid( const context : ref< GetActionsContext > ) : Bool
	{
		return true;
	}

}

class E3Hack_QuestPlayAnimationKillNPC extends ActionBool
{

	public function SetProperties()
	{
		actionName = 'E3Hack_QuestPlayAnimationKillNPC';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Bool( actionName, true, 'E3Hack_QuestPlayAnimationKillNPC', 'E3Hack_QuestPlayAnimationKillNPC' );
	}

	public constexpr static function IsAvailable( device : ScriptableDeviceComponentPS ) : Bool
	{
		return true;
	}

	public constexpr static function IsClearanceValid( clearance : Clearance ) : Bool
	{
		return true;
	}

	public constexpr static function IsContextValid( const context : ref< GetActionsContext > ) : Bool
	{
		return true;
	}

}

