Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ActivateMineUserAction.c
Go to the documentation of this file.
2{
3 protected static const float COMMAND_INT_ARGUMENT = 3;
4 protected static const string ANIMATION_BINDING_COMMAND = "CMD_Item_Action";
5
6 //------------------------------------------------------------------------------------------------
7 override event void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
8 {
9 super.PerformAction(pOwnerEntity, pUserEntity);
10
11 ChimeraCharacter character = ChimeraCharacter.Cast(pUserEntity);
12 if (!character)
13 return;
14
15 CharacterControllerComponent controller = character.GetCharacterController();
16 if (!controller)
17 return;
18
19 m_MineTriggereComp.SetUser(pUserEntity);
20
21 vector matUser[4], mat[4];
22 pUserEntity.GetTransform(matUser);
23 pOwnerEntity.GetTransform(mat);
24
25 SCR_EntityHelper.SnapToGround(pOwnerEntity, {pUserEntity}, startOffset: mat[1] * 0.1, onlyStatic: true);
26
27 OrientToForward(matUser[2], mat);
28 pOwnerEntity.SetTransform(mat);
29
30 CharacterAnimationComponent pAnimationComponent = controller.GetAnimationComponent();
31 int itemActionId = pAnimationComponent.BindCommand("CMD_Item_Action");
32
33 matUser[3] = pOwnerEntity.GetOrigin();
34 PointInfo ptWS = new PointInfo();
35 ptWS.Set(null, string.Empty, matUser);
36
38 params.SetEntity(pOwnerEntity);
39 params.SetAllowMovementDuringAction(false);
40 params.SetKeepInHandAfterSuccess(true);
41 params.SetCommandID(itemActionId);
42 params.SetCommandIntArg(COMMAND_INT_ARGUMENT);
43 params.SetAlignmentPoint(ptWS);
44
45 controller.TryUseItemOverrideParams(params);
46 }
47
48 //------------------------------------------------------------------------------------------------
49 override bool CanBeShownScript(IEntity user)
50 {
51 if (!super.CanBeShownScript(user))
52 return false;
53
54 return !m_MineTriggereComp.IsActivated();
55 }
56}
proto external vector GetOrigin()
proto external bool SetTransform(vector mat[4])
proto external void GetTransform(out vector mat[])
PointInfo - allows to define position.
Definition PointInfo.c:9
static const string ANIMATION_BINDING_COMMAND
override bool CanBeShownScript(IEntity user)
override event void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
void OrientToForward(vector forward, inout vector mat[4])
SCR_PressureTriggerComponent m_MineTriggereComp