Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SupplyContainerDecayAttribute.c
Go to the documentation of this file.
3{
4 [Attribute()]
5 float m_fDefaultDecayTickRate;
6
7 [Attribute()]
8 float m_fDefaultDecayValue;
9
10 override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
11 {
13 if (!editableEntity)
14 return null;
15
16 GenericEntity entity = editableEntity.GetOwnerScripted();
17 if (!entity)
18 return null;
19
20 RplComponent rpl = RplComponent.Cast(entity.FindComponent(RplComponent));
21 SCR_ResourceComponent resourceComponent = SCR_ResourceComponent.FindResourceComponent(entity);
22 if (!resourceComponent)
23 return null;
24
25 SCR_ResourceContainer supplyContainer = resourceComponent.GetContainer(EResourceType.SUPPLIES);
26 //:| Dont display Attribute for encapsulated Containers.
27 if (!supplyContainer || supplyContainer.IsEncapsulated())
28 return null;
29
31 }
32
33 override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
34 {
35 SCR_ResourceContainer supplyContainer = GetResourceContainer(item);
36
37 //:| Dont display Attribute for encapsulated Containers.
38 if (!supplyContainer || supplyContainer.IsEncapsulated())
39 return;
40
41 bool enabled = var.GetBool();
42 supplyContainer.EnableDecay(enabled);
43
44 if (!enabled)
45 return;
46
47 if (supplyContainer.GetResourceDecayTickrate() <= 0)
48 supplyContainer.SetResourceDecayTickrate(m_fDefaultDecayTickRate);
49
50 if (supplyContainer.GetResourceDecay() <= 0)
51 supplyContainer.SetResourceDecay(m_fDefaultDecayValue);
52 }
53
54 SCR_ResourceContainer GetResourceContainer(Managed item)
55 {
57 if (!editableEntity)
58 return null;
59
60 GenericEntity entity = editableEntity.GetOwnerScripted();
61 if (!entity)
62 return null;
63
64 SCR_ResourceComponent resourceComponent = SCR_ResourceComponent.FindResourceComponent(entity);
65 if (!resourceComponent)
66 return null;
67
68 return resourceComponent.GetContainer(EResourceType.SUPPLIES);
69 }
70}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
proto external Managed FindComponent(typename typeName)
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
static SCR_BaseEditorAttributeVar CreateBool(bool value)
bool EnableDecay(bool shouldEnable, bool notifyChange=true)
bool SetResourceDecay(float value, bool notifyChange=true)
void SetResourceDecayTickrate(float tickrate)
SCR_FieldOfViewSettings Attribute