Skip to content

Commit 188cf55

Browse files
committed
Fixed some import errors in the Python API with recent changes to class names. Currently, core imports newly named EngineServer as GameEngine to not break backwards compat.
Changed all other instances within the API of GameEngine to use EngineServer. Undid rename of CMRecipientFilter to RecipientFilter due to class of the same name in filters.recipients. The name will be changed in the future, but to avoid this name conflict, the old name was returned. Added missing section headers in conversions_wrap.h
1 parent 1f0ff07 commit 188cf55

File tree

12 files changed

+44
-27
lines changed

12 files changed

+44
-27
lines changed

addons/source-python/packages/source-python/_core/command.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from configobj import ConfigObj
99

1010
# Source.Python Imports
11+
from engine_c import EngineServer
1112
from _core import _CoreLogger
12-
from core import GameEngine
1313
from paths import SP_DATA_PATH
1414
# Plugins
1515
from plugins import _plugin_strings
@@ -121,7 +121,7 @@ def delay_execution(*args):
121121
# Add the delay
122122
TickDelays.delay(
123123
float(args[0]),
124-
GameEngine.server_command, ' '.join(args[1:]) + '\n')
124+
EngineServer.server_command, ' '.join(args[1:]) + '\n')
125125

126126
@staticmethod
127127
def print_version():

addons/source-python/packages/source-python/config/manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from textwrap import TextWrapper
1111

1212
# Source.Python Imports
13-
from core import GameEngine
13+
from engine_c import EngineServer
1414
from excepthooks import ExceptHooks
1515
from paths import CFG_PATH
1616
from public import public
@@ -386,7 +386,7 @@ def write(self):
386386

387387
def execute(self):
388388
'''Executes the config file'''
389-
GameEngine.server_command(
389+
EngineServer.server_command(
390390
'exec source-python/{0}\n'.format(self.filepath))
391391

392392
def _parse_old_file(self):

addons/source-python/packages/source-python/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from os import sep
99

1010
# Source.Python Imports
11-
from engine_c import GameEngine
11+
from engine_c import EngineServer as GameEngine
1212
from paths import GAME_PATH
1313
from public import public
1414

addons/source-python/packages/source-python/downloads.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# =============================================================================
66
# Source.Python Imports
77
from Source import Misc
8+
from engine_c import EngineServer
89
from core import AutoUnload
9-
from core import GameEngine
1010
from public import public
1111
# Events
1212
from events.manager import EventRegistry
@@ -67,13 +67,13 @@ def _add_to_download_table(self, item):
6767
'''Add the given file to the downloadables table'''
6868

6969
# Lock the network string tables
70-
locked = GameEngine.lock_network_string_tables(False)
70+
locked = EngineServer.lock_network_string_tables(False)
7171

7272
# Add the given file
7373
self.download_table.AddString(True, item)
7474

7575
# Reset the lock status
76-
GameEngine.lock_network_string_tables(locked)
76+
EngineServer.lock_network_string_tables(locked)
7777

7878
def server_spawn(self, GameEvent):
7979
'''Adds all items stored as downloadables to the stringtable'''

addons/source-python/packages/source-python/filters/players.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from configobj import ConfigObj
99

1010
# Source.Python Imports
11+
from engine_c import EngineServer
1112
from player_c import PlayerGenerator
12-
from core import GameEngine
1313
from core import GAME_NAME
1414
from paths import SP_DATA_PATH
1515
from public import public
@@ -213,7 +213,7 @@ def _return_weapon(PlayerInfo):
213213

214214
def _return_language(PlayerInfo):
215215
'''Returns the player's language'''
216-
return GameEngine.get_client_convar_value(
216+
return EngineServer.get_client_convar_value(
217217
index_from_playerinfo(PlayerInfo), 'cl_language')
218218

219219

addons/source-python/packages/source-python/loggers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# Source.Python Imports
1919
from cvar_c import ConVar
20-
from core import GameEngine
20+
from engine_c import EngineServer
2121
from core import echo_console
2222
from paths import LOG_PATH
2323
from public import public
@@ -143,7 +143,7 @@ def _log(self, level, msg, *args, **kwargs):
143143
message = self.formatter.format(record)
144144

145145
# Print to the main log
146-
GameEngine.log_print(message + '\n')
146+
EngineServer.log_print(message + '\n')
147147

148148
# Print to the console?
149149
if CONSOLE & areas:

addons/source-python/packages/source-python/messages/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
from path import path
1818

1919
# Source.Python Imports
20+
from engine_c import EngineServer
2021
from core import echo_console
21-
from core import GameEngine
2222
from excepthooks import ExceptHooks
2323
# UserMessage
24-
from usermessage_c import CUserMessage
24+
from usermessage_c import UserMessage
2525
# Filters
2626
from filters.recipients import RecipientFilter
2727
# Translations
@@ -442,8 +442,8 @@ def _write_field_value(self, parameter_name, usermsg, field_type,
442442
def _send_message(self, recipient, **kwargs):
443443
'''Send the message to the given recipient filter'''
444444

445-
# Get a CUserMessage instance
446-
usermsg = CUserMessage(recipient, self._message_name)
445+
# Get a UserMessage instance
446+
usermsg = UserMessage(recipient, self._message_name)
447447

448448
# Loop through all required parameters
449449
for parameter_name in self._required_parameters:
@@ -550,7 +550,7 @@ def send(self, *args, **kwargs):
550550
for index in recipient:
551551

552552
# Add the current index
553-
languages[GameEngine.get_client_convar_value(index,
553+
languages[EngineServer.get_client_convar_value(index,
554554
'cl_language')].add(index)
555555

556556
# Loop through all languages

addons/source-python/packages/source-python/players/entity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# =============================================================================
66
# Source.Python Imports
77
from conversions_c import playerinfo_from_index
8-
from core import GameEngine
8+
from engine_c import EngineServer
99
from public import public
1010
# Entities
1111
from entities.entity import BaseEntity
@@ -78,7 +78,7 @@ def isdead(self):
7878
@property
7979
def language(self):
8080
'''Returns the player's language'''
81-
return GameEngine.get_client_convar_value(self.index, 'cl_language')
81+
return EngineServer.get_client_convar_value(self.index, 'cl_language')
8282

8383
@property
8484
def uniqueid(self):

addons/source-python/packages/source-python/players/helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# =============================================================================
66
# Source.Python Imports
77
from conversions_c import *
8+
from engine_c import EngineServer
89
from public import public
910

1011

@@ -102,7 +103,7 @@ def address_from_playerinfo(player):
102103
index = index_from_playerinfo(player)
103104

104105
# Get the player's NetInfo instance
105-
netinfo = GameEngine.get_player_net_info(index)
106+
netinfo = EngineServer.get_player_net_info(index)
106107

107108
# Return the player's IP Address
108109
return netinfo.get_address()

addons/source-python/packages/source-python/settings/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from collections import OrderedDict
99

1010
# Source.Python Imports
11-
from core import GameEngine
11+
from engine_c import EngineServer
1212
# Players
1313
from players.helpers import playerinfo_from_index
1414
from players.helpers import uniqueid_from_playerinfo
@@ -73,7 +73,7 @@ def get_setting(self, index):
7373
convar = self.prefix + self.name.lower().replace(' ', '_')
7474

7575
# Get the client's convar value
76-
value = GameEngine.get_client_convar_value(index, convar)
76+
value = EngineServer.get_client_convar_value(index, convar)
7777

7878
# Use try/except to typecast the value
7979
try:

0 commit comments

Comments
 (0)