OnBoatGroupSpawn
OxideCarbonNavalobject OnBoatGroupSpawn(BoatGroupSpawner boatGroupSpawner, Vector2 vector2, Quaternion quaternion, HashSet<RHIB> list, bool boolean, bool spawnsPT)Works — the game method in this build is the one the hook was written for.
Parameters
- boatGroupSpawner
- BoatGroupSpawner
- vector2
- Vector2
- quaternion
- Quaternion
- list
- HashSet<RHIB>
- boolean
- bool
- spawnsPT
- bool
Return value
objectReturn non-null to cancel the game action.
Example
object — you can affect the game: return a value to change or cancel the action.
private object OnBoatGroupSpawn(BoatGroupSpawner boatGroupSpawner, Vector2 vector2, Quaternion quaternion, HashSet<RHIB> list, bool boolean, bool spawnsPT)
{
Puts("OnBoatGroupSpawn");
// change nothing — the game continues as usual
return null;
// to affect the game:
// return false; // non-null cancels the game action
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
void BoatGroupSpawner.SpawnBoatGroup(HashSet<RHIB>, BoatAI.AILoadMode, bool, ScientistBoatOilrigManager)
Passes: BoatGroupSpawner boatGroupSpawner, Vector2 vector2, Quaternion quaternion, HashSet<RHIB> list, bool boolean, bool spawnsPT
WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (this, l1, l4, a0, l3, a2)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
Vector3 forward = (vector - position).normalized;
bool registerWithDeepSea = false;
if (PointEntity<DeepSeaManager>.ServerInstance != null)
{
registerWithDeepSea = DeepSeaManager.IsInsideDeepSea(vector);
}
forward.y = 0f;
Quaternion rot = Quaternion.LookRotation(forward);
if (Interface.CallHook("OnBoatGroupSpawn", this, position, rot, list, registerWithDeepSea, spawnsPT) != null)
{
return;
}
BoatAI.SpawnBoatGroup(position, rot, list, registerWithDeepSea, spawnsPT);
foreach (RHIB item in list)
{
BoatAI componentInChildren = item.GetComponentInChildren<BoatAI>();
componentInChildren.MoveTo(transform.position);
// …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.