RustTip

OnSurveyGather

OxideCarbonResource

Called when a survey gathers.

void OnSurveyGather(SurveyCharge surveyCharge, object r118)
Works — the game method in this build is the one the hook was written for.

Parameters

surveyCharge
SurveyCharge
r118
object

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnSurveyGather(SurveyCharge surveyCharge, object r118)
{
    Puts("OnSurveyGather");
}

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

Injection point

Rust.opj (Oxide)
void SurveyCharge.Explode()

Passes: SurveyCharge surveyCharge, object r118

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

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

// …
		flag2 = true;
		if (resource.isLiquid)
		{
			flag3 = true;
		}
		for (int i = 0; i < num; i++)
		{
			Item item = ItemManager.Create(resource.type, iAmount, 0uL, isServerSide: true, 0uL);
			Interface.CallHook("OnSurveyGather", this, r118);
			Vector3 modifiedAimConeDirection = AimConeUtil.GetModifiedAimConeDirection(20f, Vector3.up);
			item.Drop(transform.position + Vector3.up * 1f, GetInheritedDropVelocity() + modifiedAimConeDirection * Random.Range(5f, 10f), Random.rotation).SetAngularVelocity(Random.rotation.eulerAngles * 5f);
		}
	}
}
if (flag2)
{
	string strPrefab = (flag3 ? craterPrefab_Oil.resourcePath : craterPrefab.resourcePath);
// …

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.