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_WristwatchComponent.c
Go to the documentation of this file.
1
//------------------------------------------------------------------------------------------------
2
[
EntityEditorProps
(
category
:
"GameScripted/Gadgets"
, description:
"Wristwatch gadget"
)]
3
class
SCR_WristwatchComponentClass
:
SCR_GadgetComponentClass
4
{
5
[
Attribute
(
"0"
,
UIWidgets
.ComboBox,
"Set wristwatch type"
,
""
, ParamEnumArray.FromEnum(EWristwatchType),
category
:
"Wristwatch"
)]
6
int
m_iWristwatchType;
7
8
[
Attribute
(
"{6ECDF523E1035A0F}Prefabs/Items/Equipment/Watches/Watch_SandY184A_Map.et"
,
desc
:
"Wristwatch prefab used for display within 2D map"
,
category
:
"Wristwatch"
)]
9
ResourceName
m_sMapResource;
10
11
bool
m_bSignalInit =
false
;
12
int
m_iSignalHour = -1;
13
int
m_iSignalMinute = -1;
14
int
m_iSignalSecond = -1;
15
int
m_iSignalDay = -1;
16
17
//------------------------------------------------------------------------------------------------
19
void
InitSignals(
IEntity
owner)
20
{
21
SignalsManagerComponent
signalMgr =
SignalsManagerComponent
.Cast( owner.
FindComponent
(
SignalsManagerComponent
) );
22
if
(!signalMgr)
23
return
;
24
25
// cache signals
26
m_iSignalHour = signalMgr.FindSignal(
"Hour"
);
27
m_iSignalMinute = signalMgr.FindSignal(
"Minute"
);
28
m_iSignalSecond = signalMgr.FindSignal(
"Second"
);
29
30
if
(m_iWristwatchType == EWristwatchType.VOSTOK)
31
m_iSignalDay = signalMgr.FindSignal(
"Day"
);
32
33
if
(m_iSignalHour != -1 && m_iSignalMinute != -1 && m_iSignalSecond != -1)
34
m_bSignalInit =
true
;
35
}
36
}
37
38
//------------------------------------------------------------------------------------------------
40
enum
EWristwatchType
41
{
42
SandY184A
,
// US
43
VOSTOK
// Soviet
44
}
45
46
//------------------------------------------------------------------------------------------------
47
class
SCR_WristwatchComponent : SCR_GadgetComponent
48
{
49
protected
int
m_iSeconds
;
50
protected
int
m_iMinutes
;
51
protected
int
m_iHours
;
52
protected
int
m_iDay
;
53
54
protected
SCR_WristwatchComponentClass
m_PrefabData
;
55
protected
SignalsManagerComponent
m_SignalManager
;
56
protected
TimeAndWeatherManagerEntity
m_TimeMgr
;
57
58
//------------------------------------------------------------------------------------------------
61
ResourceName
GetMapPrefabResource
()
62
{
63
return
m_PrefabData
.m_sMapResource;
64
}
65
66
//------------------------------------------------------------------------------------------------
68
void
UpdateTime
()
69
{
70
if
(!
m_TimeMgr
)
71
{
72
ChimeraWorld
world =
ChimeraWorld
.CastFrom(
GetGame
().GetWorld());
73
if
(world)
74
m_TimeMgr
= world.GetTimeAndWeatherManager();
75
76
return
;
77
}
78
79
m_TimeMgr
.GetHoursMinutesSeconds(
m_iHours
,
m_iMinutes
,
m_iSeconds
);
80
if
(
m_iHours
>= 12)
81
m_iHours
-= 12;
82
83
m_iHours
*= 10;
84
m_iHours
+= (
m_iMinutes
/6);
85
86
m_SignalManager
.SetSignalValue(
m_PrefabData
.m_iSignalHour,
m_iHours
);
87
m_SignalManager
.SetSignalValue(
m_PrefabData
.m_iSignalMinute,
m_iMinutes
);
88
m_SignalManager
.SetSignalValue(
m_PrefabData
.m_iSignalSecond,
m_iSeconds
);
89
90
m_iDay
=
m_TimeMgr
.GetDay();
91
92
m_SignalManager
.SetSignalValue(
m_PrefabData
.m_iSignalDay,
m_iDay
);
93
}
94
95
//------------------------------------------------------------------------------------------------
97
protected
void
UpdateWristwatchState
()
98
{
99
if
(
System
.IsConsoleApp())
100
return
;
101
102
if
(m_bActivated)
103
ActivateGadgetUpdate
();
104
else
105
DeactivateGadgetUpdate
();
106
107
if
(!
m_PrefabData
.m_bSignalInit)
108
m_PrefabData
.InitSignals(
GetOwner
());
109
}
110
111
//------------------------------------------------------------------------------------------------
113
void
SetMapMode
()
114
{
115
m_iMode = EGadgetMode.IN_HAND;
116
m_bActivated =
true
;
117
UpdateWristwatchState
();
118
119
ChimeraWorld
world =
ChimeraWorld
.CastFrom(
GetGame
().GetWorld());
120
if
(world)
121
m_TimeMgr
= world.GetTimeAndWeatherManager();
122
123
m_PrefabData
.InitSignals(
GetOwner
());
124
}
125
126
//------------------------------------------------------------------------------------------------
127
override
void
ModeSwitch
(EGadgetMode mode,
IEntity
charOwner)
128
{
129
super.ModeSwitch(mode, charOwner);
130
131
if
(mode == EGadgetMode.IN_HAND)
132
{
133
m_bActivated =
true
;
134
UpdateWristwatchState
();
135
}
136
}
137
138
//------------------------------------------------------------------------------------------------
139
override
void
ModeClear
(EGadgetMode mode)
140
{
141
if
(mode == EGadgetMode.IN_HAND)
142
{
143
m_bActivated =
false
;
144
UpdateWristwatchState
();
145
}
146
147
super.ModeClear(mode);
148
}
149
150
//------------------------------------------------------------------------------------------------
151
override
void
ActivateGadgetUpdate
()
152
{
153
super.ActivateGadgetUpdate();
154
155
InventoryItemComponent
itemComponent =
InventoryItemComponent
.Cast(
GetOwner
().FindComponent(
InventoryItemComponent
));
156
if
(itemComponent)
157
itemComponent.ActivateOwner(
true
);
// required for the procedural animations to function
158
}
159
160
//------------------------------------------------------------------------------------------------
161
override
void
DeactivateGadgetUpdate
()
162
{
163
super.DeactivateGadgetUpdate();
164
165
InventoryItemComponent
itemComponent =
InventoryItemComponent
.Cast(
GetOwner
().FindComponent(
InventoryItemComponent
));
166
if
(itemComponent)
167
itemComponent.ActivateOwner(
false
);
168
}
169
170
//------------------------------------------------------------------------------------------------
171
override
EGadgetType
GetType
()
172
{
173
return
EGadgetType.WRISTWATCH;
174
}
175
176
//------------------------------------------------------------------------------------------------
177
override
bool
CanBeRaised
()
178
{
179
return
true
;
180
}
181
182
//------------------------------------------------------------------------------------------------
183
override
bool
IsUsingADSControls
()
184
{
185
return
true
;
186
}
187
188
//------------------------------------------------------------------------------------------------
189
override
void
OnPostInit
(
IEntity
owner)
190
{
191
super.OnPostInit(owner);
192
193
m_PrefabData
=
SCR_WristwatchComponentClass
.Cast(
GetComponentData
(owner) );
194
m_SignalManager
=
SignalsManagerComponent
.Cast( owner.
FindComponent
(
SignalsManagerComponent
) );
195
196
UpdateWristwatchState
();
197
}
198
199
//------------------------------------------------------------------------------------------------
200
override
void
Update
(
float
timeSlice)
201
{
202
UpdateTime
();
203
}
204
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
ModeClear
void ModeClear(EGadgetMode mode)
Definition
SCR_CampaignBuildingGadgetToolComponent.c:509
ModeSwitch
override void ModeSwitch(EGadgetMode mode, IEntity charOwner)
Definition
SCR_CampaignBuildingGadgetToolComponent.c:76
GetType
override EGadgetType GetType()
Definition
SCR_CampaignBuildingGadgetToolComponent.c:60
GetComponentData
SCR_CharacterSoundComponentClass GetComponentData()
Definition
SCR_CharacterSoundComponent.c:132
EntityEditorProps
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
Definition
SCR_CompassComponent.c:10
ActivateGadgetUpdate
override void ActivateGadgetUpdate()
Definition
SCR_DetonatorGadgetComponent.c:476
DeactivateGadgetUpdate
override void DeactivateGadgetUpdate()
Definition
SCR_DetonatorGadgetComponent.c:488
CanBeRaised
override bool CanBeRaised()
Definition
SCR_DetonatorGadgetComponent.c:449
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
m_iDay
int m_iDay
Definition
SCR_TimeAndWeatherHandlerComponent.c:74
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
m_TimeMgr
TimeAndWeatherManagerEntity m_TimeMgr
Definition
SCR_WristwatchComponent.c:56
m_PrefabData
SCR_WristwatchComponentClass m_PrefabData
Definition
SCR_WristwatchComponent.c:54
GetMapPrefabResource
ResourceName GetMapPrefabResource()
Definition
SCR_WristwatchComponent.c:61
m_iHours
int m_iHours
Definition
SCR_WristwatchComponent.c:51
m_SignalManager
SignalsManagerComponent m_SignalManager
Definition
SCR_WristwatchComponent.c:55
UpdateTime
void UpdateTime()
Definition
SCR_WristwatchComponent.c:68
IsUsingADSControls
override bool IsUsingADSControls()
Definition
SCR_WristwatchComponent.c:183
SandY184A
SCR_WristwatchComponentClass SandY184A
Wristwatch type.
m_iMinutes
int m_iMinutes
Definition
SCR_WristwatchComponent.c:50
SetMapMode
void SetMapMode()
Activate in a map UI mode.
Definition
SCR_WristwatchComponent.c:113
m_iSeconds
SCR_WristwatchComponentClass m_iSeconds
UpdateWristwatchState
void UpdateWristwatchState()
Update state of wristwatch -> active/inactive.
Definition
SCR_WristwatchComponent.c:97
ChimeraWorld
Definition
ChimeraWorld.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
InventoryItemComponent
Definition
InventoryItemComponent.c:13
ResourceName
Definition
ResourceName.c:13
SCR_GadgetComponentClass
Definition
SCR_GadgetComponent.c:3
SCR_WristwatchComponentClass
Definition
SCR_WristwatchComponent.c:4
SignalsManagerComponent
Definition
SignalsManagerComponent.c:13
System
Definition
System.c:13
TimeAndWeatherManagerEntity
Definition
TimeAndWeatherManagerEntity.c:26
UIWidgets
Definition
attributes.c:40
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition
SCR_FuelNode.c:128
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
Update
@ Update
Definition
SndComponentCallbacks.c:14
OnPostInit
@ OnPostInit
Definition
SndComponentCallbacks.c:15
scripts
Game
Components
Gadgets
SCR_WristwatchComponent.c
Generated by
1.17.0