2015-09-30 02:56:11 +02:00
|
|
|
#ifndef _CORE_HPP_
|
|
|
|
#define _CORE_HPP_
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
#include "Common.hpp"
|
|
|
|
#include "Signal.hpp"
|
|
|
|
|
2015-10-11 23:26:14 +02:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
#include "Base/Vector3.hpp"
|
|
|
|
|
2015-09-30 02:56:11 +02:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
#include <queue>
|
|
|
|
#include <vector>
|
|
|
|
#include <utility>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
namespace SqMod {
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
class Core
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
friend class std::unique_ptr<Core, void(*)(Core *)>;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
struct TPlayer
|
|
|
|
{
|
|
|
|
SQInt32 Weapon;
|
|
|
|
SQFloat Health;
|
|
|
|
SQFloat Armour;
|
2015-10-11 23:26:14 +02:00
|
|
|
Vector3 Position;
|
2015-09-30 02:56:11 +02:00
|
|
|
bool Fresh;
|
|
|
|
};
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
struct TVehicle
|
|
|
|
{
|
|
|
|
SQFloat Health;
|
2015-10-11 23:26:14 +02:00
|
|
|
Vector3 Position;
|
2015-09-30 02:56:11 +02:00
|
|
|
bool Fresh;
|
|
|
|
};
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
typedef std::array<TPlayer, SQMOD_PLAYER_POOL> TPlayerInstPool;
|
|
|
|
typedef std::array<TVehicle, SQMOD_VEHICLE_POOL> TVehicleInstPool;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
typedef std::unique_ptr<RootTable> SqRootTable;
|
|
|
|
typedef std::unordered_map<String, Script> SqScriptPool;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
typedef std::unordered_map<String, String> OptionPool;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
typedef std::vector< SQChar > Buffer;
|
|
|
|
typedef std::queue< Buffer > BufferPool;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
SQInteger m_State;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
OptionPool m_Options;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
HSQUIRRELVM m_VM;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
SqRootTable m_RootTable;
|
|
|
|
SqScriptPool m_Scripts;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
String m_ErrorMsg;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
TPlayerInstPool m_PlayerTrack;
|
|
|
|
TVehicleInstPool m_VehicleTrack;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
BufferPool m_BufferPool;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Core();
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
~Core();
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Core(Core const &) = delete;
|
|
|
|
Core(Core &&) = delete;
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Core & operator=(Core const &) = delete;
|
|
|
|
Core & operator=(Core &&) = delete;
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
static void _Finalizer(Core * ptr);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
typedef std::unique_ptr<Core, void(*)(Core *)> Pointer;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
static Pointer Inst();
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool Init();
|
|
|
|
bool Load();
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Deinit();
|
|
|
|
void Unload();
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Terminate();
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void SetState(SQInteger val);
|
|
|
|
SQInteger GetState() const;
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
String GetOption(const String & name) const;
|
|
|
|
void SetOption(const String & name, const String & value);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Buffer PullBuffer(unsigned sz = 4096);
|
|
|
|
void PushBuffer(Buffer && buf);
|
|
|
|
void MakeBuffer(unsigned num, unsigned sz = 4096);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void ConnectPlayer(SQInt32 id, SQInt32 header, SqObj & payload);
|
|
|
|
void DisconnectPlayer(SQInt32 id, SQInt32 header, SqObj & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool Configure();
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool CreateVM();
|
|
|
|
void DestroyVM();
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool LoadScripts();
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool Compile(const String & name);
|
|
|
|
bool Execute();
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void PrintCallstack();
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
static void PrintFunc(HSQUIRRELVM vm, const SQChar * str, ...);
|
|
|
|
static void ErrorFunc(HSQUIRRELVM vm, const SQChar * str, ...);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
static SQInteger RuntimeErrorHandler(HSQUIRRELVM vm);
|
|
|
|
static void CompilerErrorHandler(HSQUIRRELVM vm, const SQChar * desc, const SQChar * src, SQInteger line, SQInteger column);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Destroys a Player created by the server
|
|
|
|
*/
|
2015-11-01 04:48:01 +01:00
|
|
|
bool DestroyPlayer(SQInt32 id, SQInt32 header, SqObj & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Creates a new Blip on the server
|
|
|
|
*/
|
2015-10-31 20:28:23 +01:00
|
|
|
Reference< CBlip > NewBlip(SQInt32 index, SQInt32 world, SQFloat x, SQFloat y, SQFloat z,
|
|
|
|
SQInt32 scale, SQUint32 color, SQInt32 sprid,
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 header, SqObj & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Creates a new Checkpoint on the server
|
|
|
|
*/
|
2015-10-31 20:28:23 +01:00
|
|
|
Reference< CCheckpoint > NewCheckpoint(SQInt32 player, SQInt32 world, SQFloat x, SQFloat y, SQFloat z,
|
2015-11-01 00:30:45 +01:00
|
|
|
Uint8 r, Uint8 g, Uint8 b, Uint8 a, SQFloat radius,
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 header, SqObj & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Creates a new Keybind on the server
|
|
|
|
*/
|
2015-10-31 20:28:23 +01:00
|
|
|
Reference< CKeybind > NewKeybind(SQInt32 slot, bool release,
|
|
|
|
SQInt32 primary, SQInt32 secondary, SQInt32 alternative,
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 header, SqObj & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Creates a new Object on the server
|
|
|
|
*/
|
2015-10-31 20:28:23 +01:00
|
|
|
Reference< CObject > NewObject(SQInt32 model, SQInt32 world, SQFloat x, SQFloat y, SQFloat z,
|
|
|
|
SQInt32 alpha,
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 header, SqObj & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Creates a new Pickup on the server
|
|
|
|
*/
|
2015-10-31 20:28:23 +01:00
|
|
|
Reference< CPickup > NewPickup(SQInt32 model, SQInt32 world, SQInt32 quantity,
|
|
|
|
SQFloat x, SQFloat y, SQFloat z, SQInt32 alpha, bool automatic,
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 header, SqObj & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Creates a new Sphere on the server
|
|
|
|
*/
|
2015-10-31 20:28:23 +01:00
|
|
|
Reference< CSphere > NewSphere(SQInt32 player, SQInt32 world, SQFloat x, SQFloat y, SQFloat z,
|
2015-11-01 00:30:45 +01:00
|
|
|
Uint8 r, Uint8 g, Uint8 b, SQFloat radius,
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 header, SqObj & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Creates a new Sprite on the server
|
|
|
|
*/
|
2015-10-31 20:28:23 +01:00
|
|
|
Reference< CSprite > NewSprite(SQInt32 index, const SQChar * file, SQInt32 xp, SQInt32 yp,
|
|
|
|
SQInt32 xr, SQInt32 yr, SQFloat angle, SQInt32 alpha, bool rel,
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 header, SqObj & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Creates a new Textdraw on the server
|
|
|
|
*/
|
2015-10-31 20:28:23 +01:00
|
|
|
Reference< CTextdraw > NewTextdraw(SQInt32 index, const SQChar * text, SQInt32 xp, SQInt32 yp,
|
|
|
|
SQUint32 color, bool rel,
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 header, SqObj & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------
|
|
|
|
* Creates a new Vehicle on the server
|
|
|
|
*/
|
2015-10-31 20:28:23 +01:00
|
|
|
Reference< CVehicle > NewVehicle(SQInt32 model, SQInt32 world, SQFloat x, SQFloat y, SQFloat z,
|
|
|
|
SQFloat angle, SQInt32 primary, SQInt32 secondary,
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 header, SqObj & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnBlipCreated(SQInt32 blip, SQInt32 header, SqObj & payload);
|
|
|
|
void OnCheckpointCreated(SQInt32 checkpoint, SQInt32 header, SqObj & payload);
|
|
|
|
void OnKeybindCreated(SQInt32 keybind, SQInt32 header, SqObj & payload);
|
|
|
|
void OnObjectCreated(SQInt32 object, SQInt32 header, SqObj & payload);
|
|
|
|
void OnPickupCreated(SQInt32 pickup, SQInt32 header, SqObj & payload);
|
|
|
|
void OnPlayerCreated(SQInt32 player, SQInt32 header, SqObj & payload);
|
|
|
|
void OnSphereCreated(SQInt32 sphere, SQInt32 header, SqObj & payload);
|
|
|
|
void OnSpriteCreated(SQInt32 sprite, SQInt32 header, SqObj & payload);
|
|
|
|
void OnTextdrawCreated(SQInt32 textdraw, SQInt32 header, SqObj & payload);
|
|
|
|
void OnVehicleCreated(SQInt32 vehicle, SQInt32 header, SqObj & payload);
|
2015-10-11 23:26:14 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnBlipDestroyed(SQInt32 blip, SQInt32 header, SqObj & payload);
|
|
|
|
void OnCheckpointDestroyed(SQInt32 checkpoint, SQInt32 header, SqObj & payload);
|
|
|
|
void OnKeybindDestroyed(SQInt32 keybind, SQInt32 header, SqObj & payload);
|
|
|
|
void OnObjectDestroyed(SQInt32 object, SQInt32 header, SqObj & payload);
|
|
|
|
void OnPickupDestroyed(SQInt32 pickup, SQInt32 header, SqObj & payload);
|
|
|
|
void OnPlayerDestroyed(SQInt32 player, SQInt32 header, SqObj & payload);
|
|
|
|
void OnSphereDestroyed(SQInt32 sphere, SQInt32 header, SqObj & payload);
|
|
|
|
void OnSpriteDestroyed(SQInt32 sprite, SQInt32 header, SqObj & payload);
|
|
|
|
void OnTextdrawDestroyed(SQInt32 textdraw, SQInt32 header, SqObj & payload);
|
|
|
|
void OnVehicleDestroyed(SQInt32 vehicle, SQInt32 header, SqObj & payload);
|
2015-10-11 23:26:14 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnBlipCustom(SQInt32 blip, SQInt32 header, SqObj & payload);
|
|
|
|
void OnCheckpointCustom(SQInt32 checkpoint, SQInt32 header, SqObj & payload);
|
|
|
|
void OnKeybindCustom(SQInt32 keybind, SQInt32 header, SqObj & payload);
|
|
|
|
void OnObjectCustom(SQInt32 object, SQInt32 header, SqObj & payload);
|
|
|
|
void OnPickupCustom(SQInt32 pickup, SQInt32 header, SqObj & payload);
|
|
|
|
void OnPlayerCustom(SQInt32 player, SQInt32 header, SqObj & payload);
|
|
|
|
void OnSphereCustom(SQInt32 sphere, SQInt32 header, SqObj & payload);
|
|
|
|
void OnSpriteCustom(SQInt32 sprite, SQInt32 header, SqObj & payload);
|
|
|
|
void OnTextdrawCustom(SQInt32 textdraw, SQInt32 header, SqObj & payload);
|
|
|
|
void OnVehicleCustom(SQInt32 vehicle, SQInt32 header, SqObj & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPlayerAway(SQInt32 player, bool status);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPlayerGameKeys(SQInt32 player, SQInt32 previous, SQInt32 current);
|
|
|
|
void OnPlayerName(SQInt32 player, const SQChar * previous, const SQChar * current);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPlayerRequestClass(SQInt32 player, SQInt32 offset);
|
|
|
|
void OnPlayerRequestSpawn(SQInt32 player);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPlayerSpawn(SQInt32 player);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPlayerStartTyping(SQInt32 player);
|
|
|
|
void OnPlayerStopTyping(SQInt32 player);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPlayerChat(SQInt32 player, const SQChar * message);
|
|
|
|
void OnPlayerCommand(SQInt32 player, const SQChar * command);
|
|
|
|
void OnPlayerMessage(SQInt32 player, SQInt32 receiver, const SQChar * message);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPlayerHealth(SQInt32 player, SQFloat previous, SQFloat current);
|
|
|
|
void OnPlayerArmour(SQInt32 player, SQFloat previous, SQFloat current);
|
|
|
|
void OnPlayerWeapon(SQInt32 player, SQInt32 previous, SQInt32 current);
|
|
|
|
void OnPlayerMove(SQInt32 player, const Vector3 & previous, const Vector3 & current);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPlayerWasted(SQInt32 player, SQInt32 reason);
|
|
|
|
void OnPlayerKilled(SQInt32 player, SQInt32 killer, SQInt32 reason, SQInt32 body_part);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPlayerSpectate(SQInt32 player, SQInt32 target);
|
|
|
|
void OnPlayerCrashreport(SQInt32 player, const SQChar * report);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPlayerBurning(SQInt32 player, bool state);
|
|
|
|
void OnPlayerCrouching(SQInt32 player, bool state);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPlayerState(SQInt32 player, SQInt32 previous, SQInt32 current);
|
|
|
|
void OnPlayerAction(SQInt32 player, SQInt32 previous, SQInt32 current);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnStateNone(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnStateNormal(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnStateShooting(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnStateDriver(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnStatePassenger(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnStateEnterDriver(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnStateEnterPassenger(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnStateExitVehicle(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnStateUnspawned(SQInt32 player, SQInt32 previous);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnActionNone(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnActionNormal(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnActionAiming(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnActionShooting(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnActionJumping(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnActionLieDown(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnActionGettingUp(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnActionJumpVehicle(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnActionDriving(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnActionDying(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnActionWasted(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnActionEmbarking(SQInt32 player, SQInt32 previous);
|
|
|
|
void OnActionDisembarking(SQInt32 player, SQInt32 previous);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnVehicleRespawn(SQInt32 vehicle);
|
|
|
|
void OnVehicleExplode(SQInt32 vehicle);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnVehicleHealth(SQInt32 vehicle, SQFloat previous, SQFloat current);
|
|
|
|
void OnVehicleMove(SQInt32 vehicle, const Vector3 & previous, const Vector3 & current);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPickupRespawn(SQInt32 pickup);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPlayerKeyPress(SQInt32 player, SQInt32 keybind);
|
|
|
|
void OnPlayerKeyRelease(SQInt32 player, SQInt32 keybind);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPlayerEmbarking(SQInt32 player, SQInt32 vehicle, SQInt32 slot);
|
|
|
|
void OnPlayerEmbarked(SQInt32 player, SQInt32 vehicle, SQInt32 slot);
|
|
|
|
void OnPlayerDisembark(SQInt32 player, SQInt32 vehicle);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPickupClaimed(SQInt32 player, SQInt32 pickup);
|
|
|
|
void OnPickupCollected(SQInt32 player, SQInt32 pickup);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnObjectShot(SQInt32 player, SQInt32 object, SQInt32 weapon);
|
|
|
|
void OnObjectBump(SQInt32 player, SQInt32 object);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnCheckpointEntered(SQInt32 player, SQInt32 checkpoint);
|
|
|
|
void OnCheckpointExited(SQInt32 player, SQInt32 checkpoint);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnSphereEntered(SQInt32 player, SQInt32 sphere);
|
|
|
|
void OnSphereExited(SQInt32 player, SQInt32 sphere);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnServerFrame(SQFloat delta);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnServerStartup();
|
|
|
|
void OnServerShutdown();
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnInternalCommand(SQInt32 type, const SQChar * text);
|
|
|
|
void OnLoginAttempt(const SQChar * name, const SQChar * passwd, const SQChar * ip);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnCustomEvent(SQInt32 group, SQInt32 header, SqObj & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnWorldOption(SQInt32 option, SqObj & value);
|
|
|
|
void OnWorldToggle(SQInt32 option, bool value);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnScriptReload(SQInt32 header, SqObj & payload);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnLogMessage(SQInt32 type, const SQChar * message);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void OnPlayerUpdate(SQInt32 player, SQInt32 type);
|
|
|
|
void OnVehicleUpdate(SQInt32 vehicle, SQInt32 type);
|
|
|
|
void OnEntityPool(SQInt32 type, SQInt32 id, bool deleted);
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EBlipCreated BlipCreated;
|
|
|
|
ECheckpointCreated CheckpointCreated;
|
|
|
|
EKeybindCreated KeybindCreated;
|
|
|
|
EObjectCreated ObjectCreated;
|
|
|
|
EPickupCreated PickupCreated;
|
|
|
|
EPlayerCreated PlayerCreated;
|
|
|
|
ESphereCreated SphereCreated;
|
|
|
|
ESpriteCreated SpriteCreated;
|
|
|
|
ETextdrawCreated TextdrawCreated;
|
|
|
|
EVehicleCreated VehicleCreated;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EBlipDestroyed BlipDestroyed;
|
|
|
|
ECheckpointDestroyed CheckpointDestroyed;
|
|
|
|
EKeybindDestroyed KeybindDestroyed;
|
|
|
|
EObjectDestroyed ObjectDestroyed;
|
|
|
|
EPickupDestroyed PickupDestroyed;
|
|
|
|
EPlayerDestroyed PlayerDestroyed;
|
|
|
|
ESphereDestroyed SphereDestroyed;
|
|
|
|
ESpriteDestroyed SpriteDestroyed;
|
|
|
|
ETextdrawDestroyed TextdrawDestroyed;
|
|
|
|
EVehicleDestroyed VehicleDestroyed;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EBlipCustom BlipCustom;
|
|
|
|
ECheckpointCustom CheckpointCustom;
|
|
|
|
EKeybindCustom KeybindCustom;
|
|
|
|
EObjectCustom ObjectCustom;
|
|
|
|
EPickupCustom PickupCustom;
|
|
|
|
EPlayerCustom PlayerCustom;
|
|
|
|
ESphereCustom SphereCustom;
|
|
|
|
ESpriteCustom SpriteCustom;
|
|
|
|
ETextdrawCustom TextdrawCustom;
|
|
|
|
EVehicleCustom VehicleCustom;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EPlayerAway PlayerAway;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EPlayerGameKeys PlayerGameKeys;
|
|
|
|
EPlayerRename PlayerRename;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EPlayerRequestClass PlayerRequestClass;
|
|
|
|
EPlayerRequestSpawn PlayerRequestSpawn;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EPlayerSpawn PlayerSpawn;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EPlayerStartTyping PlayerStartTyping;
|
|
|
|
EPlayerStopTyping PlayerStopTyping;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EPlayerChat PlayerChat;
|
|
|
|
EPlayerCommand PlayerCommand;
|
|
|
|
EPlayerMessage PlayerMessage;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EPlayerHealth PlayerHealth;
|
|
|
|
EPlayerArmour PlayerArmour;
|
|
|
|
EPlayerWeapon PlayerWeapon;
|
|
|
|
EPlayerMove PlayerMove;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EPlayerWasted PlayerWasted;
|
|
|
|
EPlayerKilled PlayerKilled;
|
|
|
|
EPlayerTeamKill PlayerTeamKill;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EPlayerSpectate PlayerSpectate;
|
|
|
|
EPlayerCrashreport PlayerCrashreport;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EPlayerBurning PlayerBurning;
|
|
|
|
EPlayerCrouching PlayerCrouching;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EPlayerState PlayerState;
|
|
|
|
EPlayerAction PlayerAction;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EStateNone StateNone;
|
|
|
|
EStateNormal StateNormal;
|
|
|
|
EStateShooting StateShooting;
|
|
|
|
EStateDriver StateDriver;
|
|
|
|
EStatePassenger StatePassenger;
|
|
|
|
EStateEnterDriver StateEnterDriver;
|
|
|
|
EStateEnterPassenger StateEnterPassenger;
|
|
|
|
EStateExitVehicle StateExitVehicle;
|
|
|
|
EStateUnspawned StateUnspawned;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EActionNone ActionNone;
|
|
|
|
EActionNormal ActionNormal;
|
|
|
|
EActionAiming ActionAiming;
|
|
|
|
EActionShooting ActionShooting;
|
|
|
|
EActionJumping ActionJumping;
|
|
|
|
EActionLieDown ActionLieDown;
|
|
|
|
EActionGettingUp ActionGettingUp;
|
|
|
|
EActionJumpVehicle ActionJumpVehicle;
|
|
|
|
EActionDriving ActionDriving;
|
|
|
|
EActionDying ActionDying;
|
|
|
|
EActionWasted ActionWasted;
|
|
|
|
EActionEmbarking ActionEmbarking;
|
|
|
|
EActionDisembarking ActionDisembarking;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EVehicleRespawn VehicleRespawn;
|
|
|
|
EVehicleExplode VehicleExplode;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EVehicleHealth VehicleHealth;
|
|
|
|
EVehicleMove VehicleMove;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EPickupRespawn PickupRespawn;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EKeybindKeyPress KeybindKeyPress;
|
|
|
|
EKeybindKeyRelease KeybindKeyRelease;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EVehicleEmbarking VehicleEmbarking;
|
|
|
|
EVehicleEmbarked VehicleEmbarked;
|
|
|
|
EVehicleDisembark VehicleDisembark;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EPickupClaimed PickupClaimed;
|
|
|
|
EPickupCollected PickupCollected;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EObjectShot ObjectShot;
|
|
|
|
EObjectBump ObjectBump;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
ECheckpointEntered CheckpointEntered;
|
|
|
|
ECheckpointExited CheckpointExited;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
ESphereEntered SphereEntered;
|
|
|
|
ESphereExited SphereExited;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EServerFrame ServerFrame;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EServerStartup ServerStartup;
|
|
|
|
EServerShutdown ServerShutdown;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EInternalCommand InternalCommand;
|
|
|
|
ELoginAttempt LoginAttempt;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
ECustomEvent CustomEvent;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EWorldOption WorldOption;
|
|
|
|
EWorldToggle WorldToggle;
|
2015-10-02 00:34:28 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EScriptReload ScriptReload;
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
ELogMessage LogMessage;
|
2015-10-25 02:20:33 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------------
|
|
|
|
EVMClose VMClose;
|
2015-09-30 02:56:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
extern const Core::Pointer _Core;
|
|
|
|
|
|
|
|
} // Namespace:: SqMod
|
|
|
|
|
|
|
|
#endif // _CORE_HPP_
|