7 [
Attribute(
"MISSING NAME",
desc:
"Text shown if weather State has no weather name assigned")]
10 [
Attribute(
"{4B4B51FACB828BF9}UI/Textures/Tasks/TaskIcons/96/Icon_Task_Unknown.edds",
desc:
"Icon used when weather is unknown")]
11 protected ResourceName m_sUnknownWeatherIcon;
16 if (!IsGameMode(item))
21 TimeAndWeatherManagerEntity weatherManager = world.GetTimeAndWeatherManager();
26 if (!weatherTransitionManager)
29 array<ref WeatherState> weatherStates =
new array<ref WeatherState>;
32 weatherManager.GetWeatherStatesList(weatherStates);
33 if (weatherStates.IsEmpty())
36 WeatherState currentState = weatherManager.GetCurrentWeatherState();
40 override void WriteVariable(Managed item,
SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager,
int playerID)
45 BaseGameMode gameMode =
GetGame().GetGameMode();
53 TimeAndWeatherManagerEntity weatherManager = world.GetTimeAndWeatherManager();
57 int stateIndex = var.GetInt();
59 array<ref WeatherState> weatherStates =
new array<ref WeatherState>;
60 weatherManager.GetWeatherStatesList(weatherStates);
63 if (weatherStates.IsEmpty() || stateIndex >= weatherStates.Count())
66 WeatherState weatherToSet = weatherStates[stateIndex];
71 weatherManager.SetWeatherStatePreview(
true, weatherToSet.GetStateName());
75 float transitionTime = 0;
79 transitionTime = transitionVar.GetInt();
81 weatherManager.ForceWeatherTo(
true, weatherToSet.GetStateName(), transitionTime / 3600, 0.001, playerID);
84 override void PreviewVariable(
bool setPreview, SCR_AttributesManagerEditorComponent manager)
89 WriteVariable(
null, GetVariable(), manager, -1);
94 TimeAndWeatherManagerEntity weatherManager = world.GetTimeAndWeatherManager();
99 if (!weatherTransitionManager)
103 if (weatherTransitionManager.IsPreviewingState())
104 weatherManager.SetWeatherStatePreview(
false);
108 protected override void CreatePresets()
114 array<ref WeatherState> weatherStates =
new array<ref WeatherState>;
116 TimeAndWeatherManagerEntity weatherManager = world.GetTimeAndWeatherManager();
120 weatherManager.GetWeatherStatesList(weatherStates);
122 int count = weatherStates.Count();
123 string weatherName, weatherIconPath;
126 for (
int i = 0; i < count; i++)
130 weatherName = weatherStates[i].GetLocalizedName();
131 weatherIconPath = weatherStates[i].GetIconPath();
135 weatherName = m_sUnknownWeatherName;
136 Print(
"WeatherState: '" + weatherStates[i].GetStateID() +
"' does not have weather localization name assigned!", LogLevel.ERROR);
142 weatherIconPath = m_sUnknownWeatherIcon;
143 Print(
"WeatherState: '" + weatherStates[i].GetStateID() +
"' does not have weather icon assigned!", LogLevel.ERROR);
146 value.SetName(weatherName);
147 value.SetIcon(weatherIconPath);
148 value.SetFloatValue(weatherStates[i].GetStateID());