Night Owl 7 years ago
parent
commit
3027310741
  1. 9
      dlls/h_battery.cpp
  2. 9
      dlls/healthkit.cpp

9
dlls/h_battery.cpp

@ -47,6 +47,7 @@ public: @@ -47,6 +47,7 @@ public:
int m_iJuice;
int m_iOn; // 0 = off, 1 = startup, 2 = going
float m_flSoundTime;
BOOL m_bTriggerable;
};
TYPEDESCRIPTION CRecharge::m_SaveData[] =
@ -56,6 +57,7 @@ TYPEDESCRIPTION CRecharge::m_SaveData[] = @@ -56,6 +57,7 @@ TYPEDESCRIPTION CRecharge::m_SaveData[] =
DEFINE_FIELD( CRecharge, m_iJuice, FIELD_INTEGER ),
DEFINE_FIELD( CRecharge, m_iOn, FIELD_INTEGER ),
DEFINE_FIELD( CRecharge, m_flSoundTime, FIELD_TIME ),
DEFINE_FIELD( CRecharge, m_bTriggerable, FIELD_BOOLEAN )
};
IMPLEMENT_SAVERESTORE( CRecharge, CBaseEntity )
@ -92,6 +94,7 @@ void CRecharge::Spawn() @@ -92,6 +94,7 @@ void CRecharge::Spawn()
UTIL_SetSize( pev, pev->mins, pev->maxs );
SET_MODEL( ENT( pev ), STRING( pev->model ) );
m_iJuice = (int)gSkillData.suitchargerCapacity;
m_bTriggerable = !FStringNull( pev->target );
pev->frame = 0;
}
@ -112,6 +115,11 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use @@ -112,6 +115,11 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
if( m_iJuice <= 0 )
{
pev->frame = 1;
if( m_bTriggerable )
{
FireTargets( STRING( pev->target ), pActivator, this, USE_TOGGLE, 0 );
m_bTriggerable = FALSE;
}
Off();
}
@ -173,6 +181,7 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use @@ -173,6 +181,7 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
void CRecharge::Recharge( void )
{
m_iJuice = (int)gSkillData.suitchargerCapacity;
m_bTriggerable = !FStringNull( pev->target );
pev->frame = 0;
SetThink( &CBaseEntity::SUB_DoNothing );
}

9
dlls/healthkit.cpp

@ -115,6 +115,7 @@ public: @@ -115,6 +115,7 @@ public:
int m_iJuice;
int m_iOn; // 0 = off, 1 = startup, 2 = going
float m_flSoundTime;
BOOL m_bTriggerable;
};
TYPEDESCRIPTION CWallHealth::m_SaveData[] =
@ -124,6 +125,7 @@ TYPEDESCRIPTION CWallHealth::m_SaveData[] = @@ -124,6 +125,7 @@ TYPEDESCRIPTION CWallHealth::m_SaveData[] =
DEFINE_FIELD( CWallHealth, m_iJuice, FIELD_INTEGER ),
DEFINE_FIELD( CWallHealth, m_iOn, FIELD_INTEGER ),
DEFINE_FIELD( CWallHealth, m_flSoundTime, FIELD_TIME ),
DEFINE_FIELD( CWallHealth, m_bTriggerable, FIELD_BOOLEAN )
};
IMPLEMENT_SAVERESTORE( CWallHealth, CBaseEntity )
@ -160,6 +162,7 @@ void CWallHealth::Spawn() @@ -160,6 +162,7 @@ void CWallHealth::Spawn()
UTIL_SetSize( pev, pev->mins, pev->maxs );
SET_MODEL( ENT( pev ), STRING( pev->model ) );
m_iJuice = (int)gSkillData.healthchargerCapacity;
m_bTriggerable = !FStringNull( pev->target );
pev->frame = 0;
}
@ -182,6 +185,11 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u @@ -182,6 +185,11 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
// if there is no juice left, turn it off
if( m_iJuice <= 0 )
{
if( m_bTriggerable )
{
FireTargets( STRING( pev->target ), pActivator, this, USE_TOGGLE, 0 );
m_bTriggerable = FALSE;
}
pev->frame = 1;
Off();
}
@ -231,6 +239,7 @@ void CWallHealth::Recharge( void ) @@ -231,6 +239,7 @@ void CWallHealth::Recharge( void )
{
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/medshot4.wav", 1.0, ATTN_NORM );
m_iJuice = (int)gSkillData.healthchargerCapacity;
m_bTriggerable = !FStringNull( pev->target );
pev->frame = 0;
SetThink( &CBaseEntity::SUB_DoNothing );
}

Loading…
Cancel
Save