4 const string DISPLAY_TEXTURE_PATH_FORMAT =
"dz\\gear\\navigation\\data\\GPS_%1_ca.paa";
5 const string ANIM_PHASE_DISPLAY_HIDE =
"DisplayState";
7 protected ref set<string> m_DisplayGridSelections;
8 protected ref set<string> m_DisplayAltSelections;
12 protected ref
array<int> m_OrderedPositionNumbersLast;
13 protected ref
array<int> m_AltitudeNumbersLast;
23 m_OrderedPositionNumbersLast.Insert(0);
28 m_AltitudeNumbersLast.Insert(0);
31 m_DisplayGridSelections =
new set<string>();
32 m_DisplayGridSelections.Insert(
"grid_1_0");
33 m_DisplayGridSelections.Insert(
"grid_1_1");
34 m_DisplayGridSelections.Insert(
"grid_1_2");
35 m_DisplayGridSelections.Insert(
"grid_2_0");
36 m_DisplayGridSelections.Insert(
"grid_2_1");
37 m_DisplayGridSelections.Insert(
"grid_2_2");
39 m_DisplayAltSelections =
new set<string>();
40 m_DisplayAltSelections.Insert(
"alt_0");
41 m_DisplayAltSelections.Insert(
"alt_1");
42 m_DisplayAltSelections.Insert(
"alt_2");
43 m_DisplayAltSelections.Insert(
"alt_3");
46 for (i = -1; i < 11; i++)
49 string texturePath =
string.Format(DISPLAY_TEXTURE_PATH_FORMAT, i);
54 texturePath =
string.Format(DISPLAY_TEXTURE_PATH_FORMAT,
"dash");
57 m_DisplayNumericSignTextureMap.Insert(i, texturePath);
61 protected void PositionalUpdate()
63 UpdateDisplayPosition();
64 UpdateDisplayElevation();
68 override void OnMovedInsideCargo(
EntityAI container);
70 override void SetActions()
78 override bool IsTurnedOn()
80 return GetCompEM() && GetCompEM().IsWorking();
84 override void OnWorkStart()
86 UpdateDisplayState(
true);
88 if (GetHierarchyRoot())
93 pb.MapNavigationItemInPossession(
this);
98 override void OnWorkStop()
100 UpdateDisplayState(
false);
102 if (GetHierarchyRoot())
107 pb.MapNavigationItemNotInPossession(
this);
112 override void OnWork(
float consumed_energy)
118 protected void UpdateDisplayState(
bool pIsTurnedOn)
120 SetAnimationPhaseNow(ANIM_PHASE_DISPLAY_HIDE, !pIsTurnedOn);
123 protected void UpdateDisplayPosition()
126 string selectionName;
129 if (orderedPositionNumbers.DifferentAtPosition(m_OrderedPositionNumbersLast) !=
INDEX_NOT_FOUND)
131 for (
int i = 0; i < m_DisplayGridSelections.Count(); ++i)
133 selectionName = m_DisplayGridSelections.Get(i);
134 selectionIndex = GetHiddenSelection(selectionName);
135 SetObjectTexture(selectionIndex, m_DisplayNumericSignTextureMap.Get(orderedPositionNumbers.Get(i)));
138 m_OrderedPositionNumbersLast = orderedPositionNumbers;
142 protected void UpdateDisplayElevation()
145 string selectionName;
148 if (altitudeNumbers.DifferentAtPosition(m_AltitudeNumbersLast) !=
INDEX_NOT_FOUND)
150 for (
int i = 0; i < m_DisplayAltSelections.Count(); ++i)
152 selectionName = m_DisplayAltSelections.Get(i);
153 selectionIndex = GetHiddenSelection(selectionName);
154 SetObjectTexture(selectionIndex, m_DisplayNumericSignTextureMap.Get(altitudeNumbers.Get(i)));
157 m_AltitudeNumbersLast = altitudeNumbers;
161 protected int GetHiddenSelection(
string selection)
163 int idx = GetHiddenSelectionIndex(selection);
179 override void OnDebugSpawn()
181 Battery9V.Cast(GetInventory().CreateInInventory(
"Battery9V"));