Skip to content

Commit 5323a8a

Browse files
committed
Merge branch 'master' into player_weapons_update2
2 parents 3b69498 + 3113e77 commit 5323a8a

File tree

37 files changed

+128
-6385
lines changed

37 files changed

+128
-6385
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
[virtual_function]
22

33
# _ZN20CBaseCombatCharacter13Weapon_SwitchEP17CBaseCombatWeaponi
4-
# TODO: Validate these offsets.
54
[[weapon_switch]]
6-
offset_linux = 265
7-
offset_windows = 264
5+
offset_linux = 283
6+
offset_windows = 282
87
arguments = POINTER, INT
98
return_type = BOOL

addons/source-python/packages/source-python/auth/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,5 @@
2020
# Get the sp.auth logger
2121
auth_logger = _sp_logger.auth
2222

23-
# Get the auth language strings
24-
_auth_strings = LangStrings('_core/auth_strings')
25-
2623
if not AUTH_CFG_PATH.exists():
2724
AUTH_CFG_PATH.mkdir()

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

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
# =============================================================================
66
# >> IMPORTS
77
# =============================================================================
8-
# Python Imports
9-
# Warnings
10-
from warnings import warn
118
# Source.Python Imports
129
# Commands
1310
from commands.typed import TypedServerCommand
@@ -29,50 +26,22 @@
2926
def _sp_plugin_load(command_info, plugin):
3027
"""Load a plugin."""
3128
_core_command.load_plugin(plugin)
32-
33-
@_core_command.server_sub_command(['load'])
34-
def _sp_load(command_info, plugin):
35-
"""Load a plugin."""
36-
warn('"sp load" will be removed soon. Use "sp plugin load" instead.',
37-
DeprecationWarning)
38-
_core_command.load_plugin(plugin)
3929

4030
@_core_command.server_sub_command(['plugin', 'unload'])
4131
def _sp_plugin_unload(command_info, plugin):
4232
"""Unload a plugin."""
4333
_core_command.unload_plugin(plugin)
4434

45-
@_core_command.server_sub_command(['unload'])
46-
def _sp_unload(command_info, plugin):
47-
"""Unload a plugin."""
48-
warn('"sp unload" will be removed soon. Use "sp plugin unload" instead.',
49-
DeprecationWarning)
50-
_core_command.unload_plugin(plugin)
51-
5235
@_core_command.server_sub_command(['plugin', 'reload'])
5336
def _sp_plugin_reload(command_info, plugin):
5437
"""Reload a plugin."""
5538
_core_command.reload_plugin(plugin)
5639

57-
@_core_command.server_sub_command(['reload'])
58-
def _sp_reload(command_info, plugin):
59-
"""Reload a plugin."""
60-
warn('"sp reload" will be removed soon. Use "sp plugin reload" instead.',
61-
DeprecationWarning)
62-
_core_command.reload_plugin(plugin)
63-
6440
@_core_command.server_sub_command(['plugin', 'list'])
6541
def _sp_plugin_list(command_info):
6642
"""List all currently loaded plugins."""
6743
_core_command.print_plugins()
6844

69-
@_core_command.server_sub_command(['list'])
70-
def _sp_list(command_info):
71-
"""List all currently loaded plugins."""
72-
warn('"sp list" will be removed soon. Use "sp plugin list" instead.',
73-
DeprecationWarning)
74-
_core_command.print_plugins()
75-
7645

7746
# =============================================================================
7847
# >> DESCRIPTIONS

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

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ def _get_datamap(classname):
181181

182182
def _dump_datamap(open_file, class_name, datamap):
183183
"""Dump a DataMap object to the given file object."""
184-
open_file.write('{0}\n'.format(class_name))
184+
base = datamap.base
185+
open_file.write('{} -> {}\n'.format(
186+
class_name, base and base.class_name))
185187
for desc in datamap:
186188
_dump_type_description(open_file, desc)
187189

@@ -216,11 +218,14 @@ def dump_server_classes(filename):
216218
# Loop through all server classes
217219
for server_class in ServerClassGenerator():
218220

221+
table = server_class.table
222+
219223
# Print the server class' name to file
220-
open_file.write('{0}\n'.format(server_class.name))
224+
open_file.write('{} -> {}\n'.format(
225+
server_class.name, _find_base_server_class_name(table)))
221226

