mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-11 02:28:18 +00:00
bb971bdcf0
* Add the following config variables : * sv_vote_pause: Allow voting to pause players (instead of moving to spectators) (default: 1) * sv_vote_pause_time: The time (in seconds) players have to wait in pause when paused by vote (default: 60) * sv_vote_pause_auto: Automatically unpaused players after the force-pause delay or not (default: 0) * Add the following functions : * force_pause v?i : Force v to pause for i seconds * force_unpause v : Force v to unpause
160 lines
3.2 KiB
C++
160 lines
3.2 KiB
C++
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
|
#ifndef GAME_SERVER_PLAYER_H
|
|
#define GAME_SERVER_PLAYER_H
|
|
|
|
// this include should perhaps be removed
|
|
#include "entities/character.h"
|
|
#include "gamecontext.h"
|
|
|
|
// player object
|
|
class CPlayer
|
|
{
|
|
MACRO_ALLOC_POOL_ID()
|
|
|
|
public:
|
|
CPlayer(CGameContext *pGameServer, int ClientID, int Team);
|
|
~CPlayer();
|
|
|
|
void Init(int CID);
|
|
|
|
void TryRespawn();
|
|
void Respawn();
|
|
void SetTeam(int Team);
|
|
int GetTeam() const { return m_Team; };
|
|
int GetCID() const { return m_ClientID; };
|
|
|
|
void Tick();
|
|
void PostTick();
|
|
void Snap(int SnappingClient);
|
|
|
|
void OnDirectInput(CNetObj_PlayerInput *NewInput);
|
|
void OnPredictedInput(CNetObj_PlayerInput *NewInput);
|
|
void OnDisconnect(const char *pReason);
|
|
|
|
void KillCharacter(int Weapon = WEAPON_GAME);
|
|
CCharacter *GetCharacter();
|
|
|
|
//---------------------------------------------------------
|
|
// this is used for snapping so we know how we can clip the view for the player
|
|
vec2 m_ViewPos;
|
|
|
|
// states if the client is chatting, accessing a menu etc.
|
|
int m_PlayerFlags;
|
|
|
|
// used for snapping to just update latency if the scoreboard is active
|
|
int m_aActLatency[MAX_CLIENTS];
|
|
|
|
// used for spectator mode
|
|
int m_SpectatorID;
|
|
|
|
bool m_IsReady;
|
|
|
|
//
|
|
int m_Vote;
|
|
int m_VotePos;
|
|
//
|
|
int m_LastVoteCall;
|
|
int m_LastVoteTry;
|
|
int m_LastChat;
|
|
int m_LastSetTeam;
|
|
int m_LastSetSpectatorMode;
|
|
int m_LastChangeInfo;
|
|
int m_LastEmote;
|
|
int m_LastKill;
|
|
|
|
// TODO: clean this up
|
|
struct
|
|
{
|
|
char m_SkinName[64];
|
|
int m_UseCustomColor;
|
|
int m_ColorBody;
|
|
int m_ColorFeet;
|
|
} m_TeeInfos;
|
|
|
|
int m_RespawnTick;
|
|
int m_DieTick;
|
|
int m_Score;
|
|
int m_ScoreStartTick;
|
|
bool m_ForceBalanced;
|
|
int m_LastActionTick;
|
|
struct
|
|
{
|
|
int m_TargetX;
|
|
int m_TargetY;
|
|
} m_LatestActivity;
|
|
|
|
// network latency calculations
|
|
struct
|
|
{
|
|
int m_Accum;
|
|
int m_AccumMin;
|
|
int m_AccumMax;
|
|
int m_Avg;
|
|
int m_Min;
|
|
int m_Max;
|
|
} m_Latency;
|
|
|
|
private:
|
|
CCharacter *m_pCharacter;
|
|
CGameContext *m_pGameServer;
|
|
|
|
CGameContext *GameServer() const { return m_pGameServer; }
|
|
IServer *Server() const;
|
|
|
|
//
|
|
bool m_Spawning;
|
|
int m_ClientID;
|
|
int m_Team;
|
|
|
|
|
|
// DDRace
|
|
|
|
public:
|
|
|
|
struct PauseInfo
|
|
{
|
|
CCharacterCore m_Core;
|
|
int m_StartTime;
|
|
int m_DDRaceState;
|
|
int m_FreezeTime;
|
|
int m_Armor;
|
|
int m_LastMove;
|
|
vec2 m_PrevPos;
|
|
int m_ActiveWeapon;
|
|
int m_LastWeapon;
|
|
bool m_Respawn;
|
|
bool m_aHasWeapon[NUM_WEAPONS];
|
|
bool m_Super;
|
|
bool m_DeepFreeze;
|
|
bool m_EndlessHook;
|
|
int m_PauseTime;
|
|
int m_Team;
|
|
int m_TeleCheckpoint;
|
|
int m_CpActive;
|
|
float m_CpCurrent[25];
|
|
} m_PauseInfo;
|
|
int m_ForcePauseTime;
|
|
bool m_InfoSaved;
|
|
bool IsPlaying();
|
|
void LoadCharacter();
|
|
void SaveCharacter();
|
|
int64 m_Last_KickVote;
|
|
int64 m_Last_Team;
|
|
int m_Authed;
|
|
bool m_IsUsingDDRaceClient;
|
|
bool m_ShowOthers;
|
|
|
|
int m_ChatScore;
|
|
|
|
bool AfkTimer(int new_target_x, int new_target_y); //returns true if kicked
|
|
int64 m_LastPlaytime;
|
|
int m_LastTarget_x;
|
|
int m_LastTarget_y;
|
|
int m_Sent1stAfkWarning; // afk timer's 1st warning after 50% of sv_max_afk_time
|
|
int m_Sent2ndAfkWarning; // afk timer's 2nd warning after 90% of sv_max_afk_time
|
|
char m_pAfkMsg[160];
|
|
};
|
|
|
|
#endif
|