Gorge web fixes for collision detection

* Webs placed on the floor now correctly connect with marines walking over them
* Allies and structures no longer block the web's effect if they're between the enemy and the web origin point
This commit is contained in:
RGreenlees 2023-09-26 16:30:52 +01:00 committed by pierow
parent bebb696e50
commit bf37abf714
2 changed files with 29 additions and 6 deletions

View file

@ -1738,13 +1738,23 @@ void AvHWebStrand::StrandThink()
if (!FNullEnt(Hit.pHit))
{
edict_t* webbedEdict = Hit.pHit;
AvHPlayer* theWebbedPlayer = dynamic_cast<AvHPlayer*>(CBaseEntity::Instance(webbedEdict));
if (theWebbedPlayer)
while (!FNullEnt(Hit.pHit) && Hit.flFraction < 0.99f)
{
StrandTouch(theWebbedPlayer);
edict_t* webbedEdict = Hit.pHit;
AvHPlayer* theWebbedPlayer = dynamic_cast<AvHPlayer*>(CBaseEntity::Instance(webbedEdict));
if (theWebbedPlayer && theWebbedPlayer->pev->team != this->pev->team && theWebbedPlayer->GetCanBeAffectedByEnemies())
{
StrandTouch(theWebbedPlayer);
break;
}
else
{
UTIL_TraceLine(Hit.vecEndPos, EndTrace, dont_ignore_monsters, Hit.pHit, &Hit);
}
}
}
if (!this->mSolid)

View file

@ -66,6 +66,7 @@
#include "AvHConstants.h"
#ifdef AVH_SERVER
#include "AvHGamerules.h"
#include "AvHServerUtil.h"
@ -86,8 +87,20 @@ bool AvHWebProjectile::CreateWeb()
AvHWebSpinner* theWebSpinner = NULL;
if(this->GetWebSpinner(theWebSpinner))
{
vec3_t NormalizedVelocity;
VectorCopy(this->pev->velocity, NormalizedVelocity);
NormalizedVelocity.Normalize();
TraceResult surfaceTraceResult;
UTIL_TraceLine(this->pev->origin, this->pev->origin + (NormalizedVelocity * 10.0f), dont_ignore_monsters, this->edict(), &surfaceTraceResult);
vec3_t theNewPoint = this->pev->origin;
if (surfaceTraceResult.flFraction < 1.0f)
{
theNewPoint = theNewPoint + (surfaceTraceResult.vecPlaneNormal * 3.0f);
}
vec3_t theLastPoint;
if(theWebSpinner->GetLastPoint(theLastPoint))
{