1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-16 07:07:13 +02:00

Implement new API changes.

Initial implementation of entity streaming events, 3D arrows, drunk effects., camera interpolation, entity options and whatnot. Not yet tested!
This commit is contained in:
Sandu Liviu Catalin
2019-06-02 00:39:06 +03:00
parent 0b0ec9c40c
commit 7fdcf7efc0
11 changed files with 452 additions and 12 deletions

View File

@ -240,6 +240,15 @@ CSStr CPlayer::GetUID2() const
return s_Buffer;
}
// ------------------------------------------------------------------------------------------------
void CPlayer::Kill() const
{
// Validate the managed identifier
Validate();
// Perform the requested operation
_Func->KillPlayer(m_ID);
}
// ------------------------------------------------------------------------------------------------
void CPlayer::Kick() const
{
@ -1377,6 +1386,59 @@ void CPlayer::Unspectate() const
_Func->SetPlayerSpectateTarget(m_ID, -1);
}
// ------------------------------------------------------------------------------------------------
void CPlayer::SetPlayer3DArrow(CPlayer & target, bool toggle) const
{
// Validate the managed identifier
Validate();
// Spectate the given target
_Func->SetPlayer3DArrowForPlayer(m_ID, target.GetID(), toggle);
}
// ------------------------------------------------------------------------------------------------
bool CPlayer::GetPlayer3DArrow(CPlayer & target) const
{
// Validate the managed identifier
Validate();
// Spectate the given target
return _Func->GetPlayer3DArrowForPlayer(m_ID, target.GetID());
}
// ------------------------------------------------------------------------------------------------
void CPlayer::SetPlayer3DArrowID(SQInteger id, bool toggle) const
{
// Validate the managed identifier
Validate();
// Spectate the given target
_Func->SetPlayer3DArrowForPlayer(m_ID, id, toggle);
}
// ------------------------------------------------------------------------------------------------
bool CPlayer::GetPlayer3DArrowID(SQInteger id) const
{
// Validate the managed identifier
Validate();
// Spectate the given target
return _Func->GetPlayer3DArrowForPlayer(m_ID, id);
}
// ------------------------------------------------------------------------------------------------
bool CPlayer::InterpolateCameraLookAt(const Vector3 & pos, Uint32 ms) const
{
// Validate the managed identifier
Validate();
// Perform the requested operation
return _Func->InterpolateCameraLookAt(m_ID, pos.x, pos.y, pos.z, ms) != vcmpErrorRequestDenied;
}
// ------------------------------------------------------------------------------------------------
bool CPlayer::InterpolateCameraLookAtEx(Float32 x, Float32 y, Float32 z, Uint32 ms) const
{
// Validate the managed identifier
Validate();
// Perform the requested operation
return _Func->InterpolateCameraLookAt(m_ID, x, y, z, ms) != vcmpErrorRequestDenied;
}
// ------------------------------------------------------------------------------------------------
void CPlayer::Redirect(StackStrF & ip, Uint32 port, StackStrF & nick,
StackStrF & server_pass, StackStrF & user_pass)
@ -1409,6 +1471,42 @@ void CPlayer::PlaySound(Int32 sound_id) const
_Func->PlaySound(_Func->GetPlayerUniqueWorld(m_ID), sound_id, NAN, NAN, NAN);
}
// ------------------------------------------------------------------------------------------------
void CPlayer::SetDrunkHandling(SQInteger level) const
{
// Validate the managed identifier
Validate();
// Perform the requested operation
_Func->SetPlayerDrunkHandling(m_ID, static_cast< Uint32 >(level));
}
// ------------------------------------------------------------------------------------------------
SQInteger CPlayer::GetDrunkHandling() const
{
// Validate the managed identifier
Validate();
// Perform the requested operation
return _Func->GetPlayerDrunkHandling(m_ID);
}
// ------------------------------------------------------------------------------------------------
void CPlayer::SetDrunkVisuals(SQInteger level) const
{
// Validate the managed identifier
Validate();
// Perform the requested operation
_Func->SetPlayerDrunkVisuals(m_ID, static_cast< Uint8 >(level));
}
// ------------------------------------------------------------------------------------------------
SQInteger CPlayer::GetDrunkVisuals() const
{
// Validate the managed identifier
Validate();
// Perform the requested operation
return _Func->GetPlayerDrunkVisuals(m_ID);
}
// ------------------------------------------------------------------------------------------------
LightObj & CPlayer::CreateCheckpointEx(Int32 world, bool sphere, Float32 x, Float32 y, Float32 z,
Uint8 r, Uint8 g, Uint8 b, Uint8 a, Float32 radius) const
@ -2673,6 +2771,8 @@ void Register_CPlayer(HSQUIRRELVM vm)
.Prop(_SC("Away"), &CPlayer::IsAway)
.Prop(_SC("Spec"), &CPlayer::GetSpectator, &CPlayer::SetSpectator)
.Prop(_SC("SpecID"), &CPlayer::GetSpectatorID, &CPlayer::SetSpectatorID)
.Prop(_SC("DrunkHandling"), &CPlayer::GetDrunkHandling, &CPlayer::SetDrunkHandling)
.Prop(_SC("DrunkVisuals"), &CPlayer::GetDrunkVisuals, &CPlayer::SetDrunkVisuals)
.Prop(_SC("CollideAreas"), &CPlayer::GetCollideAreas, &CPlayer::SetCollideAreas)
.Prop(_SC("Authority"), &CPlayer::GetAuthority, &CPlayer::SetAuthority)
.Prop(_SC("TrackPosition"), &CPlayer::GetTrackPosition, &CPlayer::SetTrackPosition)
@ -2693,6 +2793,7 @@ void Register_CPlayer(HSQUIRRELVM vm)
.Prop(_SC("Blue"), &CPlayer::GetColorB, &CPlayer::SetColorB)
// Member Methods
.Func(_SC("StreamedFor"), &CPlayer::IsStreamedFor)
.Func(_SC("Kill"), &CPlayer::Kill)
.Func(_SC("Kick"), &CPlayer::Kick)
.Func(_SC("Ban"), &CPlayer::Ban)
.Func(_SC("KickBecause"), &CPlayer::KickBecause)
@ -2722,6 +2823,12 @@ void Register_CPlayer(HSQUIRRELVM vm)
.Func(_SC("Spectating"), &CPlayer::GetSpectator)
.Func(_SC("Unspectate"), &CPlayer::Unspectate)
.Func(_SC("Spectate"), &CPlayer::SetSpectator)
.Func(_SC("SetPlayer3DArrow"), &CPlayer::SetPlayer3DArrow)
.Func(_SC("GetPlayer3DArrow"), &CPlayer::GetPlayer3DArrow)
.Func(_SC("SetPlayer3DArrowID"), &CPlayer::SetPlayer3DArrowID)
.Func(_SC("GetPlayer3DArrowID"), &CPlayer::GetPlayer3DArrowID)
.Func(_SC("InterpolateCameraLookAt"), &CPlayer::InterpolateCameraLookAt)
.Func(_SC("InterpolateCameraLookAtEx"), &CPlayer::InterpolateCameraLookAtEx)
.Func(_SC("Redirect"), &CPlayer::Redirect)
.Func(_SC("GetModuleList"), &CPlayer::GetModuleList)
.Func(_SC("PlaySound"), &CPlayer::PlaySound)

