OnWireConnect
OxideCarbonPlayerCalled when a wire connects.
object OnWireConnect(BasePlayer basePlayer, IOEntity iOEntity, int int32, IOEntity iOEntity, int int32, List<Vector3> linePoints, List<float> list)Works — the game method in this build is the one the hook was written for.
Parameters
- basePlayer
- BasePlayer
- iOEntity
- IOEntity
- int32
- int
- iOEntity
- IOEntity
- int32
- int
- linePoints
- List<Vector3>
- list
- List<float>
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 OnWireConnect(BasePlayer basePlayer, IOEntity iOEntity, int int32, IOEntity iOEntity, int int32, List<Vector3> linePoints, List<float> list)
{
Puts("OnWireConnect");
// 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 WireTool.RPC_MakeConnection(BaseEntity.RPCMessage)
Passes: BasePlayer basePlayer, IOEntity iOEntity, int int32, IOEntity iOEntity, int int32, List<Vector3> linePoints, List<float> list
WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (l0, l5, l3, l6, l4, l1.linePoints, l8)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
{
return;
}
}
IOEntity.LineAnchor[] array = new IOEntity.LineAnchor[wireConnectionMessage.lineAnchors.Count];
if (ValidateLineAnchors(iOEntity, wireConnectionMessage.lineAnchors, array, linePoints, player))
{
WireColour wireColour = IntToColour(wireConnectionMessage.wireColor);
if (Interface.CallHook("OnWireConnect", player, iOEntity, inputIndex, iOEntity2, outputIndex, local1.linePoints, slackLevels) != null)
{
return;
}
if (wireColour == WireColour.Invisible && !player.IsInCreativeMode)
{
wireColour = DefaultColor;
}
iOEntity2.ConnectTo(iOEntity, outputIndex, inputIndex, linePoints, slackLevels, array, wireColour);
// …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.