RustTip

OnCupboardProtectionCalculated

OxideCarbonStructure

Called when a cupboard protection is calculated.

void OnCupboardProtectionCalculated(BuildingPrivlidge buildingPrivlidge, float cachedProtectedMinutes)
Работает — метод игры в этой сборке тот же, под который написан хук.

Параметры

buildingPrivlidge
BuildingPrivlidge
cachedProtectedMinutes
float

Возвращаемое значение

voidВозвращаемое значение игнорируется — хук только уведомляет.

Пример

private void OnCupboardProtectionCalculated(BuildingPrivlidge buildingPrivlidge, float cachedProtectedMinutes)
{
    Puts("OnCupboardProtectionCalculated");
}

Работает и в Oxide, и в Carbon: Carbon загружает плагины Oxide без изменений.

Место встраивания

Rust.opj (Oxide)
float BuildingPrivlidge.GetProtectedMinutes(bool)

Передаёт: BuildingPrivlidge buildingPrivlidge, float cachedProtectedMinutes

РаботаетReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, this.cachedProtectedMinutes)Assembly-CSharp.dll

Где вызывается (код игры этой ветки)

// …
	if (isServer)
	{
		if (!force && Time.realtimeSinceStartup < nextProtectedCalcTime)
		{
			return cachedProtectedMinutes;
		}
		nextProtectedCalcTime = Time.realtimeSinceStartup + 60f;
		cachedProtectedMinutes = CalculateProtectedMinutes();
		Interface.CallHook("OnCupboardProtectionCalculated", this, this.cachedProtectedMinutes);
		return cachedProtectedMinutes;
	}
	return 0f;
}

Источники: Rust.opj из OxideMod/Oxide.Rust (MIT) и метаданные хуков документации Carbon (MIT). Код методов — декомпиляция сервера этой ветки.