Added the Missing Single Tee No Hitting Logic

This commit is contained in:
GreYFoX 2011-07-21 03:13:59 +02:00
parent 959b11b13d
commit 3d07ffdbdd
4 changed files with 24 additions and 23 deletions

View file

@ -307,7 +307,7 @@ void CCharacter::FireWeapon()
m_NumObjectsHit = 0;
GameServer()->CreateSound(m_Pos, SOUND_HAMMER_FIRE, Teams()->TeamMask(Team()));
if (!g_Config.m_SvHit) break;
if (!m_Hit) break;
CCharacter *apEnts[MAX_CLIENTS];
int Hits = 0;
@ -1500,4 +1500,5 @@ void CCharacter::DDRaceInit()
m_DefEmote = EMOTE_NORMAL;
m_DefEmoteReset = -1;
m_TeleCheckpoint = 0;
m_Hit = g_Config.m_SvHit;
}

View file

@ -28,12 +28,12 @@ bool CLaser::HitCharacter(vec2 From, vec2 To)
CCharacter *pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
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);
else
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;
m_From = From;
m_Pos = At;

View file

@ -87,14 +87,14 @@ void CProjectile::Tick()
vec2 NewPos;
vec2 Speed = CurPos - PrevPos;
int Collide = GameServer()->Collision()->IntersectLine(PrevPos, CurPos, &ColPos, &NewPos, false);
CCharacter *OwnerChar = 0;
CCharacter *pOwnerChar = 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)
m_LifeSpan--;
@ -103,31 +103,31 @@ void CProjectile::Tick()
bool isWeaponCollide = false;
if
(
OwnerChar &&
TargetChr &&
OwnerChar->IsAlive() &&
TargetChr->IsAlive() &&
!TargetChr->CanCollide(m_Owner)
pOwnerChar &&
pTargetChr &&
pOwnerChar->IsAlive() &&
pTargetChr->IsAlive() &&
!pTargetChr->CanCollide(m_Owner)
)
{
isWeaponCollide = true;
//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);
GameServer()->CreateSound(ColPos, m_SoundImpact,
(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))
TargetChr->Freeze();
else if(pTargetChr && m_Freeze && ((m_Layer == LAYER_SWITCH && GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[pTargetChr->Team()]) || m_Layer != LAYER_SWITCH))
pTargetChr->Freeze();
if(Collide && m_Bouncing != 0)
{
m_StartTick = Server()->Tick();
@ -170,12 +170,12 @@ void CProjectile::Snap(int SnappingClient)
if(NetworkClipped(SnappingClient, GetPos(Ct)))
return;
CCharacter * SnapChar = GameServer()->GetPlayerChar(SnappingClient);
CCharacter* pSnapChar = GameServer()->GetPlayerChar(SnappingClient);
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;
if(SnapChar && m_Owner != -1 && !SnapChar->CanCollide(m_Owner))
if(pSnapChar && m_Owner != -1 && !pSnapChar->CanCollide(m_Owner))
return;
CNetObj_Projectile *pProj = static_cast<CNetObj_Projectile *>(Server()->SnapNewItem(NETOBJTYPE_PROJECTILE, m_ID, sizeof(CNetObj_Projectile)));

View file

@ -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);
float Dmg = 6 * l;
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 && ActivatedTeam != -1 && apEnts[i]->IsAlive() && apEnts[i]->Team() != ActivatedTeam) continue;
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;
}
}
//}