mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
fix timakro review
This commit is contained in:
parent
b1ad69633f
commit
97ecd62214
|
@ -166,39 +166,36 @@ void CLaser::DoBounce()
|
|||
}
|
||||
}
|
||||
|
||||
if (m_Owner >= 0 && m_Energy <= 0 && m_Pos && !m_TeleportCancelled)
|
||||
CCharacter *pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
|
||||
if (m_Owner >= 0 && m_Energy <= 0 && m_Pos && !m_TeleportCancelled && pOwnerChar &&
|
||||
pOwnerChar->IsAlive() && pOwnerChar->m_HasTeleLaser && m_Type == WEAPON_RIFLE)
|
||||
{
|
||||
CCharacter *pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
|
||||
vec2 PossiblePos;
|
||||
bool Found = false;
|
||||
|
||||
if (pOwnerChar && pOwnerChar->IsAlive() && pOwnerChar->m_HasTeleLaser && m_Type == WEAPON_RIFLE)
|
||||
// Check if the laser hits a player.
|
||||
bool pDontHitSelf = g_Config.m_SvOldLaser || (m_Bounces == 0 && !m_WasTele);
|
||||
vec2 At;
|
||||
CCharacter *pHit;
|
||||
if (pOwnerChar ? (!(pOwnerChar->m_Hit&CCharacter::DISABLE_HIT_RIFLE) && m_Type == WEAPON_RIFLE) : g_Config.m_SvHit)
|
||||
pHit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, pDontHitSelf ? pOwnerChar : 0, m_Owner);
|
||||
else
|
||||
pHit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, pDontHitSelf ? pOwnerChar : 0, m_Owner, pOwnerChar);
|
||||
|
||||
if (pHit)
|
||||
Found = GetNearestAirPosPlayer(pHit->m_Pos, &PossiblePos);
|
||||
else
|
||||
Found = GetNearestAirPos(m_Pos, m_From, &PossiblePos);
|
||||
|
||||
if (Found && PossiblePos)
|
||||
{
|
||||
vec2 PossiblePos;
|
||||
bool Found = false;
|
||||
|
||||
// Check if the laser hits a player.
|
||||
bool pDontHitSelf = g_Config.m_SvOldLaser || (m_Bounces == 0 && !m_WasTele);
|
||||
vec2 At;
|
||||
CCharacter *pHit;
|
||||
if(pOwnerChar ? (!(pOwnerChar->m_Hit&CCharacter::DISABLE_HIT_RIFLE) && m_Type == WEAPON_RIFLE) : g_Config.m_SvHit)
|
||||
pHit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, pDontHitSelf ? pOwnerChar : 0, m_Owner);
|
||||
else
|
||||
pHit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, pDontHitSelf ? pOwnerChar : 0, m_Owner, pOwnerChar);
|
||||
|
||||
if(pHit)
|
||||
Found = GetNearestAirPosPlayer(pHit->m_Pos, &PossiblePos);
|
||||
else
|
||||
Found = GetNearestAirPos(m_Pos, m_From, &PossiblePos);
|
||||
|
||||
if (Found && PossiblePos)
|
||||
{
|
||||
pOwnerChar->m_TeleGunPos = PossiblePos;
|
||||
pOwnerChar->m_TeleGunTeleport = true;
|
||||
}
|
||||
pOwnerChar->m_TeleGunPos = PossiblePos;
|
||||
pOwnerChar->m_TeleGunTeleport = true;
|
||||
}
|
||||
}
|
||||
else if(m_Owner >= 0 && m_Pos)
|
||||
{
|
||||
int MapIndex = GameServer()->Collision()->GetPureMapIndex(round_to_int(Coltile.x), round_to_int(Coltile.y));
|
||||
int MapIndex = GameServer()->Collision()->GetPureMapIndex(Coltile);
|
||||
int TileIndex = GameServer()->Collision()->GetTileIndex(MapIndex);
|
||||
int TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex);
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ void CProjectile::Tick()
|
|||
|
||||
CCharacter *pTargetChr = nullptr;
|
||||
|
||||
if(!(pOwnerChar ? (pOwnerChar->m_Hit&CCharacter::DISABLE_HIT_GRENADE) : g_Config.m_SvHit))
|
||||
if((pOwnerChar ? !(pOwnerChar->m_Hit&CCharacter::DISABLE_HIT_GRENADE) : g_Config.m_SvHit))
|
||||
pTargetChr = GameServer()->m_World.IntersectCharacter(PrevPos, ColPos, m_Freeze ? 1.0f : 6.0f, ColPos, pOwnerChar, m_Owner);
|
||||
|
||||
if(m_LifeSpan > -1)
|
||||
|
@ -174,12 +174,11 @@ void CProjectile::Tick()
|
|||
if (pOwnerChar && ColPos && !GameLayerClipped(ColPos) &&
|
||||
((m_Type == WEAPON_GRENADE && pOwnerChar->m_HasTeleGrenade) || (m_Type == WEAPON_GUN && pOwnerChar->m_HasTeleGun)))
|
||||
{
|
||||
int MapIndex = GameServer()->Collision()->GetPureMapIndex(pTargetChr ? pTargetChr->m_Pos.x : ColPos.x,
|
||||
pTargetChr ? pTargetChr->m_Pos.y : ColPos.y);
|
||||
int MapIndex = GameServer()->Collision()->GetPureMapIndex(pTargetChr ? pTargetChr->m_Pos : ColPos);
|
||||
int TileIndex = GameServer()->Collision()->GetTileIndex(MapIndex);
|
||||
int TileFIndex = GameServer()->Collision()->GetFTileIndex(MapIndex);
|
||||
|
||||
if ((m_Type == WEAPON_GUN || m_Type == WEAPON_GRENADE) && (TileIndex != TILE_NO_TELE_GUN && TileFIndex != TILE_NO_TELE_GUN))
|
||||
if (TileIndex != TILE_NO_TELE_GUN && TileFIndex != TILE_NO_TELE_GUN)
|
||||
{
|
||||
bool Found;
|
||||
vec2 PossiblePos;
|
||||
|
|
Loading…
Reference in a new issue