Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkMedicalActionSetTourniquettedGroup.c
Go to the documentation of this file.
3{
4 [Attribute("10", UIWidgets.ComboBox, "Select Character hit zone group to add/remove tourniquets", "", ParamEnumArray.FromEnum(ECharacterHitZoneGroup))]
5 ECharacterHitZoneGroup m_eCharacterHitZoneGroup;
6
7 [Attribute(defvalue: "{D70216B1B2889129}Prefabs/Items/Medicine/Tourniquet_01/Tourniquet_US_01.et", desc: "Resource name of the Tourniquet you want to use")]
8 ResourceName m_sTourniquetPrefab;
9
10 [Attribute(defvalue: "1", uiwidget: UIWidgets.CheckBox, desc: "Whether target hit zone group is tourniquetted or not")]
11 bool m_bTourniquetted;
12
13 //------------------------------------------------------------------------------------------------
14 override void OnActivate()
15 {
16 super.OnActivate();
17
18 if (!m_bTourniquetted)
19 {
20 SCR_TourniquetStorageComponent tourniquetStorage = SCR_TourniquetStorageComponent.Cast(m_DamageManager.GetOwner().FindComponent(SCR_TourniquetStorageComponent));
21 if (!tourniquetStorage)
22 {
23 Print(string.Format("ScenarioFramework Action: Tourniquet Storage Component not found for Action %1.", this), LogLevel.ERROR);
24 return;
25 }
26
27 tourniquetStorage.RemoveTourniquetFromSlot(m_eCharacterHitZoneGroup, m_DamageManager.GetOwner());
28
29 return;
30 }
31
32 Resource resource = Resource.Load(m_sTourniquetPrefab);
33 if (!resource && !resource.IsValid())
34 return;
35
36 EntitySpawnParams spawnParams = new EntitySpawnParams();
37 m_DamageManager.GetOwner().GetWorldTransform(spawnParams.Transform);
38 spawnParams.TransformMode = ETransformMode.WORLD;
39
40 IEntity tourniquet = GetGame().SpawnEntityPrefab(resource, GetGame().GetWorld(), spawnParams);
41 if (!tourniquet)
42 return;
43
44 SCR_ConsumableItemComponent consumableItemComp = SCR_ConsumableItemComponent.Cast(tourniquet.FindComponent(SCR_ConsumableItemComponent));
45 if (!consumableItemComp)
46 return;
47
48 SCR_ConsumableEffectBase consumableEffect = consumableItemComp.GetConsumableEffect();
49 if (!consumableEffect)
50 return;
51
53 params.SetEntity(tourniquet);
54 params.SetAllowMovementDuringAction(false);
55 params.SetKeepInHandAfterSuccess(false);
56 params.SetIntParam(m_DamageManager.FindAssociatedBandagingBodyPart(m_eCharacterHitZoneGroup));
57
58 consumableEffect.ApplyEffect(m_DamageManager.GetOwner(), m_DamageManager.GetOwner(), tourniquet, params);
59 }
60}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
override void OnActivate()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external Managed FindComponent(typename typeName)
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
bool RemoveTourniquetFromSlot(ECharacterHitZoneGroup eHitZoneGroup, IEntity retrievingCharacter=null)
void EntitySpawnParams()
Definition gameLib.c:130
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute