From 3c1c0457225a30911a0d87567c58772f675128e9 Mon Sep 17 00:00:00 2001 From: GreYFoXGTi Date: Sun, 14 Nov 2010 12:01:42 +0200 Subject: [PATCH] Added Flicker effect to NON-Active Entities --- src/game/server/entities/door.cpp | 2 ++ src/game/server/entities/dragger.cpp | 4 +++- src/game/server/entities/gun.cpp | 7 +++++-- src/game/server/entities/light.cpp | 2 ++ src/game/server/entities/pickup.cpp | 3 +++ src/game/server/entities/plasma.cpp | 2 ++ src/game/server/entities/projectile.cpp | 3 ++- 7 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/game/server/entities/door.cpp b/src/game/server/entities/door.cpp index 88828c9ba..64d4f31fb 100644 --- a/src/game/server/entities/door.cpp +++ b/src/game/server/entities/door.cpp @@ -65,6 +65,8 @@ void CDoor::Snap(int SnappingClient) pObj->m_Y = (int)m_Pos.y; CCharacter * Char = GameServer()->GetPlayerChar(SnappingClient); + int Tick = (Server()->Tick()%Server()->TickSpeed())%11; + if (Char && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[Char->Team()] && (!Tick)) return; if(Char == 0) return; if(Char->Team() == TEAM_SUPER) diff --git a/src/game/server/entities/dragger.cpp b/src/game/server/entities/dragger.cpp index e97ae9cec..159b72030 100644 --- a/src/game/server/entities/dragger.cpp +++ b/src/game/server/entities/dragger.cpp @@ -26,7 +26,7 @@ CDragger::CDragger(CGameWorld *pGameWorld, vec2 Pos, float Strength, bool NW, in void CDragger::Move() { - if(m_Target && m_Target->m_Super) + if(m_Target && m_Target->m_Alive && (m_Target->m_Super || m_Layer == LAYER_SWITCH && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[m_Target->Team()])) m_Target = 0; if(m_Target) return; @@ -123,6 +123,8 @@ void CDragger::Snap(int SnappingClient) return; CCharacter * Char = GameServer()->GetPlayerChar(SnappingClient); + int Tick = (Server()->Tick()%Server()->TickSpeed())%11; + if (Char && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[Char->Team()] && (!Tick)) return; if(Char && m_Target && Char->Team() != m_Target->Team()) return; CNetObj_Laser *obj = static_cast(Server()->SnapNewItem(NETOBJTYPE_LASER, m_Id, sizeof(CNetObj_Laser))); diff --git a/src/game/server/entities/gun.cpp b/src/game/server/entities/gun.cpp index 3d7ad2792..39240d6b0 100644 --- a/src/game/server/entities/gun.cpp +++ b/src/game/server/entities/gun.cpp @@ -88,11 +88,14 @@ void CGun::Tick() } -void CGun::Snap(int snapping_client) +void CGun::Snap(int SnappingClient) { - if(NetworkClipped(snapping_client)) + if(NetworkClipped(SnappingClient)) return; + CCharacter * SnapChar = GameServer()->GetPlayerChar(SnappingClient); + int Tick = (Server()->Tick()%Server()->TickSpeed())%11; + if (SnapChar && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[SnapChar->Team()] && (!Tick)) return; CNetObj_Laser *pObj = static_cast(Server()->SnapNewItem(NETOBJTYPE_LASER, m_Id, sizeof(CNetObj_Laser))); pObj->m_X = (int)m_Pos.x; pObj->m_Y = (int)m_Pos.y; diff --git a/src/game/server/entities/light.cpp b/src/game/server/entities/light.cpp index caf5b2e69..34390779b 100644 --- a/src/game/server/entities/light.cpp +++ b/src/game/server/entities/light.cpp @@ -112,6 +112,8 @@ void CLight::Snap(int SnappingClient) pObj->m_Y = (int)m_Pos.y; CCharacter * Char = GameServer()->GetPlayerChar(SnappingClient); + int Tick = (Server()->Tick()%Server()->TickSpeed())%6; + if (Char && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[Char->Team()] && (Tick)) return; if(Char == 0) return; if(Char->Team() == TEAM_SUPER) diff --git a/src/game/server/entities/pickup.cpp b/src/game/server/entities/pickup.cpp index 3105cf6dd..fe0d904c5 100644 --- a/src/game/server/entities/pickup.cpp +++ b/src/game/server/entities/pickup.cpp @@ -153,6 +153,9 @@ void CPickup::Snap(int SnappingClient) if(m_SpawnTick != -1 || NetworkClipped(SnappingClient)) return; */ + CCharacter * SnapChar = GameServer()->GetPlayerChar(SnappingClient); + int Tick = (Server()->Tick()%Server()->TickSpeed())%11; + if (SnapChar && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[SnapChar->Team()] && (!Tick)) return; CNetObj_Pickup *pP = static_cast(Server()->SnapNewItem(NETOBJTYPE_PICKUP, m_Id, sizeof(CNetObj_Pickup))); pP->m_X = (int)m_Pos.x; pP->m_Y = (int)m_Pos.y; diff --git a/src/game/server/entities/plasma.cpp b/src/game/server/entities/plasma.cpp index 5f9875ac6..e1bb14ea9 100644 --- a/src/game/server/entities/plasma.cpp +++ b/src/game/server/entities/plasma.cpp @@ -79,7 +79,9 @@ void CPlasma::Snap(int SnappingClient) if(NetworkClipped(SnappingClient)) return; CCharacter* SnapChar = GameServer()->GetPlayerChar(SnappingClient); + int Tick = (Server()->Tick()%Server()->TickSpeed())%11; if(!SnapChar) return; + if (!GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[SnapChar->Team()] && (!Tick)) return; if((SnapChar->Team() != m_ResponsibleTeam) && !SnapChar->GetPlayer()->m_IsUsingDDRaceClient) return; CNetObj_Laser *pObj = static_cast(Server()->SnapNewItem(NETOBJTYPE_LASER, m_Id, sizeof(CNetObj_Laser))); pObj->m_X = (int)m_Pos.x; diff --git a/src/game/server/entities/projectile.cpp b/src/game/server/entities/projectile.cpp index 72f92d9c6..1bb4e37e6 100644 --- a/src/game/server/entities/projectile.cpp +++ b/src/game/server/entities/projectile.cpp @@ -171,7 +171,8 @@ void CProjectile::Snap(int SnappingClient) if(NetworkClipped(SnappingClient, GetPos(Ct))) return; CCharacter * SnapChar = GameServer()->GetPlayerChar(SnappingClient); - if (!GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[SnapChar->Team()]) return; + int Tick = (Server()->Tick()%Server()->TickSpeed())%6; + if (SnapChar && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[SnapChar->Team()] && (Tick)) return; if (