Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EnableArsenalAttribute.c
Go to the documentation of this file.
3 {
4  //------------------------------------------------------------------------------------------------
5  override void UpdateInterlinkedVariables(SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, bool isInit = false)
6  {
7  //Set sub labels
8  if (isInit)
9  {
10  manager.SetAttributeAsSubAttribute(SCR_ArsenalAmmunitionModeAttribute);
11  manager.SetAttributeAsSubAttribute(SCR_ArsenalEquipmentEditorAttribute);
12  manager.SetAttributeAsSubAttribute(SCR_ArsenalOutfitEditorAttribute);
13  manager.SetAttributeAsSubAttribute(SCR_ArsenalWeaponRackEquipmentEditorAttribute);
14  manager.SetAttributeAsSubAttribute(SCR_ArsenalWeaponRackWeaponsEditorAttribute);
15  manager.SetAttributeAsSubAttribute(SCR_ArsenalWeaponsEditorAttribute);
16  }
17 
18  bool enabled = var && var.GetBool();
19 
20  manager.SetAttributeEnabled(SCR_ArsenalAmmunitionModeAttribute, enabled);
21  manager.SetAttributeEnabled(SCR_ArsenalEquipmentEditorAttribute, enabled);
22  manager.SetAttributeEnabled(SCR_ArsenalOutfitEditorAttribute, enabled);
23  manager.SetAttributeEnabled(SCR_ArsenalWeaponRackEquipmentEditorAttribute, enabled);
24  manager.SetAttributeEnabled(SCR_ArsenalWeaponRackWeaponsEditorAttribute, enabled);
25  manager.SetAttributeEnabled(SCR_ArsenalWeaponsEditorAttribute, enabled);
26  }
27 
28  //------------------------------------------------------------------------------------------------
29  override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
30  {
31  SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item);
32  if (!editableEntity)
33  return null;
34 
35  SCR_ArsenalComponent arsenalComponent = SCR_ArsenalComponent.FindArsenalComponent(editableEntity.GetOwner());
36  if (!arsenalComponent)
37  return null;
38 
39  return SCR_BaseEditorAttributeVar.CreateBool(arsenalComponent.IsArsenalEnabled());
40  }
41 
42  //------------------------------------------------------------------------------------------------
43  override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
44  {
45  if (!var)
46  return;
47 
48  SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item);
49  if (!editableEntity)
50  return;
51 
52  SCR_ArsenalComponent arsenalComponent = SCR_ArsenalComponent.FindArsenalComponent(editableEntity.GetOwner());
53  if (!arsenalComponent)
54  return;
55 
56  arsenalComponent.SetArsenalEnabled(var.GetBool());
57  }
58 }
SCR_ArsenalEquipmentEditorAttribute
Definition: SCR_ArsenalEquipmentEditorAttribute.c:2
SCR_ArsenalAmmunitionModeAttribute
Definition: SCR_ArsenalAmmunitionModeAttribute.c:2
SCR_BaseEditorAttributeCustomTitle
Definition: SCR_BaseEditorAttribute.c:868
SCR_ArsenalWeaponsEditorAttribute
Definition: SCR_ArsenalWeaponsEditorAttribute.c:2
SCR_BaseEditorAttributeVar
Definition: SCR_BaseEditorAttributeVar.c:1
SCR_ArsenalWeaponRackWeaponsEditorAttribute
Definition: SCR_ArsenalWeaponRackWeaponsEditorAttribute.c:2
SCR_EnableArsenalAttribute
Definition: SCR_EnableArsenalAttribute.c:2
SCR_BaseEditorAttribute
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
Definition: SCR_BaseEditorAttribute.c:3
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
SCR_ArsenalWeaponRackEquipmentEditorAttribute
Definition: SCR_ArsenalWeaponRackEquipmentEditorAttribute.c:2
SCR_ArsenalOutfitEditorAttribute
Definition: SCR_ArsenalOutfitEditorAttribute.c:2
SCR_ArsenalComponent
Definition: SCR_ArsenalComponent.c:9
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468