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_WindOverrideEditorAttribute.c
Go to the documentation of this file.
1
4
// Script File
5
[
BaseContainerProps
(),
SCR_BaseEditorAttributeCustomTitle
()]
6
class
SCR_WindOverrideEditorAttribute
:
SCR_BaseEditorAttribute
7
{
8
override
SCR_BaseEditorAttributeVar
ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
9
{
10
//If opened in global attributes
11
if
(!
IsGameMode
(item))
12
return
null;
13
14
GenericEntity
ent =
GenericEntity
.Cast(item);
15
ChimeraWorld
world = ent.
GetWorld
();
16
TimeAndWeatherManagerEntity
weatherManager = world.GetTimeAndWeatherManager();
17
if
(!weatherManager)
18
return
null;
19
20
return
SCR_BaseEditorAttributeVar
.
CreateBool
(weatherManager.IsWindSpeedOverridden() || weatherManager.IsWindDirectionOverridden());
21
}
22
23
override
void
UpdateInterlinkedVariables(
SCR_BaseEditorAttributeVar
var, SCR_AttributesManagerEditorComponent manager,
bool
isInit =
false
)
24
{
25
if
(!var)
26
return
;
27
28
if
(isInit)
29
{
30
manager.SetAttributeAsSubAttribute(
SCR_WindSpeedEditorAttribute
);
31
manager.SetAttributeAsSubAttribute(
SCR_WindDirectionEditorAttribute
);
32
}
33
34
bool
overrideWeather = var && var.
GetBool
();
35
36
manager.SetAttributeEnabled(
SCR_WindSpeedEditorAttribute
, overrideWeather);
37
manager.SetAttributeEnabled(
SCR_WindDirectionEditorAttribute
, overrideWeather);
38
}
39
40
override
void
WriteVariable(Managed item,
SCR_BaseEditorAttributeVar
var, SCR_AttributesManagerEditorComponent manager,
int
playerID)
41
{
42
if
(!var)
43
return
;
44
45
GenericEntity
ent =
GenericEntity
.Cast(item);
46
ChimeraWorld
world = ent.
GetWorld
();
47
TimeAndWeatherManagerEntity
weatherManager = world.GetTimeAndWeatherManager();
48
if
(!weatherManager)
49
return
;
50
51
BaseWeatherStateTransitionManager
weatherTransitionManager = weatherManager.GetTransitionManager();
52
53
//Is preview
54
if
(!item)
55
{
56
if
(!weatherTransitionManager)
57
return
;
58
59
//Has override so show preview
60
if
(var.
GetBool
())
61
{
62
//Set wind override preview
63
SCR_BaseEditorAttributeVar
windSpeedVar;
64
if
(!manager.GetAttributeVariable(
SCR_WindSpeedEditorAttribute
, windSpeedVar))
65
return
;
66
67
SCR_BaseEditorAttributeVar
windDirectionVar;
68
if
(!manager.GetAttributeVariable(
SCR_WindDirectionEditorAttribute
, windDirectionVar))
69
return
;
70
71
SCR_WindDirectionInfo
windDirectionInfo;
72
if
(!weatherManager.
GetWindDirectionInfoFromIndex
(windDirectionVar.
GetInt
(), windDirectionInfo))
73
return
;
74
75
weatherManager.
SetWindPreview
(
true
, windSpeedVar.
GetFloat
(), windDirectionInfo.
GetWindDirectionValue
());
76
}
77
//Override false so disable preview
78
else
if
(weatherTransitionManager.IsPreviewingWind())
79
{
80
weatherManager.
SetWindPreview
(
false
);
81
}
82
83
return
;
84
}
85
86
//Cancel preview
87
if
(weatherTransitionManager && weatherTransitionManager.IsPreviewingWind())
88
weatherManager.
SetWindPreview
(
false
);
89
90
weatherManager.
DelayedSetWindOverride
(var.
GetBool
(), playerID);
91
}
92
93
override
void
PreviewVariable(
bool
setPreview, SCR_AttributesManagerEditorComponent manager)
94
{
95
//Set preview (Also called from SCR_WindSpeedEditorAttribute and SCR_WindDirectionEditorAttribute)
96
if
(setPreview)
97
{
98
WriteVariable(null,
GetVariable
(), manager, -1);
99
}
100
//Cancel preview (On reset)
101
else
102
{
103
ChimeraWorld
world =
GetGame
().GetWorld();
104
TimeAndWeatherManagerEntity
weatherManager = world.GetTimeAndWeatherManager();
105
if
(!weatherManager)
106
return
;
107
108
BaseWeatherStateTransitionManager
weatherTransitionManager = weatherManager.GetTransitionManager();
109
if
(!weatherTransitionManager)
110
return
;
111
112
if
(weatherTransitionManager.IsPreviewingWind())
113
weatherManager.
SetWindPreview
(
false
);
114
}
115
}
116
};
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_WindDirectionEditorAttribute
Definition
SCR_WindDirectionEditorAttribute.c:6
SCR_WindDirectionInfo
Definition
TimeAndWeatherManagerEntity.c:1197
SCR_WindDirectionInfo::GetWindDirectionValue
int GetWindDirectionValue()
Definition
TimeAndWeatherManagerEntity.c:1213
SCR_WindOverrideEditorAttribute
Definition
SCR_WindOverrideEditorAttribute.c:7
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_WindOverrideEditorAttribute.c
Generated by
1.17.0