1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-02-20 19:57:12 +01:00

Expose functionality to emit custom entity events.

This commit is contained in:
Sandu Liviu Catalin 2016-07-27 00:13:50 +03:00
parent 18f5f90a47
commit f7b0909ed7
14 changed files with 105 additions and 0 deletions

View File

@ -116,6 +116,15 @@ void CBlip::BindEvent(Int32 evid, Object & env, Function & func) const
}
}
// ------------------------------------------------------------------------------------------------
void CBlip::CustomEvent(Int32 header, Object & payload) const
{
// Validate the managed identifier
Validate();
// Perfrom the requested action
Core::Get().EmitBlipCustom(m_ID, header, payload);
}
// ------------------------------------------------------------------------------------------------
Int32 CBlip::GetWorld() const
{
@ -304,6 +313,7 @@ void Register_CBlip(HSQUIRRELVM vm)
.Prop(_SC("Active"), &CBlip::IsActive)
// Core Methods
.Func(_SC("Bind"), &CBlip::BindEvent)
.Func(_SC("CustomEvent"), &CBlip::CustomEvent)
// Core Overloads
.Overload< bool (CBlip::*)(void) >(_SC("Destroy"), &CBlip::Destroy)
.Overload< bool (CBlip::*)(Int32) >(_SC("Destroy"), &CBlip::Destroy)

View File

@ -157,6 +157,11 @@ public:
*/
void BindEvent(Int32 evid, Object & env, Function & func) const;
/* --------------------------------------------------------------------------------------------
* Emit a custom event for the managed entity
*/
void CustomEvent(Int32 header, Object & payload) const;
/* --------------------------------------------------------------------------------------------
* Retrieve the world in which the referenced blip entity exists.
*/

View File

@ -129,6 +129,15 @@ void CCheckpoint::BindEvent(Int32 evid, Object & env, Function & func) const
}
}
// ------------------------------------------------------------------------------------------------
void CCheckpoint::CustomEvent(Int32 header, Object & payload) const
{
// Validate the managed identifier
Validate();
// Perfrom the requested action
Core::Get().EmitCheckpointCustom(m_ID, header, payload);
}
// ------------------------------------------------------------------------------------------------
bool CCheckpoint::IsStreamedFor(CPlayer & player) const
{
@ -497,6 +506,7 @@ void Register_CCheckpoint(HSQUIRRELVM vm)
.Prop(_SC("Active"), &CCheckpoint::IsActive)
// Core Methods
.Func(_SC("Bind"), &CCheckpoint::BindEvent)
.Func(_SC("CustomEvent"), &CCheckpoint::CustomEvent)
// Core Overloads
.Overload< bool (CCheckpoint::*)(void) >(_SC("Destroy"), &CCheckpoint::Destroy)
.Overload< bool (CCheckpoint::*)(Int32) >(_SC("Destroy"), &CCheckpoint::Destroy)

View File

@ -164,6 +164,11 @@ public:
*/
void BindEvent(Int32 evid, Object & env, Function & func) const;
/* --------------------------------------------------------------------------------------------
* Emit a custom event for the managed entity
*/
void CustomEvent(Int32 header, Object & payload) const;
/* --------------------------------------------------------------------------------------------
* See if the managed checkpoint entity is streamed for the specified player.
*/

View File

@ -116,6 +116,15 @@ void CKeybind::BindEvent(Int32 evid, Object & env, Function & func) const
}
}
// ------------------------------------------------------------------------------------------------
void CKeybind::CustomEvent(Int32 header, Object & payload) const
{
// Validate the managed identifier
Validate();
// Perfrom the requested action
Core::Get().EmitKeybindCustom(m_ID, header, payload);
}
// ------------------------------------------------------------------------------------------------
Int32 CKeybind::GetFirst() const
{
@ -203,6 +212,7 @@ void Register_CKeybind(HSQUIRRELVM vm)
.Prop(_SC("Active"), &CKeybind::IsActive)
// Core Methods
.Func(_SC("Bind"), &CKeybind::BindEvent)
.Func(_SC("CustomEvent"), &CKeybind::CustomEvent)
// Core Overloads
.Overload< bool (CKeybind::*)(void) >(_SC("Destroy"), &CKeybind::Destroy)
.Overload< bool (CKeybind::*)(Int32) >(_SC("Destroy"), &CKeybind::Destroy)

View File

@ -157,6 +157,11 @@ public:
*/
void BindEvent(Int32 evid, Object & env, Function & func) const;
/* --------------------------------------------------------------------------------------------
* Emit a custom event for the managed entity
*/
void CustomEvent(Int32 header, Object & payload) const;
/* --------------------------------------------------------------------------------------------
* Retrieve the first key code of the managed keybind entity.
*/

View File

@ -129,6 +129,15 @@ void CObject::BindEvent(Int32 evid, Object & env, Function & func) const
}
}
// ------------------------------------------------------------------------------------------------
void CObject::CustomEvent(Int32 header, Object & payload) const
{
// Validate the managed identifier
Validate();
// Perfrom the requested action
Core::Get().EmitObjectCustom(m_ID, header, payload);
}
// ------------------------------------------------------------------------------------------------
bool CObject::IsStreamedFor(CPlayer & player) const
{
@ -832,6 +841,7 @@ void Register_CObject(HSQUIRRELVM vm)
.Prop(_SC("Active"), &CObject::IsActive)
// Core Methods
.Func(_SC("Bind"), &CObject::BindEvent)
.Func(_SC("CustomEvent"), &CObject::CustomEvent)
// Core Overloads
.Overload< bool (CObject::*)(void) >(_SC("Destroy"), &CObject::Destroy)
.Overload< bool (CObject::*)(Int32) >(_SC("Destroy"), &CObject::Destroy)

View File

@ -179,6 +179,11 @@ public:
*/
void BindEvent(Int32 evid, Object & env, Function & func) const;
/* --------------------------------------------------------------------------------------------
* Emit a custom event for the managed entity
*/
void CustomEvent(Int32 header, Object & payload) const;
/* --------------------------------------------------------------------------------------------
* See if the managed object entity is streamed for the specified player.
*/

View File

@ -121,6 +121,15 @@ void CPickup::BindEvent(Int32 evid, Object & env, Function & func) const
}
}
// ------------------------------------------------------------------------------------------------
void CPickup::CustomEvent(Int32 header, Object & payload) const
{
// Validate the managed identifier
Validate();
// Perfrom the requested action
Core::Get().EmitPickupCustom(m_ID, header, payload);
}
// ------------------------------------------------------------------------------------------------
bool CPickup::IsStreamedFor(CPlayer & player) const
{
@ -385,6 +394,7 @@ void Register_CPickup(HSQUIRRELVM vm)
.Prop(_SC("Active"), &CPickup::IsActive)
// Core Methods
.Func(_SC("Bind"), &CPickup::BindEvent)
.Func(_SC("CustomEvent"), &CPickup::CustomEvent)
// Core Overloads
.Overload< bool (CPickup::*)(void) >(_SC("Destroy"), &CPickup::Destroy)
.Overload< bool (CPickup::*)(Int32) >(_SC("Destroy"), &CPickup::Destroy)

View File

@ -160,6 +160,11 @@ public:
*/
void BindEvent(Int32 evid, Object & env, Function & func) const;
/* --------------------------------------------------------------------------------------------
* Emit a custom event for the managed entity
*/
void CustomEvent(Int32 header, Object & payload) const;
/* --------------------------------------------------------------------------------------------
* See if the managed pickup entity is streamed for the specified player.
*/

View File

@ -142,6 +142,15 @@ void CPlayer::BindEvent(Int32 evid, Object & env, Function & func) const
}
}
// ------------------------------------------------------------------------------------------------
void CPlayer::CustomEvent(Int32 header, Object & payload) const
{
// Validate the managed identifier
Validate();
// Perfrom the requested action
Core::Get().EmitPlayerCustom(m_ID, header, payload);
}
// ------------------------------------------------------------------------------------------------
bool CPlayer::IsConnected() const
{
@ -2195,6 +2204,7 @@ void Register_CPlayer(HSQUIRRELVM vm)
.Prop(_SC("Active"), &CPlayer::IsActive)
// Core Methods
.Func(_SC("Bind"), &CPlayer::BindEvent)
.Func(_SC("CustomEvent"), &CPlayer::CustomEvent)
// Properties
.Prop(_SC("Connected"), &CPlayer::IsConnected)
.Prop(_SC("Admin"), &CPlayer::GetAdmin, &CPlayer::SetAdmin)

View File

@ -215,6 +215,11 @@ public:
*/
void BindEvent(Int32 evid, Object & env, Function & func) const;
/* --------------------------------------------------------------------------------------------
* Emit a custom event for the managed entity
*/
void CustomEvent(Int32 header, Object & payload) const;
/* --------------------------------------------------------------------------------------------
* See whether the managed player entity is connected.
*/

View File

@ -125,6 +125,15 @@ void CVehicle::BindEvent(Int32 evid, Object & env, Function & func) const
}
}
// ------------------------------------------------------------------------------------------------
void CVehicle::CustomEvent(Int32 header, Object & payload) const
{
// Validate the managed identifier
Validate();
// Perfrom the requested action
Core::Get().EmitVehicleCustom(m_ID, header, payload);
}
// ------------------------------------------------------------------------------------------------
bool CVehicle::IsStreamedFor(CPlayer & player) const
{
@ -1652,6 +1661,7 @@ void Register_CVehicle(HSQUIRRELVM vm)
.Prop(_SC("Active"), &CVehicle::IsActive)
// Core Methods
.Func(_SC("Bind"), &CVehicle::BindEvent)
.Func(_SC("CustomEvent"), &CVehicle::CustomEvent)
// Core Overloads
.Overload< bool (CVehicle::*)(void) >(_SC("Destroy"), &CVehicle::Destroy)
.Overload< bool (CVehicle::*)(Int32) >(_SC("Destroy"), &CVehicle::Destroy)

View File

@ -175,6 +175,11 @@ public:
*/
void BindEvent(Int32 evid, Object & env, Function & func) const;
/* --------------------------------------------------------------------------------------------
* Emit a custom event for the managed entity
*/
void CustomEvent(Int32 header, Object & payload) const;
/* --------------------------------------------------------------------------------------------
* See if the managed vehicle entity is streamed for the specified player.
*/