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_VehicleTrackDecalComponent.c
Go to the documentation of this file.
1
// Spawns Track Decal
2
3
[
ComponentEditorProps
(
category
:
"GameScripted/Test"
, description:
"SCR_VehicleTrackDecal"
)]
4
class
SCR_VehicleTrackDecalClass
:
ScriptComponentClass
5
{
6
};
7
8
class
SCR_VehicleTrackDecal
:
ScriptComponent
9
{
10
[
Attribute
(
""
,
UIWidgets
.ResourceNamePicker,
desc
:
"Material for track decal"
,
params
:
"emat"
)]
11
private
ResourceName
m_TrackMaterial;
12
13
[
Attribute
(
"0.5"
,
UIWidgets
.EditBox,
"Minimal lateral slip of wheel"
)]
14
float
m_fMinimalLateralSlip;
15
16
[
Attribute
(
"0.5"
,
UIWidgets
.EditBox,
"Minimal longitudinal slip of wheel"
)]
17
float
m_fMinimalLongitudinalSlip;
18
19
VehicleWheeledSimulation
m_VehicleWheeledSimulation;
20
21
ref array<ref TrackDecalFactory> m_TrackDecals;
22
int
m_iWheelCount = 0;
23
24
//------------------------------------------------------------------------------------------------
25
override
void
OnPostInit
(
IEntity
owner)
26
{
27
// Don't run this component on console app
28
if
(
System
.IsConsoleApp())
29
{
30
Deactivate
(owner);
31
return
;
32
}
33
34
SetEventMask
(owner,
EntityEvent
.INIT);
35
}
36
37
//------------------------------------------------------------------------------------------------
38
override
void
EOnInit(
IEntity
owner)
39
{
40
super.EOnInit(owner);
41
GenericEntity
generic_entity =
GenericEntity
.Cast(owner);
42
43
if
(generic_entity)
44
{
45
m_VehicleWheeledSimulation =
VehicleWheeledSimulation
.Cast(generic_entity.
FindComponent
(
VehicleWheeledSimulation
));
46
m_iWheelCount = m_VehicleWheeledSimulation.WheelCount();
47
}
48
49
m_TrackDecals =
new
array<ref TrackDecalFactory>();
50
m_TrackDecals.Resize(m_iWheelCount);
51
52
for
(
int
i = 0; i < m_iWheelCount; i++)
53
{
54
m_TrackDecals[i] =
new
TrackDecalFactory
(m_TrackMaterial, 0.25, 10);
55
}
56
57
SetEventMask
(owner,
EntityEvent
.FRAME);
58
}
59
60
//------------------------------------------------------------------------------------------------
61
override
void
EOnFrame(
IEntity
owner,
float
timeSlice)
62
{
63
for
(
int
i = 0; i < m_iWheelCount; i++)
64
{
65
UpdateTrack(owner, i);
66
}
67
}
68
69
void
UpdateTrack(
IEntity
owner,
int
wheelIdx)
70
{
71
float
lateralSlip = m_VehicleWheeledSimulation.WheelGetLateralSlip(wheelIdx);
72
float
latitudeSlip = m_VehicleWheeledSimulation.WheelGetLongitudinalSlip(wheelIdx);
73
74
bool
shouldAddTrackDecal = m_VehicleWheeledSimulation.WheelHasContact(wheelIdx) && (lateralSlip >= m_fMinimalLateralSlip || latitudeSlip >= m_fMinimalLongitudinalSlip);
75
76
if
(!shouldAddTrackDecal)
77
{
78
m_TrackDecals[wheelIdx].FinalizeDecal(0.25);
79
return
;
80
}
81
82
vector
position
= m_VehicleWheeledSimulation.WheelGetContactPosition(wheelIdx);
83
vector
normal = m_VehicleWheeledSimulation.WheelGetContactNormal(wheelIdx);
84
IEntity
contactEntity = m_VehicleWheeledSimulation.WheelGetContactEntity(wheelIdx);
85
86
m_TrackDecals[wheelIdx].AddPoint(contactEntity,
position
, normal, 1.0);
87
}
88
};
ComponentEditorProps
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
Definition
SCR_AIGroupUtilityComponent.c:12
Deactivate
void Deactivate()
Definition
SCR_BaseHintCondition.c:115
position
vector position
Definition
SCR_DestructibleTreeV2.c:30
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
GenericComponent::SetEventMask
proto external int SetEventMask(notnull IEntity owner, int mask)
GenericEntity
Definition
GenericEntity.c:16
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
ResourceName
Definition
ResourceName.c:13
SCR_VehicleTrackDecalClass
Definition
SCR_VehicleTrackDecalComponent.c:5
SCR_VehicleTrackDecal
Definition
SCR_VehicleTrackDecalComponent.c:9
ScriptComponentClass
Definition
ScriptComponentClass.c:8
ScriptComponent
Definition
ScriptComponent.c:24
System
Definition
System.c:13
TrackDecalFactory
Definition
TrackDecalFactory.c:13
UIWidgets
Definition
attributes.c:40
VehicleWheeledSimulation
Definition
VehicleWheeledSimulation.c:13
vector
Definition
vector.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EntityEvent
EntityEvent
Various entity events.
Definition
EntityEvent.c:14
OnPostInit
@ OnPostInit
Definition
SndComponentCallbacks.c:15
scripts
Game
Vehicle
SCR_VehicleTrackDecalComponent.c
Generated by
1.17.0