mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Don't send faketunes to new client versions, and simplify code
This commit is contained in:
parent
6dd38c7da0
commit
d603214133
|
@ -132,13 +132,6 @@ void CCharacter::SetSolo(bool Solo)
|
|||
{
|
||||
m_Core.m_Solo = Solo;
|
||||
Teams()->m_Core.SetSolo(m_pPlayer->GetCID(), Solo);
|
||||
|
||||
if(Solo)
|
||||
m_NeededFaketuning |= FAKETUNE_SOLO;
|
||||
else
|
||||
m_NeededFaketuning &= ~FAKETUNE_SOLO;
|
||||
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
|
||||
void CCharacter::SetSuper(bool Super)
|
||||
|
@ -988,25 +981,29 @@ void CCharacter::SnapCharacter(int SnappingClient, int ID)
|
|||
Weapon = WEAPON_NINJA;
|
||||
}
|
||||
|
||||
// This could probably happen when m_Jetpack changes instead
|
||||
// jetpack and ninjajetpack prediction
|
||||
// solo, collision, jetpack and ninjajetpack prediction
|
||||
if(m_pPlayer->GetCID() == SnappingClient)
|
||||
{
|
||||
if(m_Core.m_Jetpack && Weapon != WEAPON_NINJA)
|
||||
int Faketuning = 0;
|
||||
if(m_pPlayer->GetClientVersion() < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
if(!(m_NeededFaketuning & FAKETUNE_JETPACK))
|
||||
{
|
||||
m_NeededFaketuning |= FAKETUNE_JETPACK;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone);
|
||||
}
|
||||
if(m_Core.m_Jetpack && Weapon != WEAPON_NINJA)
|
||||
Faketuning |= FAKETUNE_JETPACK;
|
||||
if(m_Core.m_Solo)
|
||||
Faketuning |= FAKETUNE_SOLO;
|
||||
if(m_Core.m_HammerHitDisabled)
|
||||
Faketuning |= FAKETUNE_NOHAMMER;
|
||||
if(m_Core.m_CollisionDisabled)
|
||||
Faketuning |= FAKETUNE_NOCOLL;
|
||||
if(m_Core.m_HookHitDisabled)
|
||||
Faketuning |= FAKETUNE_NOHOOK;
|
||||
if(!m_Core.m_EndlessJump && m_Core.m_Jumps == 0)
|
||||
Faketuning |= FAKETUNE_NOJUMP;
|
||||
}
|
||||
else
|
||||
if(Faketuning != m_NeededFaketuning)
|
||||
{
|
||||
if(m_NeededFaketuning & FAKETUNE_JETPACK)
|
||||
{
|
||||
m_NeededFaketuning &= ~FAKETUNE_JETPACK;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone);
|
||||
}
|
||||
m_NeededFaketuning = Faketuning;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1469,8 +1466,6 @@ void CCharacter::HandleTiles(int Index)
|
|||
m_Core.m_ShotgunHitDisabled = true;
|
||||
m_Core.m_GrenadeHitDisabled = true;
|
||||
m_Core.m_LaserHitDisabled = true;
|
||||
m_NeededFaketuning |= FAKETUNE_NOHAMMER;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
else if(((m_TileIndex == TILE_HIT_ENABLE) || (m_TileFIndex == TILE_HIT_ENABLE)) && (m_Core.m_HammerHitDisabled || m_Core.m_ShotgunHitDisabled || m_Core.m_GrenadeHitDisabled || m_Core.m_LaserHitDisabled))
|
||||
{
|
||||
|
@ -1479,8 +1474,6 @@ void CCharacter::HandleTiles(int Index)
|
|||
m_Core.m_GrenadeHitDisabled = false;
|
||||
m_Core.m_HammerHitDisabled = false;
|
||||
m_Core.m_LaserHitDisabled = false;
|
||||
m_NeededFaketuning &= ~FAKETUNE_NOHAMMER;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
|
||||
// collide with others
|
||||
|
@ -1488,15 +1481,11 @@ void CCharacter::HandleTiles(int Index)
|
|||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't collide with others");
|
||||
m_Core.m_CollisionDisabled = true;
|
||||
m_NeededFaketuning |= FAKETUNE_NOCOLL;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
else if(((m_TileIndex == TILE_NPC_ENABLE) || (m_TileFIndex == TILE_NPC_ENABLE)) && m_Core.m_CollisionDisabled)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can collide with others");
|
||||
m_Core.m_CollisionDisabled = false;
|
||||
m_NeededFaketuning &= ~FAKETUNE_NOCOLL;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
|
||||
// hook others
|
||||
|
@ -1504,15 +1493,11 @@ void CCharacter::HandleTiles(int Index)
|
|||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't hook others");
|
||||
m_Core.m_HookHitDisabled = true;
|
||||
m_NeededFaketuning |= FAKETUNE_NOHOOK;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
else if(((m_TileIndex == TILE_NPH_ENABLE) || (m_TileFIndex == TILE_NPH_ENABLE)) && m_Core.m_HookHitDisabled)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can hook others");
|
||||
m_Core.m_HookHitDisabled = false;
|
||||
m_NeededFaketuning &= ~FAKETUNE_NOHOOK;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
|
||||
// unlimited air jumps
|
||||
|
@ -1520,21 +1505,11 @@ void CCharacter::HandleTiles(int Index)
|
|||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You have unlimited air jumps");
|
||||
m_Core.m_EndlessJump = true;
|
||||
if(m_Core.m_Jumps == 0)
|
||||
{
|
||||
m_NeededFaketuning &= ~FAKETUNE_NOJUMP;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
}
|
||||
else if(((m_TileIndex == TILE_UNLIMITED_JUMPS_DISABLE) || (m_TileFIndex == TILE_UNLIMITED_JUMPS_DISABLE)) && m_Core.m_EndlessJump)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You don't have unlimited air jumps");
|
||||
m_Core.m_EndlessJump = false;
|
||||
if(m_Core.m_Jumps == 0)
|
||||
{
|
||||
m_NeededFaketuning |= FAKETUNE_NOJUMP;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
}
|
||||
|
||||
// walljump
|
||||
|
@ -1683,16 +1658,12 @@ void CCharacter::HandleTiles(int Index)
|
|||
else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Core.m_HammerHitDisabled && Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can hammer hit others");
|
||||
m_NeededFaketuning &= ~FAKETUNE_NOHAMMER;
|
||||
m_Core.m_HammerHitDisabled = false;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Core.m_HammerHitDisabled) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't hammer hit others");
|
||||
m_NeededFaketuning |= FAKETUNE_NOHAMMER;
|
||||
m_Core.m_HammerHitDisabled = true;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Core.m_ShotgunHitDisabled && Collision()->GetSwitchDelay(MapIndex) == WEAPON_SHOTGUN)
|
||||
{
|
||||
|
@ -1742,18 +1713,6 @@ void CCharacter::HandleTiles(int Index)
|
|||
else
|
||||
str_format(aBuf, sizeof(aBuf), "You can jump %d times", NewJumps);
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), aBuf);
|
||||
|
||||
if(NewJumps == 0 && !m_Core.m_EndlessJump)
|
||||
{
|
||||
m_NeededFaketuning |= FAKETUNE_NOJUMP;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
else if(m_Core.m_Jumps == 0)
|
||||
{
|
||||
m_NeededFaketuning &= ~FAKETUNE_NOJUMP;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
|
||||
m_Core.m_Jumps = NewJumps;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue