RustTip

OnClanColorChanged

OxideCarbonClan

Called when a clan color is changed.

void OnClanColorChanged(LocalClan local0, Color32 newColor, ulong bySteamId)
Works — the game method in this build is the one the hook was written for.

Parameters

local0
LocalClan
newColor
Color32
bySteamId
ulong

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnClanColorChanged(LocalClan local0, Color32 newColor, ulong bySteamId)
{
    Puts("OnClanColorChanged");
}

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

Injection point

Rust.opj (Oxide)
void LocalClan.<SetColor>d__61.MoveNext()

Passes: LocalClan local0, Color32 newColor, ulong bySteamId

WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (l0, this.newColor, this.bySteamId)Rust.Clans.Local.dll

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

// …
	else if (localClan.Color.ToInt32() == newColor.ToInt32())
	{
		result = ClanResult.Success;
	}
	else if (localClan._backend.Database.UpdateClanColor(localClan.ClanId, newColor))
	{
		localClan._backend.Database.AppendLog(localClan.ClanId, "set_color", bySteamId, newColor.ToHex());
		localClan.Changed(ClanDataSource.Basic);
		Interface.CallHook("OnClanColorChanged", localClan, this.newColor, this.bySteamId);
		result = ClanResult.Success;
	}
	else
	{
		result = ClanResult.Fail;
	}
}
catch (Exception exception)
// …

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.