RustTip

OnTechTreeNodeUnlocked

OxideCarbonTechTree

Called when a tech tree node is unlocked.

void OnTechTreeNodeUnlocked(Workbench workbench, TechTreeData.NodeInstance nodeInstance, BasePlayer basePlayer, PooledList<ItemDefinition> pooledList)
Works — the game method in this build is the one the hook was written for.

Parameters

workbench
Workbench
nodeInstance
TechTreeData.NodeInstance
basePlayer
BasePlayer
pooledList
PooledList<ItemDefinition>

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnTechTreeNodeUnlocked(Workbench workbench, TechTreeData.NodeInstance nodeInstance, BasePlayer basePlayer, PooledList<ItemDefinition> pooledList)
{
    Puts("OnTechTreeNodeUnlocked");
}

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

Injection point

Rust.opj (Oxide)
void Workbench.RPC_TechTreeUnlock(BaseEntity.RPCMessage)

Passes: Workbench workbench, TechTreeData.NodeInstance nodeInstance, BasePlayer basePlayer, PooledList<ItemDefinition> pooledList

WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, l5, l0, l12)Assembly-CSharp.dll

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

// …
			}
		}
		Debug.Log("Player unlocked group :" + item2.groupName);
	}
	player.inventory.Take(null, itemid, num3);
	player.blueprints.UnlockList(pooledList2);
	foreach (ItemDefinition item3 in pooledList2)
	{
		Interface.CallHook("OnTechTreeNodeUnlocked", this, byID, player, local12);
		int num4 = ScrapForResearch(item3, techTreeForLevel.techTreeLevel, out var tax3, this);
		Analytics.Azure.OnBlueprintLearned(player, item3, "techtree", num4 + tax3, this);
	}
}

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.