1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00
SqMod/source/Core.hpp

924 lines
36 KiB
C++
Raw Normal View History

2015-09-30 02:56:11 +02:00
#ifndef _CORE_HPP_
#define _CORE_HPP_
// ------------------------------------------------------------------------------------------------
#include "Base/Shared.hpp"
2015-09-30 02:56:11 +02:00
// ------------------------------------------------------------------------------------------------
#include "Base/Shared.hpp"
#include "Base/Vector3.hpp"
#include "Base/Color4.hpp"
2015-09-30 02:56:11 +02:00
// ------------------------------------------------------------------------------------------------
#include <vector>
#include <map>
2015-09-30 02:56:11 +02:00
// ------------------------------------------------------------------------------------------------
namespace SqMod {
// ------------------------------------------------------------------------------------------------
extern Core * _Core;
2015-11-08 06:20:31 +01:00
/* ------------------------------------------------------------------------------------------------
* ...
2015-11-08 06:20:31 +01:00
*/
2015-09-30 02:56:11 +02:00
class Core
{
2015-11-08 06:20:31 +01:00
protected:
/* --------------------------------------------------------------------------------------------
2015-11-08 06:20:31 +01:00
* Helper structure meant to track changes in player instances.
*/
struct PlayerTrack
2015-09-30 02:56:11 +02:00
{
PlayerTrack() : mWeapon(-1), mHealth(0), mArmour(0), mPosition()
{ /* ... */ }
Int32 mWeapon; /* Last used player weapon. */
Float32 mHealth; /* Last known player health. */
Float32 mArmour; /* Last known player armour */
Vector3 mPosition; /* Last known player position. */
2015-09-30 02:56:11 +02:00
};
/* --------------------------------------------------------------------------------------------
2015-11-08 06:20:31 +01:00
* Helper structure meant to track changes in vehicle instances.
*/
struct VehicleTrack
2015-09-30 02:56:11 +02:00
{
VehicleTrack() : mHealth(0), mPosition()
{ /* ... */ }
Float32 mHealth; /* Last known vehicle health. */
Vector3 mPosition; /* Last known vehicle position. */
};
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
typedef String MsgPrefix[SQMOD_PLAYER_MSG_PREFIXES];
2015-09-30 02:56:11 +02:00
/* --------------------------------------------------------------------------------------------
* ...
*/
struct BlipInst
{
BlipInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(NULL)
{ /* ... */ }
~BlipInst();
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
Int32 mID;
Int16 mFlags;
CBlip * mInst;
Object mObj;
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
Int32 mWorld;
Int32 mScale;
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
Int32 mSprID;
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
Vector3 mPosition;
Color4 mColor;
2015-11-08 06:20:31 +01:00
// ----------------------------------------------------------------------------------------
Function mOnDestroyed;
Function mOnCustom;
// ----------------------------------------------------------------------------------------
};
/* --------------------------------------------------------------------------------------------
* ...
*/
struct CheckpointInst
{
CheckpointInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(NULL)
{ /* ... */ }
2015-09-30 02:56:11 +02:00
~CheckpointInst();
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
Int32 mID;
Int16 mFlags;
CCheckpoint * mInst;
Object mObj;
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
Function mOnDestroyed;
Function mOnCustom;
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
Function mOnEntered;
Function mOnExited;
};
/* --------------------------------------------------------------------------------------------
* ...
*/
struct ForcefieldInst
{
ForcefieldInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(NULL)
{ /* ... */ }
~ForcefieldInst();
// ----------------------------------------------------------------------------------------
Int32 mID;
Int16 mFlags;
CForcefield * mInst;
Object mObj;
// ----------------------------------------------------------------------------------------
Function mOnDestroyed;
Function mOnCustom;
// ----------------------------------------------------------------------------------------
Function mOnEntered;
Function mOnExited;
};
2015-09-30 02:56:11 +02:00
/* --------------------------------------------------------------------------------------------
* ...
*/
struct KeybindInst
{
KeybindInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(NULL)
{ /* ... */ }
~KeybindInst();
// ----------------------------------------------------------------------------------------
Int32 mID;
Int16 mFlags;
CKeybind * mInst;
Object mObj;
// ----------------------------------------------------------------------------------------
Int32 mPrimary;
Int32 mSecondary;
Int32 mAlternative;
Int32 mRelease;
// ----------------------------------------------------------------------------------------
Function mOnDestroyed;
Function mOnCustom;
// ----------------------------------------------------------------------------------------
Function mOnKeyPress;
Function mOnKeyRelease;
};
/* --------------------------------------------------------------------------------------------
* ...
*/
struct ObjectInst
{
ObjectInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(NULL)
{ /* ... */ }
2015-09-30 02:56:11 +02:00
~ObjectInst();
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
Int32 mID;
Int16 mFlags;
CObject * mInst;
Object mObj;
// ----------------------------------------------------------------------------------------
Function mOnDestroyed;
Function mOnCustom;
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
Function mOnShot;
Function mOnBump;
};
/* --------------------------------------------------------------------------------------------
* ...
*/
struct PickupInst
{
PickupInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(NULL)
{ /* ... */ }
2015-09-30 02:56:11 +02:00
~PickupInst();
// ----------------------------------------------------------------------------------------
Int32 mID;
Int16 mFlags;
CPickup * mInst;
Object mObj;
// ----------------------------------------------------------------------------------------
Function mOnDestroyed;
Function mOnCustom;
// ----------------------------------------------------------------------------------------
Function mOnRespawn;
Function mOnClaimed;
Function mOnCollected;
};
2015-09-30 02:56:11 +02:00
/* --------------------------------------------------------------------------------------------
* ...
*/
struct PlayerInst
{
PlayerInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(NULL)
{ /* ... */ }
// ----------------------------------------------------------------------------------------
Int32 mID;
Int16 mFlags;
CPlayer * mInst;
Object mObj;
// ----------------------------------------------------------------------------------------
Int32 mAuthority;
// ----------------------------------------------------------------------------------------
MsgPrefix mPrefixes;
// ----------------------------------------------------------------------------------------
Uint32 mMessageColor;
Int32 mAnnounceStyle;
// ----------------------------------------------------------------------------------------
Function mOnDestroyed;
Function mOnCustom;
// ----------------------------------------------------------------------------------------
Function mOnAway;
Function mOnGameKeys;
Function mOnRename;
Function mOnRequestClass;
Function mOnRequestSpawn;
Function mOnSpawn;
Function mOnStartTyping;
Function mOnStopTyping;
Function mOnChat;
Function mOnCommand;
Function mOnMessage;
Function mOnHealth;
Function mOnArmour;
Function mOnWeapon;
Function mOnMove;
Function mOnWasted;
Function mOnKilled;
Function mOnTeamKill;
Function mOnSpectate;
Function mOnCrashreport;
Function mOnBurning;
Function mOnCrouching;
Function mOnState;
Function mOnAction;
Function mOnStateNone;
Function mOnStateNormal;
Function mOnStateShooting;
Function mOnStateDriver;
Function mOnStatePassenger;
Function mOnStateEnterDriver;
Function mOnStateEnterPassenger;
Function mOnStateExitVehicle;
Function mOnStateUnspawned;
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;
Function mOnKeyPress;
Function mOnKeyRelease;
Function mOnEmbarking;
Function mOnEmbarked;
Function mOnDisembark;
Function mOnPickupClaimed;
Function mOnPickupCollected;
Function mOnObjectShot;
Function mOnObjectBump;
Function mOnCheckpointEntered;
Function mOnCheckpointExited;
Function mOnForcefieldEntered;
Function mOnForcefieldExited;
};
/* --------------------------------------------------------------------------------------------
* ...
*/
struct SpriteInst
{
SpriteInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(NULL)
{ /* ... */ }
2015-09-30 02:56:11 +02:00
~SpriteInst();
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
Int32 mID;
Int16 mFlags;
CSprite * mInst;
Object mObj;
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
String mPath;
// ----------------------------------------------------------------------------------------
Function mOnDestroyed;
Function mOnCustom;
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
};
2015-09-30 02:56:11 +02:00
/* --------------------------------------------------------------------------------------------
* ...
*/
struct TextdrawInst
{
TextdrawInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(NULL)
{ /* ... */ }
~TextdrawInst();
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
Int32 mID;
Int16 mFlags;
CTextdraw * mInst;
Object mObj;
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
String mText;
2015-09-30 02:56:11 +02:00
// ----------------------------------------------------------------------------------------
Function mOnDestroyed;
Function mOnCustom;
// ----------------------------------------------------------------------------------------
};
2015-09-30 02:56:11 +02:00
/* --------------------------------------------------------------------------------------------
* ...
*/
struct VehicleInst
{
VehicleInst() : mID(-1), mFlags(ENF_DEFAULT), mInst(NULL)
{ /* ... */ }
~VehicleInst();
// ----------------------------------------------------------------------------------------
Int32 mID;
Int16 mFlags;
CVehicle * mInst;
Object mObj;
// ----------------------------------------------------------------------------------------
Function mOnDestroyed;
Function mOnCustom;
// ----------------------------------------------------------------------------------------
Function mOnRespawn;
Function mOnExplode;
Function mOnHealth;
Function mOnMove;
Function mOnEmbarking;
Function mOnEmbarked;
Function mOnDisembark;
};
// --------------------------------------------------------------------------------------------
typedef std::vector< BlipInst > Blips;
typedef std::vector< CheckpointInst > Checkpoints;
typedef std::vector< ForcefieldInst > Forcefields;
typedef std::vector< KeybindInst > Keybinds;
typedef std::vector< ObjectInst > Objects;
typedef std::vector< PickupInst > Pickups;
typedef std::vector< PlayerInst > Players;
typedef std::vector< SpriteInst > Sprites;
typedef std::vector< TextdrawInst > Textdraws;
typedef std::vector< VehicleInst > Vehicles;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
typedef PlayerTrack PlayerInstTrack[SQMOD_PLAYER_POOL];
typedef VehicleTrack VehicleInstTrack[SQMOD_VEHICLE_POOL];
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
typedef std::map< String, Script > Scripts;
typedef std::map< String, String > Options;
2015-09-30 02:56:11 +02:00
private:
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Int32 m_State;
HSQUIRRELVM m_VM;
Scripts m_Scripts;
Options m_Options;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Blips m_Blips;
Checkpoints m_Checkpoints;
Forcefields m_Forcefields;
Keybinds m_Keybinds;
Objects m_Objects;
Pickups m_Pickups;
Players m_Players;
Sprites m_Sprites;
Textdraws m_Textdraws;
Vehicles m_Vehicles;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
PlayerInstTrack m_PlayerTrack;
VehicleInstTrack m_VehicleTrack;
2015-09-30 02:56:11 +02:00
protected:
2015-09-30 02:56:11 +02:00
/* --------------------------------------------------------------------------------------------
* Default constructor.
2015-09-30 02:56:11 +02:00
*/
Core();
2015-09-30 02:56:11 +02:00
/* --------------------------------------------------------------------------------------------
* Copy constructor. (disabled)
2015-09-30 02:56:11 +02:00
*/
Core(const Core &);
2015-09-30 02:56:11 +02:00
/* --------------------------------------------------------------------------------------------
* Copy assignment operator. (disabled)
2015-09-30 02:56:11 +02:00
*/
Core & operator = (const Core &);
2015-09-30 02:56:11 +02:00
public:
2015-11-08 06:20:31 +01:00
/* --------------------------------------------------------------------------------------------
* Destructor.
2015-11-08 06:20:31 +01:00
*/
~Core();
2015-11-08 06:20:31 +01:00
/* --------------------------------------------------------------------------------------------
* Singleton retriever.
2015-11-08 06:20:31 +01:00
*/
static Core * Get()
{
if (!_Core)
{
_Core = new Core();
}
return _Core;
}
2015-11-08 06:20:31 +01:00
/* --------------------------------------------------------------------------------------------
* Lifetime managers.
2015-11-08 06:20:31 +01:00
*/
bool Init();
bool Load();
void Terminate();
2015-11-08 06:20:31 +01:00
/* --------------------------------------------------------------------------------------------
* State mutators.
2015-11-08 06:20:31 +01:00
*/
void SetState(Int32 val) { m_State = val; }
Int32 GetState() const { return m_State; }
2015-11-08 06:20:31 +01:00
/* --------------------------------------------------------------------------------------------
* Option mutators.
2015-11-08 06:20:31 +01:00
*/
CSStr GetOption(const String & name) const;
void SetOption(const String & name, const String & value);
2015-11-08 06:20:31 +01:00
/* --------------------------------------------------------------------------------------------
* Retrieve the virtual machine.
2015-11-08 06:20:31 +01:00
*/
HSQUIRRELVM GetVM() const { return m_VM; }
2015-11-08 06:20:31 +01:00
protected:
2015-11-08 06:20:31 +01:00
/* --------------------------------------------------------------------------------------------
* Script output handlers.
2015-11-08 06:20:31 +01:00
*/
static void PrintFunc(HSQUIRRELVM vm, CSStr msg, ...);
static void ErrorFunc(HSQUIRRELVM vm, CSStr msg, ...);
2015-11-08 06:20:31 +01:00
/* --------------------------------------------------------------------------------------------
* Script error handlers.
2015-11-08 06:20:31 +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
public:
2015-11-08 06:20:31 +01:00
/* --------------------------------------------------------------------------------------------
* Instance creators.
2015-11-08 06:20:31 +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
Object & NewCheckpoint(Int32 player, Int32 world, Float32 x, Float32 y, Float32 z,
Uint8 r, Uint8 g, Uint8 b, Uint8 a, Float32 radius,
Int32 header, Object & payload);
2015-11-08 06:20:31 +01:00
Object & NewForcefield(Int32 player, Int32 world, Float32 x, Float32 y, Float32 z,
Uint8 r, Uint8 g, Uint8 b, Float32 radius,
Int32 header, Object & payload);
2015-11-08 06:20:31 +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
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
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
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
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
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
/* --------------------------------------------------------------------------------------------
* Instance destroyers.
2015-11-08 06:20:31 +01:00
*/
bool DelBlip(Int32 id, Int32 header, Object & payload);
bool DelCheckpoint(Int32 id, Int32 header, Object & payload);
bool DelForcefield(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 DelSprite(Int32 id, Int32 header, Object & payload);
bool DelTextdraw(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
/* --------------------------------------------------------------------------------------------
* Instance retrievers.
2015-11-08 06:20:31 +01:00
*/
BlipInst & GetBlip(Int32 id) { return m_Blips.at(id); }
CheckpointInst & GetCheckpoint(Int32 id) { return m_Checkpoints.at(id); }
ForcefieldInst & GetForcefield(Int32 id) { return m_Forcefields.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); }
SpriteInst & GetSprite(Int32 id) { return m_Sprites.at(id); }
TextdrawInst & GetTextdraw(Int32 id) { return m_Textdraws.at(id); }
VehicleInst & GetVehicle(Int32 id) { return m_Vehicles.at(id); }
2015-09-30 02:56:11 +02:00
protected:
2015-11-08 06:20:31 +01:00
/* --------------------------------------------------------------------------------------------
* Instance cleaners.
2015-11-08 06:20:31 +01:00
*/
void ResetInst(BlipInst & inst);
void ResetInst(CheckpointInst & inst);
void ResetInst(ForcefieldInst & inst);
void ResetInst(KeybindInst & inst);
void ResetInst(ObjectInst & inst);
void ResetInst(PickupInst & inst);
void ResetInst(PlayerInst & inst);
void ResetInst(SpriteInst & inst);
void ResetInst(TextdrawInst & inst);
void ResetInst(VehicleInst & inst);
2015-09-30 02:56:11 +02:00
2015-11-08 06:20:31 +01:00
/* --------------------------------------------------------------------------------------------
* Bindings cleaners.
2015-11-08 06:20:31 +01:00
*/
void ResetFunc(BlipInst & inst);
void ResetFunc(CheckpointInst & inst);
void ResetFunc(ForcefieldInst & inst);
void ResetFunc(KeybindInst & inst);
void ResetFunc(ObjectInst & inst);
void ResetFunc(PickupInst & inst);
void ResetFunc(PlayerInst & inst);
void ResetFunc(SpriteInst & inst);
void ResetFunc(TextdrawInst & inst);
void ResetFunc(VehicleInst & inst);
void ResetFunc();
2015-11-08 06:20:31 +01:00
// --------------------------------------------------------------------------------------------
static void Emit(Function & func)
{
if (!func.IsNull())
func.Execute();
}
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
template < typename A1 >
static void Emit(Function & func, A1 a1)
{
if (!func.IsNull())
func.Execute(a1);
}
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
template < typename A1, typename A2 >
static void Emit(Function & func, A1 a1, A2 a2)
{
if (!func.IsNull())
func.Execute(a1, a2);
}
2015-11-08 06:20:31 +01:00
// --------------------------------------------------------------------------------------------
template < typename A1, typename A2, typename A3 >
static void Emit(Function & func, A1 a1, A2 a2, A3 a3)
{
if (!func.IsNull())
func.Execute(a1, a2, a3);
}
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
template < typename A1, typename A2, typename A3, typename A4 >
static void Emit(Function & func, A1 a1, A2 a2, A3 a3, A4 a4)
{
if (!func.IsNull())
func.Execute(a1, a2, a3, a4);
}
2015-11-08 06:20:31 +01:00
// --------------------------------------------------------------------------------------------
template < typename A1, typename A2, typename A3, typename A4, typename A5 >
static void Emit(Function & func, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
{
if (!func.IsNull())
func.Execute(a1, a2, a3, a4, a5);
}
2015-11-08 06:20:31 +01:00
// --------------------------------------------------------------------------------------------
template < typename A1, typename A2, typename A3, typename A4, typename A5, typename A6 >
static void Emit(Function & func, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
{
if (!func.IsNull())
func.Execute(a1, a2, a3, a4, a5, a6);
}
2015-09-30 02:56:11 +02:00
public:
2015-11-08 06:20:31 +01:00
/* --------------------------------------------------------------------------------------------
* Global event binder.
*/
bool BindEvent(Int32 id, Object & env, Function & func);
/* --------------------------------------------------------------------------------------------
* Player lifetime management.
*/
void ConnectPlayer(Int32 id, Int32 header, Object & payload);
void DisconnectPlayer(Int32 id, Int32 header, Object & payload);
/* --------------------------------------------------------------------------------------------
* Event propagators.
*/
void EmitBlipCreated(Int32 blip, Int32 header, Object & payload);
void EmitCheckpointCreated(Int32 checkpoint, Int32 header, Object & payload);
void EmitForcefieldCreated(Int32 forcefield, Int32 header, Object & payload);
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 EmitSpriteCreated(Int32 sprite, Int32 header, Object & payload);
void EmitTextdrawCreated(Int32 textdraw, Int32 header, Object & payload);
void EmitVehicleCreated(Int32 vehicle, Int32 header, Object & payload);
void EmitBlipDestroyed(Int32 blip, Int32 header, Object & payload);
void EmitCheckpointDestroyed(Int32 checkpoint, Int32 header, Object & payload);
void EmitForcefieldDestroyed(Int32 forcefield, Int32 header, Object & payload);
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 EmitSpriteDestroyed(Int32 sprite, Int32 header, Object & payload);
void EmitTextdrawDestroyed(Int32 textdraw, Int32 header, Object & payload);
void EmitVehicleDestroyed(Int32 vehicle, Int32 header, Object & payload);
void EmitBlipCustom(Int32 blip, Int32 header, Object & payload);
void EmitCheckpointCustom(Int32 checkpoint, Int32 header, Object & payload);
void EmitForcefieldCustom(Int32 forcefield, Int32 header, Object & payload);
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 EmitSpriteCustom(Int32 sprite, Int32 header, Object & payload);
void EmitTextdrawCustom(Int32 textdraw, Int32 header, Object & payload);
void EmitVehicleCustom(Int32 vehicle, Int32 header, Object & payload);
void EmitPlayerAway(Int32 player, bool status);
void EmitPlayerGameKeys(Int32 player, Int32 previous, Int32 current);
void EmitPlayerRename(Int32 player, CCStr previous, CCStr current);
void EmitPlayerRequestClass(Int32 player, Int32 offset);
void EmitPlayerRequestSpawn(Int32 player);
void EmitPlayerSpawn(Int32 player);
void EmitPlayerStartTyping(Int32 player);
void EmitPlayerStopTyping(Int32 player);
void EmitPlayerChat(Int32 player, CCStr message);
void EmitPlayerCommand(Int32 player, CCStr command);
void EmitPlayerMessage(Int32 player, Int32 receiver, CCStr message);
void EmitPlayerHealth(Int32 player, Float32 previous, Float32 current);
void EmitPlayerArmour(Int32 player, Float32 previous, Float32 current);
void EmitPlayerWeapon(Int32 player, Int32 previous, Int32 current);
void EmitPlayerMove(Int32 player, const Vector3 & previous, const Vector3 & current);
void EmitPlayerWasted(Int32 player, Int32 reason);
void EmitPlayerKilled(Int32 player, Int32 killer, Int32 reason, Int32 body_part);
void EmitPlayerTeamKill(Int32 player, Int32 killer, Int32 reason, Int32 body_part);
void EmitPlayerSpectate(Int32 player, Int32 target);
void EmitPlayerCrashreport(Int32 player, CCStr report);
void EmitPlayerBurning(Int32 player, bool state);
void EmitPlayerCrouching(Int32 player, bool state);
void EmitPlayerState(Int32 player, Int32 previous, Int32 current);
void EmitPlayerAction(Int32 player, Int32 previous, Int32 current);
void EmitStateNone(Int32 player, Int32 previous);
void EmitStateNormal(Int32 player, Int32 previous);
void EmitStateShooting(Int32 player, Int32 previous);
void EmitStateDriver(Int32 player, Int32 previous);
void EmitStatePassenger(Int32 player, Int32 previous);
void EmitStateEnterDriver(Int32 player, Int32 previous);
void EmitStateEnterPassenger(Int32 player, Int32 previous);
void EmitStateExitVehicle(Int32 player, Int32 previous);
void EmitStateUnspawned(Int32 player, Int32 previous);
void EmitActionNone(Int32 player, Int32 previous);
void EmitActionNormal(Int32 player, Int32 previous);
void EmitActionAiming(Int32 player, Int32 previous);
void EmitActionShooting(Int32 player, Int32 previous);
void EmitActionJumping(Int32 player, Int32 previous);
void EmitActionLieDown(Int32 player, Int32 previous);
void EmitActionGettingUp(Int32 player, Int32 previous);
void EmitActionJumpVehicle(Int32 player, Int32 previous);
void EmitActionDriving(Int32 player, Int32 previous);
void EmitActionDying(Int32 player, Int32 previous);
void EmitActionWasted(Int32 player, Int32 previous);
void EmitActionEmbarking(Int32 player, Int32 previous);
void EmitActionDisembarking(Int32 player, Int32 previous);
void EmitVehicleRespawn(Int32 vehicle);
void EmitVehicleExplode(Int32 vehicle);
void EmitVehicleHealth(Int32 vehicle, Float32 previous, Float32 current);
void EmitVehicleMove(Int32 vehicle, const Vector3 & previous, const Vector3 & current);
void EmitPickupRespawn(Int32 pickup);
void EmitPlayerKeyPress(Int32 player, Int32 keybind);
void EmitPlayerKeyRelease(Int32 player, Int32 keybind);
void EmitPlayerEmbarking(Int32 player, Int32 vehicle, Int32 slot);
void EmitPlayerEmbarked(Int32 player, Int32 vehicle, Int32 slot);
void EmitPlayerDisembark(Int32 player, Int32 vehicle);
void EmitPickupClaimed(Int32 player, Int32 pickup);
void EmitPickupCollected(Int32 player, Int32 pickup);
void EmitObjectShot(Int32 player, Int32 object, Int32 weapon);
void EmitObjectBump(Int32 player, Int32 object);
void EmitCheckpointEntered(Int32 player, Int32 checkpoint);
void EmitCheckpointExited(Int32 player, Int32 checkpoint);
void EmitForcefieldEntered(Int32 player, Int32 forcefield);
void EmitForcefieldExited(Int32 player, Int32 forcefield);
void EmitServerFrame(Float32 delta);
void EmitServerStartup();
void EmitServerShutdown();
void EmitInternalCommand(Int32 type, CCStr text);
void EmitLoginAttempt(CCStr name, CCStr passwd, CCStr ip);
void EmitCustomEvent(Int32 group, Int32 header, Object & payload);
void EmitWorldOption(Int32 option, Object & value);
void EmitWorldToggle(Int32 option, bool value);
void EmitScriptReload(Int32 header, Object & payload);
void EmitScriptUnload();
void EmitPlayerUpdate(Int32 player, Int32 type);
void EmitVehicleUpdate(Int32 vehicle, Int32 type);
void EmitEntityPool(Int32 type, Int32 id, bool deleted);
/* --------------------------------------------------------------------------------------------
* Retrie global event bidings.
*/
Function & GetEvent(Int32 evid);
/* --------------------------------------------------------------------------------------------
* Retrie local event bidings.
*/
Function & GetBlipEvent(Int32 id, Int32 evid);
Function & GetCheckpointEvent(Int32 id, Int32 evid);
Function & GetForcefieldEvent(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 & GetSpriteEvent(Int32 id, Int32 evid);
Function & GetTextdrawEvent(Int32 id, Int32 evid);
Function & GetVehicleEvent(Int32 id, Int32 evid);
2015-11-08 06:20:31 +01:00
private:
2015-11-08 06:20:31 +01:00
/* --------------------------------------------------------------------------------------------
* Global event bindings.
*/
Function mOnBlipCreated;
Function mOnCheckpointCreated;
Function mOnForcefieldCreated;
Function mOnKeybindCreated;
Function mOnObjectCreated;
Function mOnPickupCreated;
Function mOnPlayerCreated;
Function mOnSpriteCreated;
Function mOnTextdrawCreated;
Function mOnVehicleCreated;
Function mOnBlipDestroyed;
Function mOnCheckpointDestroyed;
Function mOnForcefieldDestroyed;
Function mOnKeybindDestroyed;
Function mOnObjectDestroyed;
Function mOnPickupDestroyed;
Function mOnPlayerDestroyed;
Function mOnSpriteDestroyed;
Function mOnTextdrawDestroyed;
Function mOnVehicleDestroyed;
Function mOnBlipCustom;
Function mOnCheckpointCustom;
Function mOnForcefieldCustom;
Function mOnKeybindCustom;
Function mOnObjectCustom;
Function mOnPickupCustom;
Function mOnPlayerCustom;
Function mOnSpriteCustom;
Function mOnTextdrawCustom;
Function mOnVehicleCustom;
Function mOnPlayerAway;
Function mOnPlayerGameKeys;
Function mOnPlayerRename;
Function mOnPlayerRequestClass;
Function mOnPlayerRequestSpawn;
Function mOnPlayerSpawn;
Function mOnPlayerStartTyping;
Function mOnPlayerStopTyping;
Function mOnPlayerChat;
Function mOnPlayerCommand;
Function mOnPlayerMessage;
Function mOnPlayerHealth;
Function mOnPlayerArmour;
Function mOnPlayerWeapon;
Function mOnPlayerMove;
Function mOnPlayerWasted;
Function mOnPlayerKilled;
Function mOnPlayerTeamKill;
Function mOnPlayerSpectate;
Function mOnPlayerCrashreport;
Function mOnPlayerBurning;
Function mOnPlayerCrouching;
Function mOnPlayerState;
Function mOnPlayerAction;
Function mOnStateNone;
Function mOnStateNormal;
Function mOnStateShooting;
Function mOnStateDriver;
Function mOnStatePassenger;
Function mOnStateEnterDriver;
Function mOnStateEnterPassenger;
Function mOnStateExitVehicle;
Function mOnStateUnspawned;
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;
Function mOnVehicleRespawn;
Function mOnVehicleExplode;
Function mOnVehicleHealth;
Function mOnVehicleMove;
Function mOnPickupRespawn;
Function mOnKeybindKeyPress;
Function mOnKeybindKeyRelease;
Function mOnVehicleEmbarking;
Function mOnVehicleEmbarked;
Function mOnVehicleDisembark;
Function mOnPickupClaimed;
Function mOnPickupCollected;
Function mOnObjectShot;
Function mOnObjectBump;
Function mOnCheckpointEntered;
Function mOnCheckpointExited;
Function mOnForcefieldEntered;
Function mOnForcefieldExited;
Function mOnServerFrame;
Function mOnServerStartup;
Function mOnServerShutdown;
Function mOnInternalCommand;
Function mOnLoginAttempt;
Function mOnCustomEvent;
Function mOnWorldOption;
Function mOnWorldToggle;
Function mOnScriptReload;
Function mOnScriptUnload;
2015-09-30 02:56:11 +02:00
};
} // Namespace:: SqMod
#endif // _CORE_HPP_