FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge branch 'master' into entities_changes · Zipcore/Source.Python@47baab2 · GitHub

Repository navigation

Commit 47baab2

Browse files
committed
Merge branch 'master' into entities_changes
2 parents ed269ce + 606e8c9 commit 47baab2

18 files changed

Lines changed: 151 additions & 181 deletions

File tree

‎addons/source-python/packages/source-python/commands/client/command.py‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@
1111
from commands.client.manager import client_command_manager
1212

1313

14-
# =============================================================================
15-
# >> ALL DECLARATION
16-
# =============================================================================
17-
__all__ = ('ClientCommand',
18-
)
19-
20-
2114
# =============================================================================
2215
# >> CLASSES
2316
# =============================================================================

‎addons/source-python/packages/source-python/commands/client/filter.py‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@
1111
from commands.client.manager import client_command_manager
1212

1313

14-
# =============================================================================
15-
# >> ALL DECLARATION
16-
# =============================================================================
17-
__all__ = ('ClientCommandFilter',
18-
)
19-
20-
2114
# =============================================================================
2215
# >> CLASSES
2316
# =============================================================================

‎addons/source-python/packages/source-python/commands/client/manager.py‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
from commands.player import _PlayerCommandManager
1414

1515

16-
# =============================================================================
17-
# >> ALL DECLARATION
18-
# =============================================================================
19-
__all__ = ('client_command_manager',
20-
)
21-
22-
2316
# =============================================================================
2417
# >> CLASSES
2518
# =============================================================================

‎addons/source-python/packages/source-python/commands/say/command.py‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@
1111
from commands.say.manager import say_command_manager
1212

1313

14-
# =============================================================================
15-
# >> ALL DECLARATION
16-
# =============================================================================
17-
__all__ = ('SayCommand',
18-
)
19-
20-
2114
# =============================================================================
2215
# >> CLASSES
2316
# =============================================================================

‎addons/source-python/packages/source-python/commands/say/filter.py‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@
1111
from commands.say.manager import say_command_manager
1212

1313

14-
# =============================================================================
15-
# >> ALL DECLARATION
16-
# =============================================================================
17-
__all__ = ('SayFilter',
18-
)
19-
20-
2114
# =============================================================================
2215
# >> CLASSES
2316
# =============================================================================

‎addons/source-python/packages/source-python/commands/say/manager.py‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
from commands.say import unregister_say_filter
1414

1515

16-
# =============================================================================
17-
# >> ALL DECLARATION
18-
# =============================================================================
19-
__all__ = ('say_command_manager',
20-
)
21-
22-
2316
# =============================================================================
2417
# >> CLASSES
2518
# =============================================================================

‎addons/source-python/packages/source-python/commands/server/command.py‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@
1111
from commands.server.manager import server_command_manager
1212

1313

14-
# =============================================================================
15-
# >> ALL DECLARATION
16-
# =============================================================================
17-
__all__ = ('ServerCommand',
18-
)
19-
20-
2114
# =============================================================================
2215
# >> CLASSES
2316
# =============================================================================

‎addons/source-python/packages/source-python/commands/server/manager.py‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@
1111
from commands.server import get_server_command
1212

1313

14-
# =============================================================================
15-
# >> ALL DECLARATION
16-
# =============================================================================
17-
__all__ = ('server_command_manager',
18-
)
19-
20-
2114
# =============================================================================
2215
# >> CLASSES
2316
# =============================================================================

‎addons/source-python/packages/source-python/engines/precache.py‎

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@
1414
from path import Path
1515

1616
# Source.Python Imports
17+
# Core
18+
from core import AutoUnload
1719
# Engines
1820
from engines.server import engine_server
21+
# Events
22+
from events.manager import event_registry
1923
# Stringtables
2024
from stringtables import INVALID_STRING_INDEX
2125
from stringtables import string_tables
@@ -39,7 +43,7 @@ class PrecacheError(Exception):
3943
"""Object was not able to be precached due to limit being reached."""
4044

4145

42-
class _PrecacheBase(Path):
46+
class _PrecacheBase(Path, AutoUnload):
4347

4448
"""Base precache class used to interact with a specific object."""
4549

@@ -52,6 +56,12 @@ def __init__(self, path, download=False):
5256
# Call Path's __init__ with the given path
5357
super(_PrecacheBase, self).__init__(path)
5458

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+
5565
# Should the path be added to the downloadables?
5666
if download:
5767

@@ -71,25 +81,24 @@ def index(self):
7181
# Return the precache index
7282
return index
7383

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-
8384
# If the object was not precached, raise an error
8485
raise PrecacheError(
8586
'{0} was not able to be precached due to the '.format(self) +
8687
'{0} table reaching its limit.'.format(self._precache_table))
8788

89+
def _server_spawn(self, game_event):
90+
"""Precache the object on map change."""
91+
self._precache_method(self)
92+
8893
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
9096
with suppress(AttributeError):
9197
self._downloads._unload_instance()
9298

99+
# Unregister the server_spawn event
100+
event_registry.unregister_for_event('server_spawn', self._server_spawn)
101+
93102

94103
class Decal(_PrecacheBase):
95104

‎addons/source-python/packages/source-python/listeners/tick/__init__.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# Source.Python Imports
99
# Listeners
1010
from listeners import listeners_logger
11+
from listeners.tick.delays import Delay
1112
from listeners.tick.delays import tick_delays
1213
from listeners.tick.repeat import TickRepeat
1314
from listeners.tick.repeat import TickRepeatStatus
@@ -16,7 +17,8 @@
1617
# =============================================================================
1718
# >> ALL DECLARATION
1819
# =============================================================================
19-
__all__ = ('TickRepeat',
20+
__all__ = ('Delay',
21+
'TickRepeat',
2022
'TickRepeatStatus',
2123
'tick_delays',
2224
)

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL