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 + 1;
14 if( self._target._realValue > self._target.maxValue )
15 self._target._realValue = self._target.minValue;
16 Raise_DataEvent( self._target, ITEM_DATALINK_SET );
20 } else if( pKey == K_BACKSPACE || pKey == K_MOUSE2 || pKey == K_LEFTARROW ) {
21 Sound_Play( self.soundPressed );
22 self._presstime = Timer_Time;
24 self._target._realValue = self._target._realValue - 1;
25 if( self._target._realValue < self._target.minValue )
26 self._target._realValue = self._target.maxValue;
28 Raise_DataEvent( self._target, ITEM_DATALINK_SET );
37 void() Item_SwitchButton_Spawn =
39 Item_ValueButton_Spawn();
41 self._key = Item_SwitchButton_Key;