|
5 | 5 | # =============================================================================
|
6 | 6 | # >> IMPORTS
|
7 | 7 | # =============================================================================
|
| 8 | +# Python Imports |
| 9 | +# Warnings |
| 10 | +from warnings import warn |
| 11 | + |
8 | 12 | # Source.Python Imports
|
9 | 13 | # Bitbuffers
|
10 | 14 | from bitbuffers import BitBufferWrite
|
| 15 | +# ConVars |
| 16 | +from cvars import ConVar |
11 | 17 | # Engines
|
12 | 18 | from engines.server import engine_server
|
13 | 19 | # Entities
|
|
26 | 32 | from weapons.manager import weapon_manager
|
27 | 33 |
|
28 | 34 |
|
| 35 | +# ============================================================================= |
| 36 | +# >> GLOBAL VARIABLES |
| 37 | +# ============================================================================= |
| 38 | +_disable_immunity_alpha = ConVar('sv_disable_immunity_alpha') |
| 39 | + |
| 40 | + |
29 | 41 | # =============================================================================
|
30 | 42 | # >> CLASSES
|
31 | 43 | # =============================================================================
|
@@ -132,6 +144,17 @@ def spawn(self):
|
132 | 144 | """Spawn the player."""
|
133 | 145 | self._spawn()
|
134 | 146 |
|
| 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 | + |
135 | 158 | @wrap_entity_mem_func
|
136 | 159 | def give_named_item(self, item, sub_type=0, econ_item_view=None, unk=False):
|
137 | 160 | """Give the player a named item."""
|
|
0 commit comments