mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-24 13:44:22 +00:00
Merge pull request #119 from FreeSlave/opfor-ropes-init
Init ropes in Activated instead of delayed think
This commit is contained in:
commit
1a43b00326
@ -168,6 +168,7 @@ TYPEDESCRIPTION CRope::m_SaveData[] =
|
|||||||
DEFINE_FIELD( CRope, mEndingModel, FIELD_STRING ),
|
DEFINE_FIELD( CRope, mEndingModel, FIELD_STRING ),
|
||||||
DEFINE_FIELD( CRope, mAttachedObjectsOffset, FIELD_FLOAT ),
|
DEFINE_FIELD( CRope, mAttachedObjectsOffset, FIELD_FLOAT ),
|
||||||
DEFINE_FIELD( CRope, m_bMakeSound, FIELD_CHARACTER ),
|
DEFINE_FIELD( CRope, m_bMakeSound, FIELD_CHARACTER ),
|
||||||
|
DEFINE_FIELD( CRope, m_activated, FIELD_CHARACTER ),
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_SAVERESTORE( CRope, CBaseDelay )
|
IMPLEMENT_SAVERESTORE( CRope, CBaseDelay )
|
||||||
@ -242,11 +243,19 @@ void CRope::Spawn()
|
|||||||
|
|
||||||
m_NumSamples = m_iSegments + 1;
|
m_NumSamples = m_iSegments + 1;
|
||||||
|
|
||||||
SetThink(&CRope::StartThink);
|
m_activated = false;
|
||||||
pev->nextthink = gpGlobals->time + 0.01;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRope::StartThink()
|
void CRope::Activate()
|
||||||
|
{
|
||||||
|
if (!m_activated)
|
||||||
|
{
|
||||||
|
InitRope();
|
||||||
|
m_activated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRope::InitRope()
|
||||||
{
|
{
|
||||||
AddFlags( FL_ALWAYSTHINK );
|
AddFlags( FL_ALWAYSTHINK );
|
||||||
|
|
||||||
@ -1345,7 +1354,7 @@ class CElectrifiedWire : public CRope
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CElectrifiedWire();
|
CElectrifiedWire();
|
||||||
void EXPORT StartElectrifiedThink();
|
void InitElectrifiedRope();
|
||||||
virtual int Save( CSave &save );
|
virtual int Save( CSave &save );
|
||||||
virtual int Restore( CRestore &restore );
|
virtual int Restore( CRestore &restore );
|
||||||
static TYPEDESCRIPTION m_SaveData[];
|
static TYPEDESCRIPTION m_SaveData[];
|
||||||
@ -1355,6 +1364,7 @@ public:
|
|||||||
void Precache();
|
void Precache();
|
||||||
|
|
||||||
void Spawn();
|
void Spawn();
|
||||||
|
void Activate();
|
||||||
|
|
||||||
void EXPORT ElectrifiedRopeThink();
|
void EXPORT ElectrifiedRopeThink();
|
||||||
|
|
||||||
@ -1490,13 +1500,20 @@ void CElectrifiedWire::Spawn()
|
|||||||
{
|
{
|
||||||
CRope::Spawn();
|
CRope::Spawn();
|
||||||
pev->classname = MAKE_STRING( "env_electrified_wire" );
|
pev->classname = MAKE_STRING( "env_electrified_wire" );
|
||||||
|
|
||||||
SetThink(&CElectrifiedWire::StartElectrifiedThink);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CElectrifiedWire::StartElectrifiedThink()
|
void CElectrifiedWire::Activate()
|
||||||
{
|
{
|
||||||
StartThink();
|
if (!m_activated)
|
||||||
|
{
|
||||||
|
InitElectrifiedRope();
|
||||||
|
m_activated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CElectrifiedWire::InitElectrifiedRope()
|
||||||
|
{
|
||||||
|
InitRope();
|
||||||
|
|
||||||
m_uiNumUninsulatedSegments = 0;
|
m_uiNumUninsulatedSegments = 0;
|
||||||
m_bIsActive = true;
|
m_bIsActive = true;
|
||||||
|
@ -36,8 +36,9 @@ public:
|
|||||||
virtual void Precache();
|
virtual void Precache();
|
||||||
|
|
||||||
virtual void Spawn();
|
virtual void Spawn();
|
||||||
|
void Activate();
|
||||||
|
|
||||||
void EXPORT StartThink();
|
void InitRope();
|
||||||
void EXPORT RopeThink();
|
void EXPORT RopeThink();
|
||||||
|
|
||||||
virtual int Save( CSave &save );
|
virtual int Save( CSave &save );
|
||||||
@ -288,6 +289,9 @@ private:
|
|||||||
int mDisallowPlayerAttachment;
|
int mDisallowPlayerAttachment;
|
||||||
|
|
||||||
bool m_bMakeSound;
|
bool m_bMakeSound;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool m_activated;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //ROPES_H
|
#endif //ROPES_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user