NSTraceAttack: Deal better with recursion by taking damage into account on whether or not we should continue 'penetrating'
This commit is contained in:
parent
7632d0debd
commit
8d16c58862
4 changed files with 18 additions and 1 deletions
|
@ -164,6 +164,7 @@ struct
|
|||
float m_flEventTime;
|
||||
float m_flEventFrame;
|
||||
float m_flEventMdl;
|
||||
int m_iEventWeapon;
|
||||
|
||||
int m_iLastWeapon;
|
||||
int m_iOldWeapon;
|
||||
|
|
|
@ -90,10 +90,19 @@ Event_Callback(float mtime, __inout float btime)
|
|||
/* if the sequence ain't the same anymore... */
|
||||
if (pSeat->m_flEventFrame != pSeat->m_eViewModel.frame)
|
||||
return;
|
||||
|
||||
/* if the model changed... */
|
||||
if (pSeat->m_flEventMdl != pSeat->m_eViewModel.modelindex)
|
||||
return;
|
||||
|
||||
print(sprintf("%d %d %i\n", pSeat->m_flEventFrame, pSeat->m_flEventMdl, pSeat->m_iEventWeapon));
|
||||
|
||||
/* weapon changed */
|
||||
player pl = (player)(pSeat->m_ePlayer);
|
||||
|
||||
if (pSeat->m_iEventWeapon != pl.activeweapon)
|
||||
return;
|
||||
|
||||
/* only play once */
|
||||
if (mtime == btime)
|
||||
return;
|
||||
|
@ -102,6 +111,8 @@ Event_Callback(float mtime, __inout float btime)
|
|||
if (btime <= pSeat->m_flEventTime && (mtime > pSeat->m_flEventTime)) {
|
||||
pSeat->m_pEventCall();
|
||||
pSeat->m_pEventCall = __NULL__;
|
||||
pSeat->m_flEventMdl = 0;
|
||||
pSeat->m_flEventFrame = -1;
|
||||
}
|
||||
|
||||
btime = mtime;
|
||||
|
|
|
@ -67,6 +67,8 @@ View_AddEvent(void(void) pCallback, float flTime)
|
|||
pSeat->m_flEventTime = flTime;
|
||||
pSeat->m_flEventFrame = pSeat->m_eViewModel.frame;
|
||||
pSeat->m_flEventMdl = pSeat->m_eViewModel.modelindex;
|
||||
NSClientPlayer pl = (NSClientPlayer)pSeat->m_ePlayer;
|
||||
pSeat->m_iEventWeapon = pl.activeweapon;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -41,6 +41,9 @@ NSTraceAttack::_FireSingle(vector vecPos, vector vecAngles, float flDamage, floa
|
|||
if (flRange <= 0)
|
||||
return;
|
||||
|
||||
if (flDamage < 1)
|
||||
return;
|
||||
|
||||
range = (vecAngles * 8196);
|
||||
|
||||
m_eOwner.dimension_solid = 255;
|
||||
|
@ -151,7 +154,7 @@ NSTraceAttack::_FireSingle(vector vecPos, vector vecAngles, float flDamage, floa
|
|||
cont = pointcontents(trace_endpos + v_forward * m_flMaxThickness);
|
||||
|
||||
if (cont == CONTENT_EMPTY)
|
||||
_FireSingle(trace_endpos + (v_forward * 2), vecAngles, m_flDamage / 2, flRange);
|
||||
_FireSingle(trace_endpos + (v_forward * 2), vecAngles, flDamage / 2, flRange);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue