Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_WindDirectionEditorAttribute.c
Go to the documentation of this file.
1 
6 {
7  override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
8  {
9  //If opened in global attributes
10  if (!IsGameMode(item))
11  return null;
12 
13  GenericEntity ent = GenericEntity.Cast(item);
14  ChimeraWorld world = ent.GetWorld();
15  TimeAndWeatherManagerEntity weatherManager = world.GetTimeAndWeatherManager();
16  if (!weatherManager)
17  return null;
18 
19  int CurrentWindDirectionIndex;
20  SCR_WindDirectionInfo windDirectionInfo;
21 
22  weatherManager.GetWindDirectionInfoFromFloat(weatherManager.GetWindDirection(), CurrentWindDirectionIndex, windDirectionInfo);
23  return SCR_BaseEditorAttributeVar.CreateInt(CurrentWindDirectionIndex);
24  }
25 
26 
27  override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
28  {
29  if (!var)
30  return;
31 
32  GenericEntity ent = GenericEntity.Cast(item);
33  ChimeraWorld world = ent.GetWorld();
34  TimeAndWeatherManagerEntity weatherManager = world.GetTimeAndWeatherManager();
35  if (!weatherManager)
36  return;
37 
38  int windDirectionIndex = var.GetInt();
39  int CurrentWindDirectionIndex;
40  SCR_WindDirectionInfo windDirectionInfo;
41  weatherManager.GetWindDirectionInfoFromFloat(weatherManager.GetWindDirection(), CurrentWindDirectionIndex, windDirectionInfo);
42 
43  //Wind did not change
44  if (CurrentWindDirectionIndex == windDirectionIndex)
45  return;
46 
47  weatherManager.GetWindDirectionInfoFromIndex(windDirectionIndex, windDirectionInfo);
48  weatherManager.DelayedOverrideWindDirection(windDirectionInfo.GetWindDirectionValue(), playerID);
49  }
50 
51  protected void CreatePresets()
52  {
53  ChimeraWorld world = GetGame().GetWorld();
54  TimeAndWeatherManagerEntity timeManager = world.GetTimeAndWeatherManager();
55  if (!timeManager)
56  return;
57 
58  m_aValues.Clear();
59 
60  array<SCR_WindDirectionInfo> orderedWindDirectionInfo = new array<SCR_WindDirectionInfo>;
61  timeManager.GetOrderedWindDirectionInfoArray(orderedWindDirectionInfo);
63 
64  foreach (SCR_WindDirectionInfo windDirectionInfo: orderedWindDirectionInfo)
65  {
67  value.SetName(windDirectionInfo.GetUIInfo().GetName());
68  value.SetFloatValue(windDirectionInfo.GetWindDirectionValue());
69 
70  m_aValues.Insert(value);
71  }
72  }
73 
74  //Call PreviewVariable of SCR_WindAutomaticEditorAttribute
75  override void PreviewVariable(bool setPreview, SCR_AttributesManagerEditorComponent manager)
76  {
77  if (!setPreview)
78  return;
79 
80  SCR_BaseEditorAttribute overrideAttribute = manager.GetAttributeRef(SCR_WindAutomaticEditorAttribute);
81  if (!overrideAttribute)
82  return;
83 
84  overrideAttribute.PreviewVariable(setPreview, manager);
85  }
86 
87  override int GetEntries(notnull array<ref SCR_BaseEditorAttributeEntry> outEntries)
88  {
89  CreatePresets();
90  //outEntries.Insert(new SCR_EditorAttributeEntryOverride(weatherManager.IsWindDirectionOverridden(), SCR_WindDirectionOverrideEditorAttribute));
91  return super.GetEntries(outEntries);
92  }
93 };
ChimeraWorld
Definition: ChimeraWorld.c:12
m_aValues
SCR_BaseEditorAttributeEntryTimeSlider m_aValues
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
SCR_BaseEditorAttributeCustomTitle
Definition: SCR_BaseEditorAttribute.c:868
SCR_WindDirectionEditorAttribute
Definition: SCR_WindDirectionEditorAttribute.c:5
SCR_BaseEditorAttributeVar
Definition: SCR_BaseEditorAttributeVar.c:1
SCR_WindAutomaticEditorAttribute
Weather attribute if it should override certain weather values.
Definition: SCR_WindAutomaticEditorAttribute.c:3
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_EditorAttributeFloatStringValueHolder
Definition: SCR_BaseFloatValueHolderEditorAttribute.c:17
SCR_BaseFloatValueHolderEditorAttribute
Attribute base for Name, icon and float value for other attributes to inherent from.
Definition: SCR_BaseFloatValueHolderEditorAttribute.c:3
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