Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkActionDamageWheel.c
Go to the documentation of this file.
3{
4 [Attribute(desc: "Target entity. (Optional if action is attached on Slot that spawns target entity)")]
5 ref SCR_ScenarioFrameworkGet m_Getter;
6
7 [Attribute(defvalue: "", desc: "Name of Slots that are defined on the SlotManagerComponent on target vehicle")]
8 ref array<string> m_aSlotNamesOnSlotManager;
9
10 [Attribute(defvalue: "100", desc: "Health Percentage to be set for target wheels", UIWidgets.Graph, "0 100 1")]
11 int m_iHealthPercentage;
12
13 //------------------------------------------------------------------------------------------------
14 override void OnActivate(IEntity object)
15 {
16 if (!CanActivate())
17 return;
18
19 IEntity entity;
20 if (!ValidateInputEntity(object, m_Getter, entity))
21 return;
22
23 SlotManagerComponent slotManager = SlotManagerComponent.Cast(entity.FindComponent(SlotManagerComponent));
24 if (!slotManager)
25 {
26 if (object)
27 Print(string.Format("ScenarioFramework Action: Slot Manager Component not found for Action %1 attached on %2.", this, object.GetName()), LogLevel.ERROR);
28 else
29 Print(string.Format("ScenarioFramework Action: Slot Manager Component not found for Action %1.", this), LogLevel.ERROR);
30
31 return;
32 }
33
34 foreach (string slotName : m_aSlotNamesOnSlotManager)
35 {
36 EntitySlotInfo slotInfo = slotManager.GetSlotByName(slotName);
37 if (!slotInfo)
38 {
39 if (object)
40 Print(string.Format("ScenarioFramework Action: Name of the slot %1 not found on target entity for Action %2 attached on %3.", slotName, this, object.GetName()), LogLevel.ERROR);
41 else
42 Print(string.Format("ScenarioFramework Action: Name of the slot %1 not found on target entity for Action %1.", slotName, this), LogLevel.ERROR);
43
44 return;
45 }
46
47 IEntity wheelEntity = slotInfo.GetAttachedEntity();
48 if (!wheelEntity)
49 {
50 if (object)
51 Print(string.Format("ScenarioFramework Action: Retrieving target wheel entity failed for Action %1 attached on %2.", this, object.GetName()), LogLevel.ERROR);
52 else
53 Print(string.Format("ScenarioFramework Action: Retrieving target wheel entity failed for Action %1.", this), LogLevel.ERROR);
54
55 return;
56 }
57
58 SCR_DamageManagerComponent damageManager = SCR_DamageManagerComponent.GetDamageManager(wheelEntity);
59 if (!damageManager)
60 {
61 if (object)
62 Print(string.Format("ScenarioFramework Action: Retrieving Damage Manager of target entity failed for Action %1 attached on %2.", this, object.GetName()), LogLevel.ERROR);
63 else
64 Print(string.Format("ScenarioFramework Action: Retrieving Damage Manager of target entity failed for Action %1.", this), LogLevel.ERROR);
65
66 return;
67 }
68
69 damageManager.SetHealthScaled(m_iHealthPercentage * 0.01);
70 }
71 }
72}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
override void OnActivate()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Adds ability to attach an object to a slot.
proto external Managed FindComponent(typename typeName)
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