Skip to content

Commit 329cfe9

Browse files
committed
Added missing rotation property
1 parent ca83e29 commit 329cfe9

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

‎src/core/modules/entities/entities_entity.cpp‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,19 @@ void CBaseEntityWrapper::SetColor(Color& color)
857857
}
858858

859859

860+
QAngle CBaseEntityWrapper::GetRotation()
861+
{
862+
static int offset = FindDatamapPropertyOffset("m_angRotation");
863+
return GetNetworkPropertyByOffset<QAngle>(offset);
864+
}
865+
866+
void CBaseEntityWrapper::SetRotation(QAngle& rotation)
867+
{
868+
static int offset = FindDatamapPropertyOffset("m_angRotation");
869+
SetNetworkPropertyByOffset<QAngle>(offset, rotation);
870+
}
871+
872+
860873
Vector CBaseEntityWrapper::GetEyeLocation()
861874
{
862875
return GetOrigin() + GetViewOffset();

‎src/core/modules/entities/entities_entity.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,9 @@ class CBaseEntityWrapper: public IServerEntity
350350
Color GetColor();
351351
void SetColor(Color& color);
352352

353+
QAngle GetRotation();
354+
void SetRotation(QAngle& rotation);
355+
353356
Vector GetEyeLocation();
354357

355358
void StopSound(const char* sample, int channel);

‎src/core/modules/entities/entities_entity_wrap.cpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,14 @@ void export_base_entity(scope _entity)
404404
":rtype: Color"
405405
);
406406

407+
BaseEntity.add_property(
408+
"rotation",
409+
&CBaseEntityWrapper::GetRotation,
410+
&CBaseEntityWrapper::SetRotation,
411+
"Get/set the entity's rotation.\n\n"
412+
":rtype: QAngle"
413+
);
414+
407415
BaseEntity.def(
408416
"get_eye_location",
409417
&CBaseEntityWrapper::GetEyeLocation,

0 commit comments

Comments
 (0)