RustTip

OnAIBrainStateSwitched

OxideCarbonNPC

Called when an AI brAIn state is switched.

void OnAIBrainStateSwitched(BaseAIBrain baseAIBrain, BaseAIBrain.BasicAIState currentState)
Works — the game method in this build is the one the hook was written for.

Parameters

baseAIBrain
BaseAIBrain
currentState
BaseAIBrain.BasicAIState

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnAIBrainStateSwitched(BaseAIBrain baseAIBrain, BaseAIBrain.BasicAIState currentState)
{
    Puts("OnAIBrainStateSwitched");
}

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

Injection point

Rust.opj (Oxide)
bool BaseAIBrain.SwitchToState(BaseAIBrain.BasicAIState, int)

Passes: BaseAIBrain baseAIBrain, BaseAIBrain.BasicAIState currentState

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

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.