DayZ 1.24
Loading...
Searching...
No Matches
GPSReceiver.c
Go to the documentation of this file.
1class GPSReceiver : ItemGPS
2{
3
4 const string DISPLAY_TEXTURE_PATH_FORMAT = "dz\\gear\\navigation\\data\\GPS_%1_ca.paa";
5 const string ANIM_PHASE_DISPLAY_HIDE = "DisplayState";
6
10
14
16 {
19
20 int i;
21 for (i = 0; i < MapNavigationBehaviour.DISPLAY_GRID_POS_MAX_CHARS_COUNT * 2; ++i)
23
24 for (i = 0; i < MapNavigationBehaviour.DISPLAY_ALT_MAX_CHARS_COUNT; ++i)
25 m_AltitudeNumbersLast.Insert(0);
26
28 m_DisplayGridSelections.Insert("grid_1_0");
29 m_DisplayGridSelections.Insert("grid_1_1");
30 m_DisplayGridSelections.Insert("grid_1_2");
31 m_DisplayGridSelections.Insert("grid_2_0");
32 m_DisplayGridSelections.Insert("grid_2_1");
33 m_DisplayGridSelections.Insert("grid_2_2");
34
36 m_DisplayAltSelections.Insert("alt_0");
37 m_DisplayAltSelections.Insert("alt_1");
38 m_DisplayAltSelections.Insert("alt_2");
39 m_DisplayAltSelections.Insert("alt_3");
40
42 for (i = -1; i < 11; i++)
43 {
44
45 string texturePath = string.Format(DISPLAY_TEXTURE_PATH_FORMAT, i);
46
48 if (i == -1)
49 texturePath = string.Format(DISPLAY_TEXTURE_PATH_FORMAT, "dash");
50
52 }
53 }
54
55 protected void PositionalUpdate()
56 {
59 }
60
63
64 override void SetActions()
65 {
66 super.SetActions();
67
70 }
71
72 override bool IsTurnedOn()
73 {
74 return GetCompEM() && GetCompEM().IsWorking();
75 }
76
77 //------------------------------------------------------------------------------
78 override void OnWorkStart()
79 {
81
82 if (GetHierarchyRoot())
83 {
84 PlayerBase pb = PlayerBase.Cast(GetHierarchyRoot());
85 if (pb)
86 pb.MapNavigationItemInPossession(this);
87 }
88 }
89
90 override void OnWorkStop()
91 {
92 UpdateDisplayState(false);
93
94 if (GetHierarchyRoot())
95 {
96 PlayerBase pb = PlayerBase.Cast(GetHierarchyRoot());
97 if (pb)
98 pb.MapNavigationItemNotInPossession(this);
99 }
100 }
101
102 override void OnWork(float consumed_energy)
103 {
105 }
106 //------------------------------------------------------------------------------
107
108 protected void UpdateDisplayState(bool pIsTurnedOn)
109 {
110 SetAnimationPhaseNow(ANIM_PHASE_DISPLAY_HIDE, !pIsTurnedOn);
111 }
112
113 protected void UpdateDisplayPosition()
114 {
115 int selectionIndex;
116 string selectionName;
117 array<int> orderedPositionNumbers = MapNavigationBehaviour.OrderedPositionNumbersFromGridCoords(this);
118
120 {
121 for (int i = 0; i < m_DisplayGridSelections.Count(); ++i)
122 {
126 }
127
129 }
130 }
131
132 protected void UpdateDisplayElevation()
133 {
134 int selectionIndex;
135 string selectionName;
136 array<int> altitudeNumbers = MapNavigationBehaviour.OrderedAltitudeNumbersPosition(this);
137
138 if (altitudeNumbers.DifferentAtPosition(m_AltitudeNumbersLast) != INDEX_NOT_FOUND)
139 {
140 for (int i = 0; i < m_DisplayAltSelections.Count(); ++i)
141 {
145 }
146
148 }
149 }
150
151 protected int GetHiddenSelection(string selection)
152 {
153 int idx = GetHiddenSelectionIndex(selection);
154
155 if (idx != INDEX_NOT_FOUND)
156 return idx;
157 else
158 return 0;
159 }
160
161 //================================================================
162 // DEBUG
163 //================================================================
164
165 override void OnDebugSpawn()
166 {
167 Battery9V.Cast(GetInventory().CreateInInventory("Battery9V"));
168 }
169}
void AddAction(typename actionName)
void MapNavigationBehaviour(PlayerBase pPlayer, EMapNavigationType pNavigationType=EMapNavigationType.BASIC)
ref map< int, string > m_DisplayNumericSignTextureMap
Definition GPSReceiver.c:9
int GetHiddenSelection(string selection)
const string ANIM_PHASE_DISPLAY_HIDE
Definition GPSReceiver.c:5
void UpdateDisplayState(bool pIsTurnedOn)
ref array< int > m_AltitudeNumbersLast
Definition GPSReceiver.c:13
override void OnDebugSpawn()
override void OnWork(float consumed_energy)
void UpdateDisplayElevation()
ref set< string > m_DisplayAltSelections
Definition GPSReceiver.c:8
void UpdateDisplayPosition()
const string DISPLAY_TEXTURE_PATH_FORMAT
Definition GPSReceiver.c:4
void GPSReceiver()
Definition GPSReceiver.c:15
override void OnWorkStart()
Definition GPSReceiver.c:78
ref set< string > m_DisplayGridSelections
Definition GPSReceiver.c:7
override bool IsTurnedOn()
Definition GPSReceiver.c:72
override void SetActions()
Definition GPSReceiver.c:64
override void OnMovedInsideCargo(EntityAI container)
need to be overriden, otherwise the item will be turned off when moved to cargo
ref array< int > m_OrderedPositionNumbersLast
cache
Definition GPSReceiver.c:12
void PositionalUpdate()
Definition GPSReceiver.c:55
override void OnWorkStop()
Definition GPSReceiver.c:90
const int INDEX_NOT_FOUND
Definition gameplay.c:13