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_WindAutomaticEditorAttribute.c
Go to the documentation of this file.
1
2
[
BaseContainerProps
(),
SCR_BaseEditorAttributeCustomTitle
()]
3
class
SCR_WindAutomaticEditorAttribute
:
SCR_BaseEditorAttribute
4
{
5
//------------------------------------------------------------------------------------------------
6
override
SCR_BaseEditorAttributeVar
ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
7
{
8
//If opened in global attributes
9
if
(!
IsGameMode
(item))
10
return
null;
11
12
GenericEntity
ent =
GenericEntity
.Cast(item);
13
ChimeraWorld
world = ent.
GetWorld
();
14
TimeAndWeatherManagerEntity
weatherManager = world.GetTimeAndWeatherManager();
15
if
(!weatherManager)
16
return
null;
17
18
return
SCR_BaseEditorAttributeVar
.
CreateBool
(!weatherManager.IsWindSpeedOverridden() || !weatherManager.IsWindDirectionOverridden());
19
}
20
21
//------------------------------------------------------------------------------------------------
22
override
void
UpdateInterlinkedVariables(
SCR_BaseEditorAttributeVar
var, SCR_AttributesManagerEditorComponent manager,
bool
isInit =
false
)
23
{
24
if
(isInit)
25
{
26
manager.SetAttributeAsSubAttribute(
SCR_WindSpeedEditorAttribute
);
27
manager.SetAttributeAsSubAttribute(
SCR_WindDirectionEditorAttribute
);
28
}
29
30
bool
isAutomatic =
false
;
31
if
(var)
32
isAutomatic = var.
GetBool
();
33
34
manager.SetAttributeEnabled(
SCR_WindSpeedEditorAttribute
, var && !isAutomatic);
35
manager.SetAttributeEnabled(
SCR_WindDirectionEditorAttribute
, var && !isAutomatic);
36
}
37
38
//------------------------------------------------------------------------------------------------
39
override
void
WriteVariable(Managed item,
SCR_BaseEditorAttributeVar
var, SCR_AttributesManagerEditorComponent manager,
int
playerID)
40
{
41
if
(!var)
42
return
;
43
44
BaseGameMode gameMode =
GetGame
().GetGameMode();
45
if
(!gameMode)
46
return
;
47
48
ChimeraWorld
world =
ChimeraWorld
.CastFrom(gameMode.GetWorld());
49
if
(!world)
50
return
;
51
52
TimeAndWeatherManagerEntity
weatherManager = world.GetTimeAndWeatherManager();
53
if
(!weatherManager)
54
return
;
55
56
BaseWeatherStateTransitionManager
weatherTransitionManager = weatherManager.GetTransitionManager();
57
58
//Is preview
59
if
(!item)
60
{
61
if
(!weatherTransitionManager)
62
return
;
63
64
//Has override so show preview
65
if
(!var.
GetBool
())
66
{
67
//Set wind override preview
68
SCR_BaseEditorAttributeVar
windSpeedVar;
69
if
(!manager.GetAttributeVariable(
SCR_WindSpeedEditorAttribute
, windSpeedVar))
70
return
;
71
72
SCR_BaseEditorAttributeVar
windDirectionVar;
73
if
(!manager.GetAttributeVariable(
SCR_WindDirectionEditorAttribute
, windDirectionVar))
74
return
;
75
76
SCR_WindDirectionInfo
windDirectionInfo;
77
if
(!weatherManager.
GetWindDirectionInfoFromIndex
(windDirectionVar.
GetInt
(), windDirectionInfo))
78
return
;
79
80
weatherManager.
SetWindPreview
(
true
, windSpeedVar.
GetFloat
(), windDirectionInfo.
GetWindDirectionValue
());
81
}
82
//Is Automatic so disable preview
83
else
if
(weatherTransitionManager.IsPreviewingWind())
84
{
85
weatherManager.
SetWindPreview
(
false
);
86
}
87
88
return
;
89
}
90
91
//Cancel preview
92
if
(weatherTransitionManager && weatherTransitionManager.IsPreviewingWind())
93
weatherManager.
SetWindPreview
(
false
);
94
95
//Set to autmomatic
96
weatherManager.
DelayedSetWindOverride
(!var.
GetBool
(), playerID);
97
}
98
99
//------------------------------------------------------------------------------------------------
100
override
void
PreviewVariable(
bool
setPreview, SCR_AttributesManagerEditorComponent manager)
101
{
102
//Set preview (Also called from SCR_WindSpeedEditorAttribute and SCR_WindDirectionEditorAttribute)
103
if
(setPreview)
104
{
105
WriteVariable(null,
GetVariable
(), manager, -1);
106
}
107
//Cancel preview (On reset)
108
else
109
{
110
ChimeraWorld
world =
GetGame
().GetWorld();
111
TimeAndWeatherManagerEntity
weatherManager = world.GetTimeAndWeatherManager();
112
if
(!weatherManager)
113
return
;
114
115
BaseWeatherStateTransitionManager
weatherTransitionManager = weatherManager.GetTransitionManager();
116
if
(!weatherTransitionManager)
117
return
;
118
119
if
(weatherTransitionManager.IsPreviewingWind())
120
weatherManager.
SetWindPreview
(
false
);
121
}
122
}
123
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
BaseWeatherStateTransitionManager
Definition
BaseWeatherStateTransitionManager.c:8
ChimeraWorld
Definition
ChimeraWorld.c:13
GenericEntity
Definition
GenericEntity.c:16
IEntity::GetWorld
proto external BaseWorld GetWorld()
SCR_BaseEditorAttributeCustomTitle
Definition
SCR_BaseEditorAttribute.c:876
SCR_BaseEditorAttribute
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
Definition
SCR_BaseEditorAttribute.c:4
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::CreateBool
static SCR_BaseEditorAttributeVar CreateBool(bool value)
Definition
SCR_BaseEditorAttributeVar.c:119
SCR_BaseEditorAttributeVar::GetBool
bool GetBool()
Definition
SCR_BaseEditorAttributeVar.c:56
SCR_BaseEditorAttributeVar::GetFloat
float GetFloat()
Definition
SCR_BaseEditorAttributeVar.c:38
SCR_BaseEditorAttributeVar::GetInt
int GetInt()
Definition
SCR_BaseEditorAttributeVar.c:20
SCR_WindAutomaticEditorAttribute
Weather attribute if it should override certain weather values.
Definition
SCR_WindAutomaticEditorAttribute.c:4
SCR_WindDirectionEditorAttribute
Definition
SCR_WindDirectionEditorAttribute.c:6
SCR_WindDirectionInfo
Definition
TimeAndWeatherManagerEntity.c:1197
SCR_WindDirectionInfo::GetWindDirectionValue
int GetWindDirectionValue()
Definition
TimeAndWeatherManagerEntity.c:1213
SCR_WindSpeedEditorAttribute
Definition
SCR_WindSpeedEditorAttribute.c:4
TimeAndWeatherManagerEntity
Definition
TimeAndWeatherManagerEntity.c:26
TimeAndWeatherManagerEntity::SetWindPreview
bool SetWindPreview(bool preview, float windSpeed=-1, float windAngleDegrees=-1)
Definition
TimeAndWeatherManagerEntity.c:147
TimeAndWeatherManagerEntity::GetWindDirectionInfoFromIndex
bool GetWindDirectionInfoFromIndex(int index, out SCR_WindDirectionInfo windDirectionInfo)
Definition
TimeAndWeatherManagerEntity.c:593
TimeAndWeatherManagerEntity::DelayedSetWindOverride
void DelayedSetWindOverride(bool overrideWind, int playerChangingWind=-1)
Definition
TimeAndWeatherManagerEntity.c:672
scripts
Game
Editor
Containers
Attributes
SCR_WindAutomaticEditorAttribute.c
Generated by
1.17.0