Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_WeatherInstantEditorAttribute.c
Go to the documentation of this file.
1
4
[
BaseContainerProps
(),
SCR_BaseEditorAttributeCustomTitle
()]
5
class
SCR_WeatherInstantEditorAttribute
:
SCR_BasePresetsEditorAttribute
6
{
7
[
Attribute
(
"MISSING NAME"
,
desc
:
"Text shown if weather State has no weather name assigned"
)]
8
protected
LocalizedString
m_sUnknownWeatherName
;
9
10
[
Attribute
(
"{4B4B51FACB828BF9}UI/Textures/Tasks/TaskIcons/96/Icon_Task_Unknown.edds"
,
desc
:
"Icon used when weather is unknown"
)]
11
protected
ResourceName
m_sUnknownWeatherIcon
;
12
13
override
SCR_BaseEditorAttributeVar
ReadVariable
(Managed item, SCR_AttributesManagerEditorComponent manager)
14
{
15
//If opened in global attributes
16
if
(!
IsGameMode
(item))
17
return
null;
18
19
GenericEntity
ent =
GenericEntity
.Cast(item);
20
ChimeraWorld
world = ent.
GetWorld
();
21
TimeAndWeatherManagerEntity
weatherManager = world.GetTimeAndWeatherManager();
22
if
(!weatherManager)
23
return
null;
24
25
BaseWeatherStateTransitionManager
weatherTransitionManager = weatherManager.GetTransitionManager();
26
if
(!weatherTransitionManager)
27
return
null;
28
29
array<ref WeatherState> weatherStates =
new
array<ref WeatherState>;
30
31
//Get weather states
32
weatherManager.GetWeatherStatesList(weatherStates);
33
if
(weatherStates.IsEmpty())
34
return
null;
35
36
WeatherState
currentState = weatherManager.GetCurrentWeatherState();
37
return
SCR_BaseEditorAttributeVar
.
CreateInt
(currentState.GetStateID());
38
}
39
40
override
void
WriteVariable
(Managed item,
SCR_BaseEditorAttributeVar
var, SCR_AttributesManagerEditorComponent manager,
int
playerID)
41
{
42
if
(!var)
43
return
;
44
45
BaseGameMode gameMode =
GetGame
().GetGameMode();
46
if
(!gameMode)
47
return
;
48
49
ChimeraWorld
world =
ChimeraWorld
.CastFrom(gameMode.GetWorld());
50
if
(!world)
51
return
;
52
53
TimeAndWeatherManagerEntity
weatherManager = world.GetTimeAndWeatherManager();
54
if
(!weatherManager)
55
return
;
56
57
int
stateIndex = var.
GetInt
();
58
59
array<ref WeatherState> weatherStates =
new
array<ref WeatherState>;
60
weatherManager.GetWeatherStatesList(weatherStates);
61
62
//Valid state
63
if
(weatherStates.IsEmpty() || stateIndex >= weatherStates.Count())
64
return
;
65
66
WeatherState
weatherToSet = weatherStates[stateIndex];
67
68
//Preview Weather
69
if
(!item)
70
{
71
weatherManager.
SetWeatherStatePreview
(
true
, weatherToSet.GetStateName());
72
return
;
73
}
74
75
float
transitionTime = 0;
76
77
SCR_BaseEditorAttributeVar
transitionVar;
78
if
(manager && manager.GetAttributeVariable(
SCR_WeatherInstantTransitionTimeEditorAttribute
, transitionVar))
79
transitionTime = transitionVar.
GetInt
();
80
81
weatherManager.
ForceWeatherTo
(
true
, weatherToSet.GetStateName(), transitionTime / 3600, 0.001, playerID);
82
}
83
84
override
void
PreviewVariable
(
bool
setPreview, SCR_AttributesManagerEditorComponent manager)
85
{
86
//Preview weather. Note that if advanced is turned on preview should disapear
87
if
(setPreview)
88
{
89
WriteVariable
(null,
GetVariable
(), manager, -1);
90
}
91
else
92
{
93
ChimeraWorld
world =
GetGame
().GetWorld();
94
TimeAndWeatherManagerEntity
weatherManager = world.GetTimeAndWeatherManager();
95
if
(!weatherManager)
96
return
;
97
98
BaseWeatherStateTransitionManager
weatherTransitionManager = weatherManager.GetTransitionManager();
99
if
(!weatherTransitionManager)
100
return
;
101
102
//Remove preview
103
if
(weatherTransitionManager.IsPreviewingState())
104
weatherManager.
SetWeatherStatePreview
(
false
);
105
}
106
}
107
108
protected
override
void
CreatePresets
()
109
{
110
m_aValues
.Clear();
111
112
SCR_EditorAttributeFloatStringValueHolder
value;
113
114
array<ref WeatherState> weatherStates =
new
array<ref WeatherState>;
115
ChimeraWorld
world =
GetGame
().GetWorld();
116
TimeAndWeatherManagerEntity
weatherManager = world.GetTimeAndWeatherManager();
117
if
(!weatherManager)
118
return
;
119
120
weatherManager.GetWeatherStatesList(weatherStates);
121
122
int
count = weatherStates.Count();
123
string
weatherName;
124
ResourceName
weatherIconPath;
125
126
//Create preset list
127
for
(
int
i = 0; i < count; i++)
128
{
129
value =
new
SCR_EditorAttributeFloatStringValueHolder
();
130
131
weatherName = weatherStates[i].GetLocalizedName();
132
weatherIconPath = weatherStates[i].GetIconPath();
133
134
if
(
SCR_StringHelper
.
IsEmptyOrWhiteSpace
(weatherName))
135
{
136
weatherName =
m_sUnknownWeatherName
;
137
Print
(
"WeatherState: '"
+ weatherStates[i].GetStateID() +
"' does not have weather localization name assigned!"
,
LogLevel
.ERROR);
138
}
139
140
141
if
(
SCR_StringHelper
.
IsEmptyOrWhiteSpace
(weatherIconPath))
142
{
143
weatherIconPath =
m_sUnknownWeatherIcon
;
144
Print
(
"WeatherState: '"
+ weatherStates[i].GetStateID() +
"' does not have weather icon assigned!"
,
LogLevel
.ERROR);
145
}
146
147
value.
SetName
(weatherName);
148
value.
SetIcon
(weatherIconPath);
149
value.
SetFloatValue
(weatherStates[i].GetStateID());
150
151
m_aValues
.Insert(value);
152
}
153
}
154
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
BaseWeatherStateTransitionManager
Definition
BaseWeatherStateTransitionManager.c:8
ChimeraWorld
Definition
ChimeraWorld.c:13
GenericEntity
Definition
GenericEntity.c:16
IEntity::GetWorld
proto external BaseWorld GetWorld()
LocalizedString
Definition
LocalizedString.c:22
ResourceName
Definition
ResourceName.c:13
SCR_BaseEditorAttributeCustomTitle
Definition
SCR_BaseEditorAttribute.c:876
SCR_BaseEditorAttribute::GetVariable
sealed SCR_BaseEditorAttributeVar GetVariable(bool createWhenNull=false)
Definition
SCR_BaseEditorAttribute.c:307
SCR_BaseEditorAttribute::IsGameMode
bool IsGameMode(Managed item)
Definition
SCR_BaseEditorAttribute.c:466
SCR_BaseEditorAttributeVar
Definition
SCR_BaseEditorAttributeVar.c:2
SCR_BaseEditorAttributeVar::CreateInt
static SCR_BaseEditorAttributeVar CreateInt(int value)
Definition
SCR_BaseEditorAttributeVar.c:107
SCR_BaseEditorAttributeVar::GetInt
int GetInt()
Definition
SCR_BaseEditorAttributeVar.c:20
SCR_BaseFloatValueHolderEditorAttribute::m_aValues
ref array< ref SCR_EditorAttributeFloatStringValueHolder > m_aValues
Definition
SCR_BaseFloatValueHolderEditorAttribute.c:6
SCR_BasePresetsEditorAttribute
Definition
SCR_BasePresetsEditorAttribute.c:6
SCR_EditorAttributeFloatStringValueHolder
Definition
SCR_BaseFloatValueHolderEditorAttribute.c:61
SCR_EditorAttributeFloatStringValueHolder::SetFloatValue
void SetFloatValue(float newValue)
Definition
SCR_BaseFloatValueHolderEditorAttribute.c:129
SCR_EditorAttributeFloatStringValueHolder::SetIcon
void SetIcon(ResourceName newIcon, bool isImageset=false)
Definition
SCR_BaseFloatValueHolderEditorAttribute.c:80
SCR_EditorAttributeFloatStringValueHolder::SetName
void SetName(string newName)
Definition
SCR_BaseFloatValueHolderEditorAttribute.c:105
SCR_StringHelper
Definition
SCR_StringHelper.c:2
SCR_StringHelper::IsEmptyOrWhiteSpace
static bool IsEmptyOrWhiteSpace(string input)
Definition
SCR_StringHelper.c:594
SCR_WeatherInstantEditorAttribute
Definition
SCR_WeatherInstantEditorAttribute.c:6
SCR_WeatherInstantEditorAttribute::m_sUnknownWeatherIcon
ResourceName m_sUnknownWeatherIcon
Definition
SCR_WeatherInstantEditorAttribute.c:11
SCR_WeatherInstantEditorAttribute::PreviewVariable
override void PreviewVariable(bool setPreview, SCR_AttributesManagerEditorComponent manager)
Definition
SCR_WeatherInstantEditorAttribute.c:84
SCR_WeatherInstantEditorAttribute::WriteVariable
override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
Definition
SCR_WeatherInstantEditorAttribute.c:40
SCR_WeatherInstantEditorAttribute::CreatePresets
override void CreatePresets()
Definition
SCR_WeatherInstantEditorAttribute.c:108
SCR_WeatherInstantEditorAttribute::m_sUnknownWeatherName
LocalizedString m_sUnknownWeatherName
Definition
SCR_WeatherInstantEditorAttribute.c:8
SCR_WeatherInstantEditorAttribute::ReadVariable
override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
Definition
SCR_WeatherInstantEditorAttribute.c:13
SCR_WeatherInstantTransitionTimeEditorAttribute
Definition
SCR_WeatherInstantTransitionTimeEditorAttribute.c:8
TimeAndWeatherManagerEntity
Definition
TimeAndWeatherManagerEntity.c:26
TimeAndWeatherManagerEntity::ForceWeatherTo
void ForceWeatherTo(bool setLooping, string weatherID=string.Empty, float transitionDuration=0, float stateDuration=0.001, int playerThatChangedWeather=0)
Definition
TimeAndWeatherManagerEntity.c:265
TimeAndWeatherManagerEntity::SetWeatherStatePreview
bool SetWeatherStatePreview(bool preview, string stateName="")
Definition
TimeAndWeatherManagerEntity.c:125
WeatherState
Definition
WeatherState.c:8
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
Editor
Containers
Attributes
SCR_WeatherInstantEditorAttribute.c
Generated by
1.17.0