[hlcoders] Flag not being set?

2005-03-05 Thread Knifa
Hi all.
For no reason at all, flags have stopped being set on my brush entity
(func_fortsite)
This entity is supposed to stop traces from one of my weapons
(weapon_freezer) if you are on the other team (which it does, but it
doesn't do what it's supposed to if has the flag)
When the func_fortsite spawns, I set the flags like this:
   if (m_nTeam == 1)
   {
   AddFlag( FL_FORT_BLUE );
   SetCollisionGroup( COLLISION_GROUP_BLUE_FORT );
   DevMsg(Blue Fort Site\n);
   }
   else
   {
   AddFlag( FL_FORT_RED );
   SetCollisionGroup( COLLISION_GROUP_RED_FORT );
   DevMsg(Red Fort Site\n);
   }
Where m_nTeam is a KeyField, it prints to the console, and everything
seems okay.
On the weapon I do the traces, and check for the flag like this:
trace_t tr;
   if ( pOwner-GetTeamNumber() == TEAM_COMBINE )
   {
   UTIL_TraceLine( start, end, MASK_SHOT, pOwner,
COLLISION_GROUP_BLUE_WEAPONS, tr );
   }
   else
   {
   UTIL_TraceLine( start, end, MASK_SHOT, pOwner,
COLLISION_GROUP_RED_WEAPONS, tr );
   }
   if ( tr.fraction == 1 || (tr.surface.flags  SURF_SKY) )
   return;
   if ( tr.DidHitWorld() )
   return;
   CBaseEntity *pHit = tr.m_pEnt;
   if (!pHit)
   return;
   DevMsg( Team: %d\n, pOwner-GetTeamNumber() );
   DevMsg( %d\n, pHit-GetFlags() );
   if (pOwner-GetTeamNumber() == TEAM_COMBINE)
   {
   if (pHit-GetFlags()  FL_FORT_RED)
   {
   DevMsg(Blue player tried to fire in Red Fort Site\n);
   return;
   }
   }
   else
   {
   if (pHit-GetFlags()  FL_FORT_BLUE)
   {
   DevMsg(Red player tried to fire in Blue Fort Site\n);
   return;
   }
   }
That works fine if you are a combine and firing at a rebel fort site,
but it doesn't if you are a rebel and are firing at a combine site.
When you fire at a combine site, the console says the flags are set to 0.
The weirdest thing is, I hadn't even edited the code when it started
doing this, and it was working before I recompiled.
Does anyone know what might be wrong?
--
Knifa
SourceForts
http://knd.org.uk/sourceforts/
___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


Re: [hlcoders] Flag not being set?

2005-03-05 Thread Knifa
Nevermind, I just get it to get the collision group instead, and that
works.
Hi all.
For no reason at all, flags have stopped being set on my brush entity
(func_fortsite)
This entity is supposed to stop traces from one of my weapons
(weapon_freezer) if you are on the other team (which it does, but it
doesn't do what it's supposed to if has the flag)
When the func_fortsite spawns, I set the flags like this:
   if (m_nTeam == 1)
   {
   AddFlag( FL_FORT_BLUE );
   SetCollisionGroup( COLLISION_GROUP_BLUE_FORT );
   DevMsg(Blue Fort Site\n);
   }
   else
   {
   AddFlag( FL_FORT_RED );
   SetCollisionGroup( COLLISION_GROUP_RED_FORT );
   DevMsg(Red Fort Site\n);
   }
Where m_nTeam is a KeyField, it prints to the console, and everything
seems okay.
On the weapon I do the traces, and check for the flag like this:
trace_t tr;
   if ( pOwner-GetTeamNumber() == TEAM_COMBINE )
   {
   UTIL_TraceLine( start, end, MASK_SHOT, pOwner,
COLLISION_GROUP_BLUE_WEAPONS, tr );
   }
   else
   {
   UTIL_TraceLine( start, end, MASK_SHOT, pOwner,
COLLISION_GROUP_RED_WEAPONS, tr );
   }
   if ( tr.fraction == 1 || (tr.surface.flags  SURF_SKY) )
   return;
   if ( tr.DidHitWorld() )
   return;
   CBaseEntity *pHit = tr.m_pEnt;
   if (!pHit)
   return;
   DevMsg( Team: %d\n, pOwner-GetTeamNumber() );
   DevMsg( %d\n, pHit-GetFlags() );
   if (pOwner-GetTeamNumber() == TEAM_COMBINE)
   {
   if (pHit-GetFlags()  FL_FORT_RED)
   {
   DevMsg(Blue player tried to fire in Red Fort Site\n);
   return;
   }
   }
   else
   {
   if (pHit-GetFlags()  FL_FORT_BLUE)
   {
   DevMsg(Red player tried to fire in Blue Fort Site\n);
   return;
   }
   }
That works fine if you are a combine and firing at a rebel fort site,
but it doesn't if you are a rebel and are firing at a combine site.
When you fire at a combine site, the console says the flags are set to 0.
The weirdest thing is, I hadn't even edited the code when it started
doing this, and it was working before I recompiled.
Does anyone know what might be wrong?
--
Knifa
SourceForts
http://knd.org.uk/sourceforts/
___
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


--
Knifa
SourceForts
http://knd.org.uk/sourceforts/
___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders