|
12 | 12 | # Source.Python Imports |
13 | 13 | # Core |
14 | 14 | from core import AutoUnload |
| 15 | +from core import GAME_NAME |
15 | 16 | from core import SOURCE_ENGINE |
16 | 17 | # Entities |
17 | 18 | from entities.constants import INVALID_ENTITY_INDEX |
@@ -172,9 +173,8 @@ def __init__(self): |
172 | 173 | """Store all teams and their aliases for the current game.""" |
173 | 174 | super().__init__() |
174 | 175 |
|
175 | | - # Store all of the aliases except for spec/un |
176 | | - self.aliases = { |
177 | | - x: y for x, y in teams_by_name.items() if x not in ('un', 'spec')} |
| 176 | + # Store all of the aliases |
| 177 | + self.aliases = {**teams_by_name} |
178 | 178 | self.update({x: set() for x in self.aliases.values()}) |
179 | 179 |
|
180 | 180 | def __getitem__(self, item): |
@@ -389,17 +389,20 @@ def _on_weapon_bump(args): |
389 | 389 | make_object(Player, args[0]), edict_from_pointer(args[1]).classname) |
390 | 390 |
|
391 | 391 |
|
392 | | -@EntityPreHook(EntityCondition.is_player, 'buy_internal') |
393 | | -def _on_weapon_purchase(args): |
394 | | - """Return whether the player is allowed to purchase the weapon.""" |
395 | | - # TODO: |
396 | | - # In CS:GO it seems like the weapon isn't passed as a string anymore. |
397 | | - # Instead it's rather a pointer that might be NULL. If it's not NULL, the |
398 | | - # function sets it to some value: |
399 | | - #if ( a3 ) |
400 | | - # *(_DWORD *)a3 = v16; |
401 | | - return weapon_restriction_manager.on_player_purchasing_weapon( |
402 | | - make_object(Player, args[0]), args[1 if SOURCE_ENGINE != 'csgo' else 2]) |
| 392 | +if GAME_NAME in ('css', 'csgo'): |
| 393 | + @EntityPreHook(EntityCondition.is_player, 'buy_internal') |
| 394 | + def _on_weapon_purchase(args): |
| 395 | + """Return whether the player is allowed to purchase the weapon.""" |
| 396 | + # TODO: |
| 397 | + # In CS:GO it seems like the weapon isn't passed as a string anymore. |
| 398 | + # Instead it's rather a pointer that might be NULL. If it's not NULL, |
| 399 | + # the function sets it to some value: |
| 400 | + #if ( a3 ) |
| 401 | + # *(_DWORD *)a3 = v16; |
| 402 | + return weapon_restriction_manager.on_player_purchasing_weapon( |
| 403 | + make_object(Player, args[0]), |
| 404 | + args[1 if SOURCE_ENGINE != 'csgo' else 2] |
| 405 | + ) |
403 | 406 |
|
404 | 407 |
|
405 | 408 | # ============================================================================= |
|
0 commit comments