Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ScenarioFrameworkMedicalActions.c
Go to the documentation of this file.
1 class SCR_ContainerMedicalActionTitle : BaseContainerCustomTitle
2 {
3  override bool _WB_GetCustomTitle(BaseContainer source, out string title)
4  {
5  title = source.GetClassName();
6  title.Replace("SCR_ScenarioFrameworkMedicalAction", "");
7  string sOriginal = title;
8  SplitStringByUpperCase(sOriginal, title);
9  return true;
10  }
11 
12  protected void SplitStringByUpperCase(string input, out string output)
13  {
14  output = "";
15  bool wasPreviousUpperCase;
16  int asciiChar;
17  for (int i, count = input.Length(); i < count; i++)
18  {
19  asciiChar = input.ToAscii(i);
20  bool isLowerCase = (asciiChar > 96 && asciiChar < 123);
21  if (i > 0 && !wasPreviousUpperCase && !isLowerCase)
22  {
23  output += " " + asciiChar.AsciiToString();
24  wasPreviousUpperCase = true;
25  }
26  else
27  {
28  if (isLowerCase)
29  wasPreviousUpperCase = false;
30  output += asciiChar.AsciiToString();
31  }
32  }
33  }
34 }
35 
38 class SCR_ScenarioFrameworkActionMedical : SCR_ScenarioFrameworkActionBase
39 {
40  [Attribute(desc: "Target entity for Medical Action")];
41  ref SCR_ScenarioFrameworkGet m_Getter;
42 
43  [Attribute(desc: "Medical actions that will be executed on target entity")];
44  ref array<ref SCR_ScenarioFrameworkMedicalAction> m_aMedicalActions;
45 
46  //------------------------------------------------------------------------------------------------
47  override void OnActivate(IEntity object)
48  {
49  if (!CanActivate())
50  return;
51 
52  if (!m_Getter)
53  {
54  Print(string.Format("ScenarioFramework Action: Getter not found for Action %1.", this), LogLevel.ERROR);
55  return;
56  }
57 
58  SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
59  if (!entityWrapper)
60  {
61  Print(string.Format("ScenarioFramework Action: Issue with Getter detected for Action %1.", this), LogLevel.ERROR);
62  return;
63  }
64 
65  IEntity entity = IEntity.Cast(entityWrapper.GetValue());
66  if (!entity)
67  {
68  Print(string.Format("ScenarioFramework Action: Entity not found for Action %1.", this), LogLevel.ERROR);
69  return;
70  }
71 
72  SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(entity);
73  if (!character)
74  {
75  Print(string.Format("ScenarioFramework Action: Entity is not ChimeraCharacter for Action %1.", this), LogLevel.ERROR);
76  return;
77  }
78 
79  foreach (SCR_ScenarioFrameworkMedicalAction medicalAction : m_aMedicalActions)
80  {
81  medicalAction.Init(character);
82  }
83  }
84 }
85 
88 class SCR_ScenarioFrameworkMedicalAction
89 {
91 
92  //------------------------------------------------------------------------------------------------
95  void Init(SCR_ChimeraCharacter character)
96  {
97  m_DamageManager = SCR_CharacterDamageManagerComponent.Cast(character.GetDamageManager());
98  if (!m_DamageManager)
99  {
100  Print(string.Format("ScenarioFramework Action: Character Damage Manager Component not found for Action %1.", this), LogLevel.ERROR);
101  return;
102  }
103 
104  OnActivate();
105  }
106 
107  //------------------------------------------------------------------------------------------------
108  void OnActivate();
109 }
110 
113 class SCR_ScenarioFrameworkMedicalActionSetBlood : SCR_ScenarioFrameworkMedicalAction
114 {
115  [Attribute(defvalue: "6000", uiwidget: UIWidgets.Slider, desc: "Character blood hit zone value", params: "0 6000 0.001")]
116  float m_fBloodValue;
117 
118  //------------------------------------------------------------------------------------------------
119  override void OnActivate()
120  {
121  HitZone bloodHitZone = m_DamageManager.GetBloodHitZone();
122  if (!bloodHitZone)
123  {
124  Print(string.Format("ScenarioFramework Action: Blood Hit Zone not found for Action %1.", this), LogLevel.ERROR);
125  return;
126  }
127 
128  bloodHitZone.SetHealth(m_fBloodValue);
129  }
130 }
131 
134 class SCR_ScenarioFrameworkMedicalActionSetResilience : SCR_ScenarioFrameworkMedicalAction
135 {
136  [Attribute(defvalue: "100", uiwidget: UIWidgets.Slider, desc: "Character resilience hit zone value", params: "0 100 0.001")]
137  float m_fResilienceValue;
138 
139  //------------------------------------------------------------------------------------------------
140  override void OnActivate()
141  {
142  HitZone resilienceHitZone = m_DamageManager.GetResilienceHitZone();
143  if (!resilienceHitZone)
144  {
145  Print(string.Format("ScenarioFramework Action: Resilience Hit Zone not found for Action %1.", this), LogLevel.ERROR);
146  return;
147  }
148 
149  resilienceHitZone.SetHealth(m_fResilienceValue);
150  }
151 }
152 
155 class SCR_ScenarioFrameworkMedicalActionRemoveAllBleedings : SCR_ScenarioFrameworkMedicalAction
156 {
157  //------------------------------------------------------------------------------------------------
158  override void OnActivate()
159  {
160  m_DamageManager.RemoveAllBleedings();
161  }
162 }
163 
166 class SCR_ScenarioFrameworkMedicalActionRemoveGroupBleeding : SCR_ScenarioFrameworkMedicalAction
167 {
168  [Attribute("10", UIWidgets.ComboBox, "Select Character hit zone group to stop bleeding from", "", ParamEnumArray.FromEnum(ECharacterHitZoneGroup))]
169  ECharacterHitZoneGroup m_eCharacterHitZoneGroup;
170 
171  //------------------------------------------------------------------------------------------------
172  override void OnActivate()
173  {
174  m_DamageManager.RemoveGroupBleeding(m_eCharacterHitZoneGroup);
175  }
176 }
177 
180 class SCR_ScenarioFrameworkMedicalActionAddParticularBleeding : SCR_ScenarioFrameworkMedicalAction
181 {
182  [Attribute(uiwidget: UIWidgets.EditBox, desc: "Which hit zone will start bleeding")];
183  string m_sHitZoneName;
184 
185  //------------------------------------------------------------------------------------------------
186  override void OnActivate()
187  {
188  m_DamageManager.AddParticularBleeding(m_sHitZoneName);
189  }
190 }
191 
194 class SCR_ScenarioFrameworkMedicalActionAddRandomBleeding : SCR_ScenarioFrameworkMedicalAction
195 {
196  //------------------------------------------------------------------------------------------------
197  override void OnActivate()
198  {
199  m_DamageManager.AddRandomBleeding();
200  }
201 }
202 
205 class SCR_ScenarioFrameworkMedicalActionSetTourniquettedGroup : SCR_ScenarioFrameworkMedicalAction
206 {
207  [Attribute("10", UIWidgets.ComboBox, "Select Character hit zone group to add/remove tourniquets", "", ParamEnumArray.FromEnum(ECharacterHitZoneGroup))]
208  ECharacterHitZoneGroup m_eCharacterHitZoneGroup;
209 
210  [Attribute(defvalue: "{D70216B1B2889129}Prefabs/Items/Medicine/Tourniquet_01/Tourniquet_US_01.et", desc: "Resource name of the Tourniquet you want to use")]
211  ResourceName m_sTourniquetPrefab;
212 
213  [Attribute(defvalue: "1", uiwidget: UIWidgets.CheckBox, desc: "Whether target hit zone group is tourniquetted or not")]
214  bool m_bTourniquetted;
215 
216  //------------------------------------------------------------------------------------------------
217  override void OnActivate()
218  {
219  if (!m_bTourniquetted)
220  {
222  if (!tourniquetStorage)
223  {
224  Print(string.Format("ScenarioFramework Action: Tourniquet Storage Component not found for Action %1.", this), LogLevel.ERROR);
225  return;
226  }
227 
228  tourniquetStorage.RemoveTourniquetFromSlot(m_eCharacterHitZoneGroup, m_DamageManager.GetOwner());
229 
230  return;
231  }
232 
233  Resource resource = Resource.Load(m_sTourniquetPrefab);
234  if (!resource && !resource.IsValid())
235  return;
236 
237  EntitySpawnParams spawnParams = new EntitySpawnParams();
238  m_DamageManager.GetOwner().GetWorldTransform(spawnParams.Transform);
239  spawnParams.TransformMode = ETransformMode.WORLD;
240 
241  IEntity tourniquet = GetGame().SpawnEntityPrefab(resource, GetGame().GetWorld(), spawnParams);
242  if (!tourniquet)
243  return;
244 
245  SCR_ConsumableItemComponent consumableItemComp = SCR_ConsumableItemComponent.Cast(tourniquet.FindComponent(SCR_ConsumableItemComponent));
246  if (!consumableItemComp)
247  return;
248 
249  SCR_ConsumableEffectBase consumableEffect = consumableItemComp.GetConsumableEffect();
250  if (!consumableEffect)
251  return;
252 
254  params.SetEntity(tourniquet);
255  params.SetAllowMovementDuringAction(false);
256  params.SetKeepInHandAfterSuccess(false);
257  params.SetIntParam(m_DamageManager.FindAssociatedBandagingBodyPart(m_eCharacterHitZoneGroup));
258 
259  consumableEffect.ApplyEffect(m_DamageManager.GetOwner(), m_DamageManager.GetOwner(), tourniquet, params);
260  }
261 }
262 
265 class SCR_ScenarioFrameworkMedicalActionSetSalineBaggedGroup : SCR_ScenarioFrameworkMedicalAction
266 {
267  [Attribute(defvalue: "{00E36F41CA310E2A}Prefabs/Items/Medicine/SalineBag_01/SalineBag_US_01.et", desc: "Resource name of the Saline bag you want to use")]
268  ResourceName m_sSalineBagPrefab;
269 
270  //------------------------------------------------------------------------------------------------
271  override void OnActivate()
272  {
273  Resource resource = Resource.Load(m_sSalineBagPrefab);
274  if (!resource)
275  return;
276 
277  EntitySpawnParams spawnParams = new EntitySpawnParams();
278  m_DamageManager.GetOwner().GetWorldTransform(spawnParams.Transform);
279  spawnParams.TransformMode = ETransformMode.WORLD;
280 
281  IEntity salineBag = GetGame().SpawnEntityPrefab(resource, GetGame().GetWorld(), spawnParams);
282  if (!salineBag)
283  return;
284 
285  SCR_ConsumableItemComponent consumableItemComp = SCR_ConsumableItemComponent.Cast(salineBag.FindComponent(SCR_ConsumableItemComponent));
286  if (!consumableItemComp)
287  return;
288 
289  SCR_ConsumableEffectBase consumableEffect = consumableItemComp.GetConsumableEffect();
290  if (!consumableEffect)
291  return;
292 
293  consumableEffect.ApplyEffect(m_DamageManager.GetOwner(), m_DamageManager.GetOwner(), salineBag, null);
294  }
295 }
296 
299 class SCR_ScenarioFrameworkMedicalActionSetPermitUnconsciousness : SCR_ScenarioFrameworkMedicalAction
300 {
301  [Attribute(defvalue: "true", uiwidget: UIWidgets.CheckBox, desc: "Whether unconsciousness is allowed for this particular character")]
303 
304  //------------------------------------------------------------------------------------------------
305  override void OnActivate()
306  {
307  m_DamageManager.SetPermitUnconsciousness(m_bPermitUnconsciousness, true);
308  }
309 }
310 
313 class SCR_ScenarioFrameworkMedicalActionSetBleedingRate : SCR_ScenarioFrameworkMedicalAction
314 {
315  [Attribute(defvalue: "1", uiwidget: UIWidgets.Slider, desc: "Character bleeding rate multiplier", params: "0 5 0.001")]
316  float m_fBleedingRate;
317 
318  //------------------------------------------------------------------------------------------------
319  override void OnActivate()
320  {
321  m_DamageManager.SetDOTScale(m_fBleedingRate, true);
322  }
323 }
324 
327 class SCR_ScenarioFrameworkMedicalActionSetRegenerationRate : SCR_ScenarioFrameworkMedicalAction
328 {
329  [Attribute(defvalue: "1", uiwidget: UIWidgets.Slider, desc: "Character regeneration rate multiplier", params: "0 5 0.001")]
330  float m_fRegeneration;
331 
332  //------------------------------------------------------------------------------------------------
333  override void OnActivate()
334  {
335  m_DamageManager.SetRegenScale(m_fRegeneration, true);
336  }
337 }
ECharacterHitZoneGroup
ECharacterHitZoneGroup
Definition: SCR_CharacterDamageManagerComponent.c:1
m_bPermitUnconsciousness
protected bool m_bPermitUnconsciousness
Definition: SCR_GameModeHealthSettings.c:14
HitZone
Definition: HitZone.c:12
SCR_TourniquetStorageComponent
Definition: SCR_TourniquetStorageComponent.c:48
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
ItemUseParameters
Definition: ItemUseParameters.c:15
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_ContainerMedicalActionTitle
Definition: SCR_ScenarioFrameworkMedicalActions.c:1
Init
void Init(IEntity entity=null, vector worldPos=vector.Zero, float timestamp=0.0, EAITargetInfoCategory category=0)
Definition: SCR_AITargetInfo.c:27
OnActivate
override void OnActivate()
Definition: SCR_CharacterCommandLoiter.c:23
m_bTourniquetted
protected bool m_bTourniquetted
Definition: SCR_InventoryHitZoneSlotUI.c:3
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_ContainerActionTitle
SCR_ContainerActionTitle BaseContainerCustomTitle SCR_ContainerActionTitle()] class SCR_ScenarioFrameworkActionBase
Definition: SCR_ScenarioFrameworkActions.c:43
SCR_CharacterDamageManagerComponent
Definition: SCR_CharacterDamageManagerComponent.c:18
BaseContainerProps
SCR_ContainerMedicalActionTitle BaseContainerCustomTitle BaseContainerProps()
Medical actions that will be executed on target entity.
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
m_DamageManager
DamageManagerComponent m_DamageManager
Definition: SCR_AITargetInfo.c:19
SCR_ScenarioFrameworkGet
Definition: SCR_ScenarioFrameworkActionsGetters.c:26