Skip to content

Commit b7f090e

Browse files
author
L'In20Cible
committed
Added a warning into Player.set_color for CS:GO.
1 parent 0f3dc0d commit b7f090e

File tree

1 file changed

+23
-0
lines changed
  • addons/source-python/packages/source-python/players/engines/csgo

1 file changed

+23
-0
lines changed

addons/source-python/packages/source-python/players/engines/csgo/__init__.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@
55
# =============================================================================
66
# >> IMPORTS
77
# =============================================================================
8+
# Python Imports
9+
# Warnings
10+
from warnings import warn
11+
812
# Source.Python Imports
913
# Bitbuffers
1014
from bitbuffers import BitBufferWrite
15+
# ConVars
16+
from cvars import ConVar
1117
# Engines
1218
from engines.server import engine_server
1319
# Entities
@@ -26,6 +32,12 @@
2632
from weapons.manager import weapon_manager
2733

2834

35+
# =============================================================================
36+
# >> GLOBAL VARIABLES
37+
# =============================================================================
38+
_disable_immunity_alpha = ConVar('sv_disable_immunity_alpha')
39+
40+
2941
# =============================================================================
3042
# >> CLASSES
3143
# =============================================================================
@@ -132,6 +144,17 @@ def spawn(self):
132144
"""Spawn the player."""
133145
self._spawn()
134146

147+
def set_color(self, color):
148+
"""Set the player's color."""
149+
if not _disable_immunity_alpha.get_bool() and color.a != self.color.a:
150+
warn(
151+
'Changing the alpha of a player will have no effect unless ' +
152+
'"sv_disable_immunity_alpha" is set to "1".'
153+
)
154+
super().set_color(color)
155+
156+
color = property(_Player.get_color, set_color)
157+
135158
@wrap_entity_mem_func
136159
def give_named_item(self, item, sub_type=0, econ_item_view=None, unk=False):
137160
"""Give the player a named item."""

0 commit comments

Comments
 (0)