Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SpecialCollisionDamageEffect.c
Go to the documentation of this file.
2{
5
6 [Attribute(defvalue: "1", uiwidget: UIWidgets.Slider, desc: "Max speed of the character in this collider", params: "0 1 0.001")]
8
9 [Attribute(defvalue: "0", desc: "Allow jumping or climbing when in this collider")]
11
12 [Attribute(desc: "Sound event that will be played when damage is dealt")]
13 protected string m_sOnDamageSoundEvent;
14
15 protected int m_iDamageSoundEvent = 0;
16
17 //------------------------------------------------------------------------------------------------
19 {
21 }
22
23 //------------------------------------------------------------------------------------------------
24 protected override void HandleConsequences(SCR_ExtendedDamageManagerComponent dmgManager, DamageEffectEvaluator evaluator)
25 {
26 super.HandleConsequences(dmgManager, evaluator);
27
28 evaluator.HandleEffectConsequences(this, dmgManager);
29 }
30
31 //------------------------------------------------------------------------------------------------
32 override void OnEffectAdded(SCR_ExtendedDamageManagerComponent dmgManager)
33 {
34 super.OnEffectAdded(dmgManager);
35
37 {
38 Terminate();
39 return;
40 }
41
42 ApplyMobilityLimits(dmgManager);
43 }
44
45 //------------------------------------------------------------------------------------------------
46 override void OnEffectRemoved(SCR_ExtendedDamageManagerComponent dmgManager)
47 {
48 super.OnEffectRemoved(dmgManager);
49
50 ApplyMobilityLimits(dmgManager);
51 }
52
53 //------------------------------------------------------------------------------------------------
54 void SetResponsibleEntity(notnull IEntity entity)
55 {
56 m_ResponsibleEntity = entity;
57 }
58
59 //------------------------------------------------------------------------------------------------
64
65 //-----------------------------------------------------------------------------------------------------------
66 void ApplyMobilityLimits(SCR_ExtendedDamageManagerComponent dmgManager)
67 {
68 SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(dmgManager.GetOwner());
69 if (!character)
70 {
71 Terminate();
72 return;
73 }
74
75 m_Controller = SCR_CharacterControllerComponent.Cast(character.GetCharacterController());
76 if (!m_Controller)
77 {
78 Terminate();
79 return;
80 }
81
82 if (dmgManager.GetAllPersistentEffectsOfType(SCR_SpecialCollisionDamageEffect, true).Contains(this))
83 {
84 character.SetSpeedLimit(this, GetMaxSpeedLimitScaled());
85 return;
86 }
87
88 character.SetSpeedLimit(this, 1);
89 }
90
91 //------------------------------------------------------------------------------------------------
96
97 //------------------------------------------------------------------------------------------------
102
103 //------------------------------------------------------------------------------------------------
104 protected override void OnEffectApplied(SCR_ExtendedDamageManagerComponent dmgManager)
105 {
107 if (!characterDamageMgr)
108 return;
109
110 characterDamageMgr.PlaySoundEvent(m_sOnDamageSoundEvent);
111 }
112
113 //------------------------------------------------------------------------------------------------
116 protected void CopyDataFromSourceEntity(notnull IEntity srcEnt)
117 {
118 SCR_SpecialCollisionHandlerComponent specialCollisionComp = SCR_SpecialCollisionHandlerComponent.Cast(srcEnt.FindComponent(SCR_SpecialCollisionHandlerComponent));
119 if (!specialCollisionComp)
120 return;
121
122 SCR_SpecialCollisionHandlerComponentClass data = SCR_SpecialCollisionHandlerComponentClass.Cast(specialCollisionComp.GetComponentData(srcEnt));
123 if (!data)
124 return;
125
126 array<SCR_SpecialCollisionDamageEffect> damageEffects = {};
127 data.GetSpecialCollisionDamageEffects(damageEffects);
128 typename thisType = Type();
129 foreach (SCR_SpecialCollisionDamageEffect effect : damageEffects)
130 {
131 if (effect.Type() != thisType)
132 continue;
133
134 m_sOnDamageSoundEvent = effect.GetDamageSoundEvent();
135 break;
136 }
137 }
138
139 //------------------------------------------------------------------------------------------------
140 override bool Save(ScriptBitWriter w)
141 {
142 super.Save(w);
143
146
147 // If the responsible entity is not replicated, we don't transfer info about it.
148 // This is not na error. The world can be full of entities that are not replicated.
149 // It is also possible that the entity gets deleted in the meantime.
150 RplComponent reponsibleEntRplComp = null;
153 w.WriteBool(reponsibleEntRplComp != null);
154 if (reponsibleEntRplComp)
155 w.WriteRplId(reponsibleEntRplComp.Id());
156
157 return true;
158 }
159
160 //------------------------------------------------------------------------------------------------
161 override bool Load(ScriptBitReader r)
162 {
163 super.Load(r);
164
167
168 bool hasRplReponsibleEnt = false;
169 r.ReadBool(hasRplReponsibleEnt);
170 if (hasRplReponsibleEnt)
171 {
172 RplId reponsibleEntRplId;
173 r.ReadRplId(reponsibleEntRplId);
174 RplComponent reponsibleEntRplComp = RplComponent.Cast(Replication.FindItem(reponsibleEntRplId));
175 if (reponsibleEntRplComp)
176 {
177 m_ResponsibleEntity = reponsibleEntRplComp.GetEntity();
179 }
180 else
181 {
182 m_ResponsibleEntity = null;
183 }
184 }
185
186 return true;
187 }
188}
Get all prefabs that have the spawner data
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
int Type
Main replication API.
Definition Replication.c:14
Replication item identifier.
Definition RplId.c:14
static RplComponent GetEntityRplComponent(notnull IEntity entity)
override void HandleConsequences(SCR_ExtendedDamageManagerComponent dmgManager, DamageEffectEvaluator evaluator)
void CopyDataFromSourceEntity(notnull IEntity srcEnt)
override void OnEffectApplied(SCR_ExtendedDamageManagerComponent dmgManager)
override void OnEffectRemoved(SCR_ExtendedDamageManagerComponent dmgManager)
SCR_CharacterControllerComponent m_Controller
void ApplyMobilityLimits(SCR_ExtendedDamageManagerComponent dmgManager)
override void OnEffectAdded(SCR_ExtendedDamageManagerComponent dmgManager)
SCR_FieldOfViewSettings Attribute