Actually, had a bit of time to test CS:GO. It seems that the functionality still exists for this, but the item isn't included in the buy menu. If I use the following script:
Syntax: Select all
from commands.say import SayCommand
from players.entity import Player
@SayCommand('nvg')
def give_nvg(command, index, team_only):
Player(index).has_nightvision = True
then, I can use the following in my client console to activate the nightvision overlay:
That is, of course, after adding the properties to our data. You can also just set the nightvision_on attribute if you don't really want to worry about ownership of them:
Syntax: Select all
from commands.say import SayCommand
from players.entity import Player
@SayCommand('nvg')
def nvg_toggle(command, index, team_only):
player = Player(index)
player.nightvision_on = 1 - (player.nightvision_on % 2)
Both has_nightvision and nightvision_on are not 1/0 values the first time you retrieve them, which is why I used %2 and not just simply set to True/False on the toggle. The only exception to that is CS:GO's has_nightvision. I think we should probably fix that internally to pass back either 1/0 or True/False in these situations. Setting to 1/0 or True/False works just fine, though.
I will go ahead and add those to CS:GO's data and we will make the other adjustments when we get the chance.