Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
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."
)]
2
class
SCR_MineAnimationComponentClass
:
WeaponAnimationComponentClass
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
8
protected
AnimationEventID
m_iMineDown
= -1;
9
protected
AnimationEventID
m_iMineActivated
= -1;
10
protected
AnimationEventID
m_iMineDisarmed
= -1;
11
12
//------------------------------------------------------------------------------------------------
13
// constructor
17
void
SCR_MineAnimationComponentClass
(
IEntityComponentSource
componentSource,
IEntitySource
parentSource,
IEntitySource
prefabSource)
18
{
19
m_iMineDown
=
GameAnimationUtils
.RegisterAnimationEvent(
MINE_PLACED_EVENT_NAME
);
20
m_iMineActivated
=
GameAnimationUtils
.RegisterAnimationEvent(
MINE_ACTIVATED_EVENT_NAME
);
21
m_iMineDisarmed
=
GameAnimationUtils
.RegisterAnimationEvent(
MINE_DISARMED_EVENT_NAME
);
22
}
23
24
//------------------------------------------------------------------------------------------------
26
int
GetMineDownID
()
27
{
28
return
m_iMineDown
;
29
}
30
31
//------------------------------------------------------------------------------------------------
33
int
GetMineActivatedID
()
34
{
35
return
m_iMineActivated
;
36
}
37
38
//------------------------------------------------------------------------------------------------
40
int
GetMineDisarmedID
()
41
{
42
return
m_iMineDisarmed
;
43
}
44
}
45
46
class
SCR_MineAnimationComponent
:
WeaponAnimationComponent
47
{
48
protected
IEntity
m_Owner
;
49
50
//------------------------------------------------------------------------------------------------
51
// constructor
55
void
SCR_MineAnimationComponent
(
IEntityComponentSource
src,
IEntity
ent,
IEntity
parent)
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
65
SCR_MineAnimationComponentClass
prefabData =
SCR_MineAnimationComponentClass
.Cast(
GetComponentData
(
GetOwner
()));
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
}
AnimationEventID
int AnimationEventID
Definition
AnimationStringTypes.c:1
m_Owner
IEntity m_Owner
Definition
SCR_CampaignServiceCompositionComponent.c:18
GetComponentData
SCR_CharacterSoundComponentClass GetComponentData()
Definition
SCR_CharacterSoundComponent.c:132
EntityEditorProps
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
Definition
SCR_CompassComponent.c:10
SCR_MineAnimationComponent
void SCR_MineAnimationComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_MineAnimationComponent.c:55
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
BaseItemAnimationComponent::OnAnimationEvent
void OnAnimationEvent(AnimationEventID animEventType, AnimationEventID animUserString, int intParam, float timeFromStart, float timeToEnd)
GameAnimationUtils
Definition
GameAnimationUtils.c:8
GameMaterial
Definition
GameMaterial.c:13
IEntityComponentSource
Definition
IEntityComponentSource.c:13
IEntity
Definition
IEntity.c:13
IEntitySource
Definition
IEntitySource.c:13
SCR_EntityHelper
Definition
SCR_EntityHelper.c:2
SCR_EntityHelper::GetEntityRplComponent
static RplComponent GetEntityRplComponent(notnull IEntity entity)
Definition
SCR_EntityHelper.c:451
SCR_MineAnimationComponentClass
Definition
SCR_MineAnimationComponent.c:3
SCR_MineAnimationComponentClass::m_iMineActivated
AnimationEventID m_iMineActivated
Definition
SCR_MineAnimationComponent.c:9
SCR_MineAnimationComponentClass::GetMineDisarmedID
int GetMineDisarmedID()
Definition
SCR_MineAnimationComponent.c:40
SCR_MineAnimationComponentClass::MINE_PLACED_EVENT_NAME
static const string MINE_PLACED_EVENT_NAME
Definition
SCR_MineAnimationComponent.c:4
SCR_MineAnimationComponentClass::GetMineActivatedID
int GetMineActivatedID()
Definition
SCR_MineAnimationComponent.c:33
SCR_MineAnimationComponentClass::MINE_ACTIVATED_EVENT_NAME
static const string MINE_ACTIVATED_EVENT_NAME
Definition
SCR_MineAnimationComponent.c:5
SCR_MineAnimationComponentClass::SCR_MineAnimationComponentClass
void SCR_MineAnimationComponentClass(IEntityComponentSource componentSource, IEntitySource parentSource, IEntitySource prefabSource)
Definition
SCR_MineAnimationComponent.c:17
SCR_MineAnimationComponentClass::GetMineDownID
int GetMineDownID()
Definition
SCR_MineAnimationComponent.c:26
SCR_MineAnimationComponentClass::MINE_DISARMED_EVENT_NAME
static const string MINE_DISARMED_EVENT_NAME
Definition
SCR_MineAnimationComponent.c:6
SCR_MineAnimationComponentClass::m_iMineDisarmed
AnimationEventID m_iMineDisarmed
Definition
SCR_MineAnimationComponent.c:10
SCR_MineAnimationComponentClass::m_iMineDown
AnimationEventID m_iMineDown
Definition
SCR_MineAnimationComponent.c:8
SndComponent::SetSignalValueStr
proto external void SetSignalValueStr(string signal, float value)
SoundComponent
Definition
SoundComponent.c:13
TraceParam
Definition
TraceParam.c:16
WeaponAnimationComponentClass
Definition
WeaponAnimationComponentClass.c:13
WeaponAnimationComponent
Definition
WeaponAnimationComponent.c:13
vector
Definition
vector.c:13
EPhysicsLayerPresets
EPhysicsLayerPresets
Enum is filled by C++ by data in project config PhysicsSettings.LayerPresets.
Definition
gameLib.c:19
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition
SCR_FuelNode.c:128
TraceFlags
TraceFlags
Definition
TraceFlags.c:13
scripts
Game
Components
Mines
SCR_MineAnimationComponent.c
Generated by
1.17.0