4 enum ETimeAccelCategories
7 UNDERGROUND_ENTRANCE = 0x00000001,
8 UNDERGROUND_RESERVOIR = 0x00000002,
9 ENERGY_CONSUMPTION = 0x00000004,
10 ENERGY_RECHARGE = 0x00000008,
11 FOOD_DECAY = 0x00000010,
17 class FeatureTimeAccel
19 static ref TimeAccelParam m_CurrentTimeAccel;
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);
38 m_Mapping.Insert(
id, catBit);
46 return m_Mapping.Get(
id);
51 static int GetDiagIDByCategory(ETimeAccelCategories category)
53 for (
int i = 0; i < m_Mapping.Count();i++)
55 if (m_Mapping.GetElement(i) == category)
57 return m_Mapping.GetKey(i);
65 static bool GetFeatureTimeAccelEnabled(ETimeAccelCategories categoryBit)
67 return (m_CurrentTimeAccel && m_CurrentTimeAccel.param1 && (categoryBit & m_CurrentTimeAccel.param3) != 0);
72 static float GetFeatureTimeAccelValue()
74 if (m_CurrentTimeAccel)
75 return m_CurrentTimeAccel.param2;
81 static void CopyTimeAccelClipboard(
bool enable,
int timeAccelBig,
float timeAccelSmall,
int bitMask)
83 string output =
"-timeAccel=";
85 output += val.ToString()+
","+timeAccelBig.ToString()+
","+timeAccelSmall.ToString()+
","+bitMask.ToString();
86 GetGame().CopyToClipboard(output);
91 static int GetTimeAccelBitmask()
95 foreach (
int id : m_IDs)
97 WriteCategoryBit(bitmask,
id);
105 static void WriteCategoryBit(out
int bitmask,
int diagMenuID)
107 int bit = GetCategoryByDiagID(diagMenuID);
110 bitmask = bitmask | bit;
116 static bool AreTimeAccelParamsSame(TimeAccelParam p1, TimeAccelParam p2)
120 if (p1.param1 != p2.param1)
122 if (p1.param2 != p2.param2)
124 if (p1.param3 != p2.param3)
131 static void SendTimeAccel(Man player, TimeAccelParam param)
133 GetGame().RPCSingleParam(player,
ERPCs.DIAG_TIMEACCEL, param,
true, player.GetIdentity());