Thread: Sandbot v0.3
View Single Post
Re: Sandbot v0.3
Old
  (#9)
tschumann
Moderator
 
tschumann's Avatar
 
Status: Offline
Posts: 247
Join Date: Apr 2011
Location: Australia
Default Re: Sandbot v0.3 - 04-12-2016

I just did but I'm not sure how it works.

From util.cpp:
Code:
float UTIL_IlluminationOf (edict_t *pEdict) // KWo - 23.03.2012 - rewritten - thanks to Immortal_BLG
{
   // this function returns a value between 0 and 100 corresponding to the entity's illumination.
   // Thanks to William van der Sterren for the human-like illumination filter computation. We
   // only consider noticeable the illuminations between 0 and 30 percent of the maximal value,
   // else it's too bright to be taken in account and we return the full illumination. The HL
   // engine allows entities to have illuminations up to 300 (hence the 75 as 30% of 300). - from RACC


   int entity_index;

   entity_index = ENTINDEX (pEdict) - 1; // get entity index

   // PMB - if pEdict is a bot, we had to create an invisible entity to correctly retrieve the
   // fakeclient's illumination (thanks to Tom Simpson from FoxBot for this engine bug fix)
   // KWo - added it for all clients - maybe there are also other bots, heh?
   if (!FNullEnt(pEdict))
   {
      if ((entity_index >= 0) && (entity_index < 32) && (pEdict->v.flags & FL_FAKECLIENT))
         return (100 * sqrt (min (75.0, (float) pEdict->v.light_level) / 75.0));
      else
         return (100 * sqrt (min (75.0, (float) GETENTITYILLUM (pEdict)) / 75.0));
   }
   return (0.0);
}
I'm sure light_level was always 0 when I tried it on bots.
More investigation required...
  
Reply With Quote