Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_DisarmMineAction.c
Go to the documentation of this file.
2{
3 protected static const float COMMAND_INT_ARGUMENT = 0;
4 protected static const string ANIMATION_BINDING_COMMAND = "CMD_Item_Action";
5
6 [Attribute(defvalue: "1", desc: "Distance in meters from which the player will be able to see this user action. [m]\nThis distance also hides the context blip when the player uses freelook, until they are within range.\nDistance is measured from both the position of the feet and the position of the eyes, and the closer one is used to determine if the condition is met.\nWhen value is set to 0 then it means that distance checks are skipped, and visibility distance is dictated by value from 'Visibility Range'.", params: "0 inf 0.01")]
7 protected float m_fSpottingDistance;
8
9 //------------------------------------------------------------------------------------------------
10 override event void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
11 {
12 super.PerformAction(pOwnerEntity, pUserEntity);
13
14 ChimeraCharacter character = ChimeraCharacter.Cast(pUserEntity);
15 if (!character)
16 return;
17
18 CharacterControllerComponent controller = character.GetCharacterController();
19 if (!controller)
20 return;
21
22 vector matUser[4], mat[4];
23 pUserEntity.GetTransform(matUser);
24 pOwnerEntity.GetTransform(mat);
25
26 SCR_EntityHelper.SnapToGround(pOwnerEntity, {pUserEntity}, startOffset: mat[1] * 0.1, onlyStatic: true);
27
28 OrientToForward(matUser[2], mat);
29 pOwnerEntity.SetTransform(mat);
30
31 m_MineTriggereComp.SetUser(pUserEntity);
32
33 CharacterAnimationComponent pAnimationComponent = controller.GetAnimationComponent();
34 int itemActionId = pAnimationComponent.BindCommand(ANIMATION_BINDING_COMMAND);
35
36 matUser[3] = pOwnerEntity.GetOrigin();
37 PointInfo ptWS = new PointInfo();
38 ptWS.Set(null, string.Empty, matUser);
39
41 params.SetEntity(pOwnerEntity);
42 params.SetAllowMovementDuringAction(false);
43 params.SetKeepInHandAfterSuccess(true);
44 params.SetIsMainUserOfTheItem(true);
45 params.SetKeepGadgetVisible(false);
46 params.SetCommandID(itemActionId);
47 params.SetCommandIntArg(COMMAND_INT_ARGUMENT);
48 params.SetAlignmentPoint(ptWS);
49
50 controller.TryUseItemOverrideParams(params);
51 }
52
53 //------------------------------------------------------------------------------------------------
54 override bool CanBeShownScript(IEntity user)
55 {
56 if (!super.CanBeShownScript(user))
57 return false;
58
59 if (!m_MineTriggereComp.IsActivated())
60 return false;
61
62 ChimeraCharacter character = ChimeraCharacter.Cast(user);
63 if (!character)
64 return false;
65
66 if (m_fSpottingDistance <= 0)
67 return true;
68
69 //distance check here to prevent showing of the interaction blip when using freelook from further distances
71 if (vector.Distance(position, character.EyePosition()) < m_fSpottingDistance)
72 return true;
73
74 return vector.Distance(position, character.GetOrigin()) < m_fSpottingDistance;
75 }
76}
vector position
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external IEntity GetOwner()
Returns the parent entity of this action.
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
void OrientToForward(vector forward, inout vector mat[4])
SCR_PressureTriggerComponent m_MineTriggereComp
override event void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
nThis distance also hides the context blip when the player uses until they are within range nDistance is measured from both the position of the feet and the position of the and the closer one is used to determine if the condition is met nWhen value is set to then it means that distance checks are and visibility distance is dictated by value from Visibility params
static const string ANIMATION_BINDING_COMMAND
static const float COMMAND_INT_ARGUMENT
override bool CanBeShownScript(IEntity user)
SCR_FieldOfViewSettings Attribute