2010-11-20 10:37:14 +00:00
|
|
|
/* (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. */
|
2010-05-29 07:25:38 +00:00
|
|
|
#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()
|
2015-07-09 00:08:14 +00:00
|
|
|
|
2014-07-26 12:46:31 +00:00
|
|
|
friend class CSaveTee;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
public:
|
2011-02-12 10:40:36 +00:00
|
|
|
CPlayer(CGameContext *pGameServer, int ClientID, int Team);
|
2010-05-29 07:25:38 +00:00
|
|
|
~CPlayer();
|
|
|
|
|
2014-08-09 12:50:51 +00:00
|
|
|
void Reset();
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
void TryRespawn();
|
|
|
|
void Respawn();
|
2014-07-26 12:46:31 +00:00
|
|
|
CCharacter* ForceSpawn(vec2 Pos); // required for loading savegames
|
2011-12-30 21:30:28 +00:00
|
|
|
void SetTeam(int Team, bool DoChatMsg=true);
|
2010-05-29 07:25:38 +00:00
|
|
|
int GetTeam() const { return m_Team; };
|
|
|
|
int GetCID() const { return m_ClientID; };
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void Tick();
|
2011-03-10 09:08:14 +00:00
|
|
|
void PostTick();
|
2010-05-29 07:25:38 +00:00
|
|
|
void Snap(int SnappingClient);
|
2013-12-31 05:13:57 +00:00
|
|
|
void FakeSnap(int SnappingClient);
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
void OnDirectInput(CNetObj_PlayerInput *NewInput);
|
|
|
|
void OnPredictedInput(CNetObj_PlayerInput *NewInput);
|
2011-02-14 18:41:32 +00:00
|
|
|
void OnDisconnect(const char *pReason);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2014-12-07 02:42:43 +00:00
|
|
|
void ThreadKillCharacter(int Weapon = WEAPON_GAME);
|
2010-05-29 07:25:38 +00:00
|
|
|
void KillCharacter(int Weapon = WEAPON_GAME);
|
|
|
|
CCharacter *GetCharacter();
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2013-12-31 05:13:57 +00:00
|
|
|
void FindDuplicateSkins();
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// this is used for snapping so we know how we can clip the view for the player
|
|
|
|
vec2 m_ViewPos;
|
2014-03-12 23:56:39 +00:00
|
|
|
int m_TuneZone;
|
|
|
|
int m_TuneZoneOld;
|
2011-03-01 17:31:20 +00:00
|
|
|
|
|
|
|
// 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];
|
2011-03-10 09:08:14 +00:00
|
|
|
|
|
|
|
// used for spectator mode
|
|
|
|
int m_SpectatorID;
|
2011-03-15 08:58:57 +00:00
|
|
|
|
|
|
|
bool m_IsReady;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
//
|
|
|
|
int m_Vote;
|
|
|
|
int m_VotePos;
|
|
|
|
//
|
2011-03-10 09:08:14 +00:00
|
|
|
int m_LastVoteCall;
|
|
|
|
int m_LastVoteTry;
|
|
|
|
int m_LastChat;
|
|
|
|
int m_LastSetTeam;
|
|
|
|
int m_LastSetSpectatorMode;
|
|
|
|
int m_LastChangeInfo;
|
|
|
|
int m_LastEmote;
|
|
|
|
int m_LastKill;
|
2013-08-10 02:21:20 +00:00
|
|
|
int m_LastCommands[4];
|
|
|
|
int m_LastCommandPos;
|
2013-10-18 09:42:35 +00:00
|
|
|
int m_LastWhisperTo;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2014-10-26 18:39:42 +00:00
|
|
|
int m_SendVoteIndex;
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// TODO: clean this up
|
2011-04-13 18:37:12 +00:00
|
|
|
struct
|
2010-05-29 07:25:38 +00:00
|
|
|
{
|
|
|
|
char m_SkinName[64];
|
|
|
|
int m_UseCustomColor;
|
|
|
|
int m_ColorBody;
|
|
|
|
int m_ColorFeet;
|
|
|
|
} m_TeeInfos;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
int m_RespawnTick;
|
|
|
|
int m_DieTick;
|
|
|
|
int m_Score;
|
2010-05-31 20:35:47 +00:00
|
|
|
int m_ScoreStartTick;
|
2010-05-29 07:25:38 +00:00
|
|
|
bool m_ForceBalanced;
|
2010-10-09 17:14:42 +00:00
|
|
|
int m_LastActionTick;
|
2013-12-31 05:13:57 +00:00
|
|
|
bool m_StolenSkin;
|
2011-05-23 11:06:38 +00:00
|
|
|
int m_TeamChangeTick;
|
2010-10-09 17:14:42 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int m_TargetX;
|
|
|
|
int m_TargetY;
|
|
|
|
} m_LatestActivity;
|
2011-03-10 09:08:14 +00:00
|
|
|
|
2011-04-13 18:37:12 +00:00
|
|
|
// network latency calculations
|
2011-03-10 09:08:14 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int m_Accum;
|
|
|
|
int m_AccumMin;
|
|
|
|
int m_AccumMax;
|
|
|
|
int m_Avg;
|
|
|
|
int m_Min;
|
2011-04-13 18:37:12 +00:00
|
|
|
int m_Max;
|
2011-03-10 09:08:14 +00:00
|
|
|
} m_Latency;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
private:
|
2011-04-19 08:42:48 +00:00
|
|
|
CCharacter *m_pCharacter;
|
2014-11-25 19:33:21 +00:00
|
|
|
int m_NumInputs;
|
2010-05-29 07:25:38 +00:00
|
|
|
CGameContext *m_pGameServer;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
CGameContext *GameServer() const { return m_pGameServer; }
|
|
|
|
IServer *Server() const;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
//
|
|
|
|
bool m_Spawning;
|
|
|
|
int m_ClientID;
|
|
|
|
int m_Team;
|
|
|
|
|
2011-01-29 00:59:50 +00:00
|
|
|
|
2011-04-09 06:41:31 +00:00
|
|
|
// DDRace
|
|
|
|
|
2011-01-29 00:59:50 +00:00
|
|
|
public:
|
2011-12-29 13:58:39 +00:00
|
|
|
enum
|
2011-01-29 00:59:50 +00:00
|
|
|
{
|
2011-12-29 13:58:39 +00:00
|
|
|
PAUSED_NONE=0,
|
|
|
|
PAUSED_SPEC,
|
|
|
|
PAUSED_PAUSED,
|
|
|
|
PAUSED_FORCE
|
|
|
|
};
|
|
|
|
|
|
|
|
int m_Paused;
|
2013-12-22 17:30:13 +00:00
|
|
|
bool m_DND;
|
2011-12-29 13:58:39 +00:00
|
|
|
int64 m_NextPauseTick;
|
2014-08-09 15:25:29 +00:00
|
|
|
char m_TimeoutCode[64];
|
2011-12-29 13:58:39 +00:00
|
|
|
|
|
|
|
void ProcessPause();
|
2011-06-06 20:18:37 +00:00
|
|
|
int m_ForcePauseTime;
|
2011-06-06 19:24:27 +00:00
|
|
|
bool IsPlaying();
|
2011-01-29 00:59:50 +00:00
|
|
|
int64 m_Last_KickVote;
|
|
|
|
int64 m_Last_Team;
|
|
|
|
int m_Authed;
|
2014-01-30 15:49:15 +00:00
|
|
|
int m_ClientVersion;
|
2011-01-29 00:59:50 +00:00
|
|
|
bool m_ShowOthers;
|
2014-02-02 18:56:10 +00:00
|
|
|
bool m_ShowAll;
|
2014-08-09 17:53:38 +00:00
|
|
|
bool m_SpecTeam;
|
2014-01-11 12:59:20 +00:00
|
|
|
bool m_NinjaJetpack;
|
2013-08-18 01:27:30 +00:00
|
|
|
bool m_Afk;
|
2014-12-07 02:42:43 +00:00
|
|
|
int m_KillMe;
|
2011-02-02 10:49:19 +00:00
|
|
|
|
2011-02-08 12:44:59 +00:00
|
|
|
int m_ChatScore;
|
|
|
|
|
2011-05-06 19:16:53 +00:00
|
|
|
bool AfkTimer(int new_target_x, int new_target_y); //returns true if kicked
|
2014-02-21 17:27:00 +00:00
|
|
|
void AfkVoteTimer(CNetObj_PlayerInput *NewTarget);
|
2011-03-22 19:49:12 +00:00
|
|
|
int64 m_LastPlaytime;
|
2011-12-27 10:19:02 +00:00
|
|
|
int64 m_LastEyeEmote;
|
2011-03-22 19:49:12 +00:00
|
|
|
int m_LastTarget_x;
|
|
|
|
int m_LastTarget_y;
|
2014-02-21 17:27:00 +00:00
|
|
|
CNetObj_PlayerInput m_LastTarget;
|
2011-04-23 17:59:25 +00:00
|
|
|
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
|
2011-03-22 19:49:12 +00:00
|
|
|
char m_pAfkMsg[160];
|
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
|
|
|
bool m_EyeEmote;
|
2012-02-14 20:38:06 +00:00
|
|
|
int m_TimerType;
|
Added the following settings to Close #123.
sv_time_in_broadcast, 1, 0, 1, CFGFLAG_SERVER, "Whether to display time in broadcast every interval or not by default, later the choice can be changed by players via chat commands"
sv_time_in_broadcast_interval, 1, 0, 60, CFGFLAG_SERVER, "How often to update the broadcast time"
sv_time_in_gametimer, 0, 0, 1, CFGFLAG_SERVER, "Whether to display time in the round/game timer or not by default, later the choice can be changed by players via chat commands"
Added the following Chat commands to give the player the choice over their settings:
"saytime", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTime, this, "Privately messages you your current time in this current running race"
"saytimeall", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race"
"time", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message"
"broadcasttime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetBroadcastTime, this, "Personal Setting of showing time in the broadcast, broadcasttime s, where s = on for on, off for off, toggle for toggle and nothing to show current status"
"servergametime", "?s", CFGFLAG_CHAT|CFGFLAG_SERVER, ConSetServerGameTime, this, "Personal Setting of showing time in the round/game timer, servergametime s, where s = on for on off for off, toggle for toggle and nothing to show current status"
Fixed Chat Command "eyeemote" and made it a set + toggle instead of just toggle for better bin techneques
Moved some vars from CCharacter to CPlayer to keep their status evern after death but not after disconnect.
So now players have the choice to see which timer they wanna see if any.
Note: These changes are all untested Stay away from this update on your main server until they are tested, i don't even know if they will compile propperly
2011-12-29 12:17:34 +00:00
|
|
|
int m_DefEmote;
|
|
|
|
int m_DefEmoteReset;
|
2014-09-18 10:14:00 +00:00
|
|
|
bool m_Halloween;
|
2014-10-12 09:33:36 +00:00
|
|
|
bool m_FirstPacket;
|
2011-09-07 22:51:55 +00:00
|
|
|
#if defined(CONF_SQL)
|
|
|
|
int64 m_LastSQLQuery;
|
|
|
|
#endif
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|