RustTip

OnMlrsRocketFired

OxideCarbonVehicle

Called when an mlrs rocket is fired.

void OnMlrsRocketFired(MLRS mLRS, ServerProjectile local7)
Works — the game method in this build is the one the hook was written for.

Parameters

mLRS
MLRS
local7
ServerProjectile

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnMlrsRocketFired(MLRS mLRS, ServerProjectile local7)
{
    Puts("OnMlrsRocketFired");
}

Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.

Injection point

Rust.opj (Oxide)
void MLRS.FireNextRocket()

Passes: MLRS mLRS, ServerProjectile local7

WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, l7)Assembly-CSharp.dll

Where it is called (this branch's game code)

// …
	}
	radiusModIndex++;
	Vector2 vector = Random.insideUnitCircle * (targetAreaRadius - RocketDamageRadius) * num;
	Vector3 target = TrueHitPos + new Vector3(vector.x, 0f, vector.y);
	Vector3 aimToTarget = Ballistics.GetAimToTarget(firingPoint.position, target, rocketSpeed, vRotMax, rocketBaseGravity, minRange, out var requiredGravity);
	if (TryFireProjectile(rocketContainer, AmmoTypes.MLRS_ROCKET, firingPos, aimToTarget, rocketOwnerRef.Get(serverside: true) as BasePlayer, 0f, 0f, out var projectile))
	{
		projectile.gravityModifier = requiredGravity / (0f - Physics.gravity.y);
		Interface.CallHook("OnMlrsRocketFired", this, projectile);
		nextRocketIndex--;
	}
	else
	{
		EndFiring();
	}
}

Sources: Rust.opj from OxideMod/Oxide.Rust (MIT) and hook metadata of the Carbon documentation (MIT). Method code is decompiled from this branch's server.