mirror of
https://github.com/rehlds/resemiclip.git
synced 2024-12-25 14:15:50 +03:00
Use CSGameRules()->PlayerRelationship & refactoring
This commit is contained in:
parent
8cae39a981
commit
f18977d9b2
@ -7,6 +7,14 @@
|
||||
#define GET_DISTANCE(a, b) ((a - b).Length2D())
|
||||
#define GET_COLLIDE(a, b) (abs(a.z - b.z) < 96 && (a - b).Length2D() < 96)
|
||||
|
||||
enum
|
||||
{
|
||||
SC_TEAM_ALL = 0,
|
||||
SC_TEAM_T,
|
||||
SC_TEAM_CT,
|
||||
SC_TEAM_TEAMMATE,
|
||||
};
|
||||
|
||||
extern int DispatchSpawn(edict_t *pEntity);
|
||||
extern int ShouldCollide(edict_t *pentTouched, edict_t *pentOther);
|
||||
extern int OnMetaAttach();
|
||||
|
@ -62,7 +62,7 @@ bool CConfig::Parse_Settings(const char *str, const char *value)
|
||||
cfg_effects = clamp(i, 0, 1);
|
||||
}
|
||||
else if (!strcasecmp(str, "team")) {
|
||||
cfg_team = clamp(i, 0, 3);
|
||||
cfg_team = clamp(i, SC_TEAM_ALL, SC_TEAM_TEAMMATE);
|
||||
}
|
||||
else if (!strcasecmp(str, "penetfire")) {
|
||||
cfg_penetfire = clamp(i, 0, 1);
|
||||
@ -209,7 +209,7 @@ int Load_Config()
|
||||
|
||||
g_Config.SetEnable(1);
|
||||
g_Config.SetTime(0.0f);
|
||||
g_Config.SetTeam(3);
|
||||
g_Config.SetTeam(SC_TEAM_TEAMMATE);
|
||||
g_Config.SetCrouch(0);
|
||||
g_Config.SetDistance(160.0f);
|
||||
g_Config.SetTransparency(100);
|
||||
|
10
src/main.cpp
10
src/main.cpp
@ -285,11 +285,11 @@ inline bool allowDontSolid(playermove_t *pm, edict_t *pHost, int host, int j)
|
||||
int entTeamId = EntPlayer->m_iTeam;
|
||||
|
||||
*pPlayer->GetDiff(pObject) = GET_DISTANCE(hostOrigin, entOrigin);
|
||||
*pPlayer->GetSolid(pObject) = (hostTeamId == 3
|
||||
*pPlayer->GetSolid(pObject) = (hostTeamId == SPECTATOR
|
||||
|| ((g_Config.GetEffects()
|
||||
|| *pPlayer->GetDiff(pObject) < g_Config.GetDistance())
|
||||
&& ((g_Config.GetTeam() == 0) ? 1
|
||||
: (g_Config.GetTeam() == 3) ? (hostTeamId == entTeamId)
|
||||
&& ((g_Config.GetTeam() == SC_TEAM_ALL) ? 1
|
||||
: (g_Config.GetTeam() == SC_TEAM_TEAMMATE) ? (CSGameRules()->PlayerRelationship(HostPlayer, EntPlayer) == GR_TEAMMATE)
|
||||
: (hostTeamId == g_Config.GetTeam()
|
||||
&& entTeamId == g_Config.GetTeam()))
|
||||
&& !pObject->GetDont()));
|
||||
@ -428,8 +428,8 @@ void PM_Move(playermove_t *pm, int server)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((g_Config.GetTeam() == 0) ? 1
|
||||
: (g_Config.GetTeam() == 3) ? (hostTeamId == EntPlayer->m_iTeam)
|
||||
if ((g_Config.GetTeam() == SC_TEAM_ALL) ? 1
|
||||
: (g_Config.GetTeam() == SC_TEAM_TEAMMATE) ? (CSGameRules()->PlayerRelationship(pCBasePlayer, EntPlayer) == GR_TEAMMATE)
|
||||
: (hostTeamId == g_Config.GetTeam()
|
||||
&& EntPlayer->m_iTeam == g_Config.GetTeam()))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user