| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,13 +11,6 @@ | |||
| 11 | 11 | from commands.client.manager import client_command_manager | |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | - # ============================================================================= | ||
| 15 | - # >> ALL DECLARATION | ||
| 16 | - # ============================================================================= | ||
| 17 | - __all__ = ('ClientCommand', | ||
| 18 | - ) | ||
| 19 | - | ||
| 20 | - | ||
| 21 | 14 | # ============================================================================= | |
| 22 | 15 | # >> CLASSES | |
| 23 | 16 | # ============================================================================= | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,13 +11,6 @@ | |||
| 11 | 11 | from commands.client.manager import client_command_manager | |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | - # ============================================================================= | ||
| 15 | - # >> ALL DECLARATION | ||
| 16 | - # ============================================================================= | ||
| 17 | - __all__ = ('ClientCommandFilter', | ||
| 18 | - ) | ||
| 19 | - | ||
| 20 | - | ||
| 21 | 14 | # ============================================================================= | |
| 22 | 15 | # >> CLASSES | |
| 23 | 16 | # ============================================================================= | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,13 +13,6 @@ | |||
| 13 | 13 | from commands.player import _PlayerCommandManager | |
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | - # ============================================================================= | ||
| 17 | - # >> ALL DECLARATION | ||
| 18 | - # ============================================================================= | ||
| 19 | - __all__ = ('client_command_manager', | ||
| 20 | - ) | ||
| 21 | - | ||
| 22 | - | ||
| 23 | 16 | # ============================================================================= | |
| 24 | 17 | # >> CLASSES | |
| 25 | 18 | # ============================================================================= | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,13 +11,6 @@ | |||
| 11 | 11 | from commands.say.manager import say_command_manager | |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | - # ============================================================================= | ||
| 15 | - # >> ALL DECLARATION | ||
| 16 | - # ============================================================================= | ||
| 17 | - __all__ = ('SayCommand', | ||
| 18 | - ) | ||
| 19 | - | ||
| 20 | - | ||
| 21 | 14 | # ============================================================================= | |
| 22 | 15 | # >> CLASSES | |
| 23 | 16 | # ============================================================================= | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,13 +11,6 @@ | |||
| 11 | 11 | from commands.say.manager import say_command_manager | |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | - # ============================================================================= | ||
| 15 | - # >> ALL DECLARATION | ||
| 16 | - # ============================================================================= | ||
| 17 | - __all__ = ('SayFilter', | ||
| 18 | - ) | ||
| 19 | - | ||
| 20 | - | ||
| 21 | 14 | # ============================================================================= | |
| 22 | 15 | # >> CLASSES | |
| 23 | 16 | # ============================================================================= | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,13 +13,6 @@ | |||
| 13 | 13 | from commands.say import unregister_say_filter | |
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | - # ============================================================================= | ||
| 17 | - # >> ALL DECLARATION | ||
| 18 | - # ============================================================================= | ||
| 19 | - __all__ = ('say_command_manager', | ||
| 20 | - ) | ||
| 21 | - | ||
| 22 | - | ||
| 23 | 16 | # ============================================================================= | |
| 24 | 17 | # >> CLASSES | |
| 25 | 18 | # ============================================================================= | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,13 +11,6 @@ | |||
| 11 | 11 | from commands.server.manager import server_command_manager | |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | - # ============================================================================= | ||
| 15 | - # >> ALL DECLARATION | ||
| 16 | - # ============================================================================= | ||
| 17 | - __all__ = ('ServerCommand', | ||
| 18 | - ) | ||
| 19 | - | ||
| 20 | - | ||
| 21 | 14 | # ============================================================================= | |
| 22 | 15 | # >> CLASSES | |
| 23 | 16 | # ============================================================================= | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,13 +11,6 @@ | |||
| 11 | 11 | from commands.server import get_server_command | |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | - # ============================================================================= | ||
| 15 | - # >> ALL DECLARATION | ||
| 16 | - # ============================================================================= | ||
| 17 | - __all__ = ('server_command_manager', | ||
| 18 | - ) | ||
| 19 | - | ||
| 20 | - | ||
| 21 | 14 | # ============================================================================= | |
| 22 | 15 | # >> CLASSES | |
| 23 | 16 | # ============================================================================= | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,8 +14,12 @@ | |||
| 14 | 14 | from path import Path | |
| 15 | 15 | ||
| 16 | 16 | # Source.Python Imports | |
| 17 | + # Core | ||
| 18 | + from core import AutoUnload | ||
| 17 | 19 | # Engines | |
| 18 | 20 | from engines.server import engine_server | |
| 21 | + # Events | ||
| 22 | + from events.manager import event_registry | ||
| 19 | 23 | # Stringtables | |
| 20 | 24 | from stringtables import INVALID_STRING_INDEX | |
| 21 | 25 | from stringtables import string_tables | |
@@ -39,7 +43,7 @@ class PrecacheError(Exception): | |||
| 39 | 43 | """Object was not able to be precached due to limit being reached.""" | |
| 40 | 44 | ||
| 41 | 45 | ||
| 42 | - class _PrecacheBase(Path): | ||
| 46 | + class _PrecacheBase(Path, AutoUnload): | ||
| 43 | 47 | ||
| 44 | 48 | """Base precache class used to interact with a specific object.""" | |
| 45 | 49 | ||
@@ -52,6 +56,12 @@ def __init__(self, path, download=False): | |||
| 52 | 56 | # Call Path's __init__ with the given path | |
| 53 | 57 | super(_PrecacheBase, self).__init__(path) | |
| 54 | 58 | ||
| 59 | + # Precache the instance | ||
| 60 | + self._precache_method(self) | ||
| 61 | + | ||
| 62 | + # Register the server_spawn event to precache every map change | ||
| 63 | + event_registry.register_for_event('server_spawn', self._server_spawn) | ||
| 64 | + | ||
| 55 | 65 | # Should the path be added to the downloadables? | |
| 56 | 66 | if download: | |
| 57 | 67 | ||
@@ -71,25 +81,24 @@ def index(self): | |||
| 71 | 81 | # Return the precache index | |
| 72 | 82 | return index | |
| 73 | 83 | ||
| 74 | - # Attempt to precache the object | ||
| 75 | - index = self._precache_method(self) | ||
| 76 | - | ||
| 77 | - # Was the object able to be precached? | ||
| 78 | - if index != INVALID_STRING_INDEX: | ||
| 79 | - | ||
| 80 | - # Return the precache index | ||
| 81 | - return index | ||
| 82 | - | ||
| 83 | 84 | # If the object was not precached, raise an error | |
| 84 | 85 | raise PrecacheError( | |
| 85 | 86 | '{0} was not able to be precached due to the '.format(self) + | |
| 86 | 87 | '{0} table reaching its limit.'.format(self._precache_table)) | |
| 87 | 88 | ||
| 89 | + def _server_spawn(self, game_event): | ||
| 90 | + """Precache the object on map change.""" | ||
| 91 | + self._precache_method(self) | ||
| 92 | + | ||
| 88 | 93 | def _unload_instance(self): | |
| 89 | - """Remove the path from the downloads list.""" | ||
| 94 | + """Remove from the downloads list and unregister server_spawn.""" | ||
| 95 | + # Remove the path from the downloads list | ||
| 90 | 96 | with suppress(AttributeError): | |
| 91 | 97 | self._downloads._unload_instance() | |
| 92 | 98 | ||
| 99 | + # Unregister the server_spawn event | ||
| 100 | + event_registry.unregister_for_event('server_spawn', self._server_spawn) | ||
| 101 | + | ||
| 93 | 102 | ||
| 94 | 103 | class Decal(_PrecacheBase): | |
| 95 | 104 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,7 @@ | |||
| 8 | 8 | # Source.Python Imports | |
| 9 | 9 | # Listeners | |
| 10 | 10 | from listeners import listeners_logger | |
| 11 | + from listeners.tick.delays import Delay | ||
| 11 | 12 | from listeners.tick.delays import tick_delays | |
| 12 | 13 | from listeners.tick.repeat import TickRepeat | |
| 13 | 14 | from listeners.tick.repeat import TickRepeatStatus | |
@@ -16,7 +17,8 @@ | |||
| 16 | 17 | # ============================================================================= | |
| 17 | 18 | # >> ALL DECLARATION | |
| 18 | 19 | # ============================================================================= | |
| 19 | - __all__ = ('TickRepeat', | ||
| 20 | + __all__ = ('Delay', | ||
| 21 | + 'TickRepeat', | ||
| 20 | 22 | 'TickRepeatStatus', | |
| 21 | 23 | 'tick_delays', | |
| 22 | 24 | ) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments