Skip to content

Commit

Permalink
Fixed SP not loading in CS:GO
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayuto committed May 24, 2016
1 parent e6f02db commit 260beb3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
9 changes: 9 additions & 0 deletions addons/source-python/packages/source-python/__init__.py
Expand Up @@ -160,6 +160,15 @@ def setup_global_pointers():
except NotImplementedError:
server.server = manager.get_global_pointer('Server')

_sp_logger.log_debug('Setting up global "factory_dictionary" variables...')
from entities import factories
try:
from _entities._factories import factory_dictionary
except ImportError:
factory_dictionary = manager.get_global_pointer('EntityFactoryDictionary')

factories.factory_dictionary = factory_dictionary


# =============================================================================
# >> SP COMMAND
Expand Down
3 changes: 2 additions & 1 deletion addons/source-python/packages/source-python/core/dumps.py
Expand Up @@ -16,7 +16,6 @@
# Entities
from entities import ServerClassGenerator
from entities.datamaps import FieldType
from entities.factories import factory_dictionary
from entities.props import SendPropType
# Filters
from filters.entities import BaseEntityIter
Expand Down Expand Up @@ -159,6 +158,7 @@ def _get_datamaps():
The yielded values are two-tuples, which contain the data class name of
the data map and the actual DataMap object.
"""
from entities.factories import factory_dictionary
for classname in factory_dictionary:
datamap = _get_datamap(classname)
while datamap:
Expand All @@ -173,6 +173,7 @@ def _get_datamap(classname):
return base_entity.datamap

# We haven't found an entity. Let's create it temporarily
from entities.factories import factory_dictionary
entity = factory_dictionary.create(classname)
datamap = entity.base_entity.datamap
factory_dictionary.destroy(classname, entity)
Expand Down
Expand Up @@ -25,7 +25,6 @@
from entities.classes import server_classes
from entities.constants import DamageTypes
from entities.constants import RenderMode
from entities.factories import factory_dictionary
from entities.helpers import create_entity
from entities.helpers import edict_from_index
from entities.helpers import index_from_inthandle
Expand Down Expand Up @@ -207,6 +206,7 @@ def _size(self):
@property
def factory(self):
"""Return the entity's factory."""
from entities.factories import factory_dictionary
return factory_dictionary.find_factory(self.classname)

@property
Expand Down
10 changes: 0 additions & 10 deletions addons/source-python/packages/source-python/entities/factories.py
Expand Up @@ -26,13 +26,3 @@
'EntityFactoryDictionary',
'factory_dictionary',
)


# ============================================================================
# >> GLOBAL VARIABLES
# ============================================================================
# Get the factory_dictionary instance...
try:
from _entities._factories import factory_dictionary
except ImportError:
factory_dictionary = manager.get_global_pointer('EntityFactoryDictionary')

0 comments on commit 260beb3

Please sign in to comment.