View File

@ -265,6 +265,11 @@ public:
*/
CSStr GetUID2() const;
/* --------------------------------------------------------------------------------------------
* Set player's health to 0 and reset the death reason.
*/
void Kill() const;
/* --------------------------------------------------------------------------------------------
* Kick the managed player entity from the server.
*/
@ -740,6 +745,36 @@ public:
*/
void Unspectate() const;
/* --------------------------------------------------------------------------------------------
* Set whether the target player will see an objective arrow over a player.
*/
void SetPlayer3DArrow(CPlayer & target, bool toggle) const;
/* --------------------------------------------------------------------------------------------
* See whether the target player sees an objective arrow over a player.
*/
bool GetPlayer3DArrow(CPlayer & target) const;
/* --------------------------------------------------------------------------------------------
* Set whether the target player will see an objective arrow over a player.
*/
void SetPlayer3DArrowID(SQInteger id, bool toggle) const;
/* --------------------------------------------------------------------------------------------
* See whether the target player sees an objective arrow over a player.
*/
bool GetPlayer3DArrowID(SQInteger id) const;
/* --------------------------------------------------------------------------------------------
* Smoothly pivots the camera angle.
*/
bool InterpolateCameraLookAt(const Vector3 & pos, Uint32 ms) const;
/* --------------------------------------------------------------------------------------------
* Smoothly pivots the camera angle.
*/
bool InterpolateCameraLookAtEx(Float32 x, Float32 y, Float32 z, Uint32 ms) const;
/* --------------------------------------------------------------------------------------------
* Redirect the managed player entity to the specified server.
*/
@ -756,6 +791,26 @@ public:
*/
void PlaySound(Int32 sound_id) const;
/* --------------------------------------------------------------------------------------------
* Set how delayed a player's turn handling is when in a vehicle.
*/
void SetDrunkHandling(SQInteger level) const;
/* --------------------------------------------------------------------------------------------
* Retrieve how delayed a player's turn handling is when in a vehicle.
*/
SQInteger GetDrunkHandling() const;
/* --------------------------------------------------------------------------------------------
* Set how intense the drunk blur overlay is for a player.
*/
void SetDrunkVisuals(SQInteger level) const;
/* --------------------------------------------------------------------------------------------
* Retrieve how intense the drunk blur overlay is for a player.
*/
SQInteger GetDrunkVisuals() const;
/* --------------------------------------------------------------------------------------------
* Create a checkpoint or sphere for this player.
*/

