4enum ETimeAccelCategories
7 UNDERGROUND_ENTRANCE = 0x00000001,
8 UNDERGROUND_RESERVOIR = 0x00000002,
9 ENERGY_CONSUMPTION = 0x00000004,
10 ENERGY_RECHARGE = 0x00000008,
11 FOOD_DECAY = 0x00000010,
12 DYNAMIC_MUSIC_PLAYER = 0x00000020,
19 static ref TimeAccelParam m_CurrentTimeAccel;
21 static ref array<int> m_IDs =
new array<int>();
22 static bool m_Initializeded =
Init();
26 Bind(
DiagMenuIDs.FEATURE_TIME_ACCEL_UG_ENTRANCES, ETimeAccelCategories.UNDERGROUND_ENTRANCE);
27 Bind(
DiagMenuIDs.FEATURE_TIME_ACCEL_UG_RESERVOIR, ETimeAccelCategories.UNDERGROUND_RESERVOIR);
28 Bind(
DiagMenuIDs.FEATURE_TIME_ACCEL_ENERGY_CONSUME, ETimeAccelCategories.ENERGY_CONSUMPTION);
29 Bind(
DiagMenuIDs.FEATURE_TIME_ACCEL_ENERGY_RECHARGE, ETimeAccelCategories.ENERGY_RECHARGE);
30 Bind(
DiagMenuIDs.FEATURE_TIME_ACCEL_FOOD_DECAY, ETimeAccelCategories.FOOD_DECAY);
32 Bind(
DiagMenuIDs.FEATURE_TIME_ACCEL_DYNAMIC_MUSIC_PLAYER, ETimeAccelCategories.DYNAMIC_MUSIC_PLAYER);
41 m_Mapping.
Insert(
id, catBit);
49 return m_Mapping.Get(
id);
54 static int GetDiagIDByCategory(ETimeAccelCategories category)
56 for (
int i = 0; i < m_Mapping.Count();i++)
58 if (m_Mapping.GetElement(i) == category)
60 return m_Mapping.GetKey(i);
68 static bool GetFeatureTimeAccelEnabled(ETimeAccelCategories categoryBit)
70 return (m_CurrentTimeAccel && m_CurrentTimeAccel.param1 && (categoryBit & m_CurrentTimeAccel.param3) != 0);
75 static float GetFeatureTimeAccelValue()
77 if (m_CurrentTimeAccel)
78 return m_CurrentTimeAccel.param2;
84 static void CopyTimeAccelClipboard(
bool enable,
int timeAccelBig,
float timeAccelSmall,
int bitMask)
86 string output =
"-timeAccel=";
88 output += val.ToString()+
","+timeAccelBig.ToString()+
","+timeAccelSmall.
ToString()+
","+bitMask.ToString();
94 static int GetTimeAccelBitmask()
98 foreach (
int id : m_IDs)
100 WriteCategoryBit(bitmask,
id);
108 static void WriteCategoryBit(out
int bitmask,
int diagMenuID)
110 int bit = GetCategoryByDiagID(diagMenuID);
111 if (DiagMenu.GetValue(diagMenuID))
113 bitmask = bitmask | bit;
119 static bool AreTimeAccelParamsSame(TimeAccelParam p1, TimeAccelParam p2)
123 if (p1.param1 != p2.param1)
125 if (p1.param2 != p2.param2)
127 if (p1.param3 != p2.param3)
134 static void SendTimeAccel(Man player, TimeAccelParam param)
proto native void CopyToClipboard(string text)
proto native void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
proto string ToString(bool simple=true)
proto native CGame GetGame()
proto void Insert(int index, string input)
Inserts a string into the n-th index, increasing the string length by the size of the input.