Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_MineAnimationComponent.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/Mines", description: "Base component for handling animation.")]
3{
4 protected static const string MINE_PLACED_EVENT_NAME = "MineDown";
5 protected static const string MINE_ACTIVATED_EVENT_NAME = "MineActivated";
6 protected static const string MINE_DISARMED_EVENT_NAME = "MineDisarmed";
7
11
12 //------------------------------------------------------------------------------------------------
13 // constructor
23
24 //------------------------------------------------------------------------------------------------
27 {
28 return m_iMineDown;
29 }
30
31 //------------------------------------------------------------------------------------------------
34 {
35 return m_iMineActivated;
36 }
37
38 //------------------------------------------------------------------------------------------------
41 {
42 return m_iMineDisarmed;
43 }
44}
45
47{
48 protected IEntity m_Owner;
49
50 //------------------------------------------------------------------------------------------------
51 // constructor
56 {
57 m_Owner = ent;
58 }
59
60 //------------------------------------------------------------------------------------------------
61 protected override event void OnAnimationEvent(AnimationEventID animEventType, AnimationEventID animUserString, int intParam, float timeFromStart, float timeToEnd)
62 {
63 super.OnAnimationEvent(animEventType, animUserString, intParam, timeFromStart, timeToEnd);
64
66
67 if (animEventType == prefabData.GetMineDownID())
68 {
69 SoundComponent soundComponent = SoundComponent.Cast(m_Owner.FindComponent(SoundComponent));
70 if (!soundComponent)
71 return;
72
73 TraceParam param = new TraceParam();
74 param.Start = m_Owner.GetOrigin() + vector.Up * 0.3;//compensate for slopes as during the animation object may be pushed under the surface
75 param.End = m_Owner.GetOrigin() - vector.Up;
76 param.Flags = TraceFlags.WORLD | TraceFlags.ENTS;
77 array<IEntity> excluded = {m_Owner};
78 if (m_Owner != m_Owner.GetRootParent())
79 excluded.Insert(m_Owner.GetRootParent());
80
81 param.ExcludeArray = excluded;
82 param.LayerMask = EPhysicsLayerPresets.Projectile;
83 m_Owner.GetWorld().TraceMove(param, null);
84
85 GameMaterial material = param.SurfaceProps;
86 if (!material)
87 return;
88
89 soundComponent.SetSignalValueStr("Surface", material.GetSoundInfo().GetSignalValue());
90 }
91
92 if (animEventType != prefabData.GetMineActivatedID() && animEventType != prefabData.GetMineDisarmedID())
93 return;//it is cheaper to compare two ints than it is to call for a method to find a component
94
95 // Master only
96 RplComponent rplComponent = SCR_EntityHelper.GetEntityRplComponent(m_Owner);
97 if (!rplComponent || rplComponent.IsProxy())
98 return;
99
100 SCR_PressureTriggerComponent pressureTriggerComponent = SCR_PressureTriggerComponent.Cast(m_Owner.FindComponent(SCR_PressureTriggerComponent));
101 if (!pressureTriggerComponent)
102 return;
103
104 if (animEventType == prefabData.GetMineActivatedID())
105 {
106 pressureTriggerComponent.ActivateTrigger();
107 return;
108 }
109
110 if (animEventType == prefabData.GetMineDisarmedID())
111 pressureTriggerComponent.DisarmTrigger();
112 }
113}
int AnimationEventID
SCR_CharacterSoundComponentClass GetComponentData()
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
void SCR_MineAnimationComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
void OnAnimationEvent(AnimationEventID animEventType, AnimationEventID animUserString, int intParam, float timeFromStart, float timeToEnd)
static RplComponent GetEntityRplComponent(notnull IEntity entity)
void SCR_MineAnimationComponentClass(IEntityComponentSource componentSource, IEntitySource parentSource, IEntitySource prefabSource)
proto external void SetSignalValueStr(string signal, float value)
EPhysicsLayerPresets
Enum is filled by C++ by data in project config PhysicsSettings.LayerPresets.
Definition gameLib.c:19
IEntity GetOwner()
Owner entity of the fuel tank.
TraceFlags
Definition TraceFlags.c:13