Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_HelicopterCinematicFlyComponent.c
Go to the documentation of this file.
1[ComponentEditorProps(category: "GameScripted/Component", description: "")]
5
6class SCR_HelicopterCinematicFlyComponent : ScriptComponent
7{
8 [Attribute(defvalue: "2", desc: "A force multiplier used on a helicopter.")]
9 float m_fForceMultiplier;
10
11 [Attribute(defvalue: "10", desc: "A force multiplier used on a helicopter with it's initial kick to keep the direction.")]
12 float m_fInitialForceMultiplier;
13
14 [Attribute(defvalue: "2000", desc: "Delay (ms) between two pulses.")]
15 int m_iPulseDelay;
16
18
19 //------------------------------------------------------------------------------------------------
20 override void EOnInit(IEntity owner)
21 {
23
25 vehicleSimulation.EngineStart();
26 vehicleSimulation.SetThrottle(1);
27 vehicleSimulation.RotorSetForceScaleState(0, 2);
28 vehicleSimulation.RotorSetForceScaleState(1, 1);
29
30 Kick(true);
31
32 GetGame().GetCallqueue().CallLater(Kick, m_iPulseDelay, true, 0);
33 }
34
35 //------------------------------------------------------------------------------------------------
36 override void OnPostInit(IEntity owner)
37 {
38 SetEventMask(owner, EntityEvent.INIT);
39 }
40
41 //------------------------------------------------------------------------------------------------
42 void Kick(bool initialKick = false)
43 {
44 if (m_DamageManager.IsDestroyed())
45 {
46 GetGame().GetCallqueue().Remove(Kick);
47 return;
48 }
49
50 float forceMultiplier;
51
52 if (initialKick)
53 forceMultiplier = m_fForceMultiplier * m_fInitialForceMultiplier;
54 else
55 forceMultiplier = m_fForceMultiplier;
56
57 vector velOrig = GetOwner().GetPhysics().GetVelocity();
58 vector rotVector = GetOwner().GetAngles();
59 vector vel = {velOrig[0] + Math.Sin(rotVector[1] * Math.DEG2RAD) * forceMultiplier, velOrig[1], velOrig[2] + Math.Cos(rotVector[1] * Math.DEG2RAD) * forceMultiplier };
60 GetOwner().GetPhysics().SetVelocity(vel);
61 }
62}
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
DamageManagerComponent m_DamageManager
void Kick(bool initialKick=false)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external int SetEventMask(notnull IEntity owner, int mask)
proto external GenericComponent FindComponent(typename typeName)
proto external vector GetAngles()
Same as GetYawPitchRoll(), but returns rotation vector around X, Y and Z axis.
proto external Physics GetPhysics()
Definition Math.c:13
proto external GenericEntity GetOwner()
Get owner entity.
void EOnInit(IEntity owner)
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
Definition EntityEvent.c:14