2015-09-30 02:56:11 +02:00
|
|
|
#ifndef _CORE_HPP_
|
|
|
|
#define _CORE_HPP_
|
|
|
|
|
2015-10-11 23:26:14 +02:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
#include "Base/Shared.hpp"
|
2015-10-11 23:26:14 +02:00
|
|
|
#include "Base/Vector3.hpp"
|
2016-05-22 05:20:38 +02:00
|
|
|
#include "Base/Quaternion.hpp"
|
2016-02-20 23:25:00 +01:00
|
|
|
#include "Base/Color4.hpp"
|
2016-06-17 02:28:37 +02:00
|
|
|
#include "Base/ScriptSrc.hpp"
|
2015-10-11 23:26:14 +02:00
|
|
|
|
2015-09-30 02:56:11 +02:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
#include <vector>
|
2016-03-26 17:16:01 +01:00
|
|
|
#include <unordered_map>
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
namespace SqMod {
|
|
|
|
|
2016-05-22 05:20:38 +02:00
|
|
|
/* ------------------------------------------------------------------------------------------------
|
|
|
|
* Circular locks employed by the central core.
|
|
|
|
*/
|
|
|
|
enum CoreCircularLocks
|
|
|
|
{
|
2016-05-24 05:51:40 +02:00
|
|
|
CCL_RELOAD_SCRIPTS = (1 << 0),
|
|
|
|
CCL_EMIT_SERVER_OPTION = (2 << 0)
|
2016-05-22 05:20:38 +02:00
|
|
|
};
|
2016-02-20 23:25:00 +01:00
|
|
|
|
2015-11-08 06:20:31 +01:00
|
|
|
/* ------------------------------------------------------------------------------------------------
|
2016-03-26 17:16:01 +01:00
|
|
|
* Core module class responsible for managing resources.
|
2015-11-08 06:20:31 +01:00
|
|
|
*/
|
2015-09-30 02:56:11 +02:00
|
|
|
class Core
|
|
|
|
{
|
2016-05-22 05:20:38 +02:00
|
|
|
private:
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
static Core s_Inst; // Core instance.
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2015-11-07 11:17:39 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Default constructor.
|
2015-11-07 11:17:39 +01:00
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
Core();
|
2016-02-20 23:25:00 +01:00
|
|
|
|
2016-05-22 05:20:38 +02:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Copy constructor. (disabled)
|
|
|
|
*/
|
|
|
|
Core(const Core & o) = delete;
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2015-11-07 11:17:39 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Move constructor. (disabled)
|
2015-11-07 11:17:39 +01:00
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
Core(Core && o) = delete;
|
2015-11-07 11:17:39 +01:00
|
|
|
|
2016-05-22 05:20:38 +02:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Destructor.
|
|
|
|
*/
|
|
|
|
~Core();
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-05-22 05:20:38 +02:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Copy assignment operator. (disabled)
|
|
|
|
*/
|
|
|
|
Core & operator = (const Core & o) = delete;
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Move assignment operator. (disabled)
|
|
|
|
*/
|
|
|
|
Core & operator = (Core && o) = delete;
|
|
|
|
|
|
|
|
protected:
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2015-11-07 11:17:39 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Helper structure used to identify a blip entity instance on the server.
|
2015-11-07 11:17:39 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
struct BlipInst
|
|
|
|
{
|
2016-07-16 14:45:36 +02:00
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Default constructor.
|
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
BlipInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(nullptr)
|
2016-07-16 14:45:36 +02:00
|
|
|
{
|
|
|
|
Core::Get().ResetInst(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Destructor.
|
|
|
|
*/
|
|
|
|
~BlipInst()
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(mID))
|
|
|
|
{
|
2016-07-16 18:39:51 +02:00
|
|
|
Destroy(!Core::Get().ShuttingDown(), SQMOD_DESTROY_CLEANUP, NullObject());
|
2016-07-16 14:45:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Destroy the entity instance from the server, if necessary.
|
|
|
|
*/
|
2016-07-16 18:39:51 +02:00
|
|
|
void Destroy(bool destroy, Int32 header, Object & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
Int32 mID; // The unique number that identifies this entity on the server.
|
|
|
|
Uint16 mFlags; // Various options and states that can be toggled on the instance.
|
|
|
|
CBlip * mInst; // Pointer to the actual instance used to interact this entity.
|
|
|
|
Object mObj; // Script object of the instance used to interact this entity.
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
Int32 mWorld; // The identifier of the world in which this blip was created.
|
|
|
|
Int32 mScale; // The scale of the blip.
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Int32 mSprID;
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Vector3 mPosition;
|
|
|
|
Color4 mColor;
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Function mOnDestroyed;
|
|
|
|
Function mOnCustom;
|
|
|
|
};
|
2015-11-07 11:17:39 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Helper structure used to identify a checkpoint entity instance on the server.
|
2015-11-07 11:17:39 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
struct CheckpointInst
|
|
|
|
{
|
2016-07-16 14:45:36 +02:00
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Default constructor.
|
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
CheckpointInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(nullptr)
|
2016-07-16 14:45:36 +02:00
|
|
|
{
|
|
|
|
Core::Get().ResetInst(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Destructor.
|
|
|
|
*/
|
|
|
|
~CheckpointInst()
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(mID))
|
|
|
|
{
|
2016-07-16 18:39:51 +02:00
|
|
|
Destroy(!Core::Get().ShuttingDown(), SQMOD_DESTROY_CLEANUP, NullObject());
|
2016-07-16 14:45:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Destroy the entity instance from the server, if necessary.
|
|
|
|
*/
|
2016-07-16 18:39:51 +02:00
|
|
|
void Destroy(bool destroy, Int32 header, Object & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
Int32 mID; // The unique number that identifies this entity on the server.
|
|
|
|
Uint16 mFlags; // Various options and states that can be toggled on the instance.
|
|
|
|
CCheckpoint * mInst; // Pointer to the actual instance used to interact this entity.
|
|
|
|
Object mObj; // Script object of the instance used to interact this entity.
|
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Function mOnDestroyed;
|
|
|
|
Function mOnCustom;
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Function mOnEntered;
|
|
|
|
Function mOnExited;
|
2016-08-18 14:54:26 +02:00
|
|
|
Function mOnWorld;
|
2016-08-18 15:10:18 +02:00
|
|
|
Function mOnRadius;
|
2016-02-20 23:25:00 +01:00
|
|
|
};
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2015-11-07 11:17:39 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
* Helper structure used to identify a key-bind entity instance on the server.
|
2015-11-07 11:17:39 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
struct KeybindInst
|
|
|
|
{
|
2016-07-16 14:45:36 +02:00
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Default constructor.
|
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
KeybindInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(nullptr)
|
2016-07-16 14:45:36 +02:00
|
|
|
{
|
|
|
|
Core::Get().ResetInst(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Destructor.
|
|
|
|
*/
|
|
|
|
~KeybindInst()
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(mID))
|
|
|
|
{
|
2016-07-16 18:39:51 +02:00
|
|
|
Destroy(!Core::Get().ShuttingDown(), SQMOD_DESTROY_CLEANUP, NullObject());
|
2016-07-16 14:45:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Destroy the entity instance from the server, if necessary.
|
|
|
|
*/
|
2016-07-16 18:39:51 +02:00
|
|
|
void Destroy(bool destroy, Int32 header, Object & payload);
|
2016-02-20 23:25:00 +01:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
Int32 mID; // The unique number that identifies this entity on the server.
|
|
|
|
Uint16 mFlags; // Various options and states that can be toggled on the instance.
|
|
|
|
CKeybind * mInst; // Pointer to the actual instance used to interact this entity.
|
|
|
|
Object mObj; // Script object of the instance used to interact this entity.
|
2016-02-20 23:25:00 +01:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
Int32 mFirst; // Key-code of the first button from the triggering combination.
|
|
|
|
Int32 mSecond; // Key-code of the second button from the triggering combination.
|
|
|
|
Int32 mThird; // Key-code of the third button from the triggering combination.
|
|
|
|
Int32 mRelease; // Whether the key-bind reacts to button press or release.
|
2016-02-20 23:25:00 +01:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Function mOnDestroyed;
|
|
|
|
Function mOnCustom;
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Function mOnKeyPress;
|
|
|
|
Function mOnKeyRelease;
|
|
|
|
};
|
2015-11-07 11:17:39 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Helper structure used to identify an object entity instance on the server.
|
2015-11-07 11:17:39 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
struct ObjectInst
|
|
|
|
{
|
2016-07-16 14:45:36 +02:00
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Default constructor.
|
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
ObjectInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(nullptr)
|
2016-07-16 14:45:36 +02:00
|
|
|
{
|
|
|
|
Core::Get().ResetInst(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Destructor.
|
|
|
|
*/
|
|
|
|
~ObjectInst()
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(mID))
|
|
|
|
{
|
2016-07-16 18:39:51 +02:00
|
|
|
Destroy(!Core::Get().ShuttingDown(), SQMOD_DESTROY_CLEANUP, NullObject());
|
2016-07-16 14:45:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Destroy the entity instance from the server, if necessary.
|
|
|
|
*/
|
2016-07-16 18:39:51 +02:00
|
|
|
void Destroy(bool destroy, Int32 header, Object & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
Int32 mID; // The unique number that identifies this entity on the server.
|
|
|
|
Uint16 mFlags; // Various options and states that can be toggled on the instance.
|
|
|
|
CObject * mInst; // Pointer to the actual instance used to interact this entity.
|
|
|
|
Object mObj; // Script object of the instance used to interact this entity.
|
2015-11-07 11:17:39 +01:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Function mOnDestroyed;
|
|
|
|
Function mOnCustom;
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Function mOnShot;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnTouched;
|
2016-08-18 15:37:55 +02:00
|
|
|
Function mOnWorld;
|
2016-08-18 15:50:30 +02:00
|
|
|
Function mOnAlpha;
|
2016-08-18 16:12:00 +02:00
|
|
|
Function mOnReport;
|
2016-02-20 23:25:00 +01:00
|
|
|
};
|
2015-11-07 11:17:39 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Helper structure used to identify a pickup entity instance on the server.
|
2015-11-07 11:17:39 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
struct PickupInst
|
|
|
|
{
|
2016-07-16 14:45:36 +02:00
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Default constructor.
|
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
PickupInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(nullptr)
|
2016-07-16 14:45:36 +02:00
|
|
|
{
|
|
|
|
Core::Get().ResetInst(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Destructor.
|
|
|
|
*/
|
|
|
|
~PickupInst()
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(mID))
|
|
|
|
{
|
2016-07-16 18:39:51 +02:00
|
|
|
Destroy(!Core::Get().ShuttingDown(), SQMOD_DESTROY_CLEANUP, NullObject());
|
2016-07-16 14:45:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Destroy the entity instance from the server, if necessary.
|
|
|
|
*/
|
2016-07-16 18:39:51 +02:00
|
|
|
void Destroy(bool destroy, Int32 header, Object & payload);
|
2015-11-07 11:17:39 +01:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
Int32 mID; // The unique number that identifies this entity on the server.
|
|
|
|
Uint16 mFlags; // Various options and states that can be toggled on the instance.
|
|
|
|
CPickup * mInst; // Pointer to the actual instance used to interact this entity.
|
|
|
|
Object mObj; // Script object of the instance used to interact this entity.
|
2015-11-07 11:17:39 +01:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Function mOnDestroyed;
|
|
|
|
Function mOnCustom;
|
2015-11-07 11:17:39 +01:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Function mOnRespawn;
|
|
|
|
Function mOnClaimed;
|
|
|
|
Function mOnCollected;
|
2016-08-19 16:58:08 +02:00
|
|
|
Function mOnWorld;
|
2016-08-19 17:05:29 +02:00
|
|
|
Function mOnAlpha;
|
2016-08-19 17:21:41 +02:00
|
|
|
Function mOnAutomatic;
|
2016-08-19 17:26:52 +02:00
|
|
|
Function mOnAutoTimer;
|
2016-02-20 23:25:00 +01:00
|
|
|
};
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2015-11-07 11:17:39 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Helper structure used to identify a player entity instance on the server.
|
2015-11-07 11:17:39 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
struct PlayerInst
|
|
|
|
{
|
2016-07-16 14:45:36 +02:00
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Default constructor.
|
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
PlayerInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(nullptr)
|
2016-07-16 14:45:36 +02:00
|
|
|
{
|
|
|
|
Core::Get().ResetInst(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Destructor.
|
|
|
|
*/
|
|
|
|
~PlayerInst()
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(mID))
|
|
|
|
{
|
2016-07-16 18:39:51 +02:00
|
|
|
Destroy(false, SQMOD_DESTROY_CLEANUP, NullObject());
|
2016-07-16 14:45:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Destroy the entity instance from the server, if necessary.
|
|
|
|
*/
|
2016-07-16 18:39:51 +02:00
|
|
|
void Destroy(bool destroy, Int32 header, Object & payload);
|
2016-03-24 04:28:55 +01:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
Int32 mID; // The unique number that identifies this entity on the server.
|
|
|
|
Uint16 mFlags; // Various options and states that can be toggled on the instance.
|
|
|
|
CPlayer * mInst; // Pointer to the actual instance used to interact this entity.
|
|
|
|
Object mObj; // Script object of the instance used to interact this entity.
|
2016-02-20 23:25:00 +01:00
|
|
|
|
2016-06-08 15:53:16 +02:00
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
SQInteger mTrackPosition; // The number of times to track position changes.
|
|
|
|
SQInteger mTrackHeading; // The number of times to track heading changes.
|
2016-07-14 18:52:14 +02:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
Int32 mTrackPositionHeader; // Header to send when triggering position callback.
|
|
|
|
Object mTrackPositionPayload; // Payload to send when triggering position callback.
|
2016-06-08 15:53:16 +02:00
|
|
|
|
2016-08-17 12:48:29 +02:00
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Int32 mKickBanHeader; // Header to send when triggering kick/ban callback.
|
|
|
|
Object mKickBanPayload; // Payload to send when triggering kick/ban callback.
|
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
Int32 mLastWeapon; // Last known weapon of the player entity.
|
|
|
|
Float32 mLastHealth; // Last known health of the player entity.
|
|
|
|
Float32 mLastArmour; // Last known armor of the player entity.
|
|
|
|
Float32 mLastHeading; // Last known heading of the player entity.
|
|
|
|
Vector3 mLastPosition; // Last known position of the player entity.
|
2016-02-20 23:25:00 +01:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
Int32 mAuthority; // The authority level of the managed player.
|
2016-02-20 23:25:00 +01:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Function mOnDestroyed;
|
|
|
|
Function mOnCustom;
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Function mOnRequestClass;
|
|
|
|
Function mOnRequestSpawn;
|
|
|
|
Function mOnSpawn;
|
|
|
|
Function mOnWasted;
|
|
|
|
Function mOnKilled;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnEmbarking;
|
|
|
|
Function mOnEmbarked;
|
|
|
|
Function mOnDisembark;
|
|
|
|
Function mOnRename;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnState;
|
|
|
|
Function mOnStateNone;
|
|
|
|
Function mOnStateNormal;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnStateAim;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnStateDriver;
|
|
|
|
Function mOnStatePassenger;
|
|
|
|
Function mOnStateEnterDriver;
|
|
|
|
Function mOnStateEnterPassenger;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnStateExit;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnStateUnspawned;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnAction;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnActionNone;
|
|
|
|
Function mOnActionNormal;
|
|
|
|
Function mOnActionAiming;
|
|
|
|
Function mOnActionShooting;
|
|
|
|
Function mOnActionJumping;
|
|
|
|
Function mOnActionLieDown;
|
|
|
|
Function mOnActionGettingUp;
|
|
|
|
Function mOnActionJumpVehicle;
|
|
|
|
Function mOnActionDriving;
|
|
|
|
Function mOnActionDying;
|
|
|
|
Function mOnActionWasted;
|
|
|
|
Function mOnActionEmbarking;
|
|
|
|
Function mOnActionDisembarking;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnBurning;
|
|
|
|
Function mOnCrouching;
|
|
|
|
Function mOnGameKeys;
|
|
|
|
Function mOnStartTyping;
|
|
|
|
Function mOnStopTyping;
|
|
|
|
Function mOnAway;
|
|
|
|
Function mOnMessage;
|
|
|
|
Function mOnCommand;
|
|
|
|
Function mOnPrivateMessage;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnKeyPress;
|
|
|
|
Function mOnKeyRelease;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnSpectate;
|
|
|
|
Function mOnCrashreport;
|
|
|
|
Function mOnObjectShot;
|
|
|
|
Function mOnObjectTouched;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnPickupClaimed;
|
|
|
|
Function mOnPickupCollected;
|
|
|
|
Function mOnCheckpointEntered;
|
|
|
|
Function mOnCheckpointExited;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnClientScriptData;
|
|
|
|
Function mOnUpdate;
|
|
|
|
Function mOnHealth;
|
|
|
|
Function mOnArmour;
|
|
|
|
Function mOnWeapon;
|
|
|
|
Function mOnHeading;
|
|
|
|
Function mOnPosition;
|
|
|
|
Function mOnOption;
|
2016-08-17 14:40:48 +02:00
|
|
|
Function mOnAdmin;
|
2016-08-17 14:45:44 +02:00
|
|
|
Function mOnWorld;
|
2016-08-17 14:49:08 +02:00
|
|
|
Function mOnTeam;
|
2016-08-17 14:52:22 +02:00
|
|
|
Function mOnSkin;
|
2016-08-17 14:55:59 +02:00
|
|
|
Function mOnMoney;
|
2016-08-17 15:00:28 +02:00
|
|
|
Function mOnScore;
|
2016-08-17 15:04:14 +02:00
|
|
|
Function mOnWantedLevel;
|
2016-08-17 15:07:31 +02:00
|
|
|
Function mOnImmunity;
|
2016-08-17 15:10:43 +02:00
|
|
|
Function mOnAlpha;
|
2016-02-20 23:25:00 +01:00
|
|
|
};
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2015-11-07 11:17:39 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Helper structure used to identify a vehicle entity instance on the server.
|
2015-11-07 11:17:39 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
struct VehicleInst
|
|
|
|
{
|
2016-07-16 14:45:36 +02:00
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Default constructor.
|
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
VehicleInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(nullptr)
|
2016-07-16 14:45:36 +02:00
|
|
|
{
|
|
|
|
Core::Get().ResetInst(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Destructor.
|
|
|
|
*/
|
|
|
|
~VehicleInst()
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(mID))
|
|
|
|
{
|
2016-07-16 18:39:51 +02:00
|
|
|
Destroy(!Core::Get().ShuttingDown(), SQMOD_DESTROY_CLEANUP, NullObject());
|
2016-07-16 14:45:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------------------
|
|
|
|
* Destroy the entity instance from the server, if necessary.
|
|
|
|
*/
|
2016-07-16 18:39:51 +02:00
|
|
|
void Destroy(bool destroy, Int32 header, Object & payload);
|
2016-02-20 23:25:00 +01:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
Int32 mID; // The unique number that identifies this entity on the server.
|
|
|
|
Uint16 mFlags; // Various options and states that can be toggled on the instance.
|
|
|
|
CVehicle * mInst; // Pointer to the actual instance used to interact this entity.
|
|
|
|
Object mObj; // Script object of the instance used to interact this entity.
|
2016-02-20 23:25:00 +01:00
|
|
|
|
2016-06-08 15:53:16 +02:00
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
SQInteger mTrackPosition; // The number of times to track position changes.
|
|
|
|
SQInteger mTrackRotation; // The number of times to track rotation changes.
|
2016-06-08 15:53:16 +02:00
|
|
|
|
2016-05-22 05:20:38 +02:00
|
|
|
// ----------------------------------------------------------------------------------------
|
2016-08-21 17:07:35 +02:00
|
|
|
Int32 mLastPrimaryColor; // Last known secondary-color of the player entity.
|
|
|
|
Int32 mLastSecondaryColor; // Last known primary-color of the player entity.
|
2016-07-16 15:17:09 +02:00
|
|
|
Float32 mLastHealth; // Last known health of the player entity.
|
|
|
|
Vector3 mLastPosition; // Last known position of the player entity.
|
|
|
|
Quaternion mLastRotation; // Last known rotation of the player entity.
|
2016-05-22 05:20:38 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Function mOnDestroyed;
|
|
|
|
Function mOnCustom;
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
Function mOnEmbarking;
|
|
|
|
Function mOnEmbarked;
|
|
|
|
Function mOnDisembark;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnExplode;
|
|
|
|
Function mOnRespawn;
|
|
|
|
Function mOnUpdate;
|
2016-08-21 17:07:35 +02:00
|
|
|
Function mOnColor;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnHealth;
|
|
|
|
Function mOnPosition;
|
|
|
|
Function mOnRotation;
|
|
|
|
Function mOnOption;
|
2016-08-18 13:38:00 +02:00
|
|
|
Function mOnWorld;
|
2016-08-18 13:45:12 +02:00
|
|
|
Function mOnImmunity;
|
2016-08-18 13:51:55 +02:00
|
|
|
Function mOnPartStatus;
|
2016-08-20 21:42:54 +02:00
|
|
|
Function mOnTyreStatus;
|
2016-08-18 14:06:03 +02:00
|
|
|
Function mOnDamageData;
|
2016-08-18 14:13:33 +02:00
|
|
|
Function mOnRadio;
|
2016-08-18 14:21:50 +02:00
|
|
|
Function mOnHandlingRule;
|
2016-02-20 23:25:00 +01:00
|
|
|
};
|
2015-11-07 11:17:39 +01:00
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
public:
|
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// --------------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
typedef std::vector< BlipInst > Blips; // Blips entity instances container.
|
|
|
|
typedef std::vector< CheckpointInst > Checkpoints; // Checkpoints entity instances container.
|
|
|
|
typedef std::vector< KeybindInst > Keybinds; // Key-binds entity instances container.
|
|
|
|
typedef std::vector< ObjectInst > Objects; // Objects entity instances container.
|
|
|
|
typedef std::vector< PickupInst > Pickups; // Pickups entity instances container.
|
|
|
|
typedef std::vector< PlayerInst > Players; // Players entity instances container.
|
|
|
|
typedef std::vector< VehicleInst > Vehicles; // Vehicles entity instances container.
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// --------------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
typedef std::vector< ScriptSrc > Scripts; // List of loaded scripts.
|
2016-08-25 02:08:44 +02:00
|
|
|
typedef std::pair< Function, Object > FuncData; // Data about a function to be called.
|
|
|
|
typedef std::vector< FuncData > Functions; // List of functions to execute.
|
2016-06-17 02:28:37 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2016-07-16 15:17:09 +02:00
|
|
|
typedef std::unordered_map< String, String > Options; // List of custom options.
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
private:
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// --------------------------------------------------------------------------------------------
|
2016-06-03 20:26:19 +02:00
|
|
|
Int32 m_State; // Current plug-in state.
|
2016-05-22 05:20:38 +02:00
|
|
|
HSQUIRRELVM m_VM; // Script virtual machine.
|
|
|
|
Scripts m_Scripts; // Loaded scripts objects.
|
2016-08-19 18:46:26 +02:00
|
|
|
Scripts m_PendingScripts; // Pending scripts objects.
|
2016-05-22 05:20:38 +02:00
|
|
|
Options m_Options; // Custom configuration options.
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
Blips m_Blips; // Blips pool.
|
|
|
|
Checkpoints m_Checkpoints; // Checkpoints pool.
|
2016-07-16 15:17:09 +02:00
|
|
|
Keybinds m_Keybinds; // Key-binds pool.
|
2016-05-22 05:20:38 +02:00
|
|
|
Objects m_Objects; // Objects pool.
|
|
|
|
Pickups m_Pickups; // Pickups pool.
|
|
|
|
Players m_Players; // Players pool.
|
|
|
|
Vehicles m_Vehicles; // Vehicles pool.
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
Uint32 m_CircularLocks; // Prevent events from triggering themselves.
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-05-24 18:26:43 +02:00
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
Int32 m_ReloadHeader; // The specified reload header.
|
|
|
|
Object m_ReloadPayload; // The specified reload payload.
|
|
|
|
|
2016-05-22 05:20:38 +02:00
|
|
|
// --------------------------------------------------------------------------------------------
|
2016-06-17 02:14:26 +02:00
|
|
|
CStr m_IncomingNameBuffer; // Name of an incoming connection.
|
|
|
|
size_t m_IncomingNameCapacity; // Incoming connection name size.
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-06-17 02:33:58 +02:00
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
bool m_Debugging; // Enable debugging features, if any.
|
2016-06-18 19:31:35 +02:00
|
|
|
bool m_Executed; // Whether the scripts were executed.
|
2016-07-16 18:39:51 +02:00
|
|
|
bool m_Shutdown; // Whether the server currently shutting down.
|
2016-08-25 02:08:44 +02:00
|
|
|
bool m_LockPreLoadSignal; // Lock pre load signal container.
|
|
|
|
bool m_LockPostLoadSignal; // Lock post load signal container.
|
|
|
|
bool m_LockUnloadSignal; // Lock unload signal container.
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
Functions m_PreLoadSignal; // Functions to call before the loaded event.
|
|
|
|
Functions m_PostLoadSignal; // Functions to call after the loaded event.
|
|
|
|
Functions m_UnloadSignal; // Functions to call before unloading scripts.
|
2016-06-17 02:33:58 +02:00
|
|
|
|
2016-08-07 00:54:33 +02:00
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
Object m_NullBlip; // Null Blips instance.
|
|
|
|
Object m_NullCheckpoint; // Null Checkpoints instance.
|
|
|
|
Object m_NullKeybind; // Null Key-instance pool.
|
|
|
|
Object m_NullObject; // Null Objects instance.
|
|
|
|
Object m_NullPickup; // Null Pickups instance.
|
|
|
|
Object m_NullPlayer; // Null Players instance.
|
|
|
|
Object m_NullVehicle; // Null Vehicles instance.
|
|
|
|
|
2016-05-22 05:20:38 +02:00
|
|
|
public:
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Retrieve the core instance.
|
2015-09-30 02:56:11 +02:00
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
static Core & Get()
|
|
|
|
{
|
|
|
|
return s_Inst;
|
|
|
|
}
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2015-11-08 06:20:31 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Initialize the plug-in core.
|
2015-11-08 06:20:31 +01:00
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
bool Initialize();
|
2015-11-08 06:20:31 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Load and execute plug-in resources.
|
2015-11-08 06:20:31 +01:00
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
bool Execute();
|
2015-11-08 06:20:31 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Terminate the plug-in core.
|
2015-11-08 06:20:31 +01:00
|
|
|
*/
|
2016-07-16 16:52:55 +02:00
|
|
|
void Terminate(bool shutdown = false);
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-05-24 05:51:40 +02:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Reload the plug-in core.
|
|
|
|
*/
|
2016-05-24 18:26:43 +02:00
|
|
|
bool Reload();
|
2016-05-24 05:51:40 +02:00
|
|
|
|
2015-11-08 06:20:31 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Modify the current plug-in state.
|
2015-11-08 06:20:31 +01:00
|
|
|
*/
|
2016-03-10 04:57:13 +01:00
|
|
|
void SetState(Int32 val)
|
|
|
|
{
|
|
|
|
m_State = val;
|
|
|
|
}
|
|
|
|
|
2016-05-22 05:20:38 +02:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Retrieve the current plug-in state.
|
|
|
|
*/
|
2016-03-10 04:57:13 +01:00
|
|
|
Int32 GetState() const
|
|
|
|
{
|
|
|
|
return m_State;
|
|
|
|
}
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-06-18 19:31:35 +02:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-08-23 23:27:22 +02:00
|
|
|
* See whether debugging option was enabled in the plug-in.
|
2016-06-18 19:31:35 +02:00
|
|
|
*/
|
|
|
|
bool IsDebugging() const
|
|
|
|
{
|
|
|
|
return m_Debugging;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-08-23 23:27:22 +02:00
|
|
|
* See whether all queued scripts were executed and the plug-in fully started.
|
2016-06-18 19:31:35 +02:00
|
|
|
*/
|
|
|
|
bool IsExecuted() const
|
|
|
|
{
|
|
|
|
return m_Executed;
|
|
|
|
}
|
|
|
|
|
2016-07-16 18:39:51 +02:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* See whether the server is currently in the process of shutting down.
|
|
|
|
*/
|
|
|
|
bool ShuttingDown() const
|
|
|
|
{
|
|
|
|
return m_Shutdown;
|
|
|
|
}
|
|
|
|
|
2015-11-08 06:20:31 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Retrieve the value of the specified option.
|
2015-11-08 06:20:31 +01:00
|
|
|
*/
|
2016-03-11 19:04:26 +01:00
|
|
|
CSStr GetOption(CSStr name) const;
|
2016-05-22 05:20:38 +02:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-06-17 02:14:26 +02:00
|
|
|
* Retrieve the value of the specified option or the fall back value if it doesn't exist.
|
2016-05-22 05:20:38 +02:00
|
|
|
*/
|
2016-03-11 19:04:26 +01:00
|
|
|
CSStr GetOption(CSStr name, CSStr value) const;
|
2016-05-22 05:20:38 +02:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Modify the value of the specified option.
|
|
|
|
*/
|
2016-03-11 19:04:26 +01:00
|
|
|
void SetOption(CSStr name, CSStr value);
|
2015-11-08 06:20:31 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
* Retrieve the virtual machine.
|
2015-11-08 06:20:31 +01:00
|
|
|
*/
|
2016-03-10 04:57:13 +01:00
|
|
|
HSQUIRRELVM GetVM() const
|
|
|
|
{
|
|
|
|
return m_VM;
|
|
|
|
}
|
|
|
|
|
2016-05-22 05:20:38 +02:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Retrieve the circular locks.
|
|
|
|
*/
|
|
|
|
Uint32 & GetCircularLock()
|
|
|
|
{
|
|
|
|
return m_CircularLocks;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* See if certain circular locks are enabled.
|
|
|
|
*/
|
|
|
|
bool IsCircularLock(Uint32 lock) const
|
|
|
|
{
|
|
|
|
return (m_CircularLocks & lock);
|
|
|
|
}
|
|
|
|
|
2016-05-24 18:26:43 +02:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Set the header and payload for the reload.
|
|
|
|
*/
|
|
|
|
void SetReloadInfo(Int32 header, Object & payload)
|
|
|
|
{
|
|
|
|
m_ReloadHeader = header;
|
|
|
|
m_ReloadPayload = payload;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Reset the header and payload for the reload.
|
|
|
|
*/
|
|
|
|
void ResetReloadInfo()
|
|
|
|
{
|
|
|
|
m_ReloadHeader = -1;
|
|
|
|
m_ReloadPayload.Release();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Retrieve the specified reload header.
|
|
|
|
*/
|
|
|
|
Int32 GetReloadHeader() const
|
|
|
|
{
|
|
|
|
return m_ReloadHeader;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Retrieve the specified reload header.
|
|
|
|
*/
|
|
|
|
Object & GetReloadPayload()
|
|
|
|
{
|
|
|
|
return m_ReloadPayload;
|
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Adds a script to the load queue.
|
|
|
|
*/
|
2016-06-18 19:31:35 +02:00
|
|
|
bool LoadScript(CSStr filepath, bool delay);
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-05-22 05:20:38 +02:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Modify the name for the currently assigned incoming connection.
|
|
|
|
*/
|
|
|
|
void SetIncomingName(CSStr name);
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* retrieve the name for the currently assigned incoming connection..
|
|
|
|
*/
|
|
|
|
CSStr GetIncomingName()
|
|
|
|
{
|
|
|
|
return (!m_IncomingNameBuffer) ? _SC("") : m_IncomingNameBuffer;
|
|
|
|
}
|
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
protected:
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-08-19 18:46:26 +02:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Script execution process.
|
|
|
|
*/
|
|
|
|
static bool DoScripts(Scripts::iterator itr, Scripts::iterator end);
|
|
|
|
|
2015-11-08 06:20:31 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
* Script output handlers.
|
2015-11-08 06:20:31 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
static void PrintFunc(HSQUIRRELVM vm, CSStr msg, ...);
|
|
|
|
static void ErrorFunc(HSQUIRRELVM vm, CSStr msg, ...);
|
2015-11-08 06:20:31 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
* Script error handlers.
|
2015-11-08 06:20:31 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
static SQInteger RuntimeErrorHandler(HSQUIRRELVM vm);
|
|
|
|
static void CompilerErrorHandler(HSQUIRRELVM vm, CSStr desc, CSStr src,
|
|
|
|
SQInteger line, SQInteger column);
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-03-24 07:44:01 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-06-17 02:14:26 +02:00
|
|
|
* Entity scanners.
|
2016-03-24 07:44:01 +01:00
|
|
|
*/
|
|
|
|
void ImportBlips();
|
|
|
|
void ImportCheckpoints();
|
|
|
|
void ImportKeybinds();
|
|
|
|
void ImportObjects();
|
|
|
|
void ImportPickups();
|
|
|
|
void ImportPlayers();
|
|
|
|
void ImportVehicles();
|
|
|
|
|
2016-03-22 02:29:27 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Entity allocators.
|
2016-03-22 02:29:27 +01:00
|
|
|
*/
|
2016-06-26 14:47:27 +02:00
|
|
|
BlipInst & AllocBlip(Int32 id, bool owned, Int32 header, Object & payload);
|
|
|
|
CheckpointInst & AllocCheckpoint(Int32 id, bool owned, Int32 header, Object & payload);
|
|
|
|
KeybindInst & AllocKeybind(Int32 id, bool owned, Int32 header, Object & payload);
|
|
|
|
ObjectInst & AllocObject(Int32 id, bool owned, Int32 header, Object & payload);
|
|
|
|
PickupInst & AllocPickup(Int32 id, bool owned, Int32 header, Object & payload);
|
|
|
|
VehicleInst & AllocVehicle(Int32 id, bool owned, Int32 header, Object & payload);
|
2016-03-22 02:29:27 +01:00
|
|
|
|
2016-03-22 03:12:25 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-06-17 02:14:26 +02:00
|
|
|
* Entity deallocator.
|
2016-03-22 03:12:25 +01:00
|
|
|
*/
|
|
|
|
void DeallocBlip(Int32 id, bool destroy, Int32 header, Object & payload);
|
|
|
|
void DeallocCheckpoint(Int32 id, bool destroy, Int32 header, Object & payload);
|
|
|
|
void DeallocKeybind(Int32 id, bool destroy, Int32 header, Object & payload);
|
|
|
|
void DeallocObject(Int32 id, bool destroy, Int32 header, Object & payload);
|
|
|
|
void DeallocPickup(Int32 id, bool destroy, Int32 header, Object & payload);
|
|
|
|
void DeallocVehicle(Int32 id, bool destroy, Int32 header, Object & payload);
|
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
public:
|
2015-10-11 23:26:14 +02:00
|
|
|
|
2015-11-08 06:20:31 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Entity creators.
|
2015-11-08 06:20:31 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
Object & NewBlip(Int32 index, Int32 world, Float32 x, Float32 y, Float32 z,
|
|
|
|
Int32 scale, Uint32 color, Int32 sprid,
|
|
|
|
Int32 header, Object & payload);
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-05-22 05:20:38 +02:00
|
|
|
Object & NewCheckpoint(Int32 player, Int32 world, bool sphere, Float32 x, Float32 y, Float32 z,
|
2016-02-20 23:25:00 +01:00
|
|
|
Uint8 r, Uint8 g, Uint8 b, Uint8 a, Float32 radius,
|
|
|
|
Int32 header, Object & payload);
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
Object & NewKeybind(Int32 slot, bool release,
|
|
|
|
Int32 primary, Int32 secondary, Int32 alternative,
|
|
|
|
Int32 header, Object & payload);
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
Object & NewObject(Int32 model, Int32 world, Float32 x, Float32 y, Float32 z,
|
|
|
|
Int32 alpha, Int32 header, Object & payload);
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
Object & NewPickup(Int32 model, Int32 world, Int32 quantity,
|
|
|
|
Float32 x, Float32 y, Float32 z, Int32 alpha, bool automatic,
|
|
|
|
Int32 header, Object & payload);
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
Object & NewSprite(Int32 index, CSStr file, Int32 xp, Int32 yp,
|
|
|
|
Int32 xr, Int32 yr, Float32 angle, Int32 alpha, bool rel,
|
|
|
|
Int32 header, Object & payload);
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
Object & NewTextdraw(Int32 index, CSStr text, Int32 xp, Int32 yp,
|
|
|
|
Uint32 color, bool rel, Int32 header, Object & payload);
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
Object & NewVehicle(Int32 model, Int32 world, Float32 x, Float32 y, Float32 z,
|
|
|
|
Float32 angle, Int32 primary, Int32 secondary,
|
|
|
|
Int32 header, Object & payload);
|
2015-11-08 06:20:31 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Entity destroyers.
|
2015-11-08 06:20:31 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
bool DelBlip(Int32 id, Int32 header, Object & payload);
|
|
|
|
bool DelCheckpoint(Int32 id, Int32 header, Object & payload);
|
|
|
|
bool DelKeybind(Int32 id, Int32 header, Object & payload);
|
|
|
|
bool DelObject(Int32 id, Int32 header, Object & payload);
|
|
|
|
bool DelPickup(Int32 id, Int32 header, Object & payload);
|
|
|
|
bool DelVehicle(Int32 id, Int32 header, Object & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2015-11-08 06:20:31 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Entity retrievers.
|
2015-11-08 06:20:31 +01:00
|
|
|
*/
|
2016-02-20 23:25:00 +01:00
|
|
|
BlipInst & GetBlip(Int32 id) { return m_Blips.at(id); }
|
|
|
|
CheckpointInst & GetCheckpoint(Int32 id) { return m_Checkpoints.at(id); }
|
|
|
|
KeybindInst & GetKeybind(Int32 id) { return m_Keybinds.at(id); }
|
|
|
|
ObjectInst & GetObject(Int32 id) { return m_Objects.at(id); }
|
|
|
|
PickupInst & GetPickup(Int32 id) { return m_Pickups.at(id); }
|
|
|
|
PlayerInst & GetPlayer(Int32 id) { return m_Players.at(id); }
|
|
|
|
VehicleInst & GetVehicle(Int32 id) { return m_Vehicles.at(id); }
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Pool retrievers.
|
|
|
|
*/
|
|
|
|
const Blips & GetBlips() const { return m_Blips; }
|
|
|
|
const Checkpoints & GetCheckpoints() const { return m_Checkpoints; }
|
|
|
|
const Keybinds & GetKeybinds() const { return m_Keybinds; }
|
|
|
|
const Objects & GetObjects() const { return m_Objects; }
|
|
|
|
const Pickups & GetPickups() const { return m_Pickups; }
|
|
|
|
const Players & GetPlayers() const { return m_Players; }
|
|
|
|
const Vehicles & GetVehicles() const { return m_Vehicles; }
|
|
|
|
|
2016-08-07 00:54:33 +02:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Null instance retrievers.
|
|
|
|
*/
|
|
|
|
Object & GetNullBlip() { return m_NullBlip; }
|
|
|
|
Object & GetNullCheckpoint() { return m_NullCheckpoint; }
|
|
|
|
Object & GetNullKeybind() { return m_NullKeybind; }
|
|
|
|
Object & GetNullObject() { return m_NullObject; }
|
|
|
|
Object & GetNullPickup() { return m_NullPickup; }
|
|
|
|
Object & GetNullPlayer() { return m_NullPlayer; }
|
|
|
|
Object & GetNullVehicle() { return m_NullVehicle; }
|
|
|
|
|
2016-07-16 14:45:36 +02:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Container cleaner.
|
|
|
|
*/
|
2016-07-16 18:39:51 +02:00
|
|
|
void ClearContainer(EntityType type);
|
|
|
|
|
|
|
|
protected:
|
2016-07-16 14:45:36 +02:00
|
|
|
|
2015-11-08 06:20:31 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
* Instance cleaners.
|
2015-11-08 06:20:31 +01:00
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
static void ResetInst(BlipInst & inst);
|
|
|
|
static void ResetInst(CheckpointInst & inst);
|
|
|
|
static void ResetInst(KeybindInst & inst);
|
|
|
|
static void ResetInst(ObjectInst & inst);
|
|
|
|
static void ResetInst(PickupInst & inst);
|
|
|
|
static void ResetInst(PlayerInst & inst);
|
|
|
|
static void ResetInst(VehicleInst & inst);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2015-11-08 06:20:31 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
* Bindings cleaners.
|
2015-11-08 06:20:31 +01:00
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
static void ResetFunc(BlipInst & inst);
|
|
|
|
static void ResetFunc(CheckpointInst & inst);
|
|
|
|
static void ResetFunc(KeybindInst & inst);
|
|
|
|
static void ResetFunc(ObjectInst & inst);
|
|
|
|
static void ResetFunc(PickupInst & inst);
|
|
|
|
static void ResetFunc(PlayerInst & inst);
|
|
|
|
static void ResetFunc(VehicleInst & inst);
|
|
|
|
static void ResetFunc();
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
static void Emit(Function & func)
|
|
|
|
{
|
|
|
|
if (!func.IsNull())
|
2016-05-22 05:20:38 +02:00
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
func.Execute();
|
2016-05-22 05:20:38 +02:00
|
|
|
}
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
// --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
template < typename... Args > static void Emit(Function & func, Args&&... args)
|
2016-02-20 23:25:00 +01:00
|
|
|
{
|
|
|
|
if (!func.IsNull())
|
2016-05-22 05:20:38 +02:00
|
|
|
{
|
|
|
|
func.Execute(std::forward< Args >(args)...);
|
|
|
|
}
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
public:
|
2015-11-08 06:20:31 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-08-25 02:08:44 +02:00
|
|
|
* Pre load signal binder.
|
|
|
|
*/
|
|
|
|
void BindPreLoad(Object & env, Function & func, Object & payload);
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Post load signal binder.
|
|
|
|
*/
|
|
|
|
void BindPostLoad(Object & env, Function & func, Object & payload);
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Unload signal binder.
|
|
|
|
*/
|
|
|
|
void BindUnload(Object & env, Function & func, Object & payload);
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
* Global event binder.
|
|
|
|
*/
|
2016-03-22 03:12:25 +01:00
|
|
|
void BindEvent(Int32 id, Object & env, Function & func);
|
2016-02-20 23:25:00 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Player lifetime management.
|
|
|
|
*/
|
|
|
|
void ConnectPlayer(Int32 id, Int32 header, Object & payload);
|
|
|
|
void DisconnectPlayer(Int32 id, Int32 header, Object & payload);
|
|
|
|
|
2016-05-23 02:51:44 +02:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Emit a custom event.
|
|
|
|
*/
|
|
|
|
void EmitCustomEvent(Int32 group, Int32 header, Object & payload);
|
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Server events.
|
2016-02-20 23:25:00 +01:00
|
|
|
*/
|
|
|
|
void EmitBlipCreated(Int32 blip, Int32 header, Object & payload);
|
2016-05-22 05:20:38 +02:00
|
|
|
void EmitCheckpointCreated(Int32 forcefield, Int32 header, Object & payload);
|
2016-02-20 23:25:00 +01:00
|
|
|
void EmitKeybindCreated(Int32 keybind, Int32 header, Object & payload);
|
|
|
|
void EmitObjectCreated(Int32 object, Int32 header, Object & payload);
|
|
|
|
void EmitPickupCreated(Int32 pickup, Int32 header, Object & payload);
|
|
|
|
void EmitPlayerCreated(Int32 player, Int32 header, Object & payload);
|
|
|
|
void EmitVehicleCreated(Int32 vehicle, Int32 header, Object & payload);
|
|
|
|
void EmitBlipDestroyed(Int32 blip, Int32 header, Object & payload);
|
2016-05-22 05:20:38 +02:00
|
|
|
void EmitCheckpointDestroyed(Int32 forcefield, Int32 header, Object & payload);
|
2016-02-20 23:25:00 +01:00
|
|
|
void EmitKeybindDestroyed(Int32 keybind, Int32 header, Object & payload);
|
|
|
|
void EmitObjectDestroyed(Int32 object, Int32 header, Object & payload);
|
|
|
|
void EmitPickupDestroyed(Int32 pickup, Int32 header, Object & payload);
|
|
|
|
void EmitPlayerDestroyed(Int32 player, Int32 header, Object & payload);
|
|
|
|
void EmitVehicleDestroyed(Int32 vehicle, Int32 header, Object & payload);
|
|
|
|
void EmitBlipCustom(Int32 blip, Int32 header, Object & payload);
|
2016-05-22 05:20:38 +02:00
|
|
|
void EmitCheckpointCustom(Int32 forcefield, Int32 header, Object & payload);
|
2016-02-20 23:25:00 +01:00
|
|
|
void EmitKeybindCustom(Int32 keybind, Int32 header, Object & payload);
|
|
|
|
void EmitObjectCustom(Int32 object, Int32 header, Object & payload);
|
|
|
|
void EmitPickupCustom(Int32 pickup, Int32 header, Object & payload);
|
|
|
|
void EmitPlayerCustom(Int32 player, Int32 header, Object & payload);
|
|
|
|
void EmitVehicleCustom(Int32 vehicle, Int32 header, Object & payload);
|
|
|
|
void EmitServerStartup();
|
|
|
|
void EmitServerShutdown();
|
2016-05-22 05:20:38 +02:00
|
|
|
void EmitServerFrame(Float32 elapsed_time);
|
|
|
|
void EmitPluginCommand(Uint32 command_identifier, CCStr message);
|
|
|
|
void EmitIncomingConnection(CStr player_name, size_t name_buffer_size, CCStr user_password, CCStr ip_address);
|
|
|
|
void EmitPlayerRequestClass(Int32 player_id, Int32 offset);
|
|
|
|
void EmitPlayerRequestSpawn(Int32 player_id);
|
|
|
|
void EmitPlayerSpawn(Int32 player_id);
|
|
|
|
void EmitPlayerWasted(Int32 player_id, Int32 reason);
|
|
|
|
void EmitPlayerKilled(Int32 player_id, Int32 killer_id, Int32 reason, vcmpBodyPart body_part, bool team_kill);
|
|
|
|
void EmitPlayerEmbarking(Int32 player_id, Int32 vehicle_id, Int32 slot_index);
|
|
|
|
void EmitPlayerEmbarked(Int32 player_id, Int32 vehicle_id, Int32 slot_index);
|
|
|
|
void EmitPlayerDisembark(Int32 player_id, Int32 vehicle_id);
|
|
|
|
void EmitPlayerRename(Int32 player_id, CCStr old_name, CCStr new_name);
|
|
|
|
void EmitPlayerState(Int32 player_id, Int32 old_state, Int32 new_state);
|
|
|
|
void EmitStateNone(Int32 player_id, Int32 old_state);
|
|
|
|
void EmitStateNormal(Int32 player_id, Int32 old_state);
|
|
|
|
void EmitStateAim(Int32 player_id, Int32 old_state);
|
|
|
|
void EmitStateDriver(Int32 player_id, Int32 old_state);
|
|
|
|
void EmitStatePassenger(Int32 player_id, Int32 old_state);
|
|
|
|
void EmitStateEnterDriver(Int32 player_id, Int32 old_state);
|
|
|
|
void EmitStateEnterPassenger(Int32 player_id, Int32 old_state);
|
|
|
|
void EmitStateExit(Int32 player_id, Int32 old_state);
|
|
|
|
void EmitStateUnspawned(Int32 player_id, Int32 old_state);
|
|
|
|
void EmitPlayerAction(Int32 player_id, Int32 old_action, Int32 new_action);
|
|
|
|
void EmitActionNone(Int32 player_id, Int32 old_action);
|
|
|
|
void EmitActionNormal(Int32 player_id, Int32 old_action);
|
|
|
|
void EmitActionAiming(Int32 player_id, Int32 old_action);
|
|
|
|
void EmitActionShooting(Int32 player_id, Int32 old_action);
|
|
|
|
void EmitActionJumping(Int32 player_id, Int32 old_action);
|
|
|
|
void EmitActionLieDown(Int32 player_id, Int32 old_action);
|
|
|
|
void EmitActionGettingUp(Int32 player_id, Int32 old_action);
|
|
|
|
void EmitActionJumpVehicle(Int32 player_id, Int32 old_action);
|
|
|
|
void EmitActionDriving(Int32 player_id, Int32 old_action);
|
|
|
|
void EmitActionDying(Int32 player_id, Int32 old_action);
|
|
|
|
void EmitActionWasted(Int32 player_id, Int32 old_action);
|
|
|
|
void EmitActionEmbarking(Int32 player_id, Int32 old_action);
|
|
|
|
void EmitActionDisembarking(Int32 player_id, Int32 old_action);
|
|
|
|
void EmitPlayerBurning(Int32 player_id, bool is_on_fire);
|
|
|
|
void EmitPlayerCrouching(Int32 player_id, bool is_crouching);
|
|
|
|
void EmitPlayerGameKeys(Int32 player_id, Uint32 old_keys, Uint32 new_keys);
|
|
|
|
void EmitPlayerStartTyping(Int32 player_id);
|
|
|
|
void EmitPlayerStopTyping(Int32 player_id);
|
|
|
|
void EmitPlayerAway(Int32 player_id, bool is_away);
|
|
|
|
void EmitPlayerMessage(Int32 player_id, CCStr message);
|
|
|
|
void EmitPlayerCommand(Int32 player_id, CCStr message);
|
|
|
|
void EmitPlayerPrivateMessage(Int32 player_id, Int32 target_player_id, CCStr message);
|
|
|
|
void EmitPlayerKeyPress(Int32 player_id, Int32 bind_id);
|
|
|
|
void EmitPlayerKeyRelease(Int32 player_id, Int32 bind_id);
|
|
|
|
void EmitPlayerSpectate(Int32 player_id, Int32 target_player_id);
|
|
|
|
void EmitPlayerCrashreport(Int32 player_id, CCStr report);
|
|
|
|
void EmitVehicleExplode(Int32 vehicle_id);
|
|
|
|
void EmitVehicleRespawn(Int32 vehicle_id);
|
|
|
|
void EmitObjectShot(Int32 object_id, Int32 player_id, Int32 weapon_id);
|
|
|
|
void EmitObjectTouched(Int32 object_id, Int32 player_id);
|
|
|
|
void EmitPickupClaimed(Int32 pickup_id, Int32 player_id);
|
|
|
|
void EmitPickupCollected(Int32 pickup_id, Int32 player_id);
|
|
|
|
void EmitPickupRespawn(Int32 pickup_id);
|
2016-08-18 14:38:20 +02:00
|
|
|
void EmitCheckpointEntered(Int32 checkpoint_id, Int32 player_id);
|
|
|
|
void EmitCheckpointExited(Int32 checkpoint_id, Int32 player_id);
|
2016-05-22 05:20:38 +02:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Miscellaneous events.
|
|
|
|
*/
|
2016-08-18 14:54:26 +02:00
|
|
|
void EmitCheckpointWorld(Int32 checkpoint_id, Int32 old_world, Int32 new_world);
|
2016-08-18 15:10:18 +02:00
|
|
|
void EmitCheckpointRadius(Int32 checkpoint_id, Float32 old_radius, Float32 new_radius);
|
2016-08-18 15:37:55 +02:00
|
|
|
void EmitObjectWorld(Int32 object_id, Int32 old_world, Int32 new_world);
|
2016-08-18 15:50:30 +02:00
|
|
|
void EmitObjectAlpha(Int32 object_id, Int32 old_alpha, Int32 new_alpha, Int32 time);
|
2016-08-19 16:58:08 +02:00
|
|
|
void EmitPickupWorld(Int32 pickup_id, Int32 old_world, Int32 new_world);
|
2016-08-19 17:05:29 +02:00
|
|
|
void EmitPickupAlpha(Int32 pickup_id, Int32 old_alpha, Int32 new_alpha);
|
2016-08-19 17:21:41 +02:00
|
|
|
void EmitPickupAutomatic(Int32 pickup_id, bool old_status, bool new_status);
|
2016-08-19 17:26:52 +02:00
|
|
|
void EmitPickupAutoTimer(Int32 pickup_id, Int32 old_timer, Int32 new_timer);
|
2016-08-18 16:12:00 +02:00
|
|
|
void EmitObjectReport(Int32 object_id, bool old_status, bool new_status, bool touched);
|
2016-05-22 05:20:38 +02:00
|
|
|
void EmitPlayerHealth(Int32 player_id, Float32 old_health, Float32 new_health);
|
|
|
|
void EmitPlayerArmour(Int32 player_id, Float32 old_armour, Float32 new_armour);
|
|
|
|
void EmitPlayerWeapon(Int32 player_id, Int32 old_weapon, Int32 new_weapon);
|
|
|
|
void EmitPlayerHeading(Int32 player_id, Float32 old_heading, Float32 new_heading);
|
|
|
|
void EmitPlayerPosition(Int32 player_id);
|
|
|
|
void EmitPlayerOption(Int32 player_id, Int32 option_id, bool value, Int32 header, Object & payload);
|
2016-08-18 16:20:49 +02:00
|
|
|
void EmitPlayerAdmin(Int32 player_id, bool old_status, bool new_status);
|
2016-08-17 14:45:44 +02:00
|
|
|
void EmitPlayerWorld(Int32 player_id, Int32 old_world, Int32 new_world, bool secondary);
|
2016-08-17 14:49:08 +02:00
|
|
|
void EmitPlayerTeam(Int32 player_id, Int32 old_team, Int32 new_team);
|
2016-08-17 14:52:22 +02:00
|
|
|
void EmitPlayerSkin(Int32 player_id, Int32 old_skin, Int32 new_skin);
|
2016-08-17 14:55:59 +02:00
|
|
|
void EmitPlayerMoney(Int32 player_id, Int32 old_money, Int32 new_money);
|
2016-08-17 15:00:28 +02:00
|
|
|
void EmitPlayerScore(Int32 player_id, Int32 old_score, Int32 new_score);
|
2016-08-17 15:04:14 +02:00
|
|
|
void EmitPlayerWantedLevel(Int32 player_id, Int32 old_level, Int32 new_level);
|
2016-08-17 15:07:31 +02:00
|
|
|
void EmitPlayerImmunity(Int32 player_id, Int32 old_immunity, Int32 new_immunity);
|
2016-08-17 15:10:43 +02:00
|
|
|
void EmitPlayerAlpha(Int32 player_id, Int32 old_alpha, Int32 new_alpha, Int32 fade);
|
2016-08-21 17:07:35 +02:00
|
|
|
void EmitVehicleColor(Int32 vehicle_id, Int32 changed);
|
2016-05-22 05:20:38 +02:00
|
|
|
void EmitVehicleHealth(Int32 vehicle_id, Float32 old_health, Float32 new_health);
|
|
|
|
void EmitVehiclePosition(Int32 vehicle_id);
|
|
|
|
void EmitVehicleRotation(Int32 vehicle_id);
|
|
|
|
void EmitVehicleOption(Int32 vehicle_id, Int32 option_id, bool value, Int32 header, Object & payload);
|
2016-08-18 13:38:00 +02:00
|
|
|
void EmitVehicleWorld(Int32 vehicle_id, Int32 old_world, Int32 new_world);
|
2016-08-18 13:45:12 +02:00
|
|
|
void EmitVehicleImmunity(Int32 vehicle_id, Int32 old_immunity, Int32 new_immunity);
|
2016-08-18 14:32:18 +02:00
|
|
|
void EmitVehiclePartStatus(Int32 vehicle_id, Int32 part, Int32 old_status, Int32 new_status);
|
2016-08-20 21:42:54 +02:00
|
|
|
void EmitVehicleTyreStatus(Int32 vehicle_id, Int32 tyre, Int32 old_status, Int32 new_status);
|
2016-08-18 14:06:03 +02:00
|
|
|
void EmitVehicleDamageData(Int32 vehicle_id, Uint32 old_data, Uint32 new_data);
|
2016-08-18 14:13:33 +02:00
|
|
|
void EmitVehicleRadio(Int32 vehicle_id, Int32 old_radio, Int32 new_radio);
|
2016-08-18 14:32:18 +02:00
|
|
|
void EmitVehicleHandlingRule(Int32 vehicle_id, Int32 rule, Float32 old_data, Float32 new_data);
|
2016-05-22 05:20:38 +02:00
|
|
|
void EmitServerOption(Int32 option, bool value, Int32 header, Object & payload);
|
2016-02-20 23:25:00 +01:00
|
|
|
void EmitScriptReload(Int32 header, Object & payload);
|
2016-03-24 08:32:44 +01:00
|
|
|
void EmitScriptLoaded();
|
2016-02-20 23:25:00 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Entity pool changes events.
|
|
|
|
*/
|
|
|
|
void EmitEntityPool(vcmpEntityPool entity_type, Int32 entity_id, bool is_deleted);
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Entity update events.
|
|
|
|
*/
|
|
|
|
void EmitPlayerUpdate(Int32 player_id, vcmpPlayerUpdate update_type);
|
|
|
|
void EmitVehicleUpdate(Int32 vehicle_id, vcmpVehicleUpdate update_type);
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Client data streams event.
|
|
|
|
*/
|
|
|
|
void EmitClientScriptData(Int32 player_id, const uint8_t * data, size_t size);
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Retrieve global event bindings.
|
2016-02-20 23:25:00 +01:00
|
|
|
*/
|
|
|
|
Function & GetEvent(Int32 evid);
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-05-22 05:20:38 +02:00
|
|
|
* Retrieve local event bindings.
|
2016-02-20 23:25:00 +01:00
|
|
|
*/
|
|
|
|
Function & GetBlipEvent(Int32 id, Int32 evid);
|
|
|
|
Function & GetCheckpointEvent(Int32 id, Int32 evid);
|
|
|
|
Function & GetKeybindEvent(Int32 id, Int32 evid);
|
|
|
|
Function & GetObjectEvent(Int32 id, Int32 evid);
|
|
|
|
Function & GetPickupEvent(Int32 id, Int32 evid);
|
|
|
|
Function & GetPlayerEvent(Int32 id, Int32 evid);
|
|
|
|
Function & GetVehicleEvent(Int32 id, Int32 evid);
|
2015-11-08 06:20:31 +01:00
|
|
|
|
2016-02-20 23:25:00 +01:00
|
|
|
private:
|
2015-11-08 06:20:31 +01:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
* Global event bindings.
|
|
|
|
*/
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnCustomEvent;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnBlipCreated;
|
|
|
|
Function mOnCheckpointCreated;
|
|
|
|
Function mOnKeybindCreated;
|
|
|
|
Function mOnObjectCreated;
|
|
|
|
Function mOnPickupCreated;
|
|
|
|
Function mOnPlayerCreated;
|
|
|
|
Function mOnVehicleCreated;
|
|
|
|
Function mOnBlipDestroyed;
|
|
|
|
Function mOnCheckpointDestroyed;
|
|
|
|
Function mOnKeybindDestroyed;
|
|
|
|
Function mOnObjectDestroyed;
|
|
|
|
Function mOnPickupDestroyed;
|
|
|
|
Function mOnPlayerDestroyed;
|
|
|
|
Function mOnVehicleDestroyed;
|
|
|
|
Function mOnBlipCustom;
|
|
|
|
Function mOnCheckpointCustom;
|
|
|
|
Function mOnKeybindCustom;
|
|
|
|
Function mOnObjectCustom;
|
|
|
|
Function mOnPickupCustom;
|
|
|
|
Function mOnPlayerCustom;
|
|
|
|
Function mOnVehicleCustom;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnServerStartup;
|
|
|
|
Function mOnServerShutdown;
|
|
|
|
Function mOnServerFrame;
|
|
|
|
Function mOnIncomingConnection;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnPlayerRequestClass;
|
|
|
|
Function mOnPlayerRequestSpawn;
|
|
|
|
Function mOnPlayerSpawn;
|
|
|
|
Function mOnPlayerWasted;
|
|
|
|
Function mOnPlayerKilled;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnPlayerEmbarking;
|
|
|
|
Function mOnPlayerEmbarked;
|
|
|
|
Function mOnPlayerDisembark;
|
|
|
|
Function mOnPlayerRename;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnPlayerState;
|
|
|
|
Function mOnStateNone;
|
|
|
|
Function mOnStateNormal;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnStateAim;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnStateDriver;
|
|
|
|
Function mOnStatePassenger;
|
|
|
|
Function mOnStateEnterDriver;
|
|
|
|
Function mOnStateEnterPassenger;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnStateExit;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnStateUnspawned;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnPlayerAction;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnActionNone;
|
|
|
|
Function mOnActionNormal;
|
|
|
|
Function mOnActionAiming;
|
|
|
|
Function mOnActionShooting;
|
|
|
|
Function mOnActionJumping;
|
|
|
|
Function mOnActionLieDown;
|
|
|
|
Function mOnActionGettingUp;
|
|
|
|
Function mOnActionJumpVehicle;
|
|
|
|
Function mOnActionDriving;
|
|
|
|
Function mOnActionDying;
|
|
|
|
Function mOnActionWasted;
|
|
|
|
Function mOnActionEmbarking;
|
|
|
|
Function mOnActionDisembarking;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnPlayerBurning;
|
|
|
|
Function mOnPlayerCrouching;
|
|
|
|
Function mOnPlayerGameKeys;
|
|
|
|
Function mOnPlayerStartTyping;
|
|
|
|
Function mOnPlayerStopTyping;
|
|
|
|
Function mOnPlayerAway;
|
|
|
|
Function mOnPlayerMessage;
|
|
|
|
Function mOnPlayerCommand;
|
|
|
|
Function mOnPlayerPrivateMessage;
|
|
|
|
Function mOnPlayerKeyPress;
|
|
|
|
Function mOnPlayerKeyRelease;
|
|
|
|
Function mOnPlayerSpectate;
|
|
|
|
Function mOnPlayerCrashreport;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnVehicleExplode;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnVehicleRespawn;
|
|
|
|
Function mOnObjectShot;
|
|
|
|
Function mOnObjectTouched;
|
2016-08-18 15:37:55 +02:00
|
|
|
Function mOnObjectWorld;
|
2016-08-18 15:50:30 +02:00
|
|
|
Function mOnObjectAlpha;
|
2016-08-18 16:12:00 +02:00
|
|
|
Function mOnObjectReport;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnPickupClaimed;
|
|
|
|
Function mOnPickupCollected;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnPickupRespawn;
|
2016-08-19 16:58:08 +02:00
|
|
|
Function mOnPickupWorld;
|
2016-08-19 17:05:29 +02:00
|
|
|
Function mOnPickupAlpha;
|
2016-08-19 17:21:41 +02:00
|
|
|
Function mOnPickupAutomatic;
|
2016-08-19 17:26:52 +02:00
|
|
|
Function mOnPickupAutoTimer;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnCheckpointEntered;
|
|
|
|
Function mOnCheckpointExited;
|
2016-08-18 14:54:26 +02:00
|
|
|
Function mOnCheckpointWorld;
|
2016-08-18 15:10:18 +02:00
|
|
|
Function mOnCheckpointRadius;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnEntityPool;
|
|
|
|
Function mOnClientScriptData;
|
|
|
|
Function mOnPlayerUpdate;
|
|
|
|
Function mOnVehicleUpdate;
|
|
|
|
Function mOnPlayerHealth;
|
|
|
|
Function mOnPlayerArmour;
|
|
|
|
Function mOnPlayerWeapon;
|
|
|
|
Function mOnPlayerHeading;
|
|
|
|
Function mOnPlayerPosition;
|
|
|
|
Function mOnPlayerOption;
|
2016-08-17 14:40:48 +02:00
|
|
|
Function mOnPlayerAdmin;
|
2016-08-17 14:45:44 +02:00
|
|
|
Function mOnPlayerWorld;
|
2016-08-17 14:49:08 +02:00
|
|
|
Function mOnPlayerTeam;
|
2016-08-17 14:52:22 +02:00
|
|
|
Function mOnPlayerSkin;
|
2016-08-17 14:55:59 +02:00
|
|
|
Function mOnPlayerMoney;
|
2016-08-17 15:00:28 +02:00
|
|
|
Function mOnPlayerScore;
|
2016-08-17 15:04:14 +02:00
|
|
|
Function mOnPlayerWantedLevel;
|
2016-08-17 15:07:31 +02:00
|
|
|
Function mOnPlayerImmunity;
|
2016-08-17 15:10:43 +02:00
|
|
|
Function mOnPlayerAlpha;
|
2016-08-21 17:07:35 +02:00
|
|
|
Function mOnVehicleColor;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnVehicleHealth;
|
|
|
|
Function mOnVehiclePosition;
|
|
|
|
Function mOnVehicleRotation;
|
|
|
|
Function mOnVehicleOption;
|
2016-08-18 13:38:00 +02:00
|
|
|
Function mOnVehicleWorld;
|
2016-08-18 13:45:12 +02:00
|
|
|
Function mOnVehicleImmunity;
|
2016-08-18 13:51:55 +02:00
|
|
|
Function mOnVehiclePartStatus;
|
2016-08-20 21:42:54 +02:00
|
|
|
Function mOnVehicleTyreStatus;
|
2016-08-18 14:06:03 +02:00
|
|
|
Function mOnVehicleDamageData;
|
2016-08-18 14:13:33 +02:00
|
|
|
Function mOnVehicleRadio;
|
2016-08-18 14:21:50 +02:00
|
|
|
Function mOnVehicleHandlingRule;
|
2016-05-22 05:20:38 +02:00
|
|
|
Function mOnServerOption;
|
2016-02-20 23:25:00 +01:00
|
|
|
Function mOnScriptReload;
|
2016-03-24 08:32:44 +01:00
|
|
|
Function mOnScriptLoaded;
|
2015-09-30 02:56:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // Namespace:: SqMod
|
|
|
|
|
|
|
|
#endif // _CORE_HPP_
|