Skip to content

Commit 4ab1f23

Browse files
committed
Merge branch 'player_weapons_update2'
2 parents bcff979 + 5323a8a commit 4ab1f23

File tree

28 files changed

+1387
-1549
lines changed

28 files changed

+1387
-1549
lines changed

addons/source-python/data/source-python/entities/CBaseCombatCharacter.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313

1414
gun_offset = m_HackedGunPos
1515
hitgroup = m_LastHitGroup
16-
active_weapon = m_hActiveWeapon
16+
active_weapon_handle = m_hActiveWeapon

addons/source-python/data/source-python/entities/CBaseCombatWeapon.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
next_secondary_fire_attack = LocalActiveWeaponData.m_flNextSecondaryAttack
1010
ammoprop = LocalWeaponData.m_iPrimaryAmmoType
1111
secondary_fire_ammoprop = LocalWeaponData.m_iSecondaryAmmoType
12-
owner = m_hOwner
13-
clip = m_iClip1
14-
secondary_fire_clip = m_iClip2
12+
owner_handle = m_hOwner
13+
_clip = m_iClip1
14+
_secondary_fire_clip = m_iClip2
1515
flip_view_model = LocalWeaponData.m_bFlipViewModel

addons/source-python/data/source-python/entities/CBaseEntity.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
render = m_clrRender
7878
elasticity = m_flElasticity
7979
ground_entity = m_hGroundEntity
80-
owner = m_hOwnerEntity
80+
owner_handle = m_hOwnerEntity
8181
team = m_iTeamNum
8282
render_fx = m_nRenderFX
8383
render_mode_prop = m_nRenderMode
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[property]
2+
3+
primary_ammo_count = m_iPrimaryReserveAmmoCount
4+
secondary_ammo_count = m_iSecondaryReserveAmmoCount
5+
ammoprop = m_iPrimaryAmmoType
6+
secondary_fire_ammoprop = m_iSecondaryAmmoType

addons/source-python/packages/source-python/commands/typed.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# ../commands/typed.py
2+
13
#: .. todo:: Add the ability to define prefixes for messages.
24
#: .. todo:: Add callback to the Node class. It could be called when a sub-command is required.
35

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ../core/commands/command.py
1+
# ../core/command/__init__.py
22

33
"""Registers the "sp" server command and all of its sub-commands."""
44

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ../effects.py
1+
# ../effects/__init__.py
22

33
"""Provides access to all effects within the engine."""
44

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

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@ def _obj(cls, ptr):
193193
def index(self):
194194
"""Return the entity's index."""
195195
return self._index
196+
197+
@property
198+
def owner(self):
199+
"""Return the entity's owner.
200+
201+
:return: None if the entity has no owner.
202+
:rtype: Entity
203+
"""
204+
try:
205+
return Entity(index_from_inthandle(self.owner_handle))
206+
except (ValueError, OverflowError):
207+
return None
196208

197209
@property
198210
def server_classes(self):
@@ -316,6 +328,10 @@ def get_property_string_pointer(self, name):
316328
"""Return the string property."""
317329
return self._get_property(name, 'string_pointer')
318330

331+
def get_property_char(self, name):
332+
"""Return the char property."""
333+
return self._get_property(name, 'char')
334+
319335
def get_property_uchar(self, name):
320336
"""Return the uchar property."""
321337
return self._get_property(name, 'uchar')
@@ -399,6 +415,10 @@ def set_property_string_pointer(self, name, value):
399415
"""Set the string property."""
400416
self._set_property(name, 'string_pointer', value)
401417

418+
def set_property_char(self, name, value):
419+
"""Set the char property."""
420+
self._set_property(name, 'char', value)
421+
402422
def set_property_uchar(self, name, value):
403423
"""Set the uchar property."""
404424
self._set_property(name, 'uchar', value)
@@ -536,15 +556,15 @@ def take_damage(
536556

537557
# Try to get the attacker based off of the weapon's owner
538558
with suppress(ValueError, OverflowError):
539-
attacker_index = index_from_inthandle(weapon.current_owner)
559+
attacker_index = index_from_inthandle(weapon.owner_handle)
540560
attacker = Entity(attacker_index)
541561

542562
# Is there an attacker but no weapon?
543563
if attacker is not None and weapon is None:
544564

545565
# Try to use the attacker's active weapon
546-
with suppress(AttributeError, ValueError, OverflowError):
547-
weapon = Weapon(index_from_inthandle(attacker.active_weapon))
566+
with suppress(AttributeError):
567+
weapon = attacker.active_weapon
548568

549569
# Try to set the hitgroup
550570
with suppress(AttributeError):

0 commit comments

Comments
 (0)