2 // control/data/cvar.qc
10 void() Item_Data_Cvar_Sync =
12 String_EntitySet( self, _syncValue, cvar_string( self.cvarName ) );
13 String_EntitySet( self, value, self._syncValue );
16 void() Item_Data_Cvar_Send =
18 cvar_set( self.cvarName, self.value );
19 Item_Data_Cvar_Sync();
22 void() Item_Data_Cvar_Reset =
25 String_EntitySet( self, value, self.defValue );
27 String_EntitySet( self, value, cvar_defstring( self.cvarName ) );
29 Item_Data_Cvar_Send();
32 void() Item_Data_Cvar_Test_Start =
34 cvar_set( self.cvarName, self.value );
37 void() Item_Data_Cvar_Test_End =
39 cvar_set( self.cvarName, self._syncValue );
42 void() Item_Data_Cvar_Save_ExecString = {
43 Data_ExecString = String_Append( Data_ExecString, strcat( "set \"", self.cvarName, "\" \"", self.value, "\"\n" ) );
46 void( float pEvent ) Item_Data_Cvar_DataEvent =
50 Item_Data_Cvar_Sync();
53 Item_Data_Cvar_Send();
56 Item_Data_Cvar_Reset();
58 case ITEM_DATA_TEST_START:
59 Item_Data_Cvar_Test_Start();
61 case ITEM_DATA_TEST_END:
62 Item_Data_Cvar_Test_End();
64 case ITEM_DATA_SAVE_EXECSTRING:
65 Item_Data_Cvar_Save_ExecString();
70 void() Item_Data_Cvar_Destroy =
73 String_EntityFree( self, cvarName );
76 void() Item_Data_Cvar_Spawn =
78 String_EntityZone( self, cvarName );
81 self.flag = self.flag | FLAG_HIDDEN;
83 self._dataEvent = Item_Data_Cvar_DataEvent;
84 self._reinit = Item_Data_Cvar_Sync;
85 self._destroy = Item_Data_Cvar_Destroy;
90 Item_Data_CvarCreateSave
94 void() Item_Data_CvarCreateSave_Spawn =
96 Item_Data_Cvar_Spawn();
98 registercvar( self.cvarName, self.defValue, CVAR_SAVE );