1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-15 22:57:12 +02:00

Implement the option to specify how many times you want to allow intensive entity events to be forwarded to script callbacks.

Also expose several properties for the vehicle entity type that I forgot about.
This commit is contained in:
Sandu Liviu Catalin
2016-06-08 16:53:16 +03:00
parent 6489dfdf08
commit bc1e7dbde6
7 changed files with 202 additions and 8 deletions

View File

@ -1174,6 +1174,24 @@ void CPlayer::SetMessagePrefix(Uint32 index, CSStr prefix)
mMessagePrefixes[index].assign(prefix);
}
// ------------------------------------------------------------------------------------------------
SQInteger CPlayer::GetTrackPosition() const
{
// Validate the managed identifier
Validate();
// Return the requested information
return Core::Get().GetPlayer(m_ID).mTrackPosition;
}
// ------------------------------------------------------------------------------------------------
void CPlayer::SetTrackPosition(SQInteger num) const
{
// Validate the managed identifier
Validate();
// Assign the requested information
Core::Get().GetPlayer(m_ID).mTrackPosition = num;
}
// ------------------------------------------------------------------------------------------------
Int32 CPlayer::GetLastWeapon() const
{
@ -2075,6 +2093,7 @@ void Register_CPlayer(HSQUIRRELVM vm)
.Prop(_SC("Away"), &CPlayer::IsAway)
.Prop(_SC("Spec"), &CPlayer::GetSpectator, &CPlayer::SetSpectator)
.Prop(_SC("Authority"), &CPlayer::GetAuthority, &CPlayer::SetAuthority)
.Prop(_SC("TrackPosition"), &CPlayer::GetTrackPosition, &CPlayer::SetTrackPosition)
.Prop(_SC("LastWeapon"), &CPlayer::GetLastWeapon)
.Prop(_SC("LastHealth"), &CPlayer::GetLastHealth)
.Prop(_SC("LastArmour"), &CPlayer::GetLastArmour)

View File

@ -715,6 +715,16 @@ public:
*/
void SetMessagePrefix(Uint32 index, CSStr prefix);
/* --------------------------------------------------------------------------------------------
* Retrieve the amount of tracked position changes for the managed player entity.
*/
SQInteger GetTrackPosition() const;
/* --------------------------------------------------------------------------------------------
* Retrieve the amount of tracked position changes for the managed player entity.
*/
void SetTrackPosition(SQInteger num) const;
/* --------------------------------------------------------------------------------------------
* Retrieve the last known weapon for the managed player entity.
*/

View File

@ -984,6 +984,87 @@ bool CVehicle::Embark(CPlayer & player, Int32 slot, bool allocate, bool warp) co
!= vcmpErrorRequestDenied);
}
// ------------------------------------------------------------------------------------------------
SQInteger CVehicle::GetTrackPosition() const
{
// Validate the managed identifier
Validate();
// Return the requested information
return Core::Get().GetVehicle(m_ID).mTrackPosition;
}
// ------------------------------------------------------------------------------------------------
void CVehicle::SetTrackPosition(SQInteger num) const
{
// Validate the managed identifier
Validate();
// Assign the requested information
Core::Get().GetVehicle(m_ID).mTrackPosition = num;
}
// ------------------------------------------------------------------------------------------------
SQInteger CVehicle::GetTrackRotation() const
{
// Validate the managed identifier
Validate();
// Return the requested information
return Core::Get().GetVehicle(m_ID).mTrackRotation;
}
// ------------------------------------------------------------------------------------------------
void CVehicle::SetTrackRotation(SQInteger num) const
{
// Validate the managed identifier
Validate();
// Assign the requested information
Core::Get().GetVehicle(m_ID).mTrackRotation = num;
}
// ------------------------------------------------------------------------------------------------
Int32 CVehicle::GetLastPrimaryColour() const
{
// Validate the managed identifier
Validate();
// Return the requested information
return Core::Get().GetVehicle(m_ID).mLastPrimaryColour;
}
// ------------------------------------------------------------------------------------------------
Int32 CVehicle::GetLastSecondaryColour() const
{
// Validate the managed identifier
Validate();
// Return the requested information
return Core::Get().GetVehicle(m_ID).mLastSecondaryColour;
}
// ------------------------------------------------------------------------------------------------
Float32 CVehicle::GetLastHealth() const
{
// Validate the managed identifier
Validate();
// Return the requested information
return Core::Get().GetVehicle(m_ID).mLastHealth;
}
// ------------------------------------------------------------------------------------------------
const Vector3 & CVehicle::GetLastPosition() const
{
// Validate the managed identifier
Validate();
// Return the requested information
return Core::Get().GetVehicle(m_ID).mLastPosition;
}
// ------------------------------------------------------------------------------------------------
const Quaternion & CVehicle::GetLastRotation() const
{
// Validate the managed identifier
Validate();
// Return the requested information
return Core::Get().GetVehicle(m_ID).mLastRotation;
}
// ------------------------------------------------------------------------------------------------
Float32 CVehicle::GetPositionX() const
{
@ -1678,6 +1759,13 @@ void Register_CVehicle(HSQUIRRELVM vm)
.Prop(_SC("HorizontalTurretRotation"), &CVehicle::GetHorizontalTurretRotation)
.Prop(_SC("VerTurretRotation"), &CVehicle::GetVerticalTurretRotation)
.Prop(_SC("VerticalTurretRotation"), &CVehicle::GetVerticalTurretRotation)
.Prop(_SC("TrackPosition"), &CVehicle::GetTrackPosition, &CVehicle::SetTrackPosition)
.Prop(_SC("TrackRotation"), &CVehicle::GetTrackRotation, &CVehicle::SetTrackRotation)
.Prop(_SC("LastPrimaryColour"), &CVehicle::GetLastPrimaryColour)
.Prop(_SC("LastSecondaryColour"), &CVehicle::GetLastSecondaryColour)
.Prop(_SC("LastHealth"), &CVehicle::GetLastHealth)
.Prop(_SC("LastPosition"), &CVehicle::GetLastPosition)
.Prop(_SC("LastRotation"), &CVehicle::GetLastRotation)
.Prop(_SC("PosX"), &CVehicle::GetPositionX, &CVehicle::SetPositionX)
.Prop(_SC("PosY"), &CVehicle::GetPositionY, &CVehicle::SetPositionY)
.Prop(_SC("PosZ"), &CVehicle::GetPositionZ, &CVehicle::SetPositionZ)

View File

@ -590,6 +590,51 @@ public:
*/
bool Embark(CPlayer & player, Int32 slot, bool allocate, bool warp) const;
/* --------------------------------------------------------------------------------------------
* Retrieve the amount of tracked position changes for the managed vehicle entity.
*/
SQInteger GetTrackPosition() const;
/* --------------------------------------------------------------------------------------------
* Retrieve the amount of tracked position changes for the managed vehicle entity.
*/
void SetTrackPosition(SQInteger num) const;
/* --------------------------------------------------------------------------------------------
* Retrieve the amount of tracked rotation changes for the managed vehicle entity.
*/
SQInteger GetTrackRotation() const;
/* --------------------------------------------------------------------------------------------
* Retrieve the amount of tracked rotation changes for the managed vehicle entity.
*/
void SetTrackRotation(SQInteger num) const;
/* --------------------------------------------------------------------------------------------
* Retrieve the last known primary color for the managed vehicle entity.
*/
Int32 GetLastPrimaryColour() const;
/* --------------------------------------------------------------------------------------------
* Retrieve the last known secondary color for the managed vehicle entity.
*/
Int32 GetLastSecondaryColour() const;
/* --------------------------------------------------------------------------------------------
* Retrieve the last known health for the managed vehicle entity.
*/
Float32 GetLastHealth() const;
/* --------------------------------------------------------------------------------------------
* Retrieve the last known position for the managed player entity.
*/
const Vector3 & GetLastPosition() const;
/* --------------------------------------------------------------------------------------------
* Retrieve the last known rotation for the managed player entity.
*/
const Quaternion & GetLastRotation() const;
/* --------------------------------------------------------------------------------------------
* Retrieve the position on the x axis of the managed vehicle entity.
*/