7 cm( inst, this,
"AutorechargeBehavior" ),
8 m_charges( m_charges ),
9 recharge_ms( recharge_ms ),
13 this->m_charges->
Modify( &this->
cm, this->max );
18 this->cooldown_ms = 0;
19 this->m_charges->
Modify( &this->
cm, this->max );
24 if( this->cooldown_ms > 0 )
26 if( this->cooldown_ms > step_ms )
28 this->cooldown_ms -= step_ms;
32 this->cooldown_ms = 0;
33 if( this->m_charges->
Get() < this->max )
34 this->m_charges->
Modify( &this->
cm, this->m_charges->
Get() + 1 );
38 if( this->cooldown_ms == 0 && this->m_charges->
Get() < this->max )
39 this->cooldown_ms = this->recharge_ms;