View File

@ -1148,6 +1148,42 @@ bool CVehicle::Embark(CPlayer & player, Int32 slot, bool allocate, bool warp) co
!= vcmpErrorRequestDenied);
}
// ------------------------------------------------------------------------------------------------
void CVehicle::SetPlayer3DArrow(CPlayer & target, bool toggle) const
{
// Validate the managed identifier
Validate();
// Spectate the given target
_Func->SetVehicle3DArrowForPlayer(m_ID, target.GetID(), toggle);
}
// ------------------------------------------------------------------------------------------------
bool CVehicle::GetPlayer3DArrow(CPlayer & target) const
{
// Validate the managed identifier
Validate();
// Spectate the given target
return _Func->GetVehicle3DArrowForPlayer(m_ID, target.GetID());
}
// ------------------------------------------------------------------------------------------------
void CVehicle::SetPlayer3DArrowID(SQInteger id, bool toggle) const
{
// Validate the managed identifier
Validate();
// Spectate the given target
_Func->SetVehicle3DArrowForPlayer(m_ID, id, toggle);
}
// ------------------------------------------------------------------------------------------------
bool CVehicle::GetPlayer3DArrowID(SQInteger id) const
{
// Validate the managed identifier
Validate();
// Spectate the given target
return _Func->GetVehicle3DArrowForPlayer(m_ID, id);
}
// ------------------------------------------------------------------------------------------------
bool CVehicle::GetCollideAreas() const
{
@ -2038,6 +2074,10 @@ void Register_CVehicle(HSQUIRRELVM vm)
.Func(_SC("SetHandlingRule"), &CVehicle::SetHandlingRule)
.Func(_SC("ResetHandlingRule"), &CVehicle::ResetHandlingRule)
.Func(_SC("ResetHandlings"), &CVehicle::ResetHandlings)
.Func(_SC("SetPlayer3DArrow"), &CVehicle::SetPlayer3DArrow)
.Func(_SC("GetPlayer3DArrow"), &CVehicle::GetPlayer3DArrow)
.Func(_SC("SetPlayer3DArrowID"), &CVehicle::SetPlayer3DArrowID)
.Func(_SC("GetPlayer3DArrowID"), &CVehicle::GetPlayer3DArrowID)
.Func(_SC("AreasCollide"), &CVehicle::SetAreasCollide)
// Member Overloads
.Overload< void (CVehicle::*)(const Vector3 &, bool) const >

View File

@ -622,6 +622,26 @@ public:
*/
bool Embark(CPlayer & player, Int32 slot, bool allocate, bool warp) const;
/* --------------------------------------------------------------------------------------------
* Set whether the target player will see an objective arrow over a vehicle.
*/
void SetPlayer3DArrow(CPlayer & target, bool toggle) const;
/* --------------------------------------------------------------------------------------------
* See whether the target player sees an objective arrow over a vehicle.
*/
bool GetPlayer3DArrow(CPlayer & target) const;
/* --------------------------------------------------------------------------------------------
* Set whether the target player will see an objective arrow over a vehicle.
*/
void SetPlayer3DArrowID(SQInteger id, bool toggle) const;
/* --------------------------------------------------------------------------------------------
* See whether the target player sees an objective arrow over a vehicle.
*/
bool GetPlayer3DArrowID(SQInteger id) const;
/* --------------------------------------------------------------------------------------------
* See whether the managed vehicle entity collides with user defined areas.
*/