NSProjectile: Respect 'offset' spawn key.

This commit is contained in:
Marco Cawthorne 2023-07-27 23:19:48 -07:00
parent 2656593203
commit 9a1f5e3af1
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
2 changed files with 13 additions and 3 deletions

View File

@ -94,7 +94,7 @@ private:
vector m_vecSpawnMins;
vector m_vecSpawnMaxs;
float m_flSpawnFrame;
bool m_bInheritVelocity;
vector m_vecSpawnOrigin;
/* ETQW-additions */
bool m_bIsBullet;
@ -103,6 +103,7 @@ private:
bool m_bStickToWorld;
bool m_bStickToActor;
bool m_bThrustHoming;
bool m_bInheritVelocity;
NSTimer m_thrustHandler;

View File

@ -60,6 +60,7 @@ NSProjectile::NSProjectile(void)
m_vecSpawnMins = g_vec_null;
m_vecSpawnMaxs = g_vec_null;
m_flSpawnFrame = 0;
m_vecSpawnOrigin = g_vec_null;
/* ETQW-additions */
m_bIsBullet = false;
@ -229,6 +230,9 @@ NSProjectile::SpawnKey(string strKey, string strValue)
case "inherit_velocity":
m_bInheritVelocity = ReadBool(strValue);
break;
case "offset":
m_vecSpawnOrigin = ReadVector(strValue);
break;
default:
super::SpawnKey(strKey, strValue);
break;
@ -588,7 +592,7 @@ NSProjectile::_Explode(void)
vector explodePos = origin - (v_forward * 32);
if (m_partModelDetonate)
pointparticles(particleeffectnum(m_partModelDetonate), explodePos, velocity, 1);
pointparticles(particleeffectnum(m_partModelDetonate), explodePos, trace_plane_normal, 1);
//print(sprintf("%S\n", m_defSplashDamage));
if (m_defSplashDamage) {
@ -676,7 +680,6 @@ NSProjectile::Launch(vector startPos, vector launchDir, float fuseOffset, float
return;
}
SetOrigin(startPos);
SetAngles(launchDir);
SetModel(m_oldModel);
SetSize(m_vecSpawnMins, m_vecSpawnMaxs);
@ -695,6 +698,11 @@ NSProjectile::Launch(vector startPos, vector launchDir, float fuseOffset, float
moveVel += (m_vecLaunchVelocity[1] * powerMultiplier) * v_right;
moveVel += (m_vecLaunchVelocity[2] * powerMultiplier) * v_up;
startPos += v_forward * m_vecSpawnOrigin[0];
startPos += v_right * m_vecSpawnOrigin[1];
startPos += v_up * m_vecSpawnOrigin[2];
SetOrigin(startPos);
if (m_bInheritVelocity == true)
moveVel += owner.velocity;
@ -735,6 +743,7 @@ NSProjectile::Launch(vector startPos, vector launchDir, float fuseOffset, float
}
SetFrame(m_flSpawnFrame);
SetGravity(m_flGravity);
StartSoundDef(m_sndFly, CHAN_BODY, true);
SendFlags = (-1);
//SendEntity = 0; /* HACK: remove this once Spike fixes CSQC-set traileffectnum etc. */