2 // control/visual/switchbutton.qc
4 bool( float pKey, float pAscii ) Item_SwitchButton_Key =
9 if( pKey == K_SPACE || pKey == K_ENTER || pKey == K_MOUSE1 || pKey == K_RIGHTARROW ) {
10 Sound_Play( self.soundPressed );
11 self._presstime = Timer_Time;
13 self._target._realValue = self._target._realValue + self._target.stepValue;
14 if( self._target._realValue > self._target.maxValue )
15 self._target._realValue = self._target.minValue;
17 Raise_DataEvent( self._target, ITEM_DATALINK_SET );
21 } else if( pKey == K_BACKSPACE || pKey == K_MOUSE2 || pKey == K_LEFTARROW ) {
22 Sound_Play( self.soundPressed );
23 self._presstime = Timer_Time;
25 self._target._realValue = self._target._realValue - self._target.stepValue;
26 if( self._target._realValue < self._target.minValue )
27 self._target._realValue = self._target.maxValue;
29 Raise_DataEvent( self._target, ITEM_DATALINK_SET );
38 void() Item_SwitchButton_Spawn =
40 Item_ValueButton_Spawn();
42 self._key = Item_SwitchButton_Key;