mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
added chat command /time to show or hide time until next spawn
added chat command /broadcast to show or hide broadcast until next spawn added rcon shot,shotgun_me,grenade,grenade_me,laser,laser_me Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
This commit is contained in:
parent
fd7c0c39ac
commit
b0bf68c3d3
|
@ -73,6 +73,8 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
|
||||||
m_RaceState = RACE_NONE;
|
m_RaceState = RACE_NONE;
|
||||||
m_PrevPos = Pos;
|
m_PrevPos = Pos;
|
||||||
m_Core.Reset();
|
m_Core.Reset();
|
||||||
|
m_BroadTime = true;
|
||||||
|
m_BroadCast = true;
|
||||||
m_Core.Init(&GameServer()->m_World.m_Core, GameServer()->Collision());
|
m_Core.Init(&GameServer()->m_World.m_Core, GameServer()->Collision());
|
||||||
m_Core.m_Pos = m_Pos;
|
m_Core.m_Pos = m_Pos;
|
||||||
GameServer()->m_World.m_Core.m_apCharacters[m_pPlayer->GetCID()] = &m_Core;
|
GameServer()->m_World.m_Core.m_apCharacters[m_pPlayer->GetCID()] = &m_Core;
|
||||||
|
@ -622,8 +624,13 @@ void CCharacter::Tick()
|
||||||
}
|
}
|
||||||
|
|
||||||
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_pPlayer->GetCID());
|
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_pPlayer->GetCID());
|
||||||
} else {
|
}
|
||||||
str_format(aBuftime, sizeof(aBuftime), "Current Time: %d min %d sec", IntTime/60, IntTime%60);
|
else
|
||||||
|
{
|
||||||
|
if(m_BroadTime)
|
||||||
|
str_format(aBuftime, sizeof(aBuftime), "%dm %ds", IntTime/60, IntTime%60);
|
||||||
|
else
|
||||||
|
str_format(aBuftime, sizeof(aBuftime), "");
|
||||||
|
|
||||||
if(m_CpActive != -1 && m_CpTick > Server()->Tick())
|
if(m_CpActive != -1 && m_CpTick > Server()->Tick())
|
||||||
{
|
{
|
||||||
|
@ -636,14 +643,17 @@ void CCharacter::Tick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( g_Config.m_SvBroadcast[0] != 0) {
|
if( g_Config.m_SvBroadcast[0] != 0 && m_BroadCast)
|
||||||
|
{
|
||||||
char aTmp[128];
|
char aTmp[128];
|
||||||
str_format(aTmp, sizeof(aTmp), "\n%s\n", g_Config.m_SvBroadcast);
|
str_format(aTmp, sizeof(aTmp), "\n%s\n", g_Config.m_SvBroadcast);
|
||||||
strcat(aBuftime, aTmp);
|
strcat(aBuftime, aTmp);
|
||||||
}
|
}
|
||||||
GameServer()->SendBroadcast(aBuftime, m_pPlayer->GetCID());
|
GameServer()->SendBroadcast(aBuftime, m_pPlayer->GetCID());
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if( g_Config.m_SvBroadcast[0] != 0) {
|
if( g_Config.m_SvBroadcast[0] != 0) {
|
||||||
char aTmp[128];
|
char aTmp[128];
|
||||||
str_format(aTmp, sizeof(aTmp), "%s\n", g_Config.m_SvBroadcast);
|
str_format(aTmp, sizeof(aTmp), "%s\n", g_Config.m_SvBroadcast);
|
||||||
|
|
|
@ -170,6 +170,9 @@ public:
|
||||||
int m_CpActive;
|
int m_CpActive;
|
||||||
float m_CpCurrent[25];
|
float m_CpCurrent[25];
|
||||||
|
|
||||||
|
int m_BroadTime;
|
||||||
|
int m_BroadCast;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// info for dead reckoning
|
// info for dead reckoning
|
||||||
|
|
|
@ -737,6 +737,28 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
|
||||||
else
|
else
|
||||||
Score()->ShowRank(p->GetCID(), Server()->ClientName(ClientId));
|
Score()->ShowRank(p->GetCID(), Server()->ClientName(ClientId));
|
||||||
}
|
}
|
||||||
|
else if (!str_comp_nocase(pMsg->m_pMessage, "/time")&&g_Config.m_SvEmotionalTees)
|
||||||
|
{
|
||||||
|
CCharacter* pChr = p->GetCharacter();
|
||||||
|
if (pChr)
|
||||||
|
{
|
||||||
|
if(pChr->m_BroadTime)
|
||||||
|
pChr->m_BroadTime=false;
|
||||||
|
else
|
||||||
|
pChr->m_BroadTime=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!str_comp_nocase(pMsg->m_pMessage, "/broadcast")&&g_Config.m_SvEmotionalTees)
|
||||||
|
{
|
||||||
|
CCharacter* pChr = p->GetCharacter();
|
||||||
|
if (pChr)
|
||||||
|
{
|
||||||
|
if(pChr->m_BroadCast)
|
||||||
|
pChr->m_BroadCast=false;
|
||||||
|
else
|
||||||
|
pChr->m_BroadCast=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (!str_comp_nocase(pMsg->m_pMessage, "/emotepain")&&g_Config.m_SvEmotionalTees)
|
else if (!str_comp_nocase(pMsg->m_pMessage, "/emotepain")&&g_Config.m_SvEmotionalTees)
|
||||||
{
|
{
|
||||||
CCharacter* pChr = p->GetCharacter();
|
CCharacter* pChr = p->GetCharacter();
|
||||||
|
@ -1113,16 +1135,16 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
|
||||||
case EMOTICON_8:
|
case EMOTICON_8:
|
||||||
pChr->m_EmoteType = EMOTE_SURPRISE;
|
pChr->m_EmoteType = EMOTE_SURPRISE;
|
||||||
break;
|
break;
|
||||||
case EMOTICON_13:
|
case EMOTICON_1:
|
||||||
|
case EMOTICON_4:
|
||||||
case EMOTICON_7:
|
case EMOTICON_7:
|
||||||
|
case EMOTICON_13:
|
||||||
pChr->m_EmoteType = EMOTE_BLINK;
|
pChr->m_EmoteType = EMOTE_BLINK;
|
||||||
break;
|
break;
|
||||||
case EMOTICON_3:
|
case EMOTICON_3:
|
||||||
case EMOTICON_6:
|
case EMOTICON_6:
|
||||||
pChr->m_EmoteType = EMOTE_HAPPY;
|
pChr->m_EmoteType = EMOTE_HAPPY;
|
||||||
break;
|
break;
|
||||||
case EMOTICON_1:
|
|
||||||
case EMOTICON_4:
|
|
||||||
case EMOTICON_9:
|
case EMOTICON_9:
|
||||||
case EMOTICON_15:
|
case EMOTICON_15:
|
||||||
pChr->m_EmoteType = EMOTE_PAIN;
|
pChr->m_EmoteType = EMOTE_PAIN;
|
||||||
|
@ -1533,6 +1555,96 @@ void CGameContext::ConUnSuperMe(IConsole::IResult *pResult, void *pUserData, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGameContext::ConShotgun(IConsole::IResult *pResult, void *pUserData, int cid)
|
||||||
|
{
|
||||||
|
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||||
|
if(!pSelf->CheatsAvailable(cid)) return;
|
||||||
|
int cid1 = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
|
||||||
|
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||||
|
{
|
||||||
|
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||||
|
if(chr)
|
||||||
|
{
|
||||||
|
chr->GiveWeapon(WEAPON_SHOTGUN,-1);
|
||||||
|
if(!g_Config.m_SvCheatTime)
|
||||||
|
chr->m_RaceState = RACE_CHEAT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameContext::ConShotgunMe(IConsole::IResult *pResult, void *pUserData, int cid)
|
||||||
|
{
|
||||||
|
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||||
|
if(!pSelf->CheatsAvailable(cid)) return;
|
||||||
|
CCharacter* chr = pSelf->GetPlayerChar(cid);
|
||||||
|
if(chr)
|
||||||
|
{
|
||||||
|
chr->GiveWeapon(WEAPON_SHOTGUN,-1);
|
||||||
|
if(!g_Config.m_SvCheatTime)
|
||||||
|
chr->m_RaceState = RACE_CHEAT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameContext::ConGrenade(IConsole::IResult *pResult, void *pUserData, int cid)
|
||||||
|
{
|
||||||
|
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||||
|
if(!pSelf->CheatsAvailable(cid)) return;
|
||||||
|
int cid1 = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
|
||||||
|
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||||
|
{
|
||||||
|
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||||
|
if(chr)
|
||||||
|
{
|
||||||
|
chr->GiveWeapon(WEAPON_GRENADE,-1);
|
||||||
|
if(!g_Config.m_SvCheatTime)
|
||||||
|
chr->m_RaceState = RACE_CHEAT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameContext::ConGrenadeMe(IConsole::IResult *pResult, void *pUserData, int cid)
|
||||||
|
{
|
||||||
|
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||||
|
if(!pSelf->CheatsAvailable(cid)) return;
|
||||||
|
CCharacter* chr = pSelf->GetPlayerChar(cid);
|
||||||
|
if(chr)
|
||||||
|
{
|
||||||
|
chr->GiveWeapon(WEAPON_GRENADE,-1);
|
||||||
|
if(!g_Config.m_SvCheatTime)
|
||||||
|
chr->m_RaceState = RACE_CHEAT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameContext::ConLaser(IConsole::IResult *pResult, void *pUserData, int cid)
|
||||||
|
{
|
||||||
|
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||||
|
if(!pSelf->CheatsAvailable(cid)) return;
|
||||||
|
int cid1 = clamp(pResult->GetInteger(0), 0, (int)MAX_CLIENTS-1);
|
||||||
|
if (pSelf->m_apPlayers[cid1] && compare_players(pSelf->m_apPlayers[cid],pSelf->m_apPlayers[cid1]))
|
||||||
|
{
|
||||||
|
CCharacter* chr = pSelf->GetPlayerChar(cid1);
|
||||||
|
if(chr)
|
||||||
|
{
|
||||||
|
chr->GiveWeapon(WEAPON_RIFLE,-1);
|
||||||
|
if(!g_Config.m_SvCheatTime)
|
||||||
|
chr->m_RaceState = RACE_CHEAT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameContext::ConLaserMe(IConsole::IResult *pResult, void *pUserData, int cid)
|
||||||
|
{
|
||||||
|
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||||
|
if(!pSelf->CheatsAvailable(cid)) return;
|
||||||
|
CCharacter* chr = pSelf->GetPlayerChar(cid);
|
||||||
|
if(chr)
|
||||||
|
{
|
||||||
|
chr->GiveWeapon(WEAPON_RIFLE,-1);
|
||||||
|
if(!g_Config.m_SvCheatTime)
|
||||||
|
chr->m_RaceState = RACE_CHEAT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CGameContext::ConWeapons(IConsole::IResult *pResult, void *pUserData, int cid)
|
void CGameContext::ConWeapons(IConsole::IResult *pResult, void *pUserData, int cid)
|
||||||
{
|
{
|
||||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||||
|
@ -1736,6 +1848,12 @@ void CGameContext::OnConsoleInit()
|
||||||
|
|
||||||
Console()->Register("tele", "ii", CFGFLAG_SERVER, ConTeleport, this, "Teleports Player i1 to i2",2);
|
Console()->Register("tele", "ii", CFGFLAG_SERVER, ConTeleport, this, "Teleports Player i1 to i2",2);
|
||||||
|
|
||||||
|
Console()->Register("shotgun", "i", CFGFLAG_SERVER, ConShotgun, this, "Give shotgun weapon to player i",2);
|
||||||
|
Console()->Register("shotgun_me", "", CFGFLAG_SERVER, ConShotgunMe, this, "Give shotgun weapon to self",1);
|
||||||
|
Console()->Register("grenade", "i", CFGFLAG_SERVER, ConGrenade, this, "Give grenade weapon to player i",2);
|
||||||
|
Console()->Register("grenade_me", "", CFGFLAG_SERVER, ConGrenadeMe, this, "Give grenade weapon to self",1);
|
||||||
|
Console()->Register("laser", "i", CFGFLAG_SERVER, ConLaser, this, "Give rifle weapon to player i",2);
|
||||||
|
Console()->Register("laser_me", "", CFGFLAG_SERVER, ConLaserMe, this, "Give rifle weapon to self",1);
|
||||||
Console()->Register("weapons", "i", CFGFLAG_SERVER, ConWeapons, this, "Give all weapons to player i",2);
|
Console()->Register("weapons", "i", CFGFLAG_SERVER, ConWeapons, this, "Give all weapons to player i",2);
|
||||||
Console()->Register("weapons_me", "", CFGFLAG_SERVER, ConWeaponsMe, this, "Give all weapons to self",1);
|
Console()->Register("weapons_me", "", CFGFLAG_SERVER, ConWeaponsMe, this, "Give all weapons to self",1);
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,14 @@ class CGameContext : public IGameServer
|
||||||
static void ConSuper(IConsole::IResult *pResult, void *pUserData, int cid);
|
static void ConSuper(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
static void ConSuperMe(IConsole::IResult *pResult, void *pUserData, int cid);
|
static void ConSuperMe(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
|
|
||||||
static void ConWeaponsMe(IConsole::IResult *pResult, void *pUserData, int cid);
|
static void ConShotgun(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
|
static void ConShotgunMe(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
|
static void ConGrenade(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
|
static void ConGrenadeMe(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
|
static void ConRifle(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
|
static void ConRifleMe(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
static void ConWeapons(IConsole::IResult *pResult, void *pUserData, int cid);
|
static void ConWeapons(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
|
static void ConWeaponsMe(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
|
|
||||||
static void ConTeleport(IConsole::IResult *pResult, void *pUserData, int cid);
|
static void ConTeleport(IConsole::IResult *pResult, void *pUserData, int cid);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue