Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
ThrowGrenadeAction.c
Go to the documentation of this file.
1 // Script File
3 {
4 
5  //------------------------------------------------------------------------------------------------
6  override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
7  {
8  if (!GetGame().GetWorldEntity())
9  return;
10 
11  }
12 
13  //------------------------------------------------------------------------------------------------
14  override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
15  {
16  GenericEntity user = GenericEntity.Cast(pUserEntity);
17  CharacterControllerComponent characterController = CharacterControllerComponent.Cast(user.FindComponent(CharacterControllerComponent));
18  BaseWeaponManagerComponent weaponMgr = BaseWeaponManagerComponent.Cast(user.FindComponent(BaseWeaponManagerComponent));
19 
20  if (characterController && weaponMgr)
21  {
22  // grenade
23  GrenadeSlotComponent grenadeSlot = GrenadeSlotComponent.Cast(weaponMgr.GetCurrent());
24  if (grenadeSlot)
25  {
26  Print("### GRENADE");
27  vector groundWeaponMat[4];
28  pOwnerEntity.GetTransform(groundWeaponMat);
29  IEntity weaponToDrop = weaponMgr.SetSlotWeapon(grenadeSlot, pOwnerEntity);
30  Print(weaponToDrop);
31 
32 
33  if (weaponToDrop)
34  {
35  weaponToDrop.SetTransform(groundWeaponMat);
36 
37  // Wake me up inside
38  // Wake me up inside
39  // Call my name and save me from the dark
40  // (wake rigidbody up, bring it to life!)
41  Physics weaponPhysics = weaponToDrop.GetPhysics();
42  if (weaponPhysics)
43  {
44  weaponPhysics.SetActive(1);
45  }
46  }
47  }
48 
49  }
50  }
51 
52 };
ThrowGrenadeAction
Definition: ThrowGrenadeAction.c:2
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
ScriptedUserAction
Definition: ScriptedUserAction.c:12
GenericEntity
SCR_GenericBoxEntityClass GenericEntity