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_PressureTriggerComponent.c
Go to the documentation of this file.
1
[
EntityEditorProps
(
category
:
"GameScripted/ScriptWizard"
, description:
""
)]
2
class
SCR_PressureTriggerComponentClass
:
SCR_BaseTriggerComponentClass
3
{
4
[
Attribute
(
"10"
,
desc
:
"Min. weight that can set off this trigger when applied to it. [kg]"
)]
5
protected
float
m_fMinWeight
;
6
7
//------------------------------------------------------------------------------------------------
8
float
GetMinWeight
()
9
{
10
return
m_fMinWeight
;
11
}
12
}
13
14
class
SCR_PressureTriggerComponent :
SCR_BaseTriggerComponent
15
{
16
protected
const
float
MIN_DELAY
= 125;
//time between explosion tries in ms
17
protected
float
m_fLastTryTime
= 0;
18
19
//------------------------------------------------------------------------------------------------
20
override
void
EOnContact
(
IEntity
owner,
IEntity
other,
Contact
contact)
21
{
22
if
(
GetGame
().GetWorld().GetWorldTime() -
m_fLastTryTime
<
MIN_DELAY
)
23
return
;
24
25
Physics
otherPhysics = other.
GetPhysics
();
26
if
(!otherPhysics)
27
return
;
28
29
float
otherMass = otherPhysics.GetMass();
30
31
Vehicle
vehicle =
Vehicle
.Cast(other);
32
if
(vehicle)
33
{
34
VehicleWheeledSimulation
vehicleSimulation =
VehicleWheeledSimulation
.Cast(vehicle.FindComponent(
VehicleWheeledSimulation
));
35
if
(vehicleSimulation)
36
otherMass /= vehicleSimulation.WheelCount();
// assume it's a vehicle and assume min. weight it lays on the trigger is weight / wheels count
37
}
38
39
m_fLastTryTime
=
GetGame
().GetWorld().GetWorldTime();
40
41
SCR_PressureTriggerComponentClass
data
=
SCR_PressureTriggerComponentClass
.Cast(
GetComponentData
(owner));
42
if
(!
data
)
43
return
;
44
45
if
(otherMass <
data
.GetMinWeight())
46
return
;
// Too light, won't set the trigger off
47
48
BaseTriggerComponent
baseTriggerComponent =
BaseTriggerComponent
.Cast(
GetOwner
().FindComponent(
BaseTriggerComponent
));
49
if
(!baseTriggerComponent)
50
return
;
51
52
GetGame
().GetCallqueue().CallLater(
RPC_DoTrigger
);
// Delay it to next frame, cannot delete entity in EOnContact
53
Rpc(
RPC_DoTrigger
);
54
}
55
56
//------------------------------------------------------------------------------------------------
58
void
TriggerManuallyServer
()
59
{
60
//~ Delay it to next frame, cannot trigger entity at the same time as Rpc
61
GetGame
().GetCallqueue().CallLater(
RPC_DoTrigger
);
62
Rpc(
RPC_DoTrigger
);
63
}
64
65
//------------------------------------------------------------------------------------------------
67
override
void
ActivateTrigger
()
68
{
69
super.ActivateTrigger();
70
71
IEntity
owner =
GetOwner
();
72
RplComponent rplComponent =
SCR_EntityHelper
.
GetEntityRplComponent
(owner);
73
if
(!rplComponent || rplComponent.IsProxy())
74
return
;
75
76
const
float
armingDelay = GetArmingTime() * 1000.0;
//in ms
77
if
(armingDelay != 0)
78
m_fLastTryTime
=
GetGame
().GetWorld().GetWorldTime() + armingDelay;
79
80
SetEventMask(owner,
EntityEvent
.CONTACT);
81
}
82
83
//------------------------------------------------------------------------------------------------
86
void
ResetTimeout
()
87
{
88
m_fLastTryTime
= 0;
89
}
90
91
//------------------------------------------------------------------------------------------------
93
override
void
DisarmTrigger
()
94
{
95
HideFuse
();
96
GetInstigator
().SetInstigator(null);
97
98
IEntity
owner =
GetOwner
();
99
RplComponent rplComponent =
SCR_EntityHelper
.
GetEntityRplComponent
(owner);
100
if
(!rplComponent || rplComponent.IsProxy())
101
return
;
102
103
ClearEventMask(owner,
EntityEvent
.CONTACT);
104
super.DisarmTrigger();
105
}
106
107
//------------------------------------------------------------------------------------------------
109
override
void
OnActivatedChanged
()
110
{
111
super.OnActivatedChanged();
112
113
SCR_PressureTriggerComponentClass
data
=
SCR_PressureTriggerComponentClass
.Cast(
GetComponentData
(
GetOwner
()));
114
if
(!
data
)
115
return
;
116
117
if
(!m_bActivated)
118
HideFuse
();
119
}
120
121
//------------------------------------------------------------------------------------------------
123
void
HideFuse
()
124
{
125
IEntity
owner =
GetOwner
();
126
int
meshIndex =
GameAnimationUtils
.FindMeshIndex(owner, m_sFuzeMeshName);
127
if
(meshIndex == -1)
128
return
;
129
130
GameAnimationUtils
.ShowMesh(owner, meshIndex,
false
);
131
}
132
133
//------------------------------------------------------------------------------------------------
134
override
protected
void
EOnInit
(
IEntity
owner)
135
{
136
if
(m_bLive)
137
ActivateTrigger
();
138
}
139
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
ActivateTrigger
void ActivateTrigger()
Definition
SCR_BaseTriggerComponent.c:45
RPC_DoTrigger
void RPC_DoTrigger()
Definition
SCR_BaseTriggerComponent.c:91
DisarmTrigger
void DisarmTrigger()
Definition
SCR_BaseTriggerComponent.c:62
OnActivatedChanged
void OnActivatedChanged()
Method called on the clients, the item should be outside inventory already.
Definition
SCR_BaseTriggerComponent.c:82
SCR_BaseTriggerComponent
void SCR_BaseTriggerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_BaseTriggerComponent.c:117
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
data
Get all prefabs that have the spawner data
Definition
SCR_EntityCatalogManagerComponent.c:320
EOnContact
override void EOnContact(IEntity owner, IEntity other, Contact contact)
Definition
SCR_ParticleContactComponent.c:82
m_fLastTryTime
float m_fLastTryTime
Definition
SCR_PressureTriggerComponent.c:17
HideFuse
void HideFuse()
Definition
SCR_PressureTriggerComponent.c:123
MIN_DELAY
SCR_PressureTriggerComponentClass MIN_DELAY
TriggerManuallyServer
void TriggerManuallyServer()
Manually trigger the entity (Server Only).
Definition
SCR_PressureTriggerComponent.c:58
ResetTimeout
void ResetTimeout()
Definition
SCR_PressureTriggerComponent.c:86
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
BaseTriggerComponent
Definition
BaseTriggerComponent.c:13
Contact
Definition
Contact.c:16
GameAnimationUtils
Definition
GameAnimationUtils.c:8
IEntity
Definition
IEntity.c:13
IEntity::GetPhysics
proto external Physics GetPhysics()
Physics
Definition
Physics.c:22
SCR_BaseTriggerComponentClass
Definition
SCR_BaseTriggerComponent.c:3
SCR_EntityHelper
Definition
SCR_EntityHelper.c:2
SCR_EntityHelper::GetEntityRplComponent
static RplComponent GetEntityRplComponent(notnull IEntity entity)
Definition
SCR_EntityHelper.c:451
SCR_PressureTriggerComponentClass
Definition
SCR_PressureTriggerComponent.c:3
SCR_PressureTriggerComponentClass::GetMinWeight
float GetMinWeight()
Definition
SCR_PressureTriggerComponent.c:8
SCR_PressureTriggerComponentClass::m_fMinWeight
float m_fMinWeight
Definition
SCR_PressureTriggerComponent.c:5
VehicleWheeledSimulation
Definition
VehicleWheeledSimulation.c:13
Vehicle
enum EPhysicsLayerPresets Vehicle
Definition
gameLib.c:24
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition
SCR_FuelNode.c:128
EOnInit
override void EOnInit(IEntity owner)
Definition
SCR_AIConfigComponent.c:87
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EntityEvent
EntityEvent
Various entity events.
Definition
EntityEvent.c:14
GetInstigator
BaseProjectileComponentClass GameComponentClass GetInstigator()
scripts
Game
Weapon
Explosives
SCR_PressureTriggerComponent.c
Generated by
1.17.0