View Single Post
Re: Podbot Beta 3.0 Updates? ^^
Old
  (#221)
Immortal_BLG
Member
 
Status: Offline
Posts: 171
Join Date: Nov 2007
Location: Russian Federation
Default Re: Podbot Beta 3.0 Updates? ^^ - 11-06-2008

No problems for such man
I saw your code, I earlier did not know and has peeped it from source RACC bot , and earlier at me was so:

PHP Code:
void Bot:: SwitchFlashlight (bool on)
{
     
// this function switches on/off the flashlight of a bot.

     
if
     (
          (
on && (!g_botVar[Variable_FlashLight]->GetBool () || (pev->effects EF_DIMLIGHT) || m_flashLightBattery == || !IsAlive (GetEntity ()))) ||
          (!
on && !(pev->effects EF_DIMLIGHT))
     )
         return;

     if (
on)
         
pev->effects |= EF_DIMLIGHT;
     else
         
pev->effects &= ~EF_DIMLIGHT;

     
// emit flashlight sound
     
EMIT_SOUND_DYN2 (GetEntity (), CHAN_VOICE"items/flashlight1.wav"VOL_NORMATTN_NORM0PITCH_NORM);

And charging of the battery occured so:

PHP Code:
if (pev->effects EF_DIMLIGHT)
{
     static 
float dischargingFlashLightBatteryTime 0.0;

     if (
m_flashLightBattery && dischargingFlashLightBatteryTime 1.2 <= GetWorldTime ())
     {
         
m_flashLightBattery--;

         
dischargingFlashLightBatteryTime GetWorldTime ();
     }
}
else
{
     static 
float chargingFlashLightBatteryTime 0.0;

     if (
m_flashLightBattery 100 && chargingFlashLightBatteryTime 0.2 <= GetWorldTime ())
     {
         
m_flashLightBattery++;

         
chargingFlashLightBatteryTime GetWorldTime ();
     }

You see as I counted up, complete discharging of the battery occurs for 2 minutes and complete charging for 20 seconds.
  
Reply With Quote