222227
# Get all items in the server class' table
223-
_dump_server_class_table(server_class.table, open_file)
228+
_dump_server_class_table(table, open_file)
224229

225230
# Move to the next server class
226231
server_class = server_class.next
@@ -232,6 +237,22 @@ def dump_server_classes(filename):
232237
open_file.write('\n')
233238

234239

240+
def _find_base_server_class_name(table):
241+
"""Return the name of table's base server class."""
242+
for prop in table:
243+
if prop.name != 'baseclass':
244+
continue
245+
246+
base_name = prop.data_table.name
247+
for server_class in ServerClassGenerator():
248+
if server_class.table.name == base_name:
249+
return server_class.name
250+
251+
return None
252+
253+
return None
254+
255+
235256
def _dump_server_class_table(table, open_file, level=1, offset=0):
236257
"""Dump all items in the given table to the given file."""
237258
# Loop through the send props in the table

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
'OnEntitySpawned',
8181
'OnLevelInit',
8282
'OnLevelShutdown',
83-
'OnMapEnd',
83+
'OnLevelEnd',
8484
'OnNetworkidValidated',
8585
'OnPluginLoaded',
8686
'OnPluginUnloaded',
@@ -358,7 +358,7 @@ class OnPluginUnloaded(ListenerManagerDecorator):
358358
manager = on_plugin_unloaded_manager
359359

360360

361-
class OnMapEnd(ListenerManagerDecorator):
361+
class OnLevelEnd(ListenerManagerDecorator):
362362
"""Register/unregister a map end listener."""
363363

364364
manager = on_map_end_listener_manager
@@ -373,7 +373,7 @@ class OnMapEnd(ListenerManagerDecorator):
373373
@OnLevelInit
374374
def _on_level_init(map_name):
375375
"""Called when a new map gets initialized."""
376-
OnMapEnd._level_initialized = True
376+
OnLevelEnd._level_initialized = True
377377

378378
if not _check_for_update.get_int():
379379
return
@@ -399,14 +399,14 @@ def _on_level_init(map_name):
399399
def _on_level_shutdown():
400400
"""Called on level end."""
401401
# Was no map initialized?
402-
if not OnMapEnd._level_initialized:
402+
if not OnLevelEnd._level_initialized:
403403
return
404404

405405
# Notify all registred callbacks
406406
on_map_end_listener_manager.notify()
407407

408408
# Make sure we don't get called more than once per map change
409-
OnMapEnd._level_initialized = False
409+
OnLevelEnd._level_initialized = False
410410

411411

412412
@PreHook(memory.get_virtual_function(cvar, 'CallGlobalChangeCallbacks'))

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# KeyValues
1717
from keyvalues import KeyValues
1818
# Listeners
19-
from listeners import OnLevelShutdown
19+
from listeners import OnLevelEnd
2020
from listeners.tick import Delay
2121
# Messages
2222
from _messages import DialogType
@@ -315,7 +315,7 @@ def _set_keyvalues(self, keyvalues, player, **tokens):
315315
# ============================================================================
316316
# >> LISTENERS
317317
# ============================================================================
318-
@OnLevelShutdown
319-
def _level_shutdown():
318+
@OnLevelEnd
319+
def _level_end():
320320
"""Clear the player levels dictionary."""
321321
_player_levels.clear()

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Source.Python is an open-source project that uses boost::python to allow scripte
2020
* __../custom/__ - Custom Packages
2121
* __../site-packages/__ - included site-packages
2222
* __../source-python/__ - Source.Python Python API
23-
* __../plugins/__ - plugins (use "sp load <plugin>" in server console to load)
23+
* __../plugins/__ - plugins (use "sp plugin load <plugin>" in server console to load)
2424
* __../Python3/__ - Python3.x base
2525
* __cfg/__
2626
* __../source-python/__ - configuration files

resource/source-python/translations/_core/auth_strings.ini

Lines changed: 0 additions & 97 deletions
This file was deleted.

resource/source-python/translations/_core/config_strings.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ de = "Standardwert:"
44
fr = "Valeur par défaut:"
55
nl = "Standaardwaarde:"
66
ru = "Стандартное значение:"
7+
es = "Valor por defecto:"

0 commit comments

Comments
 (0)