mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
Added the Missing Single Tee No Hitting Logic
This commit is contained in:
parent
959b11b13d
commit
3d07ffdbdd
|
@ -307,7 +307,7 @@ void CCharacter::FireWeapon()
|
||||||
m_NumObjectsHit = 0;
|
m_NumObjectsHit = 0;
|
||||||
GameServer()->CreateSound(m_Pos, SOUND_HAMMER_FIRE, Teams()->TeamMask(Team()));
|
GameServer()->CreateSound(m_Pos, SOUND_HAMMER_FIRE, Teams()->TeamMask(Team()));
|
||||||
|
|
||||||
if (!g_Config.m_SvHit) break;
|
if (!m_Hit) break;
|
||||||
|
|
||||||
CCharacter *apEnts[MAX_CLIENTS];
|
CCharacter *apEnts[MAX_CLIENTS];
|
||||||
int Hits = 0;
|
int Hits = 0;
|
||||||
|
@ -1500,4 +1500,5 @@ void CCharacter::DDRaceInit()
|
||||||
m_DefEmote = EMOTE_NORMAL;
|
m_DefEmote = EMOTE_NORMAL;
|
||||||
m_DefEmoteReset = -1;
|
m_DefEmoteReset = -1;
|
||||||
m_TeleCheckpoint = 0;
|
m_TeleCheckpoint = 0;
|
||||||
|
m_Hit = g_Config.m_SvHit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,12 @@ bool CLaser::HitCharacter(vec2 From, vec2 To)
|
||||||
CCharacter *pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
|
CCharacter *pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
|
||||||
CCharacter *pHit;
|
CCharacter *pHit;
|
||||||
|
|
||||||
if(g_Config.m_SvHit)
|
if(pOwnerChar ? pOwnerChar->m_Hit : g_Config.m_SvHit)
|
||||||
pHit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, g_Config.m_SvOldLaser || m_Bounces == 0 ? pOwnerChar : 0, m_Owner);
|
pHit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, g_Config.m_SvOldLaser || m_Bounces == 0 ? pOwnerChar : 0, m_Owner);
|
||||||
else
|
else
|
||||||
pHit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, g_Config.m_SvOldLaser || m_Bounces == 0 ? pOwnerChar : 0, m_Owner, pOwnerChar);
|
pHit = GameServer()->m_World.IntersectCharacter(m_Pos, To, 0.f, At, g_Config.m_SvOldLaser || m_Bounces == 0 ? pOwnerChar : 0, m_Owner, pOwnerChar);
|
||||||
|
|
||||||
if(!pHit || (pHit == pOwnerChar && g_Config.m_SvOldLaser) || (pHit != pOwnerChar && !g_Config.m_SvHit))
|
if(!pHit || (pHit == pOwnerChar && g_Config.m_SvOldLaser) || (pHit != pOwnerChar && pOwnerChar ? !pOwnerChar->m_Hit : !g_Config.m_SvHit))
|
||||||
return false;
|
return false;
|
||||||
m_From = From;
|
m_From = From;
|
||||||
m_Pos = At;
|
m_Pos = At;
|
||||||
|
|
|
@ -87,14 +87,14 @@ void CProjectile::Tick()
|
||||||
vec2 NewPos;
|
vec2 NewPos;
|
||||||
vec2 Speed = CurPos - PrevPos;
|
vec2 Speed = CurPos - PrevPos;
|
||||||
int Collide = GameServer()->Collision()->IntersectLine(PrevPos, CurPos, &ColPos, &NewPos, false);
|
int Collide = GameServer()->Collision()->IntersectLine(PrevPos, CurPos, &ColPos, &NewPos, false);
|
||||||
CCharacter *OwnerChar = 0;
|
CCharacter *pOwnerChar = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(m_Owner >= 0)
|
if(m_Owner >= 0)
|
||||||
OwnerChar = GameServer()->GetPlayerChar(m_Owner);
|
pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
|
||||||
|
|
||||||
CCharacter *TargetChr = GameServer()->m_World.IntersectCharacter(PrevPos, ColPos, m_Freeze ? 1.0f : 6.0f, ColPos, OwnerChar);
|
CCharacter *pTargetChr = GameServer()->m_World.IntersectCharacter(PrevPos, ColPos, m_Freeze ? 1.0f : 6.0f, ColPos, pOwnerChar);
|
||||||
|
|
||||||
if(m_LifeSpan > -1)
|
if(m_LifeSpan > -1)
|
||||||
m_LifeSpan--;
|
m_LifeSpan--;
|
||||||
|
@ -103,31 +103,31 @@ void CProjectile::Tick()
|
||||||
bool isWeaponCollide = false;
|
bool isWeaponCollide = false;
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
OwnerChar &&
|
pOwnerChar &&
|
||||||
TargetChr &&
|
pTargetChr &&
|
||||||
OwnerChar->IsAlive() &&
|
pOwnerChar->IsAlive() &&
|
||||||
TargetChr->IsAlive() &&
|
pTargetChr->IsAlive() &&
|
||||||
!TargetChr->CanCollide(m_Owner)
|
!pTargetChr->CanCollide(m_Owner)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
isWeaponCollide = true;
|
isWeaponCollide = true;
|
||||||
//TeamMask = OwnerChar->Teams()->TeamMask( OwnerChar->Team());
|
//TeamMask = OwnerChar->Teams()->TeamMask( OwnerChar->Team());
|
||||||
}
|
}
|
||||||
if (OwnerChar && OwnerChar->IsAlive())
|
if (pOwnerChar && pOwnerChar->IsAlive())
|
||||||
{
|
{
|
||||||
TeamMask = OwnerChar->Teams()->TeamMask( OwnerChar->Team());
|
TeamMask = pOwnerChar->Teams()->TeamMask( pOwnerChar->Team());
|
||||||
}
|
}
|
||||||
if( ((TargetChr && (g_Config.m_SvHit || m_Owner == -1 || TargetChr == OwnerChar)) || Collide || GameLayerClipped(CurPos)) && !isWeaponCollide)//TODO:TEAM
|
if( ((pTargetChr && (pOwnerChar ? pOwnerChar->m_Hit : g_Config.m_SvHit || m_Owner == -1 || pTargetChr == pOwnerChar)) || Collide || GameLayerClipped(CurPos)) && !isWeaponCollide)//TODO:TEAM
|
||||||
{
|
{
|
||||||
if(m_Explosive/*??*/ && (!TargetChr || (TargetChr && !m_Freeze)))
|
if(m_Explosive/*??*/ && (!pTargetChr || (pTargetChr && !m_Freeze)))
|
||||||
{
|
{
|
||||||
GameServer()->CreateExplosion(ColPos, m_Owner, m_Weapon, m_Owner == -1, (!TargetChr ? -1 : TargetChr->Team()),
|
GameServer()->CreateExplosion(ColPos, m_Owner, m_Weapon, m_Owner == -1, (!pTargetChr ? -1 : pTargetChr->Team()),
|
||||||
(m_Owner != -1)? TeamMask : -1);
|
(m_Owner != -1)? TeamMask : -1);
|
||||||
GameServer()->CreateSound(ColPos, m_SoundImpact,
|
GameServer()->CreateSound(ColPos, m_SoundImpact,
|
||||||
(m_Owner != -1)? TeamMask : -1);
|
(m_Owner != -1)? TeamMask : -1);
|
||||||
}
|
}
|
||||||
else if(TargetChr && m_Freeze && ((m_Layer == LAYER_SWITCH && GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[TargetChr->Team()]) || m_Layer != LAYER_SWITCH))
|
else if(pTargetChr && m_Freeze && ((m_Layer == LAYER_SWITCH && GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[pTargetChr->Team()]) || m_Layer != LAYER_SWITCH))
|
||||||
TargetChr->Freeze();
|
pTargetChr->Freeze();
|
||||||
if(Collide && m_Bouncing != 0)
|
if(Collide && m_Bouncing != 0)
|
||||||
{
|
{
|
||||||
m_StartTick = Server()->Tick();
|
m_StartTick = Server()->Tick();
|
||||||
|
@ -170,12 +170,12 @@ void CProjectile::Snap(int SnappingClient)
|
||||||
if(NetworkClipped(SnappingClient, GetPos(Ct)))
|
if(NetworkClipped(SnappingClient, GetPos(Ct)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CCharacter * SnapChar = GameServer()->GetPlayerChar(SnappingClient);
|
CCharacter* pSnapChar = GameServer()->GetPlayerChar(SnappingClient);
|
||||||
int Tick = (Server()->Tick()%Server()->TickSpeed())%((m_Explosive)?6:20);
|
int Tick = (Server()->Tick()%Server()->TickSpeed())%((m_Explosive)?6:20);
|
||||||
if (SnapChar && SnapChar->IsAlive() && (m_Layer == LAYER_SWITCH && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[SnapChar->Team()] && (!Tick)))
|
if (pSnapChar && pSnapChar->IsAlive() && (m_Layer == LAYER_SWITCH && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[pSnapChar->Team()] && (!Tick)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(SnapChar && m_Owner != -1 && !SnapChar->CanCollide(m_Owner))
|
if(pSnapChar && m_Owner != -1 && !pSnapChar->CanCollide(m_Owner))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CNetObj_Projectile *pProj = static_cast<CNetObj_Projectile *>(Server()->SnapNewItem(NETOBJTYPE_PROJECTILE, m_ID, sizeof(CNetObj_Projectile)));
|
CNetObj_Projectile *pProj = static_cast<CNetObj_Projectile *>(Server()->SnapNewItem(NETOBJTYPE_PROJECTILE, m_ID, sizeof(CNetObj_Projectile)));
|
||||||
|
|
|
@ -160,12 +160,12 @@ void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamag
|
||||||
l = 1-clamp((l-InnerRadius)/(Radius-InnerRadius), 0.0f, 1.0f);
|
l = 1-clamp((l-InnerRadius)/(Radius-InnerRadius), 0.0f, 1.0f);
|
||||||
float Dmg = 6 * l;
|
float Dmg = 6 * l;
|
||||||
if((int)Dmg)
|
if((int)Dmg)
|
||||||
if((g_Config.m_SvHit||NoDamage) || Owner == apEnts[i]->GetPlayer()->GetCID())
|
if((GetPlayerChar(Owner) ? GetPlayerChar(Owner)->m_Hit : g_Config.m_SvHit || NoDamage) || Owner == apEnts[i]->GetPlayer()->GetCID())
|
||||||
{
|
{
|
||||||
if(Owner != -1 && apEnts[i]->IsAlive() && !apEnts[i]->CanCollide(Owner)) continue;
|
if(Owner != -1 && apEnts[i]->IsAlive() && !apEnts[i]->CanCollide(Owner)) continue;
|
||||||
if(Owner == -1 && ActivatedTeam != -1 && apEnts[i]->IsAlive() && apEnts[i]->Team() != ActivatedTeam) continue;
|
if(Owner == -1 && ActivatedTeam != -1 && apEnts[i]->IsAlive() && apEnts[i]->Team() != ActivatedTeam) continue;
|
||||||
apEnts[i]->TakeDamage(ForceDir*Dmg*2, (int)Dmg, Owner, Weapon);
|
apEnts[i]->TakeDamage(ForceDir*Dmg*2, (int)Dmg, Owner, Weapon);
|
||||||
if(!g_Config.m_SvHit||NoDamage) break;
|
if(GetPlayerChar(Owner) ? !GetPlayerChar(Owner)->m_Hit : !g_Config.m_SvHit && !(GetPlayerChar(Owner) && GetPlayerChar(Owner)->m_Hit) || NoDamage) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
|
|
Loading…
Reference in a new issue