class C4 extends ExplosiveDevice { default m_controllerTypeName = 'C4Controller'; protected event OnRequestComponents( ri : EntityRequestComponentsInterface ) { super.OnRequestComponents( ri ); EntityRequestComponentsInterface.RequestComponent( ri, 'mesh', 'MeshComponent', false ); EntityRequestComponentsInterface.RequestComponent( ri, 'scanning', 'gameScanningComponent', false ); } protected event OnTakeControl( ri : EntityResolveComponentsInterface ) { super.OnTakeControl( ri ); m_controller = ( ( C4Controller )( EntityResolveComponentsInterface.GetComponent( ri, 'controller' ) ) ); } protected event OnGameAttached() { super.OnGameAttached(); ToggleVisibility( GetDevicePS().IsON() ); } protected event OnDetach() { super.OnDetach(); } private const override function GetController() : C4Controller { return ( ( C4Controller )( m_controller ) ); } public const override function GetDevicePS() : C4ControllerPS { return GetController().GetPS(); } protected event OnActivateC4( evt : ActivateC4 ) { var adHocAnimEvent : AdHocAnimationEvent; adHocAnimEvent = new AdHocAnimationEvent; adHocAnimEvent.animationIndex = 2; adHocAnimEvent.useBothHands = true; adHocAnimEvent.unequipWeapon = true; GameInstance.GetPlayerSystem( GetGame() ).GetLocalPlayerMainGameObject().QueueEvent( adHocAnimEvent ); ToggleVisibility( true ); } protected event OnDeactivateC4( evt : DeactivateC4 ) { var adHocAnimEvent : AdHocAnimationEvent; adHocAnimEvent = new AdHocAnimationEvent; adHocAnimEvent.animationIndex = 2; adHocAnimEvent.useBothHands = true; adHocAnimEvent.unequipWeapon = true; GameInstance.GetPlayerSystem( GetGame() ).GetLocalPlayerMainGameObject().QueueEvent( adHocAnimEvent ); ToggleVisibility( false ); } protected event OnDetonateC4( evt : DetonateC4 ) { var deathEvent : gameDeathEvent; var fakeEntityID : EntityID; deathEvent = new gameDeathEvent; QueueEvent( deathEvent ); m_collider.Toggle( false ); GameInstance.GetBlackboardSystem( GetGame() ).Get( GetAllBlackboardDefs().UI_Scanner ).SetEntityID( GetAllBlackboardDefs().UI_Scanner.ScannedObject, fakeEntityID ); } protected override function ToggleVisibility( visible : Bool ) { super.ToggleVisibility( visible ); m_scanningComponent.Toggle( visible ); m_collider.Toggle( true ); if( visible ) { GetDevicePS().SetDurabilityType( EDeviceDurabilityType.DESTRUCTIBLE ); } else { GetDevicePS().SetDurabilityType( EDeviceDurabilityType.INVULNERABLE ); } } }