RustTip

OnNetworkSubscriptionsGather

OxideCarbonNetwork

Called when a network subscriptions gathers.

object OnNetworkSubscriptionsGather(NetworkVisibilityGrid networkVisibilityGrid, Network.Visibility.Group group, ListHashSet<Network.Visibility.Group> groups, int radius)
Works — the game method in this build is the one the hook was written for.

Parameters

networkVisibilityGrid
NetworkVisibilityGrid
group
Network.Visibility.Group
groups
ListHashSet<Network.Visibility.Group>
radius
int

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 OnNetworkSubscriptionsGather(NetworkVisibilityGrid networkVisibilityGrid, Network.Visibility.Group group, ListHashSet<Network.Visibility.Group> groups, int radius)
{
    Puts("OnNetworkSubscriptionsGather");

    // 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 NetworkVisibilityGrid.GetVisibleFrom(Network.Visibility.Group, ListHashSet<Network.Visibility.Group>, int)

Passes: NetworkVisibilityGrid networkVisibilityGrid, Network.Visibility.Group group, ListHashSet<Network.Visibility.Group> groups, int radius

WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: AllAssembly-CSharp.dll

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

#define UNITY_ASSERTIONS
using Network.Visibility;
using UnityEngine.Assertions;

public void GetVisibleFrom(Group group, ListHashSet<Group> groups, int radius)
if (Interface.CallHook("OnNetworkSubscriptionsGather", this, group, groups, radius) != null)
{
	return;
}
{
	GetGlobalNetworkGroups(group, groups);
	if (group.restricted)
	{
		groups.Add(group);
// …

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.