Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
TestPushUserAction.c
Go to the documentation of this file.
1// Script File
3{
4
5 [Attribute("5", UIWidgets.Slider, "Force multiplier (force is equal to mass * multiplier)", "0 100 0.1")]
6 float m_fForceMultiplier;
7
8 //------------------------------------------------------------------------------------------------
9 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
10 {
11 if (!GetGame().GetWorldEntity())
12 return;
13 }
14
15 //------------------------------------------------------------------------------------------------
16 override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
17 {
18 Physics physics = pOwnerEntity.GetPhysics();
19 if (physics)
20 {
21 GenericEntity genEnt = GenericEntity.Cast(pOwnerEntity);
22 SCR_InteractableBoxComponent boxComponent = SCR_InteractableBoxComponent.Cast(genEnt.FindComponent(SCR_InteractableBoxComponent));
23 if (boxComponent)
24 {
25 boxComponent.CancelDragAction();
26 }
27
28
29 vector userOrigin = pUserEntity.GetOrigin();
30 vector thisOrigin = pOwnerEntity.GetOrigin();
31 vector dir = thisOrigin-userOrigin;
32 dir.Normalize();
33 physics.ApplyImpulse(dir * physics.GetMass() * m_fForceMultiplier);
34 }
35 }
36
37};
override void Init()
ArmaReforgerScripted GetGame()
Definition game.c:1398
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
proto external Physics GetPhysics()
SCR_FieldOfViewSettings Attribute
@ PerformAction