RustTip

OnTechTreeNodeUnlocked

OxideCarbonTechTree

Called when a tech tree node is unlocked.

void OnTechTreeNodeUnlocked(Workbench workbench, TechTreeData.NodeInstance nodeInstance, BasePlayer basePlayer, float single)
Method changed — check — the game method differs from the one the hook is recorded for in Oxide. The hook is still called, but its place may have shifted — worth checking after an update.

Parameters

workbench
Workbench
nodeInstance
TechTreeData.NodeInstance
basePlayer
BasePlayer
single
float

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnTechTreeNodeUnlocked(Workbench workbench, TechTreeData.NodeInstance nodeInstance, BasePlayer basePlayer, float single)
{
    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, float single

Method changed — checkReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, l5, l0, l12)Assembly-CSharp.dll

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

// …
			if (byID2 != null && byID2.itemDef != null)
			{
				player.blueprints.Unlock(byID2.itemDef);
				Analytics.Azure.OnBlueprintLearned(player, byID2.itemDef, "techtree", 0, this);
			}
		}
		Debug.Log("Player unlocked group :" + item2.groupName);
	}
	Interface.CallHook("OnTechTreeNodeUnlocked", this, byID, player, techTreeFailChance);
	player.inventory.Take(null, itemid, num4 - RollSavedResearchItems(num4));
	player.blueprints.UnlockList(pooledList2);
	foreach (ItemDefinition item3 in pooledList2)
	{
		int num5 = FragmentsForResearch(item3, techTreeForLevel.techTreeLevel, out var tax3, this);
		Analytics.Azure.OnBlueprintLearned(player, item3, "techtree", num5 + 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.