Move many player natives from core to logic.
This commit is contained in:
parent
556d5e0949
commit
dbc881143b
@ -180,8 +180,8 @@ public: //IAdminSystem
|
||||
FlagBits flags,
|
||||
bool override_only);
|
||||
bool FindFlagChar(AdminFlag flag, char *c);
|
||||
public:
|
||||
bool IsValidAdmin(AdminId id);
|
||||
public:
|
||||
void DumpCache(FILE *fp);
|
||||
AdminGroup *GetGroup(GroupId gid);
|
||||
AdminUser *GetUser(AdminId id);
|
||||
|
@ -62,6 +62,7 @@ class IVEngineServer_Logic
|
||||
public:
|
||||
virtual bool IsMapValid(const char *map) = 0;
|
||||
virtual void ServerCommand(const char *cmd) = 0;
|
||||
virtual const char *GetClientConVarValue(int clientIndex, const char *name) = 0;
|
||||
};
|
||||
|
||||
typedef void * FileHandle_t;
|
||||
@ -108,6 +109,25 @@ class IFileSystem;
|
||||
class ConVar;
|
||||
class KeyValues;
|
||||
class SMGlobalClass;
|
||||
class IPlayerInfo;
|
||||
|
||||
class IPlayerInfo_Logic
|
||||
{
|
||||
public:
|
||||
virtual bool IsObserver(IPlayerInfo *pInfo) = 0;
|
||||
virtual int GetTeamIndex(IPlayerInfo *pInfo) = 0;
|
||||
virtual int GetFragCount(IPlayerInfo *pInfo) = 0;
|
||||
virtual int GetDeathCount(IPlayerInfo *pInfo) = 0;
|
||||
virtual int GetArmorValue(IPlayerInfo *pInfo) = 0;
|
||||
virtual void GetAbsOrigin(IPlayerInfo *pInfo, float *x, float *y, float *z) = 0;
|
||||
virtual void GetAbsAngles(IPlayerInfo *pInfo, float *x, float *y, float *z) = 0;
|
||||
virtual void GetPlayerMins(IPlayerInfo *pInfo, float *x, float *y, float *z) = 0;
|
||||
virtual void GetPlayerMaxs(IPlayerInfo *pInfo, float *x, float *y, float *z) = 0;
|
||||
virtual const char *GetWeaponName(IPlayerInfo *pInfo) = 0;
|
||||
virtual const char *GetModelName(IPlayerInfo *pInfo) = 0;
|
||||
virtual int GetHealth(IPlayerInfo *pInfo) = 0;
|
||||
virtual void ChangeTeam(IPlayerInfo *pInfo, int iTeamNum) = 0;
|
||||
};
|
||||
|
||||
namespace SourceMod
|
||||
{
|
||||
@ -236,6 +256,7 @@ struct sm_core_t
|
||||
ILibrarySys *libsys;
|
||||
IVEngineServer *engine;
|
||||
IFileSystem *filesystem;
|
||||
IPlayerInfo_Logic *playerInfo;
|
||||
IRootConsole *rootmenu;
|
||||
ITimerSystem *timersys;
|
||||
IPlayerManager *playerhelpers;
|
||||
@ -252,6 +273,7 @@ struct sm_core_t
|
||||
void (*Log)(const char*, ...);
|
||||
void (*LogToFile)(FILE *fp, const char*, ...);
|
||||
void (*LogToGame)(const char *message);
|
||||
void (*ConPrint)(const char *message);
|
||||
const char * (*GetCvarString)(ConVar*);
|
||||
size_t (*Format)(char*, size_t, const char*, ...);
|
||||
size_t (*FormatArgs)(char*, size_t, const char*,va_list ap);
|
||||
@ -273,6 +295,7 @@ struct sm_core_t
|
||||
bool (*AreConfigsExecuted)();
|
||||
void (*ExecuteConfigs)(IPluginContext *ctx);
|
||||
DatabaseInfo (*GetDBInfoFromKeyValues)(KeyValues *);
|
||||
int (*GetActivityFlags)();
|
||||
const char *gamesuffix;
|
||||
/* Data */
|
||||
ServerGlobals *serverGlobals;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -98,6 +98,11 @@ public:
|
||||
{
|
||||
engine->ServerCommand(cmd);
|
||||
}
|
||||
|
||||
virtual const char *GetClientConVarValue(int clientIndex, const char *name)
|
||||
{
|
||||
return engine->GetClientConVarValue(clientIndex, name);
|
||||
}
|
||||
};
|
||||
|
||||
static VEngineServer_Logic logic_engine;
|
||||
@ -146,6 +151,78 @@ public:
|
||||
|
||||
static VFileSystem_Logic logic_filesystem;
|
||||
|
||||
class VPlayerInfo_Logic : public IPlayerInfo_Logic
|
||||
{
|
||||
public:
|
||||
bool IsObserver(IPlayerInfo *pInfo)
|
||||
{
|
||||
return pInfo->IsObserver();
|
||||
}
|
||||
int GetTeamIndex(IPlayerInfo *pInfo)
|
||||
{
|
||||
return pInfo->GetTeamIndex();
|
||||
}
|
||||
int GetFragCount(IPlayerInfo *pInfo)
|
||||
{
|
||||
return pInfo->GetFragCount();
|
||||
}
|
||||
int GetDeathCount(IPlayerInfo *pInfo)
|
||||
{
|
||||
return pInfo->GetDeathCount();
|
||||
}
|
||||
int GetArmorValue(IPlayerInfo *pInfo)
|
||||
{
|
||||
return pInfo->GetArmorValue();
|
||||
}
|
||||
void GetAbsOrigin(IPlayerInfo *pInfo, float *x, float *y, float *z)
|
||||
{
|
||||
Vector vec = pInfo->GetAbsOrigin();
|
||||
*x = vec.x;
|
||||
*y = vec.y;
|
||||
*z = vec.z;
|
||||
}
|
||||
void GetAbsAngles(IPlayerInfo *pInfo, float *x, float *y, float *z)
|
||||
{
|
||||
QAngle ang = pInfo->GetAbsAngles();
|
||||
*x = ang.x;
|
||||
*y = ang.y;
|
||||
*z = ang.z;
|
||||
}
|
||||
void GetPlayerMins(IPlayerInfo *pInfo, float *x, float *y, float *z)
|
||||
{
|
||||
Vector vec = pInfo->GetPlayerMins();
|
||||
*x = vec.x;
|
||||
*y = vec.y;
|
||||
*z = vec.z;
|
||||
}
|
||||
void GetPlayerMaxs(IPlayerInfo *pInfo, float *x, float *y, float *z)
|
||||
{
|
||||
Vector vec = pInfo->GetPlayerMaxs();
|
||||
*x = vec.x;
|
||||
*y = vec.y;
|
||||
*z = vec.z;
|
||||
}
|
||||
const char *GetWeaponName(IPlayerInfo *pInfo)
|
||||
{
|
||||
return pInfo->GetWeaponName();
|
||||
}
|
||||
const char *GetModelName(IPlayerInfo *pInfo)
|
||||
{
|
||||
return pInfo->GetModelName();
|
||||
}
|
||||
int GetHealth(IPlayerInfo *pInfo)
|
||||
{
|
||||
return pInfo->GetHealth();
|
||||
}
|
||||
void ChangeTeam(IPlayerInfo *pInfo, int iTeamNum)
|
||||
{
|
||||
pInfo->ChangeTeam(iTeamNum);
|
||||
}
|
||||
};
|
||||
|
||||
static VPlayerInfo_Logic logic_playerinfo;
|
||||
|
||||
static ConVar sm_show_activity("sm_show_activity", "13", FCVAR_SPONLY, "Activity display setting (see sourcemod.cfg)");
|
||||
|
||||
static ConVar *find_convar(const char *name)
|
||||
{
|
||||
@ -191,6 +268,11 @@ static void log_to_game(const char *message)
|
||||
Engine_LogPrintWrapper(message);
|
||||
}
|
||||
|
||||
static void conprint(const char *message)
|
||||
{
|
||||
META_CONPRINT(message);
|
||||
}
|
||||
|
||||
static const char *get_cvar_string(ConVar* cvar)
|
||||
{
|
||||
return cvar->GetString();
|
||||
@ -314,6 +396,11 @@ static DatabaseInfo keyvalues_to_dbinfo(KeyValues *kv)
|
||||
return info;
|
||||
}
|
||||
|
||||
static int get_activity_flags()
|
||||
{
|
||||
return sm_show_activity.GetInt();
|
||||
}
|
||||
|
||||
int read_cmd_argc(const CCommand &args)
|
||||
{
|
||||
return args.ArgC();
|
||||
@ -420,6 +507,7 @@ static sm_core_t core_bridge =
|
||||
&g_LibSys,
|
||||
reinterpret_cast<IVEngineServer*>(&logic_engine),
|
||||
reinterpret_cast<IFileSystem*>(&logic_filesystem),
|
||||
&logic_playerinfo,
|
||||
&g_RootMenu,
|
||||
&g_Timers,
|
||||
&g_Players,
|
||||
@ -436,6 +524,7 @@ static sm_core_t core_bridge =
|
||||
log_message,
|
||||
log_to_file,
|
||||
log_to_game,
|
||||
conprint,
|
||||
get_cvar_string,
|
||||
UTIL_Format,
|
||||
UTIL_FormatArgs,
|
||||
@ -456,8 +545,9 @@ static sm_core_t core_bridge =
|
||||
SM_AreConfigsExecuted,
|
||||
SM_ExecuteForPlugin,
|
||||
keyvalues_to_dbinfo,
|
||||
get_activity_flags,
|
||||
GAMEFIX,
|
||||
&serverGlobals
|
||||
&serverGlobals,
|
||||
};
|
||||
|
||||
void InitLogicBridge()
|
||||
|
1325
core/smn_player.cpp
1325
core/smn_player.cpp
File diff suppressed because it is too large
Load Diff
@ -35,7 +35,7 @@
|
||||
#include <IShareSys.h>
|
||||
|
||||
#define SMINTERFACE_ADMINSYS_NAME "IAdminSys"
|
||||
#define SMINTERFACE_ADMINSYS_VERSION 6
|
||||
#define SMINTERFACE_ADMINSYS_VERSION 7
|
||||
|
||||
/**
|
||||
* @file IAdminSystem.h
|
||||
@ -726,6 +726,14 @@ namespace SourceMod
|
||||
* @return True on success, false if not found.
|
||||
*/
|
||||
virtual bool FindFlagChar(AdminFlag flag, char *c) =0;
|
||||
|
||||
/**
|
||||
* brief Returns whether or not an admin id is valid.
|
||||
*
|
||||
* @param id Admin id to check.
|
||||
* @return True if valid, otherwise false.
|
||||
*/
|
||||
virtual bool IsValidAdmin(AdminId id) =0;
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user