RustTip

OnEntityReskinned

OxideCarbonCrafting

Called when an entity is reskinned.

void OnEntityReskinned(BaseEntity local3, ulong local5, BasePlayer player)
Works — the game method in this build is the one the hook was written for.

Parameters

local3
BaseEntity
local5
ulong
player
BasePlayer

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnEntityReskinned(BaseEntity local3, ulong local5, BasePlayer player)
{
    Puts("OnEntityReskinned");
}

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

Injection point

Rust.opj (Oxide)
void SprayCan.ChangeItemSkin(BaseEntity.RPCMessage)

Passes: BaseEntity local3, ulong local5, BasePlayer player

WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString ( l3, l5, a0.player)Assembly-CSharp.dll

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

// …
	baseEntity = DoRedirectSwap(baseEntity, resourcePath, targetSkinID);
}
if (baseEntity is IReskinCallback reskinCallback)
{
	reskinCallback.OnReskinned(player);
}
baseEntity.SendNetworkUpdate();
ClientRPC(RpcTarget.NetworkGroup("Client_ReskinResult"), 1, baseEntity.net.ID);
Interface.CallHook("OnEntityReskinned", baseEntity, targetSkinID, msg.player);
if (!UsingInfiniteAmmoCheat)
{
	LoseCondition(ConditionLossPerReskin);
}
Analytics.Azure.OnEntitySkinChanged(player, baseEntity, num);
ClientRPC(RpcTarget.NetworkGroup("Client_ChangeSprayColour"), -1);
using (FlagsUpdateScope flagsUpdateScope = StartSetFlags(FlagsUpdateMode.SendNetworkUpdate))
{
// …

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.