Skip to content

Commit

Permalink
Add launcher to spawned rockets
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivory42 authored Oct 2, 2023
1 parent 2c3cad6 commit 3ed063e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions free_damage_rockets_soldier_ivory.sp
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,14 @@ void SplitRocket(int rocket, bool converge)
if (!IsValidClient(owner)) return;
if (!IsValidEntity(rocket) || rocket < MaxClients) return;

bool airblasted = false;
int launcher = GetEntPropEnt(rocket, Prop_Send, "m_hLauncher");
if (launcher <= 0)
{
launcher = GetEntPropEnt(rocket, Prop_Send, "m_hOriginalLauncher");
airblasted = true;
}

GetEntPropVector(rocket, Prop_Data, "m_vecOrigin", pos);
GetEntPropVector(rocket, Prop_Send, "m_angRotation", rocketAngle);
GetEntPropVector(rocket, Prop_Data, "m_vecVelocity", rocketVel);
Expand Down Expand Up @@ -513,6 +521,15 @@ void SplitRocket(int rocket, bool converge)
AcceptEntityInput(mirv, "TeamNum");
AcceptEntityInput(mirv, "SetTeam");
SetEntPropEnt(mirv, Prop_Send, "m_hOwnerEntity", owner);

// Set our launcher to the parent launcher
if (launcher > 0 && IsValidEntity(launcher))
{
if (airblast)
SetEntPropEnt(mirv, Prop_send, "m_hOriginalLauncher", launcher);
else
SetEntPropEnt(mirv, Prop_Send, "m_hLauncher", launcher);
}
float vel[3];
GetAngleVectors(angles, vel, NULL_VECTOR, NULL_VECTOR);
ScaleVector(vel, speed);
Expand Down

0 comments on commit 3ed063e

Please sign in to comment.