diff --git a/addons/source-python/data/source-python/entities/CBaseEntity.ini b/addons/source-python/data/source-python/entities/CBaseEntity.ini
index 4e1952075..b6c6935e4 100644
--- a/addons/source-python/data/source-python/entities/CBaseEntity.ini
+++ b/addons/source-python/data/source-python/entities/CBaseEntity.ini
@@ -23,64 +23,12 @@
[keyvalue]
- avelocity = avelocity
- base_velocity = basevelocity
- class_name = classname
- damage_filter = damagefilter
- effects = effects
- friction = friction
- global_name = globalname
- gravity = gravity
- hammerid = hammerid
- health = health
- ltime = ltime
- max_health = max_health
- parent_name = parentname
- render_color = rendercolor
- render_mode = rendermode
- shadow_cast_dist = shadowcastdist
- spawn_flags = spawnflags
- speed = speed
- target = target
- velocity = velocity
view_ofs = view_ofs
- water_level = waterlevel
# =========================================================================
# >> Hard-coded KeyValues
# =========================================================================
- [[angles]]
- name = angles
- type = VECTOR
-
- [[origin]]
- name = origin
- type = VECTOR
-
[[render_amt]]
name = renderamt
type = SHORT
-
- [[target_name]]
- name = targetname
- type = STRING
-
-
-[property]
-
- maxs = m_Collision.m_vecMaxs
- mins = m_Collision.m_vecMins
- solid_type = m_Collision.m_nSolidType
- solid_flags = m_Collision.m_usSolidFlags
- collision_group = m_CollisionGroup
- rotation = m_angRotation
- render = m_clrRender
- elasticity = m_flElasticity
- ground_entity = m_hGroundEntity
- owner_handle = m_hOwnerEntity
- team_index = m_iTeamNum
- render_fx = m_nRenderFX
- render_mode_prop = m_nRenderMode
- move_type = movetype
- parent_inthandle = m_pParent
diff --git a/addons/source-python/docs/source-python/source/developing/modules/players._base.rst b/addons/source-python/docs/source-python/source/developing/modules/players._base.rst
index fbd060032..3bc89ece6 100644
--- a/addons/source-python/docs/source-python/source/developing/modules/players._base.rst
+++ b/addons/source-python/docs/source-python/source/developing/modules/players._base.rst
@@ -5,3 +5,8 @@ players._base module
:members:
:undoc-members:
:show-inheritance:
+
+.. autoclass:: _players.PlayerMixin
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/addons/source-python/packages/source-python/players/_base.py b/addons/source-python/packages/source-python/players/_base.py
index 555c39208..f1e901180 100644
--- a/addons/source-python/packages/source-python/players/_base.py
+++ b/addons/source-python/packages/source-python/players/_base.py
@@ -55,6 +55,7 @@
from memory import get_object_pointer
from memory import make_object
# Players
+from _players import PlayerMixin
from players.constants import PlayerStates
from players.helpers import address_from_playerinfo
from players.helpers import get_client_language
@@ -73,7 +74,7 @@
# =============================================================================
# >> CLASSES
# =============================================================================
-class Player(Entity):
+class Player(Entity, PlayerMixin):
"""Class used to interact directly with players."""
def __init__(self, index):
@@ -380,33 +381,12 @@ def set_eye_location(self, eye_location):
eye_location = property(Entity.get_eye_location, set_eye_location)
- @property
- def view_vector(self):
- """Return the view vector of the player.
-
- :rtype: Vector
- """
- eye_angle = self.eye_angle
-
- yaw = math.radians(eye_angle.y)
- pitch = math.radians(eye_angle.x)
-
- sy = math.sin(yaw)
- cy = math.cos(yaw)
- sp = math.sin(pitch)
- cp = math.cos(pitch)
-
- return Vector(cp * cy, cp * sy, -sp)
-
def get_view_angle(self):
"""Return the player's view angle.
:rtype: QAngle
"""
- eye_angle = self.eye_angle
- eye_angle_y = eye_angle.y
- eye_angle_y = (eye_angle_y + 360) if eye_angle_y < 0 else eye_angle_y
- return QAngle(eye_angle.x, eye_angle_y, self.rotation.z)
+ return super().view_angle
def set_view_angle(self, angle):
"""Set the player's view angle."""
diff --git a/addons/source-python/packages/source-python/players/engines/csgo/__init__.py b/addons/source-python/packages/source-python/players/engines/csgo/__init__.py
index 82ebe754c..47f7dcaef 100644
--- a/addons/source-python/packages/source-python/players/engines/csgo/__init__.py
+++ b/addons/source-python/packages/source-python/players/engines/csgo/__init__.py
@@ -43,7 +43,7 @@ class Player(_Player):
def _get_kills(self):
"""Return the number of kills the player has."""
- return self.__getattr__('kills')
+ return super().kills
def _set_kills(self, value):
"""Set the number of kills the player has."""
@@ -54,7 +54,7 @@ def _set_kills(self, value):
def _get_deaths(self):
"""Return the number of deaths the player has."""
- return self.__getattr__('deaths')
+ return super().deaths
def _set_deaths(self, value):
"""Set the number of deaths the player has."""
@@ -65,7 +65,7 @@ def _set_deaths(self, value):
def _get_assists(self):
"""Return the number of assists the player has."""
- return self.__getattr__('assists')
+ return super().assists
def _set_assists(self, value):
"""Set the number of assists the player has."""
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 80cbfdc98..648d92808 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -381,6 +381,7 @@ Set(SOURCEPYTHON_PHYSICS_MODULE_SOURCES
# ------------------------------------------------------------------
Set(SOURCEPYTHON_PLAYERS_MODULE_HEADERS
core/modules/players/players_wrap.h
+ core/modules/players/players_entity.h
core/modules/players/players_generator.h
core/modules/players/${SOURCE_ENGINE}/players_constants_wrap.h
core/modules/players/${SOURCE_ENGINE}/players_wrap.h
@@ -389,6 +390,7 @@ Set(SOURCEPYTHON_PLAYERS_MODULE_HEADERS
Set(SOURCEPYTHON_PLAYERS_MODULE_SOURCES
core/modules/players/players_bots_wrap.cpp
core/modules/players/players_constants_wrap.cpp
+ core/modules/players/players_entity.cpp
core/modules/players/players_helpers_wrap.cpp
core/modules/players/players_wrap.cpp
core/modules/players/players_generator.cpp
diff --git a/src/core/modules/entities/entities_entity.h b/src/core/modules/entities/entities_entity.h
index cd6670ad3..e6d7c4c68 100644
--- a/src/core/modules/entities/entities_entity.h
+++ b/src/core/modules/entities/entities_entity.h
@@ -80,7 +80,7 @@ class IServerUnknownExt
//-----------------------------------------------------------------------------
class CBaseEntityWrapper: public IServerEntity
{
-private:
+protected:
// Make sure that nobody can call the constructor/destructor
CBaseEntityWrapper() {}
~CBaseEntityWrapper() {}
diff --git a/src/core/modules/entities/entities_entity_wrap.cpp b/src/core/modules/entities/entities_entity_wrap.cpp
index 4cfb35814..95daba5d3 100644
--- a/src/core/modules/entities/entities_entity_wrap.cpp
+++ b/src/core/modules/entities/entities_entity_wrap.cpp
@@ -328,6 +328,14 @@ void export_base_entity(scope _entity)
":rtype: int"
);
+ BaseEntity.add_property(
+ "parent_name",
+ &CBaseEntityWrapper::GetParentName,
+ &CBaseEntityWrapper::SetParentName,
+ "Get/set the entity's parent name.\n\n"
+ ":rtype: str"
+ );
+
BaseEntity.add_property(
"shadow_cast_distance",
&CBaseEntityWrapper::GetShadowCastDistance,
diff --git a/src/core/modules/players/players_entity.cpp b/src/core/modules/players/players_entity.cpp
new file mode 100644
index 000000000..767cf192e
--- /dev/null
+++ b/src/core/modules/players/players_entity.cpp
@@ -0,0 +1,702 @@
+/**
+* =============================================================================
+* Source Python
+* Copyright (C) 2012-2016 Source Python Development Team. All rights reserved.
+* =============================================================================
+*
+* This program is free software; you can redistribute it and/or modify it under
+* the terms of the GNU General Public License, version 3.0, as published by the
+* Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+* details.
+*
+* You should have received a copy of the GNU General Public License along with
+* this program. If not, see .
+*
+* As a special exception, the Source Python Team gives you permission
+* to link the code of this program (as well as its derivative works) to
+* "Half-Life 2," the "Source Engine," and any Game MODs that run on software
+* by the Valve Corporation. You must obey the GNU General Public License in
+* all respects for all other code used. Additionally, the Source.Python
+* Development Team grants this exception to all derivative works.
+*/
+
+// ============================================================================
+// >> INCLUDES
+// ============================================================================
+// Source.Python
+#include "players_entity.h"
+
+
+// ============================================================================
+// >> PlayerMixin
+// ============================================================================
+boost::shared_ptr PlayerMixin::__init__(unsigned int uiEntityIndex)
+{
+ CBaseEntityWrapper* pEntity = (CBaseEntityWrapper*) ExcBaseEntityFromIndex(uiEntityIndex);
+ if (!pEntity->IsPlayer())
+ BOOST_RAISE_EXCEPTION(PyExc_ValueError, "Index '%d' is not a valid player.", uiEntityIndex);
+
+ return PlayerMixin::wrap(pEntity->GetBaseEntity());
+}
+
+boost::shared_ptr PlayerMixin::wrap(CBaseEntity* pEntity)
+{
+ return boost::shared_ptr(
+ (PlayerMixin *) pEntity,
+ &NeverDeleteDeleter
+ );
+}
+
+
+// CBasePlayer
+float PlayerMixin::GetSpeed()
+{
+ static int offset = FindNetworkPropertyOffset("localdata.m_flLaggedMovementValue");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetSpeed(float value)
+{
+ static int offset = FindNetworkPropertyOffset("localdata.m_flLaggedMovementValue");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+bool PlayerMixin::GetIsDucked()
+{
+ static int offset = FindDatamapPropertyOffset("m_Local.m_bDucked");
+ return GetDatamapPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetIsDucked(bool value)
+{
+ static int offset = FindDatamapPropertyOffset("m_Local.m_bDucked");
+ SetDatamapPropertyByOffset(offset, value);
+}
+
+
+bool PlayerMixin::GetIsDucking()
+{
+ static int offset = FindDatamapPropertyOffset("m_Local.m_bDucking");
+ return GetDatamapPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetIsDucking(bool value)
+{
+ static int offset = FindDatamapPropertyOffset("m_Local.m_bDucking");
+ SetDatamapPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetFlags()
+{
+ static int offset = FindNetworkPropertyOffset("m_fFlags");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetFlags(int value)
+{
+ static int offset = FindNetworkPropertyOffset("m_fFlags");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetLastWeapon()
+{
+ static int offset = FindNetworkPropertyOffset("localdata.m_hLastWeapon");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetLastWeapon(int value)
+{
+ static int offset = FindNetworkPropertyOffset("localdata.m_hLastWeapon");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetObserverTarget()
+{
+ static int offset = FindNetworkPropertyOffset("m_hObserverTarget");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetObserverTarget(int value)
+{
+ static int offset = FindNetworkPropertyOffset("m_hObserverTarget");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetDeaths()
+{
+ static int offset = FindDatamapPropertyOffset("m_iDeaths");
+ return GetDatamapPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetDeaths(int value)
+{
+ static int offset = FindDatamapPropertyOffset("m_iDeaths");
+ SetDatamapPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetKills()
+{
+ static int offset = FindDatamapPropertyOffset("m_iFrags");
+ return GetDatamapPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetKills(int value)
+{
+ static int offset = FindDatamapPropertyOffset("m_iFrags");
+ SetDatamapPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetObserverMode()
+{
+ static int offset = FindNetworkPropertyOffset("m_iObserverMode");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetObserverMode(int value)
+{
+ static int offset = FindNetworkPropertyOffset("m_iObserverMode");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetLifeState()
+{
+ static int offset = FindNetworkPropertyOffset("m_lifeState");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetLifeState(int value)
+{
+ static int offset = FindNetworkPropertyOffset("m_lifeState");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+str PlayerMixin::GetPlace()
+{
+ static int offset = FindNetworkPropertyOffset("m_szLastPlaceName");
+ return str(GetNetworkPropertyStringArrayByOffset(offset));
+}
+
+void PlayerMixin::SetPlace(const char* value)
+{
+ static int offset = FindNetworkPropertyOffset("m_szLastPlaceName");
+ SetNetworkPropertyStringArrayByOffset(offset, value);
+}
+
+
+bool PlayerMixin::GetDead()
+{
+ static int offset = FindNetworkPropertyOffset("pl.deadflag");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetDead(bool value)
+{
+ static int offset = FindNetworkPropertyOffset("pl.deadflag");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+float PlayerMixin::GetFallVelocity()
+{
+ static int offset = FindDatamapPropertyOffset("m_Local.m_flFallVelocity");
+ return GetDatamapPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetFallVelocity(float value)
+{
+ static int offset = FindDatamapPropertyOffset("m_Local.m_flFallVelocity");
+ SetDatamapPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetButtons()
+{
+ static int offset = FindDatamapPropertyOffset("m_nButtons");
+ return GetDatamapPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetButtons(int value)
+{
+ static int offset = FindDatamapPropertyOffset("m_nButtons");
+ SetDatamapPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetHiddenHUDs()
+{
+ static int offset = FindDatamapPropertyOffset("m_Local.m_iHideHUD");
+ return GetDatamapPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetHiddenHUDs(int value)
+{
+ static int offset = FindDatamapPropertyOffset("m_Local.m_iHideHUD");
+ SetDatamapPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetDrawViewModel()
+{
+ static int offset = FindDatamapPropertyOffset("m_Local.m_bDrawViewmodel");
+ return GetDatamapPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetDrawViewModel(int value)
+{
+ static int offset = FindDatamapPropertyOffset("m_Local.m_bDrawViewmodel");
+ SetDatamapPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetFOV()
+{
+ static int offset = FindNetworkPropertyOffset("m_iFOV");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetFOV(int value)
+{
+ static int offset = FindNetworkPropertyOffset("m_iFOV");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetFOVStart()
+{
+ static int offset = FindNetworkPropertyOffset("m_iFOVStart");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetFOVStart(int value)
+{
+ static int offset = FindNetworkPropertyOffset("m_iFOVStart");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+float PlayerMixin::GetFOVTime()
+{
+ static int offset = FindNetworkPropertyOffset("m_flFOVTime");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetFOVTime(float value)
+{
+ static int offset = FindNetworkPropertyOffset("m_flFOVTime");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetDefaultFOV()
+{
+ static int offset = FindNetworkPropertyOffset("m_iDefaultFOV");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetDefaultFOV(int value)
+{
+ static int offset = FindNetworkPropertyOffset("m_iDefaultFOV");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+float PlayerMixin::GetFOVRate()
+{
+ static int offset = FindDatamapPropertyOffset("m_Local.m_flFOVRate");
+ return GetDatamapPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetFOVRate(float value)
+{
+ static int offset = FindDatamapPropertyOffset("m_Local.m_flFOVRate");
+ SetDatamapPropertyByOffset(offset, value);
+}
+
+
+// CBaseCombatCharacter
+Vector PlayerMixin::GetGunOffset()
+{
+ static int offset = FindDatamapPropertyOffset("m_HackedGunPos");
+ return GetDatamapPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetGunOffset(Vector& value)
+{
+ static int offset = FindDatamapPropertyOffset("m_HackedGunPos");
+ SetDatamapPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetLastHitgroup()
+{
+ static int offset = FindDatamapPropertyOffset("m_LastHitGroup");
+ return GetDatamapPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetLastHitgroup(int value)
+{
+ static int offset = FindDatamapPropertyOffset("m_LastHitGroup");
+ SetDatamapPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetActiveWeaponHandle()
+{
+ static int offset = FindNetworkPropertyOffset("m_hActiveWeapon");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetActiveWeaponHandle(int value)
+{
+ static int offset = FindNetworkPropertyOffset("m_hActiveWeapon");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+str PlayerMixin::GetRelationship()
+{
+ return GetKeyValueString("Relationship");
+}
+
+void PlayerMixin::SetRelationship(const char* value)
+{
+ SetKeyValue("Relationship", value);
+}
+
+
+float PlayerMixin::GetPhysDamageScale()
+{
+ return GetKeyValueFloat("physdamagescale");
+}
+
+void PlayerMixin::SetPhysDamageScale(float value)
+{
+ SetKeyValue("physdamagescale", value);
+}
+
+
+QAngle PlayerMixin::GetEyeAngle()
+{
+ static int offset_x = FindNetworkPropertyOffset(EYE_ANGLE_PROPERTY(0));
+ static int offset_y = FindNetworkPropertyOffset(EYE_ANGLE_PROPERTY(1));
+ return QAngle(
+ GetNetworkPropertyByOffset(offset_x),
+ GetNetworkPropertyByOffset(offset_y),
+ 0);
+}
+
+void PlayerMixin::SetEyeAngle(QAngle& value)
+{
+ static int offset_x = FindNetworkPropertyOffset(EYE_ANGLE_PROPERTY(0));
+ static int offset_y = FindNetworkPropertyOffset(EYE_ANGLE_PROPERTY(1));
+ SetNetworkPropertyByOffset(offset_x, value.x);
+ SetNetworkPropertyByOffset(offset_y, value.y);
+}
+
+
+Vector PlayerMixin::GetViewVector()
+{
+ QAngle eye_angle = GetEyeAngle();
+
+ float yaw = DEG2RAD(eye_angle.y);
+ float pitch = DEG2RAD(eye_angle.x);
+
+ float sy, cy, sp, cp;
+ SinCos(yaw, &sy, &cy);
+ SinCos(pitch, &sp, &cp);
+
+ return Vector(cp * cy, cp * sy, -sp);
+}
+
+void PlayerMixin::SetViewVector(Vector& value)
+{
+ BOOST_RAISE_EXCEPTION(PyExc_NotImplementedError, "Setting view_vector is not implemented.");
+}
+
+
+QAngle PlayerMixin::GetViewAngle()
+{
+ QAngle eye_angle = GetEyeAngle();
+ return QAngle(
+ eye_angle.x,
+ eye_angle.y < 0 ? eye_angle.y + 360 : eye_angle.y,
+ GetRotation().z);
+}
+
+void PlayerMixin::SetViewAngle(QAngle& value)
+{
+ BOOST_RAISE_EXCEPTION(PyExc_NotImplementedError, "Setting view_angle is not implemented.");
+}
+
+
+float PlayerMixin::GetStamina()
+{
+ static int offset = FindNetworkPropertyOffset("cslocaldata.m_flStamina");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetStamina(float value)
+{
+ static int offset = FindNetworkPropertyOffset("cslocaldata.m_flStamina");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetShotsFired()
+{
+ static int offset = FindNetworkPropertyOffset("cslocaldata.m_iShotsFired");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetShotsFired(int value)
+{
+ static int offset = FindNetworkPropertyOffset("cslocaldata.m_iShotsFired");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetArmor()
+{
+ static int offset = FindNetworkPropertyOffset("m_ArmorValue");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetArmor(int value)
+{
+ static int offset = FindNetworkPropertyOffset("m_ArmorValue");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+bool PlayerMixin::GetHasDefuser()
+{
+ static int offset = FindNetworkPropertyOffset("m_bHasDefuser");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetHasDefuser(bool value)
+{
+ static int offset = FindNetworkPropertyOffset("m_bHasDefuser");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+bool PlayerMixin::GetHasHelmet()
+{
+ static int offset = FindNetworkPropertyOffset("m_bHasHelmet");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetHasHelmet(bool value)
+{
+ static int offset = FindNetworkPropertyOffset("m_bHasHelmet");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+bool PlayerMixin::GetHasNightvision()
+{
+ static int offset = FindNetworkPropertyOffset("m_bHasNightVision");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetHasNightvision(bool value)
+{
+ static int offset = FindNetworkPropertyOffset("m_bHasNightVision");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+bool PlayerMixin::GetIsInBombZone()
+{
+ static int offset = FindNetworkPropertyOffset("m_bInBombZone");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetIsInBombZone(bool value)
+{
+ static int offset = FindNetworkPropertyOffset("m_bInBombZone");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+bool PlayerMixin::GetIsInBuyZone()
+{
+ static int offset = FindNetworkPropertyOffset("m_bInBuyZone");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetIsInBuyZone(bool value)
+{
+ static int offset = FindNetworkPropertyOffset("m_bInBuyZone");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+bool PlayerMixin::GetIsInHostageRescueZone()
+{
+ static int offset = FindNetworkPropertyOffset("m_bInHostageRescueZone");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetIsInHostageRescueZone(bool value)
+{
+ static int offset = FindNetworkPropertyOffset("m_bInHostageRescueZone");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+bool PlayerMixin::GetIsDefusing()
+{
+ static int offset = FindNetworkPropertyOffset("m_bIsDefusing");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetIsDefusing(bool value)
+{
+ static int offset = FindNetworkPropertyOffset("m_bIsDefusing");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+bool PlayerMixin::GetNightvisionOn()
+{
+ static int offset = FindNetworkPropertyOffset("m_bNightVisionOn");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetNightvisionOn(bool value)
+{
+ static int offset = FindNetworkPropertyOffset("m_bNightVisionOn");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+float PlayerMixin::GetFlashDuration()
+{
+ static int offset = FindNetworkPropertyOffset("m_flFlashDuration");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetFlashDuration(float value)
+{
+ static int offset = FindNetworkPropertyOffset("m_flFlashDuration");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+float PlayerMixin::GetFlashAlpha()
+{
+ static int offset = FindNetworkPropertyOffset("m_flFlashMaxAlpha");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetFlashAlpha(float value)
+{
+ static int offset = FindNetworkPropertyOffset("m_flFlashMaxAlpha");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetCash()
+{
+ static int offset = FindNetworkPropertyOffset("m_iAccount");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetCash(int value)
+{
+ static int offset = FindNetworkPropertyOffset("m_iAccount");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetPlayerClass()
+{
+ static int offset = FindNetworkPropertyOffset(PLAYER_CLASS_PROPERTY);
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetPlayerClass(int value)
+{
+ static int offset = FindNetworkPropertyOffset(PLAYER_CLASS_PROPERTY);
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetPlayerState()
+{
+ static int offset = FindNetworkPropertyOffset("m_iPlayerState");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetPlayerState(int value)
+{
+ static int offset = FindNetworkPropertyOffset("m_iPlayerState");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetRagdoll()
+{
+ static int offset = FindNetworkPropertyOffset("m_hRagdoll");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetRagdoll(int value)
+{
+ static int offset = FindNetworkPropertyOffset("m_hRagdoll");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetActiveDevices()
+{
+ static int offset = FindNetworkPropertyOffset("m_HL2Local.m_bitsActiveDevices");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetActiveDevices(int value)
+{
+ static int offset = FindNetworkPropertyOffset("m_HL2Local.m_bitsActiveDevices");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+float PlayerMixin::GetSuitPowerLoad()
+{
+ static int offset = FindNetworkPropertyOffset("m_flSuitPowerLoad");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetSuitPowerLoad(float value)
+{
+ static int offset = FindNetworkPropertyOffset("m_flSuitPowerLoad");
+ SetNetworkPropertyByOffset(offset, value);
+}
+
+
+int PlayerMixin::GetDesiredPlayerClass()
+{
+ static int offset = FindNetworkPropertyOffset("m_Shared.m_iDesiredPlayerClass");
+ return GetNetworkPropertyByOffset(offset);
+}
+
+void PlayerMixin::SetDesiredPlayerClass(int value)
+{
+ static int offset = FindNetworkPropertyOffset("m_Shared.m_iDesiredPlayerClass");
+ SetNetworkPropertyByOffset(offset, value);
+}
diff --git a/src/core/modules/players/players_entity.h b/src/core/modules/players/players_entity.h
new file mode 100644
index 000000000..b78076992
--- /dev/null
+++ b/src/core/modules/players/players_entity.h
@@ -0,0 +1,230 @@
+/**
+* =============================================================================
+* Source Python
+* Copyright (C) 2012-2015 Source Python Development Team. All rights reserved.
+* =============================================================================
+*
+* This program is free software; you can redistribute it and/or modify it under
+* the terms of the GNU General Public License, version 3.0, as published by the
+* Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+* details.
+*
+* You should have received a copy of the GNU General Public License along with
+* this program. If not, see .
+*
+* As a special exception, the Source Python Team gives you permission
+* to link the code of this program (as well as its derivative works) to
+* "Half-Life 2," the "Source Engine," and any Game MODs that run on software
+* by the Valve Corporation. You must obey the GNU General Public License in
+* all respects for all other code used. Additionally, the Source.Python
+* Development Team grants this exception to all derivative works.
+*/
+
+#ifndef _PLAYERS_ENTITY_H
+#define _PLAYERS_ENTITY_H
+
+//-----------------------------------------------------------------------------
+// Includes.
+//-----------------------------------------------------------------------------
+#include "boost/python.hpp"
+using namespace boost::python;
+
+#include "modules/entities/entities_entity.h"
+
+
+//-----------------------------------------------------------------------------
+// MACROS
+//-----------------------------------------------------------------------------
+// Eye angle property
+#if defined(ENGINE_BRANCH_TF2)
+ #define EYE_ANGLE_PROPERTY(index) "tfnonlocaldata.m_angEyeAngles[" #index "]"
+#elif defined(ENGINE_BRANCH_BMS)
+ #define EYE_ANGLE_PROPERTY(index) "blackmesalocaldata.m_angEyeAngles[" #index "]"
+#elif defined(ENGINE_BRANCH_GMOD)
+ #define EYE_ANGLE_PROPERTY(index) "hl2mplocaldata.m_angEyeAngles[" #index "]"
+#else
+ #define EYE_ANGLE_PROPERTY(index) "m_angEyeAngles[" #index "]"
+#endif
+
+// Player class property
+#if defined(ENGINE_BRANCH_TF2)
+ #define PLAYER_CLASS_PROPERTY "m_PlayerClass.m_iClass"
+#else
+ #define PLAYER_CLASS_PROPERTY "m_iClass"
+#endif
+
+
+//-----------------------------------------------------------------------------
+// CBaseEntity extension class for players.
+//-----------------------------------------------------------------------------
+class PlayerMixin: public CBaseEntityWrapper
+{
+public:
+ static boost::shared_ptr __init__(unsigned int uiEntityIndex);
+ static boost::shared_ptr wrap(CBaseEntity* pEntity);
+
+ // CBasePlayer
+ // TODO: Return for some of these the proper entity class instead of a handle/index
+ // E. g. BaseEntity, Entity, Weapon, Player, etc.
+ float GetSpeed();
+ void SetSpeed(float value);
+
+ bool GetIsDucked();
+ void SetIsDucked(bool value);
+
+ bool GetIsDucking();
+ void SetIsDucking(bool value);
+
+ int GetFlags();
+ void SetFlags(int value);
+
+ int GetLastWeapon();
+ void SetLastWeapon(int value);
+
+ int GetObserverTarget();
+ void SetObserverTarget(int value);
+
+ int GetDeaths();
+ void SetDeaths(int value);
+
+ int GetKills();
+ void SetKills(int value);
+
+ // TODO: Return ObserverMode enum
+ int GetObserverMode();
+ void SetObserverMode(int value);
+
+ // TODO: Return LifeState enum
+ int GetLifeState();
+ void SetLifeState(int value);
+
+ str GetPlace();
+ void SetPlace(const char* value);
+
+ bool GetDead();
+ void SetDead(bool value);
+
+ float GetFallVelocity();
+ void SetFallVelocity(float value);
+
+ int GetButtons();
+ void SetButtons(int value);
+
+ int GetHiddenHUDs();
+ void SetHiddenHUDs(int value);
+
+ int GetDrawViewModel();
+ void SetDrawViewModel(int value);
+
+ int GetFOV();
+ void SetFOV(int value);
+
+ int GetFOVStart();
+ void SetFOVStart(int value);
+
+ float GetFOVTime();
+ void SetFOVTime(float value);
+
+ int GetDefaultFOV();
+ void SetDefaultFOV(int value);
+
+ float GetFOVRate();
+ void SetFOVRate(float value);
+
+ // CBaseCombatCharacter
+ Vector GetGunOffset();
+ void SetGunOffset(Vector& value);
+
+ int GetLastHitgroup();
+ void SetLastHitgroup(int value);
+
+ int GetActiveWeaponHandle();
+ void SetActiveWeaponHandle(int value);
+
+ str GetRelationship();
+ void SetRelationship(const char* value);
+
+ float GetPhysDamageScale();
+ void SetPhysDamageScale(float value);
+
+ QAngle GetEyeAngle();
+ void SetEyeAngle(QAngle& value);
+
+ Vector GetViewVector();
+ void SetViewVector(Vector& value);
+
+ QAngle GetViewAngle();
+ void SetViewAngle(QAngle& value);
+
+ // Game specific
+ // CS:S, CS:GO
+ float GetStamina();
+ void SetStamina(float value);
+
+ int GetShotsFired();
+ void SetShotsFired(int value);
+
+ int GetArmor();
+ void SetArmor(int value);
+
+ bool GetHasDefuser();
+ void SetHasDefuser(bool value);
+
+ bool GetHasHelmet();
+ void SetHasHelmet(bool value);
+
+ bool GetHasNightvision();
+ void SetHasNightvision(bool value);
+
+ bool GetIsInBombZone();
+ void SetIsInBombZone(bool value);
+
+ bool GetIsInBuyZone();
+ void SetIsInBuyZone(bool value);
+
+ bool GetIsInHostageRescueZone();
+ void SetIsInHostageRescueZone(bool value);
+
+ bool GetIsDefusing();
+ void SetIsDefusing(bool value);
+
+ bool GetNightvisionOn();
+ void SetNightvisionOn(bool value);
+
+ float GetFlashDuration();
+ void SetFlashDuration(float value);
+
+ float GetFlashAlpha();
+ void SetFlashAlpha(float value);
+
+ int GetCash();
+ void SetCash(int value);
+
+ int GetPlayerClass();
+ void SetPlayerClass(int value);
+
+ int GetPlayerState();
+ void SetPlayerState(int value);
+
+ int GetRagdoll();
+ void SetRagdoll(int value);
+
+ // HL2
+ int GetActiveDevices();
+ void SetActiveDevices(int value);
+
+ // HL2
+ float GetSuitPowerLoad();
+ void SetSuitPowerLoad(float value);
+
+ // TF2
+ int GetDesiredPlayerClass();
+ void SetDesiredPlayerClass(int value);
+};
+
+
+#endif // _PLAYERS_ENTITY_H
diff --git a/src/core/modules/players/players_wrap.cpp b/src/core/modules/players/players_wrap.cpp
index 41834212a..054db2be0 100644
--- a/src/core/modules/players/players_wrap.cpp
+++ b/src/core/modules/players/players_wrap.cpp
@@ -38,6 +38,7 @@
#include "inetchannelinfo.h"
#include "inetchannel.h"
#include "players_wrap.h"
+#include "players_entity.h"
#include ENGINE_INCLUDE_PATH(players_wrap.h)
@@ -49,6 +50,7 @@ void export_playerinfo(scope);
void export_player_generator(scope);
void export_client(scope);
void export_user_cmd(scope);
+void export_player_wrapper(scope);
//-----------------------------------------------------------------------------
@@ -60,6 +62,7 @@ DECLARE_SP_MODULE(_players)
export_player_generator(_players);
export_client(_players);
export_user_cmd(_players);
+ export_player_wrapper(_players);
}
@@ -347,3 +350,385 @@ void export_user_cmd(scope _players)
UserCmd ADD_MEM_TOOLS(CUserCmd);
}
+
+void export_player_wrapper(scope _players)
+{
+ class_, boost::noncopyable> _PlayerMixin("PlayerMixin", no_init);
+
+ _PlayerMixin.def("__init__",
+ make_constructor(
+ &PlayerMixin::__init__,
+ default_call_policies(),
+ args("entity_index")
+ )
+ );
+
+ _PlayerMixin.add_property(
+ "speed",
+ &PlayerMixin::GetSpeed,
+ &PlayerMixin::SetSpeed,
+ "Get/set the player's speed.\n\n"
+ ":rtype: float");
+
+ _PlayerMixin.add_property(
+ "is_ducked",
+ &PlayerMixin::GetIsDucked,
+ &PlayerMixin::SetIsDucked,
+ "Return whether the player is ducked.\n\n"
+ ":rtype: bool");
+
+ _PlayerMixin.add_property(
+ "is_ducking",
+ &PlayerMixin::GetIsDucked,
+ &PlayerMixin::SetIsDucked,
+ "Return whether the player is duckeding.\n\n"
+ ":rtype: bool");
+
+ _PlayerMixin.add_property(
+ "flags",
+ &PlayerMixin::GetFlags,
+ &PlayerMixin::SetFlags,
+ "Get/set the player's flags.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "last_weapon",
+ &PlayerMixin::GetLastWeapon,
+ &PlayerMixin::SetLastWeapon,
+ "Get/set the player's last weapon.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "observer_target",
+ &PlayerMixin::GetObserverTarget,
+ &PlayerMixin::SetObserverTarget,
+ "Get/set the player's observer target.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "deaths",
+ &PlayerMixin::GetDeaths,
+ &PlayerMixin::SetDeaths,
+ "Get/set the player's death count.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "kills",
+ &PlayerMixin::GetKills,
+ &PlayerMixin::SetKills,
+ "Get/set the player's kill count.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "observer_mode",
+ &PlayerMixin::GetObserverMode,
+ &PlayerMixin::SetObserverMode,
+ "Get/set the player's observer mode.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "life_state",
+ &PlayerMixin::GetLifeState,
+ &PlayerMixin::SetLifeState,
+ "Get/set the player's life state.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "place",
+ &PlayerMixin::GetPlace,
+ &PlayerMixin::SetPlace,
+ "Get/set the player's current place.\n\n"
+ ":rtype: str");
+
+ _PlayerMixin.add_property(
+ "dead",
+ &PlayerMixin::GetDead,
+ &PlayerMixin::SetDead,
+ "Return whether the player is dead.\n\n"
+ ":rtype: bool");
+
+ _PlayerMixin.add_property(
+ "fall_velocity",
+ &PlayerMixin::GetFallVelocity,
+ &PlayerMixin::SetFallVelocity,
+ "Get/set the player's fall velocity.\n\n"
+ ":rtype: float");
+
+ _PlayerMixin.add_property(
+ "buttons",
+ &PlayerMixin::GetButtons,
+ &PlayerMixin::SetButtons,
+ "Get/set the player's currently pressed buttons.\n\n"
+ ":rtype: float");
+
+ _PlayerMixin.add_property(
+ "hidden_huds",
+ &PlayerMixin::GetHiddenHUDs,
+ &PlayerMixin::SetHiddenHUDs,
+ "Get/set the player's hidden HUDs.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "draw_view_model",
+ &PlayerMixin::GetDrawViewModel,
+ &PlayerMixin::SetDrawViewModel,
+ "Get/set the player's draw view model.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "fov",
+ &PlayerMixin::GetFOV,
+ &PlayerMixin::SetFOV,
+ "Get/set the player's field of view (FOV).\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "fov_start",
+ &PlayerMixin::GetFOVStart,
+ &PlayerMixin::SetFOVStart,
+ "Get/set the player's field of view (FOV) start.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "fov_time",
+ &PlayerMixin::GetFOVTime,
+ &PlayerMixin::SetFOVTime,
+ "Get/set the player's field of view (FOV) time.\n\n"
+ ":rtype: float");
+
+ _PlayerMixin.add_property(
+ "default_fov",
+ &PlayerMixin::GetDefaultFOV,
+ &PlayerMixin::SetDefaultFOV,
+ "Get/set the player's default field of view (FOV).\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "default_fov",
+ &PlayerMixin::GetDefaultFOV,
+ &PlayerMixin::SetDefaultFOV,
+ "Get/set the player's default field of view (FOV).\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "fov_rate",
+ &PlayerMixin::GetFOVRate,
+ &PlayerMixin::SetFOVRate,
+ "Get/set the player's field of view (FOV) rate.\n\n"
+ ":rtype: float");
+
+ _PlayerMixin.add_property(
+ "gun_offset",
+ &PlayerMixin::GetGunOffset,
+ &PlayerMixin::SetGunOffset,
+ "Get/set the player's gun offset.\n\n"
+ ":rtype: Vector");
+
+ _PlayerMixin.add_property(
+ "last_hitgroup",
+ &PlayerMixin::GetLastHitgroup,
+ &PlayerMixin::SetLastHitgroup,
+ "Get/set the player's last hitgroup.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "active_weapon_handle",
+ &PlayerMixin::GetLastHitgroup,
+ &PlayerMixin::SetLastHitgroup,
+ "Get/set the player's active weapon_handle.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "relationship",
+ &PlayerMixin::GetRelationship,
+ &PlayerMixin::SetRelationship,
+ "Get/set the player's relationship.\n\n"
+ ":rtype: str");
+
+ _PlayerMixin.add_property(
+ "phys_damage_scale",
+ &PlayerMixin::GetPhysDamageScale,
+ &PlayerMixin::SetPhysDamageScale,
+ "Get/set the player's physical damage scale.\n\n"
+ ":rtype: float");
+
+ _PlayerMixin.add_property(
+ "eye_angle",
+ &PlayerMixin::GetEyeAngle,
+ &PlayerMixin::SetEyeAngle,
+ "Get/set the player's eye angle.\n\n"
+ ":rtype: QAngle");
+
+ _PlayerMixin.add_property(
+ "view_vector",
+ &PlayerMixin::GetViewVector,
+ &PlayerMixin::SetViewVector,
+ "Get/set the player's view vector.\n\n"
+ ":rtype: Vector");
+
+ _PlayerMixin.add_property(
+ "view_angle",
+ &PlayerMixin::GetViewAngle,
+ &PlayerMixin::SetViewAngle,
+ "Get/set the player's view angle.\n\n"
+ ":rtype: QAngle");
+
+ _PlayerMixin.add_property(
+ "view_offset",
+ &PlayerMixin::GetViewOffset,
+ &PlayerMixin::SetViewOffset,
+ "Get/set the player's view offset.\n\n"
+ ":rtype: Vector");
+
+ // Game specific
+ _PlayerMixin.add_property(
+ "stamina",
+ &PlayerMixin::GetStamina,
+ &PlayerMixin::SetStamina,
+ "Get/set the player's stamina.\n\n"
+ ".. note:: Only available in CS:GO and CS:S.\n\n"
+ ":rtype: float");
+
+ _PlayerMixin.add_property(
+ "shots_fired",
+ &PlayerMixin::GetShotsFired,
+ &PlayerMixin::SetShotsFired,
+ "Get/set the the number of shots fired by the player.\n\n"
+ ".. note:: Only available in CS:GO and CS:S.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "armor",
+ &PlayerMixin::GetArmor,
+ &PlayerMixin::SetArmor,
+ "Get/set the player's armor.\n\n"
+ ".. note:: Only available in CS:GO and CS:S.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "has_defuser",
+ &PlayerMixin::GetHasDefuser,
+ &PlayerMixin::SetHasDefuser,
+ "Get/set whether the player has a defuser.\n\n"
+ ".. note:: Only available in CS:GO and CS:S.\n\n"
+ ":rtype: bool");
+
+ _PlayerMixin.add_property(
+ "has_helmet",
+ &PlayerMixin::GetHasHelmet,
+ &PlayerMixin::SetHasHelmet,
+ "Get/set whether the player has a helmet.\n\n"
+ ".. note:: Only available in CS:GO and CS:S.\n\n"
+ ":rtype: bool");
+
+ _PlayerMixin.add_property(
+ "in_bomb_zone",
+ &PlayerMixin::GetIsInBombZone,
+ &PlayerMixin::SetIsInBombZone,
+ "Get/set whether the player is in a bomb zone.\n\n"
+ ".. note:: Only available in CS:GO and CS:S.\n\n"
+ ":rtype: bool");
+
+ _PlayerMixin.add_property(
+ "in_buy_zone",
+ &PlayerMixin::GetIsInBuyZone,
+ &PlayerMixin::SetIsInBuyZone,
+ "Get/set whether the player is in a buy zone.\n\n"
+ ".. note:: Only available in CS:GO and CS:S.\n\n"
+ ":rtype: bool");
+
+ _PlayerMixin.add_property(
+ "in_rescue_zone",
+ &PlayerMixin::GetIsInHostageRescueZone,
+ &PlayerMixin::SetIsInHostageRescueZone,
+ "Get/set whether the player is in a hostage rescue zone.\n\n"
+ ".. note:: Only available in CS:GO and CS:S.\n\n"
+ ":rtype: bool");
+
+ _PlayerMixin.add_property(
+ "is_defusing",
+ &PlayerMixin::GetIsDefusing,
+ &PlayerMixin::SetIsDefusing,
+ "Get/set whether the player is currently defusing the bomb.\n\n"
+ ".. note:: Only available in CS:GO and CS:S.\n\n"
+ ":rtype: bool");
+
+ _PlayerMixin.add_property(
+ "nightvision_on",
+ &PlayerMixin::GetNightvisionOn,
+ &PlayerMixin::SetNightvisionOn,
+ "Get/set whether the player is currently using nightvision.\n\n"
+ ".. note:: Only available in CS:GO and CS:S.\n\n"
+ ":rtype: bool");
+
+ _PlayerMixin.add_property(
+ "flash_duration",
+ &PlayerMixin::GetFlashDuration,
+ &PlayerMixin::SetFlashDuration,
+ "Get/set the player's flash duration.\n\n"
+ ".. note:: Only available in CS:GO and CS:S.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "flash_alpha",
+ &PlayerMixin::GetFlashAlpha,
+ &PlayerMixin::SetFlashAlpha,
+ "Get/set the player's flash alpha.\n\n"
+ ".. note:: Only available in CS:GO and CS:S.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "cash",
+ &PlayerMixin::GetCash,
+ &PlayerMixin::SetCash,
+ "Get/set the player's cash.\n\n"
+ ".. note:: Only available in CS:GO and CS:S.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "player_class",
+ &PlayerMixin::GetPlayerClass,
+ &PlayerMixin::SetPlayerClass,
+ "Get/set the player's player class.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "player_state",
+ &PlayerMixin::GetPlayerState,
+ &PlayerMixin::SetPlayerState,
+ "Get/set the player's player state.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "ragdoll",
+ &PlayerMixin::GetRagdoll,
+ &PlayerMixin::SetRagdoll,
+ "Get/set the player's ragdoll.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "active_devices",
+ &PlayerMixin::GetActiveDevices,
+ &PlayerMixin::SetActiveDevices,
+ "Get/set the player's active devices.\n\n"
+ ".. note:: Only available in HL2.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin.add_property(
+ "suit_power_load",
+ &PlayerMixin::GetSuitPowerLoad,
+ &PlayerMixin::SetSuitPowerLoad,
+ "Get/set the player's suit power load.\n\n"
+ ".. note:: Only available in HL2.\n\n"
+ ":rtype: float");
+
+ _PlayerMixin.add_property(
+ "desired_player_class",
+ &PlayerMixin::GetDesiredPlayerClass,
+ &PlayerMixin::SetDesiredPlayerClass,
+ "Get/set the player's desired player class.\n\n"
+ ".. note:: Only available in TF2.\n\n"
+ ":rtype: int");
+
+ _PlayerMixin ADD_MEM_TOOLS(PlayerMixin);
+}