mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #5533
5533: revert to send server messages for now r=def- a=C0D3D3V ![grafik](https://user-images.githubusercontent.com/14315968/176440520-5f192f17-b2c1-4140-b27a-b59c73a05349.png) send our old server messages till we come up with a better way to tell the player some effects on him have changed. See https://github.com/ddnet/ddnet/issues/5510 ## Checklist - [x] Tested the change ingame - [x] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [x] Considered possible null pointers and out of bounds array indexing - [x] Changed no physics that affect existing maps - [x] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: c0d3d3v <c0d3d3v@mag-keinen-spam.de>
This commit is contained in:
commit
cbab1fb912
|
@ -1449,11 +1449,8 @@ void CCharacter::HandleTiles(int Index)
|
|||
|
||||
// hit others
|
||||
if(((m_TileIndex == TILE_HIT_DISABLE) || (m_TileFIndex == TILE_HIT_DISABLE)) && m_Hit != (DISABLE_HIT_GRENADE | DISABLE_HIT_HAMMER | DISABLE_HIT_LASER | DISABLE_HIT_SHOTGUN))
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't hit others");
|
||||
}
|
||||
m_Hit = DISABLE_HIT_GRENADE | DISABLE_HIT_HAMMER | DISABLE_HIT_LASER | DISABLE_HIT_SHOTGUN;
|
||||
m_Core.m_NoShotgunHit = true;
|
||||
m_Core.m_NoGrenadeHit = true;
|
||||
|
@ -1463,11 +1460,8 @@ void CCharacter::HandleTiles(int Index)
|
|||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
else if(((m_TileIndex == TILE_HIT_ENABLE) || (m_TileFIndex == TILE_HIT_ENABLE)) && m_Hit != HIT_ALL)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can hit others");
|
||||
}
|
||||
m_Hit = HIT_ALL;
|
||||
m_Core.m_NoShotgunHit = false;
|
||||
m_Core.m_NoGrenadeHit = false;
|
||||
|
@ -1479,21 +1473,15 @@ void CCharacter::HandleTiles(int Index)
|
|||
|
||||
// collide with others
|
||||
if(((m_TileIndex == TILE_NPC_DISABLE) || (m_TileFIndex == TILE_NPC_DISABLE)) && !m_Core.m_NoCollision)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't collide with others");
|
||||
}
|
||||
m_Core.m_NoCollision = 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_NoCollision)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can collide with others");
|
||||
}
|
||||
m_Core.m_NoCollision = false;
|
||||
m_NeededFaketuning &= ~FAKETUNE_NOCOLL;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
|
@ -1501,21 +1489,15 @@ void CCharacter::HandleTiles(int Index)
|
|||
|
||||
// hook others
|
||||
if(((m_TileIndex == TILE_NPH_DISABLE) || (m_TileFIndex == TILE_NPH_DISABLE)) && !m_Core.m_NoHookHit)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't hook others");
|
||||
}
|
||||
m_Core.m_NoHookHit = 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_NoHookHit)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can hook others");
|
||||
}
|
||||
m_Core.m_NoHookHit = false;
|
||||
m_NeededFaketuning &= ~FAKETUNE_NOHOOK;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
|
@ -1523,11 +1505,8 @@ void CCharacter::HandleTiles(int Index)
|
|||
|
||||
// unlimited air jumps
|
||||
if(((m_TileIndex == TILE_UNLIMITED_JUMPS_ENABLE) || (m_TileFIndex == TILE_UNLIMITED_JUMPS_ENABLE)) && !m_SuperJump)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You have unlimited air jumps");
|
||||
}
|
||||
m_SuperJump = true;
|
||||
m_Core.m_EndlessJump = true;
|
||||
if(m_Core.m_Jumps == 0)
|
||||
|
@ -1537,11 +1516,8 @@ void CCharacter::HandleTiles(int Index)
|
|||
}
|
||||
}
|
||||
else if(((m_TileIndex == TILE_UNLIMITED_JUMPS_DISABLE) || (m_TileFIndex == TILE_UNLIMITED_JUMPS_DISABLE)) && m_SuperJump)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You don't have unlimited air jumps");
|
||||
}
|
||||
m_SuperJump = false;
|
||||
m_Core.m_EndlessJump = false;
|
||||
if(m_Core.m_Jumps == 0)
|
||||
|
@ -1564,20 +1540,14 @@ void CCharacter::HandleTiles(int Index)
|
|||
|
||||
// jetpack gun
|
||||
if(((m_TileIndex == TILE_JETPACK_ENABLE) || (m_TileFIndex == TILE_JETPACK_ENABLE)) && !m_Jetpack)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You have a jetpack gun");
|
||||
}
|
||||
m_Jetpack = true;
|
||||
m_Core.m_Jetpack = true;
|
||||
}
|
||||
else if(((m_TileIndex == TILE_JETPACK_DISABLE) || (m_TileFIndex == TILE_JETPACK_DISABLE)) && m_Jetpack)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You lost your jetpack gun");
|
||||
}
|
||||
m_Jetpack = false;
|
||||
m_Core.m_Jetpack = false;
|
||||
}
|
||||
|
@ -1598,53 +1568,41 @@ void CCharacter::HandleTiles(int Index)
|
|||
if(((m_TileIndex == TILE_TELE_GUN_ENABLE) || (m_TileFIndex == TILE_TELE_GUN_ENABLE)) && !m_Core.m_HasTelegunGun)
|
||||
{
|
||||
m_Core.m_HasTelegunGun = true;
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "Teleport gun enabled");
|
||||
}
|
||||
}
|
||||
else if(((m_TileIndex == TILE_TELE_GUN_DISABLE) || (m_TileFIndex == TILE_TELE_GUN_DISABLE)) && m_Core.m_HasTelegunGun)
|
||||
{
|
||||
m_Core.m_HasTelegunGun = false;
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "Teleport gun disabled");
|
||||
}
|
||||
}
|
||||
|
||||
if(((m_TileIndex == TILE_TELE_GRENADE_ENABLE) || (m_TileFIndex == TILE_TELE_GRENADE_ENABLE)) && !m_Core.m_HasTelegunGrenade)
|
||||
{
|
||||
m_Core.m_HasTelegunGrenade = true;
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "Teleport grenade enabled");
|
||||
}
|
||||
}
|
||||
else if(((m_TileIndex == TILE_TELE_GRENADE_DISABLE) || (m_TileFIndex == TILE_TELE_GRENADE_DISABLE)) && m_Core.m_HasTelegunGrenade)
|
||||
{
|
||||
m_Core.m_HasTelegunGrenade = false;
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "Teleport grenade disabled");
|
||||
}
|
||||
}
|
||||
|
||||
if(((m_TileIndex == TILE_TELE_LASER_ENABLE) || (m_TileFIndex == TILE_TELE_LASER_ENABLE)) && !m_Core.m_HasTelegunLaser)
|
||||
{
|
||||
m_Core.m_HasTelegunLaser = true;
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "Teleport laser enabled");
|
||||
}
|
||||
}
|
||||
else if(((m_TileIndex == TILE_TELE_LASER_DISABLE) || (m_TileFIndex == TILE_TELE_LASER_DISABLE)) && m_Core.m_HasTelegunLaser)
|
||||
{
|
||||
m_Core.m_HasTelegunLaser = false;
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "Teleport laser disabled");
|
||||
}
|
||||
}
|
||||
|
||||
// stopper
|
||||
if(m_Core.m_Vel.y > 0 && (m_MoveRestrictions & CANTMOVE_DOWN))
|
||||
|
@ -1717,78 +1675,54 @@ void CCharacter::HandleTiles(int Index)
|
|||
}
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_HAMMER && Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can hammer hit others");
|
||||
}
|
||||
m_Hit &= ~DISABLE_HIT_HAMMER;
|
||||
m_NeededFaketuning &= ~FAKETUNE_NOHAMMER;
|
||||
m_Core.m_NoHammerHit = false;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_HAMMER) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't hammer hit others");
|
||||
}
|
||||
m_Hit |= DISABLE_HIT_HAMMER;
|
||||
m_NeededFaketuning |= FAKETUNE_NOHAMMER;
|
||||
m_Core.m_NoHammerHit = true;
|
||||
GameServer()->SendTuningParams(m_pPlayer->GetCID(), m_TuneZone); // update tunings
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_SHOTGUN && Collision()->GetSwitchDelay(MapIndex) == WEAPON_SHOTGUN)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can shoot others with shotgun");
|
||||
}
|
||||
m_Hit &= ~DISABLE_HIT_SHOTGUN;
|
||||
m_Core.m_NoShotgunHit = false;
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_SHOTGUN) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_SHOTGUN)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't shoot others with shotgun");
|
||||
}
|
||||
m_Hit |= DISABLE_HIT_SHOTGUN;
|
||||
m_Core.m_NoShotgunHit = true;
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_GRENADE && Collision()->GetSwitchDelay(MapIndex) == WEAPON_GRENADE)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can shoot others with grenade");
|
||||
}
|
||||
m_Hit &= ~DISABLE_HIT_GRENADE;
|
||||
m_Core.m_NoGrenadeHit = false;
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_GRENADE) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_GRENADE)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't shoot others with grenade");
|
||||
}
|
||||
m_Hit |= DISABLE_HIT_GRENADE;
|
||||
m_Core.m_NoGrenadeHit = true;
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_LASER && Collision()->GetSwitchDelay(MapIndex) == WEAPON_LASER)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can shoot others with laser");
|
||||
}
|
||||
m_Hit &= ~DISABLE_HIT_LASER;
|
||||
m_Core.m_NoLaserHit = false;
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_DISABLE && !(m_Hit & DISABLE_HIT_LASER) && Collision()->GetSwitchDelay(MapIndex) == WEAPON_LASER)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), "You can't shoot others with laser");
|
||||
}
|
||||
m_Hit |= DISABLE_HIT_LASER;
|
||||
m_Core.m_NoLaserHit = true;
|
||||
}
|
||||
|
@ -1801,8 +1735,6 @@ void CCharacter::HandleTiles(int Index)
|
|||
}
|
||||
|
||||
if(NewJumps != m_Core.m_Jumps)
|
||||
{
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
char aBuf[256];
|
||||
if(NewJumps == -1)
|
||||
|
@ -1812,7 +1744,7 @@ 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_SuperJump)
|
||||
{
|
||||
m_NeededFaketuning |= FAKETUNE_NOJUMP;
|
||||
|
@ -2289,10 +2221,8 @@ void CCharacter::SetEndlessHook(bool Enable)
|
|||
{
|
||||
return;
|
||||
}
|
||||
if(GameServer()->GetClientVersion(GetPlayer()->GetCID()) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(GetPlayer()->GetCID(), Enable ? "Endless hook has been activated" : "Endless hook has been deactivated");
|
||||
}
|
||||
|
||||
m_EndlessHook = Enable;
|
||||
m_Core.m_EndlessHook = Enable;
|
||||
}
|
||||
|
|
|
@ -105,19 +105,13 @@ void CGameControllerDDRace::HandleCharacterTiles(CCharacter *pChr, int MapIndex)
|
|||
|
||||
// solo part
|
||||
if(((m_TileIndex == TILE_SOLO_ENABLE) || (m_TileFIndex == TILE_SOLO_ENABLE)) && !m_Teams.m_Core.GetSolo(ClientID))
|
||||
{
|
||||
if(GameServer()->GetClientVersion(ClientID) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(ClientID, "You are now in a solo part");
|
||||
}
|
||||
pChr->SetSolo(true);
|
||||
}
|
||||
else if(((m_TileIndex == TILE_SOLO_DISABLE) || (m_TileFIndex == TILE_SOLO_DISABLE)) && m_Teams.m_Core.GetSolo(ClientID))
|
||||
{
|
||||
if(GameServer()->GetClientVersion(ClientID) < VERSION_DDNET_NEW_HUD)
|
||||
{
|
||||
GameServer()->SendChatTarget(ClientID, "You are now out of the solo part");
|
||||
}
|
||||
pChr->SetSolo(false);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue