Skip to content

Property "desired_player_class" doesn't work for "dod" #475

Closed
@dronelektron

Description

@dronelektron

I want to get "desired_player_class" using the following code:

from commands import CommandReturn
from commands.client import ClientCommand
from players.entity import Player


@ClientCommand('sp_desired_class')
def print_desired_class(command, index):
    player = Player(index)
    desired_class = player.desired_player_class

    print(f'[DEBUG] Desired player class - {desired_class}')

    return CommandReturn.BLOCK

But I get the error:

[Source.Python]
[SP] Caught an Exception:
Traceback (most recent call last):
  File "..\addons\source-python\packages\source-python\commands\auth.py", line 44, in __call__
    return self.callback(*args)
  File "..\addons\source-python\plugins\dod_desired_class\dod_desired_class.py", line 9, in print_desired_class
    desired_class = player.desired_player_class

ValueError: Unable to find property 'm_Shared.m_iDesiredPlayerClass'.

I guess it's because of this:

https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/src/core/modules/players/players_entity.cpp#L746

Then I've tried to add this property to this file:

https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/addons/source-python/data/source-python/entities/orangebox/dod/CDODPlayer.ini

Like this:

[property]

    ragdoll = m_hRagdoll
    # DOD:S has another path to "desired player class"
    desired_player_class = m_Shared.dodsharedlocaldata.m_iDesiredPlayerClass

    [[eye_angle]]
        name = m_angEyeAngles[0]
        type = QAngle

But this property doesn't work either, looks like SP won't override